diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-03-06 09:25:31 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2024-03-07 04:23:50 +0100 |
commit | b0f8b695ef25dfd24416afe36b26d7d4f41c40a9 (patch) | |
tree | 4d248583c1dd040162c1d15421d4aed9e6324748 /sw | |
parent | 77980d4375b270f328afe1dd90e96e2e31fd498d (diff) |
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 <jluth@mail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx | bin | 0 -> 67142 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx Binary files differnew file mode 100644 index 000000000000..b39c0cad83e7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx 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 |