summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-03-08 08:37:30 -0500
committerJustin Luth <jluth@mail.com>2024-03-08 18:22:46 +0100
commit61b1d3a17ff784b7c79a92cbe069a90ce4932535 (patch)
treee56f60aad0456ac1b92c69424cc24edf13ea3964
parent6441778b61d1c6737947551e55d2c27e79260142 (diff)
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 <jluth@mail.com> Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docxbin0 -> 164493 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport21.cxx16
2 files changed, 16 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx
Binary files 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<bool>(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