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

New commits:
commit b0f8b695ef25dfd24416afe36b26d7d4f41c40a9
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Mar 6 09:25:31 2024 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Mar 7 04:23:50 2024 +0100

    tdf#160049 full unit test: use margins with left/right HoriOrientRel
    
    The other unit tests focused on the concept in general,
    but always used the same situation.
    
    This is a comprehensive test,
    indicating the things that should NOT use the margins (center, left by)
    and both things that do use the margin (right, as well as left).
    
    So there are a few "do not break what is already working" situations
    now tested for...
    
    Change-Id: I77a5d3e6244710def76b35dac1c6f0fe9ec9e480
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164474
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx
new file mode 100644
index 000000000000..b39c0cad83e7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index bc5d5f253e8e..fcb2eea321c9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -314,6 +314,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, 
"tdf160049_anchorMargin2.d
                          getProperty<sal_Int16>(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin14, 
"tdf160049_anchorMargin14.docx")
+{
+    // given a DML compat14 (Word 2010) document with a LEFT "column/text" 
anchored image
+    // followed by a RIGHT column/text anchored image (with a 2cm paragraph 
right margin)
+    // followed by a CENTER column/text anchored image (with a large left 
margin)
+    // followed by a LEFT FROM column/text anchored image (which ignores the 
left margin)
+    // followed by a LEFT "margin" anchored image (which always ignores the 
left margin)
+
+    // The shape takes into account the left margin, looking like it is in the 
middle of the doc,
+    // which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+    uno::Reference<drawing::XShape> xShape(getShapeByName(u"Picture 2"));
+    CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+                         getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
+    // The shape takes into account the right margin, looking like it is in 
the middle of the doc,
+    xShape.set(getShapeByName(u"Picture 3"));
+    CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+                         getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
+    // The third shape takes "center" very seriously, and ignores the margins
+    xShape.set(getShapeByName(u"Picture 4"));
+    CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+                         getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
+    // The fourth shape takes "left by 123", and ignores the margins, acting 
just like "margin"
+    xShape.set(getShapeByName(u"Picture 5"));
+    CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+                         getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
+    // The fifth shape shows how "left" works with "margin", which apparently 
means page margin
+    xShape.set(getShapeByName(u"Picture 6"));
+    CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
+                         getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15.docx")
 {
     // given a DML compat15 (Word 2013) document with a LEFT "column/text" 
anchored image

Reply via email to