summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-05-22 13:36:26 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-22 17:40:07 +0200
commitc1bf2a3751b6a602f2571f8642b36504b04ca3fd (patch)
tree61142e66fcbc9cc82c5f2cea54b3355ee7628dd7
parentf4a9dcc471f5cefb2c16e104a270339afa88b4d7 (diff)
tdf#60382 sw track changes: add test for Undo of IsNotTracked
TextTableRow property. Remove also maybevoid from com::sun::star::text::TextTableRow::IsNotTracked. (It's possible to add it later, if needed.) Follow-up to commit 05366b8e6683363688de8708a3d88cf144c7a2bf "itdf#60382 sw offapi: add change tracking of table/row deletion". Change-Id: I4854dcda827cc8d5b1d0ec8bba381458b3ab17b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115988 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--offapi/com/sun/star/text/TextTableRow.idl2
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx41
2 files changed, 41 insertions, 2 deletions
diff --git a/offapi/com/sun/star/text/TextTableRow.idl b/offapi/com/sun/star/text/TextTableRow.idl
index 77191c9f57d1..e418fbbf9366 100644
--- a/offapi/com/sun/star/text/TextTableRow.idl
+++ b/offapi/com/sun/star/text/TextTableRow.idl
@@ -111,7 +111,7 @@ published service TextTableRow
@since LibreOffice 7.2
*/
- [optional, property, maybevoid] boolean IsNotTracked;
+ [optional, property] boolean IsNotTracked;
};
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index d1323c8104d5..3da57c948a43 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -3690,6 +3690,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion)
assertXPath(pXmlDoc, "//page[1]//body/tab");
// delete table row with enabled change tracking
+ // (IsNotTracked property of the row will be false)
dispatchCommand(mxComponent, ".uno:DeleteRows", {});
// This was deleted without change tracking
@@ -3698,7 +3699,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion)
assertXPath(pXmlDoc, "//page[1]//body/tab");
// accept the deletion of the content of the first cell
-
SwEditShell* const pEditShell(pDoc->GetEditShell());
CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), pEditShell->GetRedlineCount());
pEditShell->AcceptRedline(0);
@@ -3716,6 +3716,45 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion)
pXmlDoc = parseLayoutDump();
assertXPath(pXmlDoc, "//page[1]//body/tab", 0);
+ // Undo, and repeat the previous test, but only with deletion of the text content of the cells
+ // (IsNotTracked property will be removed by Undo)
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ // table exists again
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+
+ // delete table row with enabled change tracking
+ dispatchCommand(mxComponent, ".uno:SelectRow", {});
+ dispatchCommand(mxComponent, ".uno:Delete", {});
+
+ // Table row still exists
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+
+ // accept the deletion of the content of the first cell
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), pEditShell->GetRedlineCount());
+ pEditShell->AcceptRedline(0);
+
+ // table row was still not deleted
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+
+ // accept last redline
+ pEditShell->AcceptRedline(0);
+
+ // table row (and the 1-row table) still exists
+ // (IsNotTracked property wasn't set for table row deletion)
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+
// Undo, and delete the row without change tracking
dispatchCommand(mxComponent, ".uno:Undo", {});