summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2020-06-16 17:11:12 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-06-17 17:00:46 +0200
commit33ad3ee258587904afaa03550858beac25b883f7 (patch)
treeb9da475b6226ce31132917efe2360bd8a52ee568 /sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
parent5568d92c5c705b4d728af859dc44afdd64e72195 (diff)
tdf#134043 DOCX import: DropDown text field instead of ComboBox form control
Change-Id: Ide9cedefde3b00fa0eeb37a6540e8d4a420b70c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96471 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport4.cxx')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx35
1 files changed, 28 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c1890a33c2cd..7356de7be9fe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -714,17 +714,38 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx"
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito");
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "manolo");
// check imported control
- uno::Reference<drawing::XControlShape> xControl(getShape(1), uno::UNO_QUERY);
+ if (getShapes() > 0)
+ {
+ uno::Reference<drawing::XControlShape> xControl(getShape(1), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(OUString("Manolo"), getProperty<OUString>(xControl->getControl(), "Text"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Manolo"), getProperty<OUString>(xControl->getControl(), "Text"));
- uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(xControl->getControl(), "StringItemList");
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength());
- CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]);
- CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
+ uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(xControl->getControl(), "StringItemList");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength());
+ CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
+ }
+ else
+ {
+ // ComboBox was imported as DropDown text 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("com.sun.star.text.textfield.DropDown"));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("manolo"), getProperty<OUString>(aField, "SelectedItem"));
+
+ uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(aField, "Items");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength());
+ CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
+ }
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCheckBoxControl, "checkbox-control.docx")