From 61b1d3a17ff784b7c79a92cbe069a90ce4932535 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 8 Mar 2024 08:37:30 -0500 Subject: tdf#160077 unit test: this file was helpful identifying a "bad fix" ...since I'm walking away from doing any fix at all as it involves layout code for layoutInCell. Following the createGraphicObject route could also benefit from a similar fix as d210667c72ff821b8cb50b386a83ed55d65ae9bf, but placing that code outside of the try/catch will be important because this example exceptions out. However, my first instinct was to put the code in the "obvious spot" and it didn't work, so adding this as a separate unit test. make CppunitTest_sw_ooxmlexport21 \ CPPUNIT_TEST_NAME=testTdf160077_layoutInCellB Change-Id: Ifa6a62d9708d9248e48766b913d54a79cfcb230a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164578 Tested-by: Justin Luth Reviewed-by: Justin Luth --- .../ooxmlexport/data/tdf160077_layoutInCellB.docx | Bin 0 -> 164493 bytes sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx new file mode 100644 index 000000000000..741bf8270855 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 5e320bb6d743..2683ccad087e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -381,6 +381,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, "tdf160077_layoutInCell.doc CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow")); } +DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellB, "tdf160077_layoutInCellB.docx") +{ + // given an in-table, group-shape vertically aligned -1.35 cm (above) the top page margin + // (which is actually forced to layoutInCell, so that turns into 1.35cm above the paragraph) + + xmlDocUniquePtr pDump = parseLayoutDump(); + const sal_Int32 nShapeTop + = getXPath(pDump, + "//body/tab[1]/row[1]/cell[1]/txt[1]/anchored/SwAnchoredDrawObject/bounds"_ostr, + "top"_ostr) + .toInt32(); + // The shape is approximately 1 cm below the top of the page, and ~0.5cm above the cell + // correct ShapeTop: 888 TWIPS, while incorrect value was -480. Cell top is 1148, PageTop is 284 + CPPUNIT_ASSERT_DOUBLES_EQUAL(888, nShapeTop, 50); +} + DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, "tdf153909_followTextFlow.docx") { // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't specified or honored -- cgit