summaryrefslogtreecommitdiff
path: root/sw/qa/extras/layout/layout.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-03-25 21:36:02 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-03-26 09:15:24 +0100
commit27894be916d5d03ee820e757d2f4abbf21d54615 (patch)
treec3b75b7d1dd9446c2ec600e257fe8d3acbe8b46b /sw/qa/extras/layout/layout.cxx
parentc49583e9a005276b9393c2393ea79b92816e07f3 (diff)
tdf#123651 sw AddVerticalFrameOffsets: make vert offset depend on hori offset
Regression from commit 961ba62df045473e5793d9e103be86eaad8d9575 (tdf#123032 sw, AddVerticalFrameOffsets: fix shape pos after mouse move, 2019-02-07), the vertical position of the bugdoc was too large, and turns out Word only works with vertical offsets if there is already a horizontal offset. For example open tdf98987.docx in Word, remove the left square shape, notice how the other square shape jumps up due to no longer working with a vertical offset (while the doc model vertical position of the shape is unchanged). Change our layout, so that in case the AddVerticalFrameOffsets compatibility flag is on (which was added to emulate Word's behavior), we also consider the horizontal offset before setting the vertical offset. Also improve the SwUiWriterTest2::testTdf122942() test that asserted doc model positions, which are now different (needed so that at the end the layout position visible to the user is unchanged). Change-Id: I8ac451efbacefdd3578b3a578260e7b2060c16a6 Reviewed-on: https://gerrit.libreoffice.org/69716 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/extras/layout/layout.cxx')
-rw-r--r--sw/qa/extras/layout/layout.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 79a67296fe13..28649cbcedef 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -72,6 +72,7 @@ public:
void testTdf122607();
void testBtlrCell();
void testTdf123898();
+ void testTdf123651();
CPPUNIT_TEST_SUITE(SwLayoutWriter);
CPPUNIT_TEST(testRedlineFootnotes);
@@ -114,6 +115,7 @@ public:
CPPUNIT_TEST(testTdf122607);
CPPUNIT_TEST(testBtlrCell);
CPPUNIT_TEST(testTdf123898);
+ CPPUNIT_TEST(testTdf123651);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2938,6 +2940,15 @@ void SwLayoutWriter::testTdf123898()
assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 42);
}
+void SwLayoutWriter::testTdf123651()
+{
+ createDoc("tdf123651.docx");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 7639;
+ // Actual: 12926'. The shape was below the second "Lorem ipsum" text, not above it.
+ assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "top", "7639");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
CPPUNIT_PLUGIN_IMPLEMENT();