diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-17 15:40:14 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-18 08:30:22 +0200 |
commit | 1a0fa139e50b0718a2a19ded10366af76d656058 (patch) | |
tree | 7f57c766bf295781f5dbbfb0ec6e00e5c2b26df8 /sw/qa | |
parent | 1fe18e95c56e66812b7d7c0e0d18ad4829dd5aa1 (diff) |
sw: allow accept/reject of redline by index
Previously .uno:AcceptTrackedChange / .uno:RejectTrackedChange always
worked by cursor position, but redlines are stored in the redline table,
so they have a unique index. Allow specifying that index when invoking
the command, and in that case ignore the cursor position.
The index is not stable after an insertion / deletion.
Reviewed-on: https://gerrit.libreoffice.org/28192
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 087b71f423cf6c047137fb1316527132bb47fc05)
Conflicts:
sw/qa/extras/uiwriter/uiwriter.cxx
Change-Id: I493a22e84800ded224fb6b9c61261744dc0fb64f
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index ca524d344452..b6838bd00366 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -188,6 +188,7 @@ public: void testTdf99004(); void testTdf84695(); void testClassificationPaste(); + void testRedlineParam(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -281,6 +282,7 @@ public: CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); CPPUNIT_TEST(testClassificationPaste); + CPPUNIT_TEST(testRedlineParam); CPPUNIT_TEST_SUITE_END(); private: @@ -3261,6 +3263,37 @@ void SwUiWriterTest::testClassificationPaste() xSourceComponent->dispose(); } +void SwUiWriterTest::testRedlineParam() +{ + // Create a document with minimal content. + SwDoc* pDoc = createDoc(); + SwDocShell* pDocShell = pDoc->GetDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + pWrtShell->Insert("middle"); + + // Turn on track changes, and add changes to the start and end of the document. + uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY); + xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true)); + pWrtShell->SttDoc(); + pWrtShell->Insert("aaa"); + pWrtShell->EndDoc(); + pWrtShell->Insert("zzz"); + + // Move the cursor to the start again, and reject the second change. + pWrtShell->SttDoc(); + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(1))} + })); + lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false); + + // This was 'middlezzz', the uno command rejected the redline under the + // cursor, instead of the requested one. + CPPUNIT_ASSERT_EQUAL(OUString("aaamiddle"), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |