summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-06-26 10:42:28 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-07-01 12:04:14 +0200
commit5cdf0c71ae8bc9f1e4a52e6e4e2ea6d8550f1edd (patch)
treedccb27164e950b538916b2f4eef15bcf5db8acd2 /sd/qa
parent9fbedb7929936a45967ae49bc15b985f95e2ebd3 (diff)
SmartArt: all visitors follow data presentation nodes
* visitors now are keeping track of current presentation node instead of looking it up by name * extracted visitor base class that follows if/else and for-each nodes * moved condition logic from ConditionAtom to visitor, as it depends on visitor state Change-Id: Iede86cd74a6098f2398a77b6cb3e9c6272dbfe4b Reviewed-on: https://gerrit.libreoffice.org/74732 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/pptx/smartart-data-follow.pptxbin0 -> 56896 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx40
2 files changed, 40 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-data-follow.pptx b/sd/qa/unit/data/pptx/smartart-data-follow.pptx
new file mode 100644
index 000000000000..7e906462d012
--- /dev/null
+++ b/sd/qa/unit/data/pptx/smartart-data-follow.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 944e583df040..fde35bd0a48d 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -80,6 +80,7 @@ public:
void testVerticalBlockList();
void testBulletList();
void testRecursion();
+ void testDataFollow();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -121,6 +122,7 @@ public:
CPPUNIT_TEST(testVerticalBlockList);
CPPUNIT_TEST(testBulletList);
CPPUNIT_TEST(testRecursion);
+ CPPUNIT_TEST(testDataFollow);
CPPUNIT_TEST_SUITE_END();
};
@@ -1316,6 +1318,44 @@ void SdImportTestSmartArt::testRecursion()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testDataFollow()
+{
+ // checks if data nodes are followed correctly
+ // different variables are set for two presentation points with the same name
+ // they should be layouted differently - one horizontally and one vertically
+
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-data-follow.pptx"), PPTX);
+
+ uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+
+ uno::Reference<drawing::XShapes> xGroupLeft(xGroup->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xGroupB(xGroupLeft->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeB1(getChildShape(getChildShape(getChildShape(xGroupB, 1), 0), 0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextB1(xShapeB1, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("B1"), xTextB1->getString());
+ uno::Reference<drawing::XShape> xShapeB2(getChildShape(getChildShape(getChildShape(xGroupB, 3), 0), 0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextB2(xShapeB2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("B2"), xTextB2->getString());
+
+ CPPUNIT_ASSERT_EQUAL(xShapeB1->getPosition().Y, xShapeB2->getPosition().Y);
+ CPPUNIT_ASSERT_GREATEREQUAL(xShapeB1->getPosition().X + xShapeB1->getSize().Width, xShapeB2->getPosition().X);
+
+ uno::Reference<drawing::XShapes> xGroupRight(xGroup->getByIndex(2), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xGroupC(xGroupRight->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeC1(getChildShape(getChildShape(getChildShape(xGroupC, 3), 0), 0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextC1(xShapeC1, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("C1"), xTextC1->getString());
+ uno::Reference<drawing::XShape> xShapeC2(getChildShape(getChildShape(getChildShape(xGroupC, 5), 0), 0), uno::UNO_QUERY);
+ uno::Reference<text::XText> xTextC2(xShapeC2, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("C2"), xTextC2->getString());
+
+ CPPUNIT_ASSERT_EQUAL(xShapeC1->getPosition().X, xShapeC2->getPosition().X);
+ CPPUNIT_ASSERT_GREATEREQUAL(xShapeC1->getPosition().Y + xShapeC1->getSize().Height, xShapeC2->getPosition().Y);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();