diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2018-12-12 18:09:12 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2018-12-17 15:40:05 +0100 |
commit | 6f2b06a279ecfeeeb7948a6373dd85bc7b4041e3 (patch) | |
tree | 9fa6c604d37efa1c99f2acd0946352eb6bbe9df3 /sd | |
parent | 967f2ac350330a28a3fc2ec0993cbaf976e6cf60 (diff) |
oox smartart, continuous block process: read space width from constraint
The information is needed by the linear layout, but it's provided by a
child algorithm of type "space", with possibly multiple foreach atoms
in-between.
So start supporting a custom space factor by reading it from
constraints, but still assume a fixed layout node name, as it's tricky
to look that up.
Change-Id: I2aa8db8823694618d8ca6707ddcd71715a65b831
Reviewed-on: https://gerrit.libreoffice.org/65049
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
(cherry picked from commit ee6787fc5597b7f730c4ee3a1f2a1b261d0a5644)
Reviewed-on: https://gerrit.libreoffice.org/65253
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-continuous-block-process.pptx | bin | 0 -> 46204 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-continuous-block-process.pptx b/sd/qa/unit/data/pptx/smartart-continuous-block-process.pptx Binary files differnew file mode 100644 index 000000000000..b2ef58f0bbb3 --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-continuous-block-process.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index fe24ff486fa3..bb5b4b3c8e6a 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -46,6 +46,7 @@ public: void testVertialBracketList(); void testTableList(); void testAccentProcess(); + void testContinuousBlockProcess(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -74,6 +75,7 @@ public: CPPUNIT_TEST(testVertialBracketList); CPPUNIT_TEST(testTableList); CPPUNIT_TEST(testAccentProcess); + CPPUNIT_TEST(testContinuousBlockProcess); CPPUNIT_TEST_SUITE_END(); }; @@ -528,6 +530,35 @@ void SdImportTestSmartArt::testAccentProcess() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testContinuousBlockProcess() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-continuous-block-process.pptx"), + PPTX); + uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + // 2 children: background, foreground. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xGroup->getCount()); + + uno::Reference<drawing::XShapes> xLinear(xGroup->getByIndex(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xLinear.is()); + // 3 children: A, B and C. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xLinear->getCount()); + + uno::Reference<text::XText> xA(xLinear->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xA.is()); + CPPUNIT_ASSERT_EQUAL(OUString("A"), xA->getString()); + uno::Reference<drawing::XShape> xAShape(xA, uno::UNO_QUERY); + CPPUNIT_ASSERT(xAShape.is()); + // Without the accompanying fix in place, this test would have failed: the + // theoretically correct value is 5462 mm100 (16933 is the total width, and + // need to divide that to 1, 0.5, 1, 0.5 and 1 units), while the old value + // was 4703 and the new one is 5461. + CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(5000), xAShape->getSize().Width); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |