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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 05:12:16 UTC 2018


 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |   21 +++++++++++----------
 sw/qa/extras/ww8export/ww8export3.cxx      |   22 ++++++++++++----------
 sw/source/filter/ww8/ww8par3.cxx           |   16 +++-------------
 3 files changed, 26 insertions(+), 33 deletions(-)

New commits:
commit d3144a09dc5e2c21ffa34e3527bb6c94cd9926e8
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Nov 24 14:39:50 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Mon Nov 26 06:11:52 2018 +0100

    partial revert tdf79435 doc: round-trip legacy input formfields
    
    Apparently import isn't always properly reading some of these
    strings, so it is just garbage being round-tripped in some cases.
    Let's just avoid that until such time as import might be fixed.
    
    I couldn't readily identify the import problem. It even happens with
    version eWW8 files and also TestBeltAndBraces() didn't seem to
    prevent the problem.
    
    These crashes are due to reading garbage:
    /srv/crashtestdata/files/doc/ooo78311-1.doc
            -DISTRICT_COURSE_OUTLINE_TEMPLATE.doc
    /srv/crashtestdata/files/doc/kde79024-2.doc
            -Ü2_Blanko.doc
    /srv/crashtestdata/files/doc/ooo24395-1.doc
            -stateapp-emp.doc
    /srv/crashtestdata/files/doc/abi9921-1.doc
    /srv/crashtestdata/files/doc/ooo59101-1.doc
            -Hovedblankett.DOC
    /srv/crashtestdata/files/doc/fdo48097-1.doc
            -BR1010.doc
    
    Change-Id: Iceaa53760867f06c73ab900c57f197dbc0fb8e65
    Reviewed-on: https://gerrit.libreoffice.org/63938
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index ac7909edcc9b..547afcd1a399 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -733,18 +733,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79435_legacyInputFields, "tdf79435_legacyInputFi
     uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
 
     OUString sTmp;
-    xParameters->getByName("EntryMacro") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
-    xParameters->getByName("Help") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
-    xParameters->getByName("ExitMacro") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+    // Doc import problems, so disabling tests
+    //xParameters->getByName("EntryMacro") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+    //xParameters->getByName("Help") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
+    //xParameters->getByName("ExitMacro") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
     xParameters->getByName("Hint") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp);
-    xParameters->getByName("Content") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
-    xParameters->getByName("Format") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
+    //xParameters->getByName("Content") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
+    //xParameters->getByName("Format") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
 
     sal_uInt16 nMaxLength = 0;
     xParameters->getByName("MaxLength") >>= nMaxLength;
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 14293e2ba5df..e85ec0efa18f 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -75,18 +75,20 @@ DECLARE_WW8EXPORT_TEST(testTdf79435_legacyInputFields, "tdf79435_legacyInputFiel
     uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
 
     OUString sTmp;
-    xParameters->getByName("EntryMacro") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
-    xParameters->getByName("Help") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
-    xParameters->getByName("ExitMacro") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+    // Too often the string reader can fail during import - fix that first to prevent round-tripping garbage.
+    // (for example BR-1010B.doc from tdf#48097)
+    //xParameters->getByName("EntryMacro") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+    //xParameters->getByName("Help") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
+    //xParameters->getByName("ExitMacro") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
     xParameters->getByName("Description") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp);
-    xParameters->getByName("Content") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
-    xParameters->getByName("Format") >>= sTmp;
-    CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
+    //xParameters->getByName("Content") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
+    //xParameters->getByName("Format") >>= sTmp;
+    //CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
 
     sal_uInt16 nMaxLength = 0;
     xParameters->getByName("MaxLength") >>= nMaxLength;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 0aec993a1159..012755119be2 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -158,11 +158,10 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr )
         if (!aBookmarkName.isEmpty()) {
             m_aFieldStack.back().SetBookmarkName(aBookmarkName);
             m_aFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
-            m_aFieldStack.back().getParameters()["Description"] <<= aFormula.msToolTip;
-            if ( aFormula.mbHelp && !aFormula.msHelp.isEmpty() )
-                m_aFieldStack.back().getParameters()["Help"] <<= aFormula.msHelp;
+            if ( aFormula.msToolTip.getLength() < 139 )
+                m_aFieldStack.back().getParameters()["Description"] <<= aFormula.msToolTip;
             m_aFieldStack.back().getParameters()["Name"] <<= aFormula.msTitle;
-            if (aFormula.mnMaxLen)
+            if (aFormula.mnMaxLen && aFormula.mnMaxLen < 32768 )
                 m_aFieldStack.back().getParameters()["MaxLength"] <<= aFormula.mnMaxLen;
 
             if ( aFormula.mfType == 1 )
@@ -175,15 +174,6 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr )
                 m_aFieldStack.back().getParameters()["Type"] <<= OUString("currentDate");
             else if ( aFormula.mfType == 5 )
                 m_aFieldStack.back().getParameters()["Type"] <<= OUString("calculated");
-
-            if ( !aFormula.msDefault.isEmpty() )
-                m_aFieldStack.back().getParameters()["Content"] <<= aFormula.msDefault;
-            if ( !aFormula.msFormatting.isEmpty() )
-                m_aFieldStack.back().getParameters()["Format"] <<= aFormula.msFormatting;
-            if ( !aFormula.msEntryMcr.isEmpty() )
-                m_aFieldStack.back().getParameters()["EntryMacro"] <<= aFormula.msEntryMcr;
-            if ( !aFormula.msExitMcr.isEmpty() )
-                m_aFieldStack.back().getParameters()["ExitMacro"] <<= aFormula.msExitMcr;
         }
         return eF_ResT::TEXT;
     }


More information about the Libreoffice-commits mailing list