diff options
author | László Németh <nemeth@numbertext.org> | 2021-12-21 11:50:19 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-12-21 15:31:00 +0100 |
commit | 1edaee2f03bce0efa409c592919458658d0aa751 (patch) | |
tree | e3c4ef64e2e2085c85e6a3d8d5c86b25c885c932 /sw/qa/extras | |
parent | 0f472e35033b356cc2dd885762ec4c4cc7b02b8f (diff) |
tdf#146244 sw: fix Undo of accepting table row insertion
Fix Undo of accepting table row insertion to get back
the "false" value of HasTextChangesOnly property and the
associated light blue table row background.
This fixes also the missing update of the table row
background at accepting the table row insertion.
Follow-up to commit 8c028b7e41e3d350d0e67005b16faf0159cc5c12
"tdf#146244 sw: update HasTextChangesOnly in modified rows".
Change-Id: I8e2436b6b7b67f06037481955ff22cdbc2b22dc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127228
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter4.cxx | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index bafc66489929..726a939a55c9 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -202,6 +202,7 @@ public: void testTdf104814(); void testTableRedlineRedoCrash(); void testTableRemoveHasTextChangesOnly(); + void testTableRemoveHasTextChangesOnly2(); void testTdf66405(); void testTdf35021_tabOverMarginDemo(); void testTdf106701_tabOverMarginAutotab(); @@ -326,6 +327,7 @@ public: CPPUNIT_TEST(testTdf104814); CPPUNIT_TEST(testTableRedlineRedoCrash); CPPUNIT_TEST(testTableRemoveHasTextChangesOnly); + CPPUNIT_TEST(testTableRemoveHasTextChangesOnly2); CPPUNIT_TEST(testTdf66405); CPPUNIT_TEST(testTdf35021_tabOverMarginDemo); CPPUNIT_TEST(testTdf106701_tabOverMarginAutotab); @@ -1682,7 +1684,6 @@ void SwUiWriterTest4::testTableRedlineRedoCrash() void SwUiWriterTest4::testTableRemoveHasTextChangesOnly() { - //createSwDoc(DATA_DIRECTORY, "tdf91292_paraBackground.docx"); SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-del-add.docx"); CPPUNIT_ASSERT(pDoc); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); @@ -1753,6 +1754,65 @@ void SwUiWriterTest4::testTableRemoveHasTextChangesOnly() assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4); } +void SwUiWriterTest4::testTableRemoveHasTextChangesOnly2() +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-del-add.docx"); + CPPUNIT_ASSERT(pDoc); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + // disable Record Changes + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + CPPUNIT_ASSERT_MESSAGE("redlining should be off", + !pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + + // check redline count + SwEditShell* const pEditShell(pDoc->GetEditShell()); + CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), pEditShell->GetRedlineCount()); + + // 4 rows in Show Changes mode + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4); + + // Move the cursor to the tracked insertion, after the first redline to activate the + // acception of the whole table row insertion with a single "Accept Change" + pWrtShell->Down(/*bSelect=*/false); + pWrtShell->Down(/*bSelect=*/false); + pWrtShell->Down(/*bSelect=*/false); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false); + Scheduler::ProcessEventsToIdle(); + dispatchCommand(mxComponent, ".uno:AcceptTrackedChange", {}); + Scheduler::ProcessEventsToIdle(); + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // Accepting tracked insertion results still 4 rows, but less redlines + assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4); + CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(11), pEditShell->GetRedlineCount()); + + // Undo: 4 rows again + pDoc->GetIDocumentUndoRedo().Undo(); + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4); + CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), pEditShell->GetRedlineCount()); + + // To check Undo of HasTextChangesOnly reject the same row results 3 rows + dispatchCommand(mxComponent, ".uno:Escape", {}); + dispatchCommand(mxComponent, ".uno:RejectTrackedChange", {}); + Scheduler::ProcessEventsToIdle(); + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // This was 4 (lost HasTextChangesOnly) + assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 3); + + // Undo: 4 rows again + pDoc->GetIDocumentUndoRedo().Undo(); + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row", 4); + CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(14), pEditShell->GetRedlineCount()); +} + void SwUiWriterTest4::testTdf66405() { // Imported formula should have zero margins |