diff options
author | Regényi Balázs <regenyi.balazs+gerrit@gmail.com> | 2020-06-22 10:28:15 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-07-02 12:32:33 +0200 |
commit | a85c2504c002dff069c129ab244cb2ba5820943d (patch) | |
tree | 1a391f6ed056c95b9d7b5f18988ab8650723ffc5 /sw/qa | |
parent | bedc5bf125bdc0377b7dc845192b274e90945e13 (diff) |
tdf#123324 DOCX import: fix shape height relative to top page margin
using UNO API RelativeHeightRelation and the associated
lo-ext attribute for OpenDocument export.
See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).
Co-authored-by: Szabolcs Tóth
Change-Id: Ibaba4b3762de5a70506dacd85a818b8972b18144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96869
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx | bin | 0 -> 20882 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx | bin | 0 -> 14683 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 36 |
3 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx Binary files differnew file mode 100644 index 000000000000..b978eec993c7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx Binary files differnew file mode 100644 index 000000000000..70c2793cbf96 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 167c05111a51..3ca1a456182f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1163,6 +1163,42 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, "tdf108505.docx") getProperty<OUString>(xText, "CharFontName")); } +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginHasHeader, + "tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx") +{ + // TODO: fix export too + if (mbExported) + return; + // tdf#123324 The height was set relative to page print area top, + // but this was handled relative to page height. + // Note: page print area top = margin + header height. + // In this case the header exists. + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + const sal_Int32 nAnchoredHeight + = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height").toInt32(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2551), nAnchoredHeight); +} + +DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginNoHeader, + "tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx") +{ + // TODO: fix export too + if (mbExported) + return; + // tdf#123324 The height was set relative from top margin, but this was handled relative from page height. + // Note: the MSO Word margin = LO margin + LO header height. + // In this case the header does not exist, so MSO Word margin and LO Writer margin are the same. + + // tdf#123324 The height was set relative to page print area top, + // but this was handled relative to page height. + // Note: page print area top = margin + header height. + // In this case the header does not exist, so OpenDocument and OOXML margins are the same. + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + const sal_Int32 nAnchoredHeight + = getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height").toInt32(); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2551), nAnchoredHeight); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |