From b389aafee9cfba9dc4dfa552347be39ff9fe41b2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 13 Nov 2018 18:00:50 +0100 Subject: oox smartart, accent process: add support for reading values from constraints And also add support for merging parent and own constraints in the layout. This fixes the lack of vertical position difference between the two pairs of shapes in the bugdoc. Change-Id: I3a91c9b0da5eed78a87116ebe0e2751a73e1508f Reviewed-on: https://gerrit.libreoffice.org/63340 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/qa/unit/data/pptx/smartart-accent-process.pptx | Bin 0 -> 46472 bytes sd/qa/unit/import-tests-smartart.cxx | 40 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 sd/qa/unit/data/pptx/smartart-accent-process.pptx (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/smartart-accent-process.pptx b/sd/qa/unit/data/pptx/smartart-accent-process.pptx new file mode 100644 index 000000000000..de556bdc6066 Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-accent-process.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 3e3c6c3691b2..898350abfba5 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -43,6 +43,7 @@ public: void testVertialBoxList(); void testVertialBracketList(); void testTableList(); + void testAccentProcess(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -70,6 +71,7 @@ public: CPPUNIT_TEST(testVertialBoxList); CPPUNIT_TEST(testVertialBracketList); CPPUNIT_TEST(testTableList); + CPPUNIT_TEST(testAccentProcess); CPPUNIT_TEST_SUITE_END(); }; @@ -450,6 +452,44 @@ void SdImportTestSmartArt::testTableList() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testAccentProcess() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-accent-process.pptx"), PPTX); + uno::Reference xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + CPPUNIT_ASSERT_EQUAL(static_cast(4), xGroup->getCount()); + uno::Reference xGroupShape(xGroup, uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroupShape.is()); + + // The pair if a parent (text + shape) and a child, so 3 shapes in total. + uno::Reference xFirstPair(xGroup->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstPair.is()); + CPPUNIT_ASSERT_EQUAL(static_cast(3), xFirstPair->getCount()); + + uno::Reference xFirstParentText(xFirstPair->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstParentText.is()); + CPPUNIT_ASSERT_EQUAL(OUString("a"), xFirstParentText->getString()); + uno::Reference xFirstParent(xFirstParentText, uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstParentText.is()); + int nFirstParentTop = xFirstParent->getPosition().Y; + + uno::Reference xFirstChildText(xFirstPair->getByIndex(2), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstChildText.is()); + CPPUNIT_ASSERT_EQUAL(OUString("b"), xFirstChildText->getString()); + uno::Reference xFirstChild(xFirstChildText, uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstChildText.is()); + int nFirstChildTop = xFirstChild->getPosition().Y; + + // First child is below the first parent. + // Without the accompanying fix in place, this test would have failed with + // 'Expected less than: 3881, Actual : 3881', i.e. xFirstChild was not + // below xFirstParent (a good position is 9081). + CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit