diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 15:27:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 16:21:32 +0200 |
commit | 0bc553f3ef3c188a96ea4875f4722ad4d40da4a3 (patch) | |
tree | ad8252ca75b12743b7148487273151672401db4d /sw/qa | |
parent | 3196e949bb23a33bdb8700dbe27782e0e6c8f1e6 (diff) |
sw lok: add callbacks for redline table insertion / removal
An alternative would be to follow the Manage Changes dialog approach and
subscribe to the SFX_HINT_DOCCHANGED notification in SwDocShell, cache
the old redline table and find out the differences to the current one,
but that way sound much more complex without benefits.
Change-Id: I20a45285b88255ccea9d6646c0b5288ac1c91879
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index ad8deaf383a6..a8b7bf916f2d 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -68,6 +68,7 @@ public: void testShapeTextUndoShells(); void testShapeTextUndoGroupShells(); void testTrackChanges(); + void testTrackChangesCallback(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -101,6 +102,7 @@ public: CPPUNIT_TEST(testShapeTextUndoShells); CPPUNIT_TEST(testShapeTextUndoGroupShells); CPPUNIT_TEST(testTrackChanges); + CPPUNIT_TEST(testTrackChangesCallback); CPPUNIT_TEST_SUITE_END(); private: @@ -116,13 +118,15 @@ private: int m_nSelectionBeforeSearchResult; int m_nSelectionAfterSearchResult; int m_nInvalidations; + int m_nRedlineTableSizeChanged; }; SwTiledRenderingTest::SwTiledRenderingTest() : m_bFound(true), m_nSelectionBeforeSearchResult(0), m_nSelectionAfterSearchResult(0), - m_nInvalidations(0) + m_nInvalidations(0), + m_nRedlineTableSizeChanged(0) { } @@ -196,6 +200,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) } } break; + case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED: + { + ++m_nRedlineTableSizeChanged; + } + break; } } @@ -1169,6 +1178,27 @@ void SwTiledRenderingTest::testTrackChanges() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testTrackChangesCallback() +{ + // Load a document. + comphelper::LibreOfficeKit::setActive(); + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this); + + // Turn on track changes and type "x". + uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true)); + m_nRedlineTableSizeChanged = 0; + pWrtShell->Insert("x"); + + // Assert that we get exactly one notification about the redline insert. + // This was 0, as LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED wasn't sent. + CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableSizeChanged); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |