summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-01-30 15:51:29 +0100
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2020-01-30 18:46:57 +0100
commit1a51db52e4aa29ecee978329fa4bcf0af4a17e85 (patch)
tree26f089272e1ac79fcc1d32f7aa711f0a0ea2b96a /sw
parentdc9b1ee0a5144ce182407d10466eab682f7da62a (diff)
tdf#129237: Add unittest
Change-Id: Ica8942e6f165afad1ed40457ec86bd20713a1a59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87744 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org> (cherry picked from commit 029d1e92945eb6ac8cd31911f35bed92a4201897) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87747
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf129237.docxbin0 -> 13162 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx43
2 files changed, 43 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf129237.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 877bc929c4b2..72cb580b2003 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -209,6 +209,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);