Kaydet (Commit) b9b4e922 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/67544Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst e426cdc9
......@@ -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;
......
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment