summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-12-21 11:50:19 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-22 10:12:16 +0100
commit631649f233bda500c627719b9e43df3fe08df7c5 (patch)
tree8cb089ed5dab764e52e751619fd7a5f3c96121ed /sw/qa/extras/uiwriter
parent4d30c63bd0652c75cda9c57ef21c4cfe65df184f (diff)
tdf#146243 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> (cherry picked from commit 1edaee2f03bce0efa409c592919458658d0aa751) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127186 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx62
1 files changed, 61 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 015a065f543b..46d06d0985ae 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -200,6 +200,7 @@ public:
void testTdf104814();
void testTableRedlineRedoCrash();
void testTableRemoveHasTextChangesOnly();
+ void testTableRemoveHasTextChangesOnly2();
void testTdf66405();
void testTdf35021_tabOverMarginDemo();
void testTdf106701_tabOverMarginAutotab();
@@ -324,6 +325,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);
@@ -1521,7 +1523,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();
@@ -1592,6 +1593,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