[Libreoffice-commits] core.git: sw/qa writerfilter/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 26 19:12:55 UTC 2019


 sw/qa/extras/ooxmlimport/data/tdf126114.docx      |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx         |    7 +++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 8e5982d799e23bee86404f3ccb3aaed524ae9675
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jun 26 20:04:37 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jun 26 21:11:55 2019 +0200

    tdf#126114 - Form fields are displayed twice (double)
    
    We need to make sure that IsFieldResultAsString() returns true
    for drop-down field, to ignore the placeholder string.
    
    Change-Id: I127800bdff78eb68e000fdbfe433bc88181ac2c3
    Reviewed-on: https://gerrit.libreoffice.org/74752
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf126114.docx b/sw/qa/extras/ooxmlimport/data/tdf126114.docx
new file mode 100644
index 000000000000..33e0395689c6
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf126114.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 1f1e03043d3c..b447c3f7273f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -366,6 +366,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124670, "tdf124670.docx")
         paragraph->getString());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf126114, "tdf126114.docx")
+{
+    // The problem was that after the drop-down form field, also the placeholder string
+    // was imported as text. Beside the duplication of the field, it also caused a crash.
+    CPPUNIT_ASSERT_EQUAL(7, getLength());
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 46f312eeeeaa..36174fa66cfb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4917,7 +4917,7 @@ bool DomainMapper_Impl::IsFieldResultAsString()
     OSL_ENSURE( pContext.get(), "no field context available");
     if( pContext.get() )
     {
-        bRet = pContext->GetTextField().is();
+        bRet = pContext->GetTextField().is() || pContext->GetFieldId() == FIELD_FORMDROPDOWN;
     }
     return bRet;
 }


More information about the Libreoffice-commits mailing list