summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-05-12 17:03:57 +0200
committerLászló Németh <nemeth@numbertext.org>2023-05-17 13:04:43 +0200
commit85a47bbb8340e65a19dc1ceaac768902a771ee77 (patch)
treeff13b7a948591bd9c873a6dcebf78288633b23f9 /sw/qa/extras
parent162cfe463ee29c2dbae9d50e39ca50336a77eea5 (diff)
tdf#155328 sw tracked table column: add DOCX export/import
Follow-up to commit ffd8d20d368a885d6d786749278fa438573227a7 "tdf#150673 sw xmloff: import/export tracked table column" and commit 896c2199d9f0a28bd405dd2d1068f5e2973cdf06 "tdf#79069 DOCX: support tracked table (row) deletion". Change-Id: Ifbe7b8b83e7071367104a09b4b559513227db786 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151709 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter5.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 4dd0a42d83c0..0bb6db185e37 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2641,6 +2641,55 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf150673_RedlineTableColumnDeletionWi
assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testRedlineTableColumnDeletionWithDOCXExport)
+{
+ // load a 1-row table, and delete the first column with enabled change tracking:
+ createSwDoc("tdf118311.fodt");
+ SwDoc* pDoc = getSwDoc();
+
+ // 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");
+ assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+ // delete first table column with enabled change tracking
+ // (HasTextChangesOnly property of the cell will be false)
+ dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+ // Deleted text content with change tracking,
+ // but not table deletion
+ discardDumpedLayout();
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+ assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 2);
+
+ // Save it to a DOCX and load it back.
+ // Exporting change tracking of the cell wasn't supported.
+ // Also Manage Changes for the import.
+ reload("Office Open XML Text", "tdf79069_tracked_table_deletion.docx");
+ pDoc = getSwDoc();
+
+ // accept the deletion of the content of the first cell
+ SwEditShell* const pEditShell(pDoc->GetEditShell());
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(1), pEditShell->GetRedlineCount());
+ pEditShell->AcceptRedline(0);
+
+ // table column was deleted
+ // (working export/import of HasTextChangesOnly of table cells)
+ pXmlDoc = parseLayoutDump();
+ assertXPath(pXmlDoc, "//page[1]//body/tab");
+ assertXPath(pXmlDoc, "//page[1]//body/tab/row/cell", 1);
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf128335)
{
// Load the bugdoc, which has 3 textboxes.