diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-10-31 16:38:05 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-11-01 07:36:08 +0100 |
commit | e49c42d17f50c8b0cac9db08dedc375dd5aa8a98 (patch) | |
tree | a4b82795f226dedb243a3151f3db46cd1b765cbf /sd/qa | |
parent | 98718dc375df991afe8136a48b9ec11051f58054 (diff) |
oox smartart, vertical bracket list: fix node counter condition
The visible effect of this was that the 2nd level text nodes were
missing from the layout result.
The cause is that when it comes to counting nodes of a condition, we
assumed that the current layout node is a presentation of a model node,
but this is not necessarily true.
Fix the problem doing a "first presentation child of", then a "presentation
of" navigation in that case, which leads us to the correct model node,
so counting its children works.
(An alternative way of getting non-zero children would be a
"presentation parent of" navigation, followed by a "presentation of"
navigation, but that would lead us to the document root, so we would
count the number of 1st level elements, not the correct 2nd level
elements.)
Change-Id: Iccebe0e2e56b7acb7fbe2c38a7c9ebb2abb309b9
Reviewed-on: https://gerrit.libreoffice.org/62703
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/pptx/vertical-bracket-list.pptx | bin | 0 -> 42124 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 19 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/vertical-bracket-list.pptx b/sd/qa/unit/data/pptx/vertical-bracket-list.pptx Binary files differnew file mode 100644 index 000000000000..bef9d7481dfc --- /dev/null +++ b/sd/qa/unit/data/pptx/vertical-bracket-list.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 3f0d274f2c6a..223b105181d5 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -41,6 +41,7 @@ public: void testSegmentedCycle(); void testBaseRtoL(); void testVertialBoxList(); + void testVertialBracketList(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -66,6 +67,7 @@ public: CPPUNIT_TEST(testSegmentedCycle); CPPUNIT_TEST(testBaseRtoL); CPPUNIT_TEST(testVertialBoxList); + CPPUNIT_TEST(testVertialBracketList); CPPUNIT_TEST_SUITE_END(); }; @@ -397,6 +399,23 @@ void SdImportTestSmartArt::testVertialBoxList() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testVertialBracketList() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/vertical-bracket-list.pptx"), PPTX); + uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xShapeGroup->getCount()); + + uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstChild.is()); + // Without the accompanying fix in place, this test would have failed with + // 'actual: 2', i.e. one child shape (with its "A" text) was missing. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xFirstChild->getCount()); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |