sw/qa/extras/ooxmlimport/data/tdf129237.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 43 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
New commits: commit 029d1e92945eb6ac8cd31911f35bed92a4201897 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jan 30 15:51:29 2020 +0100 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Thu Jan 30 17:02:48 2020 +0100 tdf#129237: Add unittest Change-Id: Ica8942e6f165afad1ed40457ec86bd20713a1a59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87744 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlimport/data/tdf129237.docx b/sw/qa/extras/ooxmlimport/data/tdf129237.docx new file mode 100644 index 000000000000..cb3f4d2987d4 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129237.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fb6fbde35536..4f4412e2678f 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -210,6 +210,49 @@ xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName CPPUNIT_ASSERT_EQUAL(OUString("First Page"), getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName")); } +DECLARE_OOXMLIMPORT_TEST(testTdf129237, "tdf129237.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; + } + + uno::Reference<text::XTextField> xEnumerationAccess1(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess1->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("title new"), xEnumerationAccess1->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference<text::XTextField> xEnumerationAccess2(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess2->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("MoM is supreme"), xEnumerationAccess2->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference<text::XTextField> xEnumerationAccess3(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess3->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("MY PATNA IS BEST IN THE WORLD"), xEnumerationAccess3->getPresentation(false).trim()); + + if( !xFields->hasMoreElements() ) { + CPPUNIT_ASSERT(false); + return; + } + + uno::Reference<text::XTextField> xEnumerationAccess4(xFields->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), xEnumerationAccess4->getPresentation(true).trim()); + CPPUNIT_ASSERT_EQUAL(OUString("Title New"), xEnumerationAccess4->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