sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx                 |   16 +++++++++++++
 2 files changed, 16 insertions(+)

New commits:
commit 61b1d3a17ff784b7c79a92cbe069a90ce4932535
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Mar 8 08:37:30 2024 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Mar 8 18:22:46 2024 +0100

    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 <jl...@mail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>

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<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

Reply via email to