diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-05-28 13:36:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-05-29 08:55:00 +0200 |
commit | 2828e3c8ec3b336bc02e7e3b6d9b5c41fc5be306 (patch) | |
tree | fc7fd66472e5c1e6e6b9f95e0fb60109b859392a /sd | |
parent | a65918c5b6aaff0206c461e46b798efb95dc42c6 (diff) |
SmartArt: sort shapes by Z order after layout algorithms
so that they are laid out in correct order
Change-Id: I82baa61311197880654d09f356decc666e6fa4c7
Reviewed-on: https://gerrit.libreoffice.org/73094
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-vertical-block-list.pptx | bin | 0 -> 47533 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 41 |
2 files changed, 41 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-vertical-block-list.pptx b/sd/qa/unit/data/pptx/smartart-vertical-block-list.pptx Binary files differnew file mode 100644 index 000000000000..923f03c0ee23 --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-vertical-block-list.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index f07cca532e1b..0267961f70cf 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -77,6 +77,7 @@ public: void testBackgroundDrawingmlFallback(); void testCenterCycle(); void testFontSize(); + void testVerticalBlockList(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -115,6 +116,7 @@ public: CPPUNIT_TEST(testBackgroundDrawingmlFallback); CPPUNIT_TEST(testCenterCycle); CPPUNIT_TEST(testFontSize); + CPPUNIT_TEST(testVerticalBlockList); CPPUNIT_TEST_SUITE_END(); }; @@ -1199,6 +1201,45 @@ void SdImportTestSmartArt::testFontSize() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testVerticalBlockList() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-vertical-block-list.pptx"), PPTX); + uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + + uno::Reference<drawing::XShapes> xGroup1(xGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xGroup1->getCount()); + uno::Reference<drawing::XShape> xShapeA(xGroup1->getByIndex(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShapeBC(xGroup1->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XText> xTextA(xShapeA, uno::UNO_QUERY); + uno::Reference<text::XText> xTextBC(xShapeBC, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("a"), xTextA->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("b\nc"), xTextBC->getString()); + + uno::Reference<beans::XPropertySet> xPropSetBC(xShapeBC, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(27000), xPropSetBC->getPropertyValue("RotateAngle").get<sal_Int32>()); + + // BC shape is rotated 90*, so width and height is swapped + CPPUNIT_ASSERT_GREATER(xShapeA->getSize().Width, xShapeBC->getSize().Height); + CPPUNIT_ASSERT_LESSEQUAL(xShapeA->getSize().Height, xShapeBC->getSize().Width); + CPPUNIT_ASSERT_GREATER(xShapeA->getPosition().X, xShapeBC->getPosition().X); + CPPUNIT_ASSERT_GREATEREQUAL(xShapeA->getPosition().Y, xShapeBC->getPosition().Y); + + uno::Reference<drawing::XShapes> xGroup3(xGroup->getByIndex(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xGroup3->getCount()); + uno::Reference<drawing::XShape> xShapeEmpty(xGroup3->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XText> xTextEmpty(xShapeEmpty, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("empty"), xTextEmpty->getString()); + + CPPUNIT_ASSERT_EQUAL(xShapeA->getSize().Width, xShapeEmpty->getSize().Width); + CPPUNIT_ASSERT_EQUAL(xShapeA->getSize().Height, xShapeEmpty->getSize().Height); + CPPUNIT_ASSERT_EQUAL(xShapeA->getPosition().X, xShapeEmpty->getPosition().X); + CPPUNIT_ASSERT_GREATEREQUAL(xShapeA->getPosition().Y + 2*xShapeA->getSize().Height, xShapeEmpty->getPosition().Y); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |