diff options
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter2.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 3da57c948a43..2453f3afcb60 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -3690,7 +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) + // (HasTextChangesOnly property of the row will be false) dispatchCommand(mxComponent, ".uno:DeleteRows", {}); // This was deleted without change tracking @@ -3717,7 +3717,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion) 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) + // (HasTextChangesOnly property will be removed by Undo) dispatchCommand(mxComponent, ".uno:Undo", {}); dispatchCommand(mxComponent, ".uno:Undo", {}); @@ -3750,7 +3750,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion) pEditShell->AcceptRedline(0); // table row (and the 1-row table) still exists - // (IsNotTracked property wasn't set for table row deletion) + // (HasTextChangesOnly property wasn't set for table row deletion) discardDumpedLayout(); pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//page[1]//body/tab"); @@ -3782,6 +3782,63 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletion) assertXPath(pXmlDoc, "//page[1]//body/tab", 0); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineTableRowDeletionWithExport) +{ + // load a 1-row table, and delete the row with enabled change tracking: + // now the row is not deleted silently, but keeps the deleted cell contents, + // and only accepting all of them will result the deletion of the table row. + SwDoc* pDoc = createDoc("tdf118311.fodt"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + // turn on red-lining and show changes + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT_MESSAGE( + "redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + + // check table + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//page[1]//body/tab"); + + // delete table row with enabled change tracking + // (HasTextChangesOnly property of the row will be false) + dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + + // Deleted text content with change tracking, + // but not table deletion + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//page[1]//body/tab"); + + // Save it and load it back. + reload("writer8", "tdf60382_tracked_table_deletion.odt"); + pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + pDoc = pTextDoc->GetDocShell()->GetWrtShell()->GetDoc(); + + // 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); + + // table row was still not deleted + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//page[1]//body/tab"); + + // accept last redline + pEditShell->AcceptRedline(0); + + // table row (and the 1-row table) was deleted finally + // (working export/import of HasTextChangesOnly) + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "//page[1]//body/tab", 0); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128335) { // Load the bugdoc, which has 3 textboxes. |