diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-04-27 10:54:27 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-04-27 11:56:56 +0200 |
commit | fccbb557add457db16e0556c3f0172cafc2cf981 (patch) | |
tree | 45b256c6ed9877d3057c2542aec9088937f094f2 /writerfilter/qa | |
parent | 16f7f5de542392ef9cfbb2efd51dd8c570a829a7 (diff) |
DOCX import: handle <wp:positionH relativeFrom="insideMargin">
This is the same as page, but it is from-left on odd pages and
from-right on even pages, i.e. our "mirror on even pages" mode.
Change-Id: I018e0ac165a3d802f64cfc314d5c5f58da3cb580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92965
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'writerfilter/qa')
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 20 | ||||
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx | bin | 0 -> 16119 bytes |
2 files changed, 20 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx index a98288fc40d3..590a93273e92 100644 --- a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx +++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/text/RelOrientation.hpp> using namespace ::com::sun::star; @@ -114,6 +115,25 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineInShapeAnchoredZOrder) // i.e. the image was behind the textbox that was hosting it. CPPUNIT_ASSERT_EQUAL(OUString("Picture 1"), xOval->getName()); } + +CPPUNIT_TEST_FIXTURE(Test, testRelfromhInsidemargin) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "relfromh-insidemargin.docx"; + getComponent() = loadFromDesktop(aURL); + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + sal_Int16 nRelation = 0; + xShape->getPropertyValue("HoriOrientRelation") >>= nRelation; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 7 (PAGE_FRAME) + // - Actual : 0 (FRAME) + // i.e. the horizontal position was relative to the paragraph area, not to the entire page. + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, nRelation); + bool bPageToggle = false; + xShape->getPropertyValue("PageToggle") >>= bPageToggle; + CPPUNIT_ASSERT(bPageToggle); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx b/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx Binary files differnew file mode 100644 index 000000000000..1f7a281e8b63 --- /dev/null +++ b/writerfilter/qa/cppunittests/dmapper/data/relfromh-insidemargin.docx |