summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-11-16 11:50:03 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-03 10:02:09 +0100
commit1733ed0935125814c963e37383f51daec8031e59 (patch)
tree8ccbc63b6a3da42cb6fd00b850462c542ae4ea62 /sw/qa/extras
parent4bb07962ef6c4fbd061dcdb4c637fd31f8c77a73 (diff)
tdf#137466: docx: support w:placeholder & w15:color in w:sdtPr
Content controls in Word can contain some other elements which are not supported by Writer. Put them into grabbag and write back to DOCX on save to avoid losing quite sensitive data. Test testSimpleSdts is modified: testcase is actully containing 4 sdt elements with ids in input and output. Change-Id: I1f9addd03ed828bf375ccac5188a004f011e8a0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125271 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de> (cherry picked from commit 7db38a496a5e458ec12888ddbf63c603706ae3fc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126000 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf137466.docxbin0 -> 20243 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx15
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx4
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlw14export.cxx2
5 files changed, 19 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf137466.docx b/sw/qa/extras/ooxmlexport/data/tdf137466.docx
new file mode 100644
index 000000000000..3c5977251bda
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf137466.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index c711a6b2a10b..a7762a057e32 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -64,6 +64,21 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
assertXPath(pXmlDoc, "/w:styles/w:style[@w:styleId='Mystyle']/w:pPr/w:numPr/w:ilvl", "val", "1");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf137466, "tdf137466.docx")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return; // initial import, no futher checks
+
+ // Ensure that we have <w:placeholder><w:docPart v:val="xxxx"/></w:placeholder>
+ OUString sDocPart = getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:placeholder/w:docPart", "val");
+ CPPUNIT_ASSERT_EQUAL(OUString("DefaultPlaceholder_-1854013440"), sDocPart);
+
+ // Ensure that we have <w15:color v:val="xxxx"/>
+ OUString sColor = getXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w15:color", "val");
+ CPPUNIT_ASSERT_EQUAL(OUString("FF0000"), sColor);
+}
+
CPPUNIT_TEST_FIXTURE(Test, testDontAddNewStyles)
{
// Given a document that lacks builtin styles, and addition of them is disabled:
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 5858eec46524..cfb779d13c84 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1021,7 +1021,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSimpleSdts)
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1);
- assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 4);
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:picture", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:group", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:citation", 1);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 081ac3252d31..6b6c5c497b65 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -579,10 +579,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO79062)
{
loadAndSave("fdo79062.docx");
xmlDocUniquePtr pXmlFootNotes = parseExport("word/footnotes.xml");
- assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14");
+ assertXPath(pXmlFootNotes, "/w:footnotes", "Ignorable", "w14 wp14 w15");
xmlDocUniquePtr pXmlEndNotes = parseExport("word/endnotes.xml");
- assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
+ assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14 w15");
//tdf#93121 don't add fake tabs in front of extra footnote paragraphs
uno::Reference<text::XFootnotesSupplier> xFootnoteSupp(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
index 157939060024..9e3184b566fe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
@@ -248,7 +248,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Test_McIgnorable, "TextEffects_StylisticSets
{
xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
- assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14");
+ assertXPath(pXmlDocument, "/w:document", "Ignorable", "w14 wp14 w15");
xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");