diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-15 22:42:22 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-10-16 00:44:21 +0200 |
commit | 337162e50b38875f626a64667ddb83f8930eab35 (patch) | |
tree | aa571b5b1439ace60780834f99de1ea18c3ef1b7 /sw/qa | |
parent | bd6349d3fe1e2c9278aa333e2daf6a9e1a413075 (diff) |
CppunitTest_sw_ooxmlexport13: fix dead code
isExported() always returns true after loadAndReload
Change-Id: Ia1ca4e5d1efa9dc4a8131574fac8c226aebada03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174983
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 85b458ba3722..2db8bc8f1bcd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -631,40 +631,37 @@ DECLARE_OOXMLEXPORT_TEST(testParaAdjustDistribute, "para-adjust-distribute.docx" CPPUNIT_TEST_FIXTURE(Test, testInputListExport) { - loadAndReload("tdf122186_input_list.odt"); - if (!isExported()) // importing the ODT, an input field - { - uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); - uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); - CPPUNIT_ASSERT(xFields->hasMoreElements()); - uno::Any aField = xFields->nextElement(); - uno::Reference<lang::XServiceInfo> xServiceInfo(aField, uno::UNO_QUERY); - CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.textfield.DropDown"_ustr)); - } - else // importing the DOCX, a content control - { - uno::Reference<beans::XPropertySet> xTextPortion(getRun(getParagraph(1), 1), uno::UNO_QUERY); - OUString aPortionType; - xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; - CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType); - uno::Reference<text::XTextContent> xContentControl; - xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; - uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValues> aListItems; - xContentControlProps->getPropertyValue(u"ListItems"_ustr) >>= aListItems; - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aListItems.getLength()); - comphelper::SequenceAsHashMap aMap0(aListItems[0]); - CPPUNIT_ASSERT_EQUAL(u"1"_ustr, aMap0[u"Value"_ustr].get<OUString>()); - comphelper::SequenceAsHashMap aMap1(aListItems[1]); - CPPUNIT_ASSERT_EQUAL(u"2"_ustr, aMap1[u"Value"_ustr].get<OUString>()); - comphelper::SequenceAsHashMap aMap2(aListItems[2]); - CPPUNIT_ASSERT_EQUAL(u"3"_ustr, aMap2[u"Value"_ustr].get<OUString>()); - uno::Reference<container::XEnumerationAccess> xContentEnumAccess(xContentControl, uno::UNO_QUERY); - uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createEnumeration(); - uno::Reference<text::XTextRange> xContent(xContentEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xContent->getString()); - } + createSwDoc("tdf122186_input_list.odt"); + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + CPPUNIT_ASSERT(xFields->hasMoreElements()); + uno::Any aField = xFields->nextElement(); + uno::Reference<lang::XServiceInfo> xServiceInfo(aField, uno::UNO_QUERY); + CPPUNIT_ASSERT(xServiceInfo->supportsService(u"com.sun.star.text.textfield.DropDown"_ustr)); + + saveAndReload(mpFilter); + + uno::Reference<beans::XPropertySet> xTextPortion(getRun(getParagraph(1), 1), uno::UNO_QUERY); + OUString aPortionType; + xTextPortion->getPropertyValue(u"TextPortionType"_ustr) >>= aPortionType; + CPPUNIT_ASSERT_EQUAL(u"ContentControl"_ustr, aPortionType); + uno::Reference<text::XTextContent> xContentControl; + xTextPortion->getPropertyValue(u"ContentControl"_ustr) >>= xContentControl; + uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValues> aListItems; + xContentControlProps->getPropertyValue(u"ListItems"_ustr) >>= aListItems; + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), aListItems.getLength()); + comphelper::SequenceAsHashMap aMap0(aListItems[0]); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, aMap0[u"Value"_ustr].get<OUString>()); + comphelper::SequenceAsHashMap aMap1(aListItems[1]); + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, aMap1[u"Value"_ustr].get<OUString>()); + comphelper::SequenceAsHashMap aMap2(aListItems[2]); + CPPUNIT_ASSERT_EQUAL(u"3"_ustr, aMap2[u"Value"_ustr].get<OUString>()); + uno::Reference<container::XEnumerationAccess> xContentEnumAccess(xContentControl, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xContent(xContentEnum->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, xContent->getString()); } DECLARE_OOXMLEXPORT_TEST(testTdf123435, "tdf123435.docx") |