[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Dec 8 10:43:03 UTC 2016


 sw/qa/extras/uiwriter/data/tdf104440.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx       |   15 +++++++++++++++
 sw/source/core/text/txtfly.cxx           |    7 +++++++
 3 files changed, 22 insertions(+)

New commits:
commit c1ae11db4a56dea9369d379a83c8a2a7afc2b99b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Dec 7 10:00:10 2016 +0100

    tdf#104440 sw: fix layout inconsistency with dynamic wrapping and undo
    
    The problem was that the second fly frame was placed on the first page
    initially, but after typing a character (which moved it to the second
    page) and then undoing, it wasn't moved back.
    
    Fix the inconsistency by handling the "fly frame takes all horizontal
    space" case as parallel wrapping (which will result in no wrapping at
    the end), this way the second fly frame appears on the second page both
    initially and after editing.
    
    As an additional data point, the DOC export of the bugdoc is now
    rendered in Word the same way as in Writer.
    
    (cherry picked from commit 862c12396585661606d4e6ae583d1d024a19d222)
    
    Conflicts:
    	sw/qa/extras/uiwriter/uiwriter.cxx
    
    Change-Id: Ifc9f17458ad0501b8ab6077e5a4998d48fd6f1d8
    Reviewed-on: https://gerrit.libreoffice.org/31725
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sw/qa/extras/uiwriter/data/tdf104440.odt b/sw/qa/extras/uiwriter/data/tdf104440.odt
new file mode 100644
index 0000000..b226bb5
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf104440.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1a37476..d7827ae 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -199,6 +199,7 @@ public:
     void testCursorWindows();
     void testLandscape();
     void testTdf95699();
+    void testTdf104440();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -299,6 +300,7 @@ public:
     CPPUNIT_TEST(testCursorWindows);
     CPPUNIT_TEST(testLandscape);
     CPPUNIT_TEST(testTdf95699);
+    CPPUNIT_TEST(testTdf104440);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3484,6 +3486,19 @@ void SwUiWriterTest::testTdf95699()
     CPPUNIT_ASSERT_EQUAL(OUString("vnd.oasis.opendocument.field.FORMCHECKBOX"), pFieldMark->GetFieldname());
 }
 
+void SwUiWriterTest::testTdf104440()
+{
+    createDoc("tdf104440.odt");
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//page[2]/body/txt/anchored");
+    xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+    // This was 0: both Text Frames in the document were anchored to a
+    // paragraph on page 1, while we expect that the second Text Frame is
+    // anchored to a paragraph on page 2.
+    CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
+    xmlXPathFreeObject(pXmlObj);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 8c041c6..efc5abe 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1386,6 +1386,13 @@ SwSurround SwTextFly::_GetSurroundForTextWrap( const SwAnchoredObject* pAnchored
             const int textMin = GetMaster()->GetNode()
                 ->getIDocumentSettingAccess()->get(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL )
                 ? TEXT_MIN_SMALL : TEXT_MIN;
+
+            // In case there is no space on either side, then SURROUND_PARALLEL
+            // gives the same result when doing the initial layout or a layout
+            // update after editing, so prefer that over SURROUND_NONE.
+            if (nLeft == 0 && nRight == 0)
+                return SURROUND_PARALLEL;
+
             if( nLeft < textMin )
                 nLeft = 0;
             if( nRight < textMin )


More information about the Libreoffice-commits mailing list