sw/qa/extras/ooxmlimport/data/tdf134572.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 28 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
New commits: commit bdbf72d9a23cf63bebc01d5fe1567f76cb260c7d Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Aug 7 12:12:27 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Aug 7 21:07:05 2020 +0200 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 <xiscofa...@libreoffice.org> 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 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf134572.docx 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits