diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2019-12-21 22:32:55 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2020-02-26 12:04:11 +0100 |
commit | b4a6977e05d87fe0a79b266ec30e4f403404f1b4 (patch) | |
tree | 969b5d55c1f3ea2dedff31009ae89ff0eec38da5 /svx/qa | |
parent | 79d396a2a64bec4e6c9aa514af40fdd67a62d8ce (diff) |
tdf#129532 tdf#98839 fixes for mirror of custom shapes
tdf#98839 In case a sheared custom shape was mirrored, the shear
angle in draw:transform had a wrong sign in the saved file.
tdf#129532 Mirroring given in draw:transform in file or via macro
was wrongly applied. Errors:
1)Mirroring from draw:transform attribute had overwritten already
existing mirroring in the enhanced-geometry.
2)Mirroring from draw:transform attribute was set in enhanced-
geometry attributes but not really applied.
Change-Id: Ifa52f3606b5a33e6492a02d6e19c883d28752da8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85670
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 40 | ||||
-rw-r--r-- | svx/qa/unit/data/tdf129532_MatrixFlipV.odg | bin | 0 -> 10036 bytes |
2 files changed, 40 insertions, 0 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 796fa4824809..a21652113ef8 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -631,6 +631,46 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf128413_tbrlOnOff) } CPPUNIT_ASSERT_EQUAL(OUString(), sError); } + +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf129532_MatrixFlipV) +{ + // The document contains two rotated shapes with the same geometry. For one of them + // "matrix(1 0 0 -1 0cm 0cm)" was manually added to the value of the draw:transform + // attribute. That should result in mirroring on the x-axis. Error was, that the lines + // which are drawn on the shape rectangle were mirrored, but not the rectangle itself. + // The rectangle was only shifted. + const OUString sFileName("tdf129532_MatrixFlipV.odg"); + OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName; + mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument"); + CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is()); + OUString sErrors; // sErrors collects the errors and should be empty in case all is OK. + + uno::Reference<drawing::XShape> xShape0(getShape(0)); + uno::Reference<beans::XPropertySet> xShape0Props(xShape0, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShape0Props.is()); + awt::Rectangle aBoundRect0; + xShape0Props->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect0; + + uno::Reference<drawing::XShape> xShape1(getShape(1)); + uno::Reference<beans::XPropertySet> xShape1Props(xShape1, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShape1Props.is()); + awt::Rectangle aBoundRect1; + xShape1Props->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect1; + + // The size of the two BoundRect rectangles are the same in case of correct + // vertical mirroring. + if (aBoundRect0.Width != aBoundRect1.Width) + { + sErrors += "\n Width expected: " + OUString::number(aBoundRect1.Width) + + " actual: " + OUString::number(aBoundRect0.Width); + } + if (aBoundRect0.Height != aBoundRect1.Height) + { + sErrors += "\n Height expected: " + OUString::number(aBoundRect1.Height) + + " actual: " + OUString::number(aBoundRect0.Height); + } + CPPUNIT_ASSERT_EQUAL(OUString(), sErrors); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/data/tdf129532_MatrixFlipV.odg b/svx/qa/unit/data/tdf129532_MatrixFlipV.odg Binary files differnew file mode 100644 index 000000000000..eb0c10b3d417 --- /dev/null +++ b/svx/qa/unit/data/tdf129532_MatrixFlipV.odg |