sw/qa/extras/ww8export/ww8export4.cxx |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

New commits:
commit f8eac9eaf0b513460341ef158b610865d68fd536
Author:     Adam Seskunas <adamsesku...@gmail.com>
AuthorDate: Sun Aug 4 12:58:26 2024 -0700
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Tue Aug 6 15:18:55 2024 +0200

    tdf#135710 - Add Unit test
    
    Change-Id: I17189845ba273f1843a922e5b8aa521a8580dcb1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171467
    Reviewed-by: Hossein <hoss...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index d72121affb87..798e3e52da75 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -413,6 +413,33 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135709)
     xPropertySet->getPropertyValue("Surround") >>= eValue;
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrap should be PARALLEL", 
text::WrapTextMode_PARALLEL, eValue);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf135710)
+{
+    // Uses same test doc as testTdf135709
+    createSwDoc("tdf135709.odt");
+    saveAndReload("MS Word 97");
+
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+    sal_Int32 nFlyLeft = getXPath(pXmlDoc, 
"(//anchored)[1]/fly/infos/bounds"_ostr, "left"_ostr).toInt32();
+
+    // Set the anchor of the image to AT PARAGRAPH, without the fix in place 
this
+    // results in the picture moving to the first column
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> 
xPropertySet(xTextFramesSupplier->getTextFrames()->getByName("Frame1") , 
uno::UNO_QUERY);
+    xPropertySet->setPropertyValue("AnchorType",
+                                       
uno::Any(text::TextContentAnchorType_AT_PARAGRAPH));
+    pXmlDoc = parseLayoutDump();
+
+    sal_Int32 nFlyLeftAfter = getXPath(pXmlDoc, 
"(//anchored)[1]/fly/infos/bounds"_ostr, "left"_ostr).toInt32();
+
+    // Without the fix in place this fails with
+    // Expected: 4771
+    // Actual:   1418
+    // i.e. the picture has moved from the second column to the first column
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(nFlyLeft), 
static_cast<double>(nFlyLeftAfter), 2.0);
+}
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 

Reply via email to