diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-08-07 12:12:27 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-08-07 21:07:05 +0200 |
commit | bdbf72d9a23cf63bebc01d5fe1567f76cb260c7d (patch) | |
tree | 3fb6fd12d42a22aa3ba35080a97eef00fdbcb384 /sw | |
parent | b02d05f460fb43424d4288969ea826afc06b66e5 (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')
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf134572.docx | bin | 0 -> 21846 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 28 |
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 Binary files differnew file mode 100644 index 000000000000..7ab509b5fd1e --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf134572.docx 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); |