diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-06-18 21:39:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-20 21:25:11 +0200 |
commit | cb95276e6e6bf12a1c06d5c252551e55c788fcb2 (patch) | |
tree | 9e54d9ddbd03f02f508af48ce8dce02d5c83a277 /sw/qa | |
parent | 292d9519bd368db69920cf0f8b94e0e51c3d14a1 (diff) |
use JsonWriter for the rest of ITiledRenderable
and fix bug in buffer reallacotion where mPos pointing
at the beginning of the new buffer instead of at the
correct index inside it.
Change-Id: Ie1ffaa176f6165e2cec85c93adc945312eff38e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96650
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 8 |
3 files changed, 16 insertions, 6 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 487def29974b..69560ae2bd15 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -49,6 +49,7 @@ #include <flddat.hxx> #include <basesh.hxx> #include <vcl/ITiledRenderable.hxx> +#include <tools/json_writer.hxx> static char const DATA_DIRECTORY[] = "/sw/qa/extras/tiledrendering/data/"; @@ -1619,8 +1620,9 @@ void SwTiledRenderingTest::testRedlineColors() pWrtShell->Insert("zzz"); // Assert that info about exactly one author is returned. - OUString aInfo = pXTextDocument->getTrackedChangeAuthors(); - std::stringstream aStream(aInfo.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pXTextDocument->getTrackedChangeAuthors(aJsonWriter); + std::stringstream aStream(aJsonWriter.extractAsOString().getStr()); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aTree.get_child("authors").size()); diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 01d05d963b3c..64e82663bdaf 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -49,6 +49,7 @@ #include <frameformats.hxx> #include <shellio.hxx> #include <editeng/fontitem.hxx> +#include <tools/json_writer.hxx> namespace { @@ -2261,8 +2262,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testImageComment) // rendering and on the desktop. SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); - OUString aPostits = pTextDoc->getPostIts(); - std::stringstream aStream(aPostits.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pTextDoc->getPostIts(aJsonWriter); + char* pChar = aJsonWriter.extractData(); + std::stringstream aStream(pChar); + free(pChar); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments")) diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index dda897ee2ee3..0f9f3255f990 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -17,6 +17,7 @@ #include <textboxhelper.hxx> #include <fmtanchr.hxx> #include <o3tl/safeint.hxx> +#include <tools/json_writer.hxx> #include <wrtsh.hxx> @@ -855,8 +856,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132603) dispatchCommand(mxComponent, ".uno:Copy", {}); Scheduler::ProcessEventsToIdle(); - OUString aPostits = pTextDoc->getPostIts(); - std::stringstream aStream(aPostits.toUtf8().getStr()); + tools::JsonWriter aJsonWriter; + pTextDoc->getPostIts(aJsonWriter); + char* pChar = aJsonWriter.extractData(); + std::stringstream aStream(pChar); + free(pChar); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments")) |