summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-06-11 08:31:18 +0200
committerGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-06-18 16:10:50 +0200
commit76478f9938a5f6d96ac65b3b633280024b60baed (patch)
treec9bb6beb396a19cd2e3005cc97b946be724e9e2b /sd/qa
parent27e3ed0d25735603d2c82744e3a8f5f3e0a8d043 (diff)
SmartArt: support ForEach references
ForEach 'ref' parameter causes specified ForEach node to be used instead. Used to create recursive structures like organisation charts. Change-Id: Iee61b2e103759355b59beb8d3f33eb3cce47c590 Reviewed-on: https://gerrit.libreoffice.org/74271 Tested-by: Jenkins Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/pptx/smartart-recursion.pptxbin0 -> 52943 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx42
2 files changed, 42 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-recursion.pptx b/sd/qa/unit/data/pptx/smartart-recursion.pptx
new file mode 100644
index 000000000000..205db6b703de
--- /dev/null
+++ b/sd/qa/unit/data/pptx/smartart-recursion.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 775411c57bba..944e583df040 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -79,6 +79,7 @@ public:
void testFontSize();
void testVerticalBlockList();
void testBulletList();
+ void testRecursion();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -119,6 +120,7 @@ public:
CPPUNIT_TEST(testFontSize);
CPPUNIT_TEST(testVerticalBlockList);
CPPUNIT_TEST(testBulletList);
+ CPPUNIT_TEST(testRecursion);
CPPUNIT_TEST_SUITE_END();
};
@@ -1273,6 +1275,46 @@ void SdImportTestSmartArt::testBulletList()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testRecursion()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-recursion.pptx"), PPTX);
+
+ uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xGroup1(xGroup->getByIndex(1), uno::UNO_QUERY);
+
+ uno::Reference<drawing::XShapes> xGroupA(xGroup1->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextA(xGroupA->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("A"), xTextA->getString());
+
+ uno::Reference<drawing::XShapes> xGroupB(xGroup1->getByIndex(1), uno::UNO_QUERY);
+ // 5 connectors, B1 with children, B2 with children
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(7), xGroupB->getCount());
+
+ uno::Reference<drawing::XShapes> xGroupB1(xGroupB->getByIndex(1), uno::UNO_QUERY);
+
+ uno::Reference<drawing::XShapes> xGroupB1a(xGroupB1->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextB1(xGroupB1a->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("B1"), xTextB1->getString());
+
+ uno::Reference<drawing::XShape> xGroupC12(xGroupB1->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextC1(getChildShape(getChildShape(getChildShape(xGroupC12, 0), 0), 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("C1"), xTextC1->getString());
+ uno::Reference<text::XText> xTextC2(getChildShape(getChildShape(getChildShape(xGroupC12, 1), 0), 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("C2"), xTextC2->getString());
+
+ uno::Reference<drawing::XShapes> xGroupB2(xGroupB->getByIndex(5), uno::UNO_QUERY);
+
+ uno::Reference<drawing::XShapes> xGroupB2a(xGroupB2->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextB2(xGroupB2a->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("B2"), xTextB2->getString());
+
+ uno::Reference<drawing::XShape> xGroupC3(xGroupB2->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextC3(getChildShape(getChildShape(getChildShape(xGroupC3, 0), 0), 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("C3"), xTextC3->getString());
+
+ xDocShRef->DoClose();
+}
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);