[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 16 20:58:11 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf116394.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |   19 +++++++++++++++++++
 2 files changed, 19 insertions(+)

New commits:
commit 63239749683ad718e10a5f561f17ca3c41ab4466
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Sat Jan 16 15:32:00 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sat Jan 16 21:57:32 2021 +0100

    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 at 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 000000000000..b152a0f3db9b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116394.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 47c901dbd32f..b363d261fbf7 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);


More information about the Libreoffice-commits mailing list