summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-02-08 14:27:05 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-08 15:36:10 +0100
commitb9b4e9223b6c0d6e0b48b694c9aabbe54a250660 (patch)
treeadc4861d9c43a4aa372b3c7041815ae42b2f4276 /sd
parente426cdc9e4af2d681b2bb0be290a3270df1886c6 (diff)
oox smartart, cycle matrix: handle left/bottom constraint in composite algo
The bugdoc has 3 shapes in the "outer" circle which have a position where either x or y is not 0. But these are defined using constraints talking about the right or bottom edge of the shape. Map that to top/left, given that we already know the shape size. Change-Id: If7ccc2fb642046eb53b48c8b2c2b2c6b023ba9e8 Reviewed-on: https://gerrit.libreoffice.org/67544 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/smartart-cycle-matrix.pptxbin50333 -> 61703 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx38
2 files changed, 38 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx
index 0815df945b6d..d154e7f64bc0 100644
--- a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx
+++ b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 22eda8b7f74d..221f7390c5a3 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -832,6 +832,44 @@ void SdImportTestSmartArt::testCycleMatrix()
CPPUNIT_ASSERT(xA2.is());
CPPUNIT_ASSERT_EQUAL(OUString("A2"), xA2->getString());
+ // Test that the layout of shapes is like this:
+ // A2 B2
+ // D2 C2
+
+ uno::Reference<drawing::XShape> xA2Shape(xA2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xA2Shape.is());
+
+ uno::Reference<text::XText> xB2(getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 1),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xB2.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("B2"), xB2->getString());
+ uno::Reference<drawing::XShape> xB2Shape(xB2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xB2Shape.is());
+
+ uno::Reference<text::XText> xC2(getChildShape(getChildShape(getChildShape(xGroup, 0), 2), 1),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xC2.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("C2"), xC2->getString());
+ uno::Reference<drawing::XShape> xC2Shape(xC2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xC2Shape.is());
+
+ uno::Reference<text::XText> xD2(getChildShape(getChildShape(getChildShape(xGroup, 0), 3), 1),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xD2.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("D2"), xD2->getString());
+ uno::Reference<drawing::XShape> xD2Shape(xD2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xD2Shape.is());
+
+ // Without the accompanying fix in place, this test would have failed, i.e.
+ // the A2 and B2 shapes had the same horizontal position, while B2 should
+ // be on the right of A2.
+ CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().X, xB2Shape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(xA2Shape->getPosition().Y, xB2Shape->getPosition().Y);
+ CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().X, xC2Shape->getPosition().X);
+ CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().Y, xC2Shape->getPosition().Y);
+ CPPUNIT_ASSERT_EQUAL(xA2Shape->getPosition().X, xD2Shape->getPosition().X);
+ CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().Y, xD2Shape->getPosition().Y);
+
xDocShRef->DoClose();
}