summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorDhiraj Holden <dhiraj.holden@gmail.com>2022-01-01 20:14:33 -0500
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-10 17:16:34 +0100
commit7c51b1129c67b2c8bc85a4560b36555b83adeeb3 (patch)
treeef05cce2e65ab9a557f547432c0a9bd58d2aa53e /svx
parentc9f81fa407f3342e323e648eaaf6c06234fe7376 (diff)
tdf#130076 Fixed flip not working properly from file
Added code to check whether the angles need to be changed when the section is flipped. Change-Id: I9cc3e16db74c6e9616385bc39849e4c73686b56c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127853 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de> (cherry picked from commit 207d202ed2f1f44e5b62157b5a92ee5e8cc2c3e5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128166 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/classicshapes.cxx42
-rw-r--r--svx/qa/unit/data/tdf130076_FlipOnSectorSection.odgbin0 -> 13736 bytes
2 files changed, 41 insertions, 1 deletions
diff --git a/svx/qa/unit/classicshapes.cxx b/svx/qa/unit/classicshapes.cxx
index 8d8ed8bd74e4..d9e0fc18c7c1 100644
--- a/svx/qa/unit/classicshapes.cxx
+++ b/svx/qa/unit/classicshapes.cxx
@@ -181,6 +181,46 @@ CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf98583ShearHorizontal)
CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
}
-}
+CPPUNIT_TEST_FIXTURE(ClassicshapesTest, testTdf130076Flip)
+{
+ // The document contains sections of a circle, one of which is scaled
+ // (1, -1), one of which is scaled (-1,1), one of which is transformed
+ // by a matrix equivalent to a vertical flip, and another which is
+ // transformed by a matrix equivalent to a horizontal flip. Error was
+ // that the transformation was made before the CircleKind was set,
+ // resulting in the flip being performed incorrectly.
+ const OUString sURL(m_directories.getURLFromSrc(sDataDirectory)
+ + "tdf130076_FlipOnSectorSection.odg");
+ mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument");
+
+ OUString sErrors; // sErrors collects the errors and should be empty in case all is OK.
+
+ for (sal_uInt8 nPageIndex = 0; nPageIndex < 2; ++nPageIndex)
+ {
+ sal_Int32 angle1, angle2;
+ const sal_Int32 goodAngle1 = 26000;
+ const sal_Int32 goodAngle2 = 26000;
+ uno::Reference<drawing::XShape> xShape(getShape(1, nPageIndex));
+ uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape2(getShape(2, nPageIndex));
+ uno::Reference<beans::XPropertySet> xShapeProps2(xShape2, uno::UNO_QUERY);
+ xShapeProps->getPropertyValue("CircleStartAngle") >>= angle1;
+ xShapeProps2->getPropertyValue("CircleStartAngle") >>= angle2;
+ if (angle1 != goodAngle1)
+ {
+ sErrors += "page " + OUString::number(nPageIndex)
+ + " expected vertical flip starting angle " + OUString::number(goodAngle1)
+ + " actual " + OUString::number(angle1) + "\n";
+ }
+ if (angle2 != goodAngle2)
+ {
+ sErrors += "page " + OUString::number(nPageIndex)
+ + " expected horizontal flip starting angle " + OUString::number(goodAngle2)
+ + " actual " + OUString::number(angle2) + "\n";
+ }
+ }
+ CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+}
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg b/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg
new file mode 100644
index 000000000000..058e7e0443f9
--- /dev/null
+++ b/svx/qa/unit/data/tdf130076_FlipOnSectorSection.odg
Binary files differ