summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-08-07 12:12:27 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-08-07 21:07:05 +0200
commitbdbf72d9a23cf63bebc01d5fe1567f76cb260c7d (patch)
tree3fb6fd12d42a22aa3ba35080a97eef00fdbcb384 /sw/qa/extras/ooxmlimport
parentb02d05f460fb43424d4288969ea826afc06b66e5 (diff)
tdf#134572: sw_ooxmlimport: Add unittest
Change-Id: I9162211edb583201ba4600362045379fbed2b05c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100302 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf134572.docxbin0 -> 21846 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf134572.docx b/sw/qa/extras/ooxmlimport/data/tdf134572.docx
new file mode 100644
index 000000000000..7ab509b5fd1e
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf134572.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 937721f2f07d..1f534cb2fbbf 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -262,6 +262,34 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129237, "tdf129237.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Title New"), xEnumerationAccess4->getPresentation(false).trim());
}
+DECLARE_OOXMLIMPORT_TEST(testTdf134572, "tdf134572.docx")
+{
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+ if( !xFields->hasMoreElements() ) {
+ CPPUNIT_ASSERT(false);
+ return;
+ }
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: RK - Risk / EH&S
+ // - Actual : [Responsible Office]
+ uno::Reference<text::XTextField> xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("RK - Risk / EH&S"), xEnumerationAccess1->getPresentation(false).trim());
+
+ if( !xFields->hasMoreElements() ) {
+ CPPUNIT_ASSERT(false);
+ return;
+ }
+
+ // - Expected: Choose an item.
+ // - Actual : A.M.
+ uno::Reference<text::XTextField> xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Choose an item."), xEnumerationAccess2->getPresentation(false).trim());
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf128076, "tdf128076.docx")
{
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);