[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 10 08:40:10 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |    5 +++--
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx  |    3 ++-
 writerfilter/source/dmapper/SdtHelper.cxx  |    9 +++++++++
 4 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 73b2bacf2f3f531896fc20aeecb51d433ecd5a9c
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Mon Jul 20 15:15:47 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Aug 10 10:39:39 2020 +0200

    tdf#134572 DOCX: Incorrect default value in dropdown text fields
    
    Change-Id: I3169e817c2f033d1525adc3b02ac3680ad220d70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99074
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 89b6b2dbb728abea2186ff1ae158c0adb67d05be)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100216
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 430749768862..1b9621b473b0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -1052,7 +1052,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf119809, "tdf119809.docx")
         CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown"));
 
         uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(aField, "Items");
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aItems.getLength());
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aItems.getLength());
     }
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 22d069a90864..c6cb3c351843 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -741,9 +741,10 @@ void Test::verifyComboBoxExport(bool aComboBoxAsDropDown)
         CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown"));
 
         uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(aField, "Items");
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength());
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aItems.getLength());
         CPPUNIT_ASSERT_EQUAL(OUString("manolo"), aItems[0]);
         CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
+        CPPUNIT_ASSERT_EQUAL(OUString("Manolo"), aItems[2]);
     }
     else
     {
@@ -767,7 +768,7 @@ 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
     verifyComboBoxExport(getShapes() == 0);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 5f401b266bfc..5b09147a0ad2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -948,9 +948,10 @@ DECLARE_OOXMLEXPORT_TEST(testN779630, "n779630.docx")
         CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.textfield.DropDown"));
 
         uno::Sequence<OUString> aItems = getProperty< uno::Sequence<OUString> >(aField, "Items");
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aItems.getLength());
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aItems.getLength());
         CPPUNIT_ASSERT_EQUAL(OUString("Yes"), aItems[0]);
         CPPUNIT_ASSERT_EQUAL(OUString("No"), aItems[1]);
+        CPPUNIT_ASSERT_EQUAL(OUString("dropdown default text"), aItems[2]);
     }
 }
 
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 4e437ae0e562..60153d4c6126 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -90,6 +90,15 @@ void SdtHelper::createDropDownControl()
             m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.TextField.DropDown"),
             uno::UNO_QUERY);
 
+        const auto it = std::find_if(
+            m_aDropDownItems.begin(), m_aDropDownItems.end(),
+            [aDefaultText](const OUString& item) -> bool { return !item.compareTo(aDefaultText); });
+
+        if (m_aDropDownItems.end() == it)
+        {
+            m_aDropDownItems.push_back(aDefaultText);
+        }
+
         // set properties
         uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
         xPropertySet->setPropertyValue("SelectedItem", uno::makeAny(aDefaultText));


More information about the Libreoffice-commits mailing list