summaryrefslogtreecommitdiff
path: root/writerfilter/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-01-27 21:07:09 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-01-28 09:08:32 +0100
commit9fedce7a261f28dc286943f7bdd2adb010ed9b31 (patch)
tree4f66cca0c5053a63e24e4b1be93aaa75de1fbcc3 /writerfilter/qa
parent77e2071a72608ab66be2b5d2568332f8c993a4c6 (diff)
tdf#103964 DOCX import: ignore rotation when setting position of group shapes
Regression from commit 36ac7749523e0c6f40a77beac278bd9e7a667a9b (DOCX import: make sure rotation does not affect shape position, 2014-09-24), the motivation for tweaking the rotation when setting the position of a shape was for images. By accident, this also happened for group shapes. But the bugdoc shows it's not a good idea to read the rotation of group shapes: the group shape is just a container, it does not have rotation in itself. (The test120551 intention was probably just to verify that the position is not entirely off, so the small required change to the expected value should be OK.) Change-Id: I8e12c28e65c5f64168c3f802546fddf472fcc6eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87551 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/qa')
-rw-r--r--writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx75
-rw-r--r--writerfilter/qa/cppunittests/dmapper/data/group-shape-rotation.docxbin0 -> 24177 bytes
2 files changed, 75 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
new file mode 100644
index 000000000000..2071f1fdf67d
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/dmapper/GraphicImport.cxx.
+class Test : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ uno::Reference<uno::XComponentContext> mxComponentContext;
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ void setUp() override;
+ void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void Test::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void Test::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+char const DATA_DIRECTORY[] = "/writerfilter/qa/cppunittests/dmapper/data/";
+
+CPPUNIT_TEST_FIXTURE(Test, testGroupShapeRotation)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "group-shape-rotation.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_Int32 nVertPosition = 0;
+ xShape->getPropertyValue("VertOrientPosition") >>= nVertPosition;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1221
+ // - Actual : -2048
+ // i.e. the group shape had a so low vertical position that the line shape did not point into
+ // it.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1221), nVertPosition);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/group-shape-rotation.docx b/writerfilter/qa/cppunittests/dmapper/data/group-shape-rotation.docx
new file mode 100644
index 000000000000..c9fee726bb89
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/data/group-shape-rotation.docx
Binary files differ