tdf#116394: sw_ooxmlexport15: Add unittest
Although the fix says in its message
"There is no point in adding a unit test for this."
The issue is a regression so I think it's better to have one,
just in case
Change-Id: Ica4774dd85c5c5fb73d5b54eb677fe8ab552a936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109441
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf116394.docx b/sw/qa/extras/ooxmlexport/data/tdf116394.docx
new file mode 100644
index 0000000..b152a0f
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf116394.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 47c901d..b363d26 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -180,6 +180,25 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123401, "tdf123401.fodt")
assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc/w:p/w:r[2]/w:instrText", " =AVERAGE(A1:A3)");
}
DECLARE_OOXMLEXPORT_TEST(testTdf116394, "tdf116394.docx")
{
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
uno::Reference<text::XTextField> xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY);
// Without the fix in place, this test would have failed with
// - Expected: ab=cd..
// - Actual : abcd..
CPPUNIT_ASSERT_EQUAL(OUString("ab=cd.."), xEnumerationAccess->getPresentation(true).trim());
xmlDocUniquePtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " MERGEFIELD ab=cd ");
}
DECLARE_OOXMLEXPORT_TEST(testTdf123356, "tdf123356.fodt")
{
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);