diff options
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 5 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-pyramid-1child.pptx | bin | 0 -> 40059 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 15 |
3 files changed, 19 insertions, 1 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index bfed9676d7c1..6a33148a7993 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1617,7 +1617,10 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& for (auto & aCurrShape : rShape->getChildren()) { aCurrShape->setPosition(aCurrPos); - aCurrPos.X -= aChildSize.Height/(nCount-1); + if (nCount > 1) + { + aCurrPos.X -= aChildSize.Height / (nCount - 1); + } aChildSize.Width += aChildSize.Height; aCurrShape->setSize(aChildSize); aCurrShape->setChildSize(aChildSize); diff --git a/sd/qa/unit/data/pptx/smartart-pyramid-1child.pptx b/sd/qa/unit/data/pptx/smartart-pyramid-1child.pptx Binary files differnew file mode 100644 index 000000000000..42e43c54bbc4 --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-pyramid-1child.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index d558f9c447df..edb8edaed9f2 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -73,6 +73,7 @@ public: void testRotation(); void testTextAutoRotation(); void testPyramid(); + void testPyramidOneChild(); void testChevron(); void testCycle(); void testvenndiagram(); @@ -122,6 +123,7 @@ public: CPPUNIT_TEST(testRotation); CPPUNIT_TEST(testTextAutoRotation); CPPUNIT_TEST(testPyramid); + CPPUNIT_TEST(testPyramidOneChild); CPPUNIT_TEST(testChevron); CPPUNIT_TEST(testCycle); CPPUNIT_TEST(testHierarchy); @@ -425,6 +427,19 @@ void SdImportTestSmartArt::testPyramid() //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet. } +void SdImportTestSmartArt::testPyramidOneChild() +{ + // Load a document with a pyra algorithm in it. + // Without the accompanying fix in place, this test would have crashed. + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/smartart-pyramid-1child.pptx"), PPTX); + uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText(getChildShape(getChildShape(xGroup, 1), 1), + uno::UNO_QUERY); + // Verify that the text of the only child is imported correctly. + CPPUNIT_ASSERT_EQUAL(OUString("A"), xText->getString()); +} + void SdImportTestSmartArt::testChevron() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-chevron.pptx"), PPTX); |