summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorAdam Seskunas <adamseskunas@gmail.com>2024-08-04 12:58:26 -0700
committerHossein <hossein@libreoffice.org>2024-08-06 15:18:55 +0200
commitf8eac9eaf0b513460341ef158b610865d68fd536 (patch)
tree77ad61f511703794b2f7331fda9143c2b92c64d6 /sw/qa
parent860c8c7262fced0284994cf8421f3916abd27be9 (diff)
tdf#135710 - Add Unit test
Change-Id: I17189845ba273f1843a922e5b8aa521a8580dcb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171467 Reviewed-by: Hossein <hossein@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ww8export/ww8export4.cxx27
1 files changed, 27 insertions, 0 deletions
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();