[Libreoffice-commits] core.git: oox/source sd/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Feb 8 14:36:38 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 4 ++
sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx |binary
sd/qa/unit/import-tests-smartart.cxx | 38 ++++++++++++++++++++
3 files changed, 42 insertions(+)
New commits:
commit b9b4e9223b6c0d6e0b48b694c9aabbe54a250660
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 8 14:27:05 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Feb 8 15:36:10 2019 +0100
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 at collabora.com>
Tested-by: Jenkins
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 2b17bee2a65d..d6a02570f535 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -543,11 +543,15 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
aPos.X = it->second;
else if ( (it = rProp.find(XML_ctrX)) != rProp.end() )
aPos.X = it->second - aSize.Width/2;
+ else if ((it = rProp.find(XML_r)) != rProp.end())
+ aPos.X = it->second - aSize.Width;
if ( (it = rProp.find(XML_t)) != rProp.end())
aPos.Y = it->second;
else if ( (it = rProp.find(XML_ctrY)) != rProp.end() )
aPos.Y = it->second - aSize.Height/2;
+ else if ((it = rProp.find(XML_b)) != rProp.end())
+ aPos.Y = it->second - aSize.Height;
if ( (it = rProp.find(XML_l)) != rProp.end() && (it2 = rProp.find(XML_r)) != rProp.end() )
aSize.Width = it2->second - it->second;
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
Binary files a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx and b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx 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();
}
More information about the Libreoffice-commits
mailing list