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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 22 13:47:31 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf105444.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx        |    9 +++++++++
 sw/qa/extras/uiwriter/uiwriter.cxx                |   10 +---------
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    4 +++-
 4 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit bdade7e3fc33c1832c6f6a472443fca8238738d2
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Sep 21 12:38:48 2018 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Sat Sep 22 15:47:11 2018 +0200

    tdf#105444 DOCX import: don't put extra paragraphs in comments
    
    on Win32, waiting only for \r\n instead of \n in RemoveLastParagraph().
    
    Change-Id: I8921a6a72e8397ed04edb9f339ba3f0bf5bbb98b
    Reviewed-on: https://gerrit.libreoffice.org/60865
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf105444.docx b/sw/qa/extras/ooxmlexport/data/tdf105444.docx
new file mode 100644
index 000000000000..a6e0ea8732e3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf105444.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 61388952f583..2b55c3f1ecfd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -797,6 +797,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119143, "tdf119143.docx")
         sParaText);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf105444, "tdf105444.docx")
+{
+    xmlDocPtr pXmlComm = parseExport("word/comments.xml");
+    if (!pXmlComm)
+        return;
+    // there is no extra paragraph on Win32, only a single one.
+    assertXPath(pXmlComm, "/w:comments/w:comment/w:p", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 0bb8c12afab1..12c3e08cb150 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5405,15 +5405,7 @@ void SwUiWriterTest::testCreateDocxAnnotation()
     uno::Reference<beans::XPropertySet> xField(xFields->nextElement(), uno::UNO_QUERY);
 
     // this was empty instead of "some text"
-    OUString aResultText = aSomeText
-#ifdef WNT
-        // FIXME From some unclear reason, on windows we get an additional
-        // paragraph in the comment - please adapt this test when that gets
-        // fixed.
-        + "\n"
-#endif
-        ;
-    CPPUNIT_ASSERT_EQUAL(aResultText, xField->getPropertyValue("Content").get<OUString>());
+    CPPUNIT_ASSERT_EQUAL(aSomeText, xField->getPropertyValue("Content").get<OUString>());
 }
 
 void SwUiWriterTest::testTdf107976()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8767256faa76..6359fdf0982a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -436,7 +436,9 @@ void DomainMapper_Impl::RemoveLastParagraph( )
             xCursor->goLeft( 1, true );
             // If this is a text on a shape, possibly the text has the trailing
             // newline removed already.
-            if (xCursor->getString() == SAL_NEWLINE_STRING)
+            if (xCursor->getString() == SAL_NEWLINE_STRING ||
+                    // tdf#105444 comments need an exception, if SAL_NEWLINE_STRING defined as "\r\n"
+                    (sizeof(SAL_NEWLINE_STRING)-1 == 2 && xCursor->getString() == "\n"))
             {
                 uno::Reference<beans::XPropertySet> xDocProps(GetTextDocument(), uno::UNO_QUERY);
                 const OUString aRecordChanges("RecordChanges");


More information about the Libreoffice-commits mailing list