diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-11-07 17:35:50 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-11-07 19:36:12 +0100 |
commit | 924f01fdef73af88284e6629c6d3604f33d27f24 (patch) | |
tree | 37d78c204f83582dacb618ec5e083dcaa9042e30 /sd | |
parent | faabaf7fe2b49085e40c7986e1b4b50973b23ab0 (diff) |
oox smartart, table list: fix too large width of children
It's possible all children request 100% of space, need to scale down in
that case. This means that children other than the first one is now
readable in the layout result.
Change-Id: I86a05cd77510bbb6686a53e33f13a60034c8e8f6
Reviewed-on: https://gerrit.libreoffice.org/63037
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/table-list.pptx | bin | 0 -> 52249 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 34 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/table-list.pptx b/sd/qa/unit/data/pptx/table-list.pptx Binary files differnew file mode 100644 index 000000000000..bc5fe7418e02 --- /dev/null +++ b/sd/qa/unit/data/pptx/table-list.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 223b105181d5..3e3c6c3691b2 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -42,6 +42,7 @@ public: void testBaseRtoL(); void testVertialBoxList(); void testVertialBracketList(); + void testTableList(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -68,6 +69,7 @@ public: CPPUNIT_TEST(testBaseRtoL); CPPUNIT_TEST(testVertialBoxList); CPPUNIT_TEST(testVertialBracketList); + CPPUNIT_TEST(testTableList); CPPUNIT_TEST_SUITE_END(); }; @@ -416,6 +418,38 @@ void SdImportTestSmartArt::testVertialBracketList() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testTableList() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/table-list.pptx"), PPTX); + uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapeGroup.is()); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xShapeGroup->getCount()); + + uno::Reference<text::XText> xParentText(xShapeGroup->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xParentText.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Parent"), xParentText->getString()); + uno::Reference<drawing::XShape> xParent(xParentText, uno::UNO_QUERY); + CPPUNIT_ASSERT(xParent.is()); + int nParentRight = xParent->getPosition().X + xParent->getSize().Width; + + uno::Reference<drawing::XShapes> xChildren(xShapeGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChildren.is()); + uno::Reference<text::XText> xChild2Text(xChildren->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChild2Text.is()); + CPPUNIT_ASSERT_EQUAL(OUString("Child 2"), xChild2Text->getString()); + uno::Reference<drawing::XShape> xChild2(xChild2Text, uno::UNO_QUERY); + CPPUNIT_ASSERT(xChild2.is()); + int nChild2Right = xChild2->getPosition().X + xChild2->getSize().Width; + + // Without the accompanying fix in place, this test would have failed with + // 'Expected less than: 100, Actual : 22014', i.e. the second child was + // shifted to the right too much. + CPPUNIT_ASSERT_LESS(100, abs(nChild2Right - nParentRight)); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |