From 8d6e14765145ab7c9cb0cbf6956eaf07db10139a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 21 Nov 2018 16:17:42 +0100 Subject: 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/63725 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 67e062aa5e5946d4985921fe2b6f87766f363ddc) Reviewed-on: https://gerrit.libreoffice.org/65248 --- sd/qa/unit/import-tests-smartart.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sd/qa') diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index edb64c3ba600..f431cdddfa03 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -472,7 +472,7 @@ void SdImportTestSmartArt::testAccentProcess() CPPUNIT_ASSERT(xFirstParentText.is()); CPPUNIT_ASSERT_EQUAL(OUString("a"), xFirstParentText->getString()); uno::Reference xFirstParent(xFirstParentText, uno::UNO_QUERY); - CPPUNIT_ASSERT(xFirstParentText.is()); + CPPUNIT_ASSERT(xFirstParent.is()); int nFirstParentTop = xFirstParent->getPosition().Y; uno::Reference xFirstChildText(xFirstPair->getByIndex(2), uno::UNO_QUERY); @@ -481,6 +481,7 @@ void SdImportTestSmartArt::testAccentProcess() uno::Reference xFirstChild(xFirstChildText, uno::UNO_QUERY); CPPUNIT_ASSERT(xFirstChildText.is()); int nFirstChildTop = xFirstChild->getPosition().Y; + int nFirstChildRight = xFirstChild->getPosition().X + xFirstChild->getSize().Width; // First child is below the first parent. // Without the accompanying fix in place, this test would have failed with @@ -488,6 +489,20 @@ void SdImportTestSmartArt::testAccentProcess() // below xFirstParent (a good position is 9081). CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop); + uno::Reference xSecondPair(xGroup->getByIndex(2), uno::UNO_QUERY); + CPPUNIT_ASSERT(xSecondPair.is()); + CPPUNIT_ASSERT_EQUAL(static_cast(3), xSecondPair->getCount()); + uno::Reference xSecondParentText(xSecondPair->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstParentText.is()); + CPPUNIT_ASSERT_EQUAL(OUString("c"), xSecondParentText->getString()); + uno::Reference 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(); } -- cgit