summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-07-22 19:08:47 +0200
committerLászló Németh <nemeth@numbertext.org>2021-07-26 12:09:10 +0200
commit5602803d07453bfd7c17ed5b6df7551d1041f97c (patch)
tree995c4d6d099a833783c22ce7ecf7ad186bd5eafa /sw
parent55f0121dd7ed2d7e84adc597bdd24ca40e0b0ce4 (diff)
tdf#143510 DOCX import: fix tracked table drag & drop
Accept or reject of tracked drag & drop table (row) move weren't handled, resulting an extra empty table (rows) instead of removing the deleted or inserted table (rows). Note: tables moved by drag & drop with track changes use w:moveFromRangeStart/End and w:moveToRangeStart/End bookmark-like elements to sign the boundary of the moved text. Now moveFrom/moveTo import is handled by tracked table (row) deletion and insertion. Change-Id: Ie382645fef28f57b30d3504fb28ac08489f705c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119406 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 7f3c0bbc174b9b0316991c174ca3b407c0e3d141) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119436
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/TC-table-DnD-move.docxbin0 -> 12977 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/TC-table-Separate-Move.docxbin0 -> 13407 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/TC-table-rowDND-front.docxbin0 -> 13389 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/TC-table-rowDND.docxbin0 -> 13378 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx50
5 files changed, 50 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/TC-table-DnD-move.docx b/sw/qa/extras/ooxmlexport/data/TC-table-DnD-move.docx
new file mode 100644
index 000000000000..f231d6f84240
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TC-table-DnD-move.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/TC-table-Separate-Move.docx b/sw/qa/extras/ooxmlexport/data/TC-table-Separate-Move.docx
new file mode 100644
index 000000000000..227f2862c68a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TC-table-Separate-Move.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/TC-table-rowDND-front.docx b/sw/qa/extras/ooxmlexport/data/TC-table-rowDND-front.docx
new file mode 100644
index 000000000000..17d3feeb3406
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TC-table-rowDND-front.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/TC-table-rowDND.docx b/sw/qa/extras/ooxmlexport/data/TC-table-rowDND.docx
new file mode 100644
index 000000000000..9608736cf20a
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TC-table-rowDND.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 1864c4bcf83e..431d5d71753d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -881,6 +881,56 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104797, "tdf104797.docx")
CPPUNIT_ASSERT_EQUAL( OUString( " Will this sentence be duplicated ADDED STUFF?" ), getRun( getParagraph( 2 ), 4 )->getString());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf143510, "TC-table-DnD-move.docx")
+{
+ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table move by drag & drop
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ if (mbExported)
+ {
+ // This was 0 (missing tracked table row deletion/insertion)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 2);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:ins", 2);
+ }
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf143510_table_from_row, "TC-table-Separate-Move.docx")
+{
+ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table move by drag & drop
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ if (mbExported)
+ {
+ // This was 0 (missing tracked table row deletion/insertion)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:del", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[3]/w:trPr/w:del", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:ins", 1);
+ }
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf143510_within_table, "TC-table-rowDND.docx")
+{
+ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table row move by DnD
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ if (mbExported)
+ {
+ // This was 0 (missing tracked table row deletion/insertion)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:del", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:ins", 1);
+ }
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf143510_within_table2, "TC-table-rowDND-front.docx")
+{
+ // check moveFromRangeStart/End and moveToRangeStart/End for tracked table row move by DnD
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ if (mbExported)
+ {
+ // This was 0 (missing tracked table row deletion/insertion)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:trPr/w:ins", 1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:trPr/w:del", 1);
+ }
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf113608_runAwayNumbering, "tdf113608_runAwayNumbering.docx")
{
// check that an incorrect numbering style is not applied