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

New commits:
commit 9aaf0f4b2c74d76d38460725b07c78e4aeabdbf3
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Sat Jan 20 12:28:48 2024 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sun Jan 21 02:38:44 2024 +0100

    tdf#153909: docx import: pre-emptive unit test for layoutInCell
    
    In LO, we have a much more strict definition of what "FollowTextFlow"
    means than the various MSO exceptions.
    
    In this case, we had to disable FollowTextFlow to allow the shape
    to be placed outside of the cell.
    However, the value of layoutInCell is actually true,
    so the fly offsets still need to be against the cell's "margin"
    and not against the outside-of-the-table paragraph margins.
    
    This unit test is a good visual example of this.
    The blue rectangle is supposed to start at the paper edge,
    (and end before the next paper edge),
    whereas if layoutInCell is turned off, the rectangle would be
    indented 1.3cm and spill off the end of the paper.
    
    This test prevents the following situation:
      - we export layoutInCell = false (very bad for a compat docx)
      - we have fixed compat import to honor layoutInCell = false
    
    Change-Id: I355837d1ce5cff76c5eb376fc76b057f248a1039
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162339
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx
index 712e37aceabd..721d1305fe12 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf153909_followTextFlow.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 3a5ae1f394ea..e079a0f588a4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -42,6 +42,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow
     sal_Int32 nTableTop = getXPath(pDump, "//tab/row/infos/bounds"_ostr, 
"top"_ostr).toInt32();
     // The entire table must be below the rectangle
     CPPUNIT_ASSERT(nTableTop > nRectBottom);
+
+    // pre-emptive test: rectangle "margin" offset against cell, not 
outside-table-paragraph.
+    // Since layoutInCell is true (as a non-defined default), the cell is the 
fly reference, thus
+    // the rectangle should start at the paper's edge, 1.3cm to the left of 
the start of the table.
+    sal_Int32 nRectLeft
+        = getXPath(pDump, "//anchored/SwAnchoredDrawObject/bounds"_ostr, 
"left"_ostr).toInt32();
+    sal_Int32 nTableLeft = getXPath(pDump, "//tab/row/infos/bounds"_ostr, 
"left"_ostr).toInt32();
+    CPPUNIT_ASSERT(nTableLeft > nRectLeft);
 }
 
 } // end of anonymous namespace

Reply via email to