From 73ae22aae1d856c62d08ca576daea15056afbb58 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 21 Sep 2016 17:27:48 +0200 Subject: lok::Document::getCommandValues: expose sw redline author colors These colors are used in the tiles, so it's a good idea if the client can use matching colors for cursors and selections. But to be able to do that, we need an API to expose these colors. Change-Id: Ia688c07e6c300fecdf8dc428d5a3f000d1857387 (cherry picked from commit d7788287456cb633226203f259e212c143b83050) --- sw/qa/extras/tiledrendering/tiledrendering.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sw/qa') diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index cce710aefd4c..f6fb64fe6652 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -75,6 +75,7 @@ public: void testSetViewGraphicSelection(); void testCreateViewGraphicSelection(); void testCreateViewTextSelection(); + void testRedlineColors(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -113,6 +114,7 @@ public: CPPUNIT_TEST(testSetViewGraphicSelection); CPPUNIT_TEST(testCreateViewGraphicSelection); CPPUNIT_TEST(testCreateViewTextSelection); + CPPUNIT_TEST(testRedlineColors); CPPUNIT_TEST_SUITE_END(); private: @@ -1430,6 +1432,29 @@ void SwTiledRenderingTest::testCreateViewTextSelection() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testRedlineColors() +{ + // Load a document. + comphelper::LibreOfficeKit::setActive(); + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + + // Turn on track changes, type "zzz" at the end. + uno::Reference xPropertySet(mxComponent, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true)); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + pWrtShell->EndDoc(); + pWrtShell->Insert("zzz"); + + // Assert that info about exactly one author is returned. + OUString aInfo = pXTextDocument->getTrackedChangeAuthors(); + std::stringstream aStream(aInfo.toUtf8().getStr()); + boost::property_tree::ptree aTree; + boost::property_tree::read_json(aStream, aTree); + CPPUNIT_ASSERT_EQUAL(static_cast(1), aTree.get_child("authors").size()); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit