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

oox smartart, accent process: fix overlapping shape pairs

Linear algorithm had an idea how to take width from constrains, but that
was unused for embedded child algorithms.

Change-Id: If4c497e053ea0d134a1ffc529f1d233ec4fc50db
Reviewed-on: https://gerrit.libreoffice.org/63725Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst e37b7e8a
...@@ -523,7 +523,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, ...@@ -523,7 +523,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
aSize.Width *= fWidthScale; aSize.Width *= fWidthScale;
aCurrShape->setSize(aSize); aCurrShape->setSize(aSize);
aCurrShape->setChildSize(aChildSize); aCurrShape->setChildSize(aSize);
aCurrPos.X += nIncX * (aSize.Width + fSpace*aSize.Width); aCurrPos.X += nIncX * (aSize.Width + fSpace*aSize.Width);
aCurrPos.Y += nIncY * (aChildSize.Height + fSpace*aChildSize.Height); aCurrPos.Y += nIncY * (aChildSize.Height + fSpace*aChildSize.Height);
} }
......
...@@ -472,7 +472,7 @@ void SdImportTestSmartArt::testAccentProcess() ...@@ -472,7 +472,7 @@ void SdImportTestSmartArt::testAccentProcess()
CPPUNIT_ASSERT(xFirstParentText.is()); CPPUNIT_ASSERT(xFirstParentText.is());
CPPUNIT_ASSERT_EQUAL(OUString("a"), xFirstParentText->getString()); CPPUNIT_ASSERT_EQUAL(OUString("a"), xFirstParentText->getString());
uno::Reference<drawing::XShape> xFirstParent(xFirstParentText, uno::UNO_QUERY); uno::Reference<drawing::XShape> xFirstParent(xFirstParentText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstParentText.is()); CPPUNIT_ASSERT(xFirstParent.is());
int nFirstParentTop = xFirstParent->getPosition().Y; int nFirstParentTop = xFirstParent->getPosition().Y;
uno::Reference<text::XText> xFirstChildText(xFirstPair->getByIndex(2), uno::UNO_QUERY); uno::Reference<text::XText> xFirstChildText(xFirstPair->getByIndex(2), uno::UNO_QUERY);
...@@ -481,6 +481,7 @@ void SdImportTestSmartArt::testAccentProcess() ...@@ -481,6 +481,7 @@ void SdImportTestSmartArt::testAccentProcess()
uno::Reference<drawing::XShape> xFirstChild(xFirstChildText, uno::UNO_QUERY); uno::Reference<drawing::XShape> xFirstChild(xFirstChildText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstChildText.is()); CPPUNIT_ASSERT(xFirstChildText.is());
int nFirstChildTop = xFirstChild->getPosition().Y; int nFirstChildTop = xFirstChild->getPosition().Y;
int nFirstChildRight = xFirstChild->getPosition().X + xFirstChild->getSize().Width;
// First child is below the first parent. // First child is below the first parent.
// Without the accompanying fix in place, this test would have failed with // Without the accompanying fix in place, this test would have failed with
...@@ -488,6 +489,20 @@ void SdImportTestSmartArt::testAccentProcess() ...@@ -488,6 +489,20 @@ void SdImportTestSmartArt::testAccentProcess()
// below xFirstParent (a good position is 9081). // below xFirstParent (a good position is 9081).
CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop); CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop);
uno::Reference<drawing::XShapes> xSecondPair(xGroup->getByIndex(2), uno::UNO_QUERY);
CPPUNIT_ASSERT(xSecondPair.is());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xSecondPair->getCount());
uno::Reference<text::XText> xSecondParentText(xSecondPair->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstParentText.is());
CPPUNIT_ASSERT_EQUAL(OUString("c"), xSecondParentText->getString());
uno::Reference<drawing::XShape> xSecondParent(xSecondParentText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xSecondParent.is());
int nSecondParentLeft = xSecondParent->getPosition().X;
// Without the accompanying fix in place, this test would have failed with
// 'Expected less than: 12700; Actual : 18540', i.e. the "b" and "c"
// shapes overlapped.
CPPUNIT_ASSERT_LESS(nSecondParentLeft, nFirstChildRight);
xDocShRef->DoClose(); 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