[Libreoffice-commits] core.git: sw/qa
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 3 15:42:48 UTC 2021
sw/qa/extras/uiwriter/uiwriter2.cxx | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
New commits:
commit 1c0965148edb2a053e8e4a6762d917326fc332a2
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Fri Sep 3 09:51:05 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Sep 3 17:42:13 2021 +0200
tdf#143215 sw: test tracked deletion of empty table rows
Only the test document was added to the previous fix.
Follow-up of commit a483a44ca00f43a64ae51d62b8fbb4129a413f6d
"tdf#143215 DOCX import: fix tracked empty row insertion/deletion".
Change-Id: If39da56e16e56a9322a35259f5984726abe0da40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121549
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 1b1a1f73be92..ee9039b8039b 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -4465,6 +4465,40 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineDOCXTableMoveToFrame)
CPPUNIT_ASSERT(!xTableNames->hasByName("Table2"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf143215)
+{
+ // load a table with tracked insertion of an empty row
+ SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-rowadd.docx");
+
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ // check table count
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+ // check table row count
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+
+ // reject insertion of the empty table row
+ IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
+ rIDRA.AcceptAllRedline(false);
+ // This was 4 (remained empty row)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+
+ // Undo and accept insertion of the table row
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ rIDRA.AcceptAllRedline(true);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+
+ // delete it with change tracking, and accept the deletion
+ dispatchCommand(mxComponent, ".uno:DeleteRows", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getRows()->getCount());
+ rIDRA.AcceptAllRedline(true);
+ // This was 4 (remained empty row)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128335)
{
// Load the bugdoc, which has 3 textboxes.
More information about the Libreoffice-commits
mailing list