diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-18 13:37:42 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 10:38:31 +0200 |
commit | 787c1a5e777f891bc0ffade69560fad09d0e8677 (patch) | |
tree | 3ce9e6721bcd28f9c650db028a1b6e6a5426956d /sw/qa | |
parent | 1be71c6e6aa4bb6506674220652163fbf0172935 (diff) |
sw: fix accepting/rejecting a change by index when cursor is not at a redline
When there is no index, then the cursor position is used to find out
which redline to accept/reject. LOK uses the index parameter instead, so
there never disable the command.
Change-Id: Icbe0905e4ebd170c6f33fe383cd3042d812a2eb0
(cherry picked from commit b6011f07254f8003929320ad842d8d09daca0e09)
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 011194879ff7..8cc29776b79c 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -68,6 +68,7 @@ public: void testUndoRepairDispatch(); void testShapeTextUndoShells(); void testShapeTextUndoGroupShells(); + void testTrackChanges(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -100,6 +101,7 @@ public: CPPUNIT_TEST(testUndoRepairDispatch); CPPUNIT_TEST(testShapeTextUndoShells); CPPUNIT_TEST(testShapeTextUndoGroupShells); + CPPUNIT_TEST(testTrackChanges); CPPUNIT_TEST_SUITE_END(); private: @@ -1138,6 +1140,36 @@ void SwTiledRenderingTest::testShapeTextUndoGroupShells() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testTrackChanges() +{ + // Load a document. + comphelper::LibreOfficeKit::setActive(); + SwXTextDocument* pXTextDocument = createDoc("dummy.fodt"); + + // Turn on trak changes, type "zzz" at the end, and move to the start. + uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true)); + SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell(); + pWrtShell->EndDoc(); + pWrtShell->Insert("zzz"); + pWrtShell->SttDoc(); + + // Reject the change by index, while the cursor does not cover the tracked change. + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(0))} + })); + comphelper::dispatchCommand(".uno:RejectTrackedChange", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + + // Assert that the reject was performed. + SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); + // This was 'Aaa bbb.zzz', the change wasn't rejected. + CPPUNIT_ASSERT_EQUAL(OUString("Aaa bbb."), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |