From dcd378bf614c99d705312259a0a0a25b40d88e2b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 2 Jan 2019 17:38:07 +0100 Subject: oox smartart, org chart: handle multiple elements in hierChild In case one manager has multiple employees, then we laid out only the first one. Recognize non-assistant type as the node type (as a start) to get the correct number of employees (when there are no assistants), and also render employees on a horizontal (and not on a vertical) path. With this, the 1 manager and multiple employees case looks reasonable. Change-Id: I3bbe0413586b1a2c25f9094dbd44f1a86c799c0f Reviewed-on: https://gerrit.libreoffice.org/65813 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/qa/unit/data/pptx/smartart-org-chart.pptx | Bin 51711 -> 52537 bytes sd/qa/unit/import-tests-smartart.cxx | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/smartart-org-chart.pptx b/sd/qa/unit/data/pptx/smartart-org-chart.pptx index 332d401fa641..3be3473fd6c4 100644 Binary files a/sd/qa/unit/data/pptx/smartart-org-chart.pptx and b/sd/qa/unit/data/pptx/smartart-org-chart.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 3f644caa8278..98df02de2fc9 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -705,6 +705,14 @@ void SdImportTestSmartArt::testOrgChart() awt::Point aManagerPos = xManagerShape->getPosition(); + // Make sure that the manager has 2 employees. + // Without the accompanying fix in place, this test would have failed with + // 'Expected: 2; Actual : 1'. + uno::Reference xEmployees(getChildShape(getChildShape(xGroup, 0), 1), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xEmployees.is()); + CPPUNIT_ASSERT_EQUAL(static_cast(2), xEmployees->getCount()); + uno::Reference xEmployee( getChildShape( getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 0), 0), 0), @@ -723,6 +731,22 @@ void SdImportTestSmartArt::testOrgChart() // two shapes were overlapping, i.e. "manager" was not above "employee". CPPUNIT_ASSERT_GREATER(aManagerPos.Y, aEmployeePos.Y); + // Make sure that the second employee is on the right of the first one. + // Without the accompanying fix in place, this test would have failed, as + // the second employee was below the first one. + uno::Reference xEmployee2( + getChildShape( + getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 0), 1), 1), 0), 0), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xEmployee2.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Employee2"), xEmployee2->getString()); + + uno::Reference xEmployee2Shape(xEmployee2, uno::UNO_QUERY); + CPPUNIT_ASSERT(xEmployee2Shape.is()); + + awt::Point aEmployee2Pos = xEmployee2Shape->getPosition(); + CPPUNIT_ASSERT_GREATER(aEmployeePos.X, aEmployee2Pos.X); + xDocShRef->DoClose(); } -- cgit