diff options
author | László Németh <nemeth@numbertext.org> | 2021-09-03 09:51:05 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-09-03 17:42:13 +0200 |
commit | 1c0965148edb2a053e8e4a6762d917326fc332a2 (patch) | |
tree | 0d86119d7da33dfe8a71783deb8e9327a3092fe1 | |
parent | a979f18254749acac4c71596c30dde9ad2908455 (diff) |
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@numbertext.org>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
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. |