sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx |binary
 sd/qa/unit/import-tests-smartart.cxx                      |   60 ++++++++++++++
 2 files changed, 60 insertions(+)

New commits:
commit 6d7c22092e66b6479ab4542286a0c0690e20b4dd
Author: ekuiitr <jhaekans...@gmail.com>
Date:   Mon Jul 2 11:44:51 2018 +0530

    Unit test for Snake Algorithm
    
    Added unit tests for snake algorithm which tests the position of the
    child nodes in normal from left to right layout and from right to left
    layout.
    
    Change-Id: I25eeb5f8a98e06e748c95b72ffdf9e1a63a4d251
    Reviewed-on: https://gerrit.libreoffice.org/56795
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx 
b/sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx
new file mode 100755
index 000000000000..1a6421b9b265
Binary files /dev/null and 
b/sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index 5c340e99e077..97f304723004 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -39,6 +39,7 @@ public:
     void testBasicRadicals();
     void testEquation();
     void testSegmentedCycle();
+    void testBaseRtoL();
 
     CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
 
@@ -62,6 +63,7 @@ public:
     CPPUNIT_TEST(testBasicRadicals);
     CPPUNIT_TEST(testEquation);
     CPPUNIT_TEST(testSegmentedCycle);
+    CPPUNIT_TEST(testBaseRtoL);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -95,6 +97,19 @@ void SdImportTestSmartArt::testBase()
     xPropSet->getPropertyValue("ParaAdjust") >>= nParaAdjust;
     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast<style::ParagraphAdjust>(nParaAdjust));
 
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(2), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(3), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(4), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y,xShape1->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y,xShape3->getPosition().Y);
+    CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
+    CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y);
+    CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X);
+    CPPUNIT_ASSERT(xShape2->getPosition().X < xShape3->getPosition().X);
+    CPPUNIT_ASSERT((xShape2->getPosition().X <  xShape4->getPosition().X) && 
(xShape3->getPosition().X > xShape4->getPosition().X));
+
     xDocShRef->DoClose();
 }
 
@@ -280,6 +295,51 @@ void SdImportTestSmartArt::testSegmentedCycle()
     //FIXME : so far this only introduce the test document, but the actual 
importer was not fixed yet.
 }
 
+void SdImportTestSmartArt::testBaseRtoL()
+{
+    sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx"),
 PPTX);
+    uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, 
xDocShRef), uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xShapeGroup->getCount());
+
+    uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("a"), xText0->getString());
+    uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("b"), xText1->getString());
+    uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(2), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("c"), xText2->getString());
+    uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(3), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("d"), xText3->getString());
+    uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(4), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("e"), xText4->getString());
+
+    uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+    sal_Int32 nFillColor = 0;
+    xShape->getPropertyValue("FillColor") >>= nFillColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4F81BD), nFillColor);
+
+    sal_Int16 nParaAdjust = 0;
+    uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, 
xShape));
+    uno::Reference<beans::XPropertySet> xPropSet(xParagraph, 
uno::UNO_QUERY_THROW);
+    xPropSet->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast<style::ParagraphAdjust>(nParaAdjust));
+
+    uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(0), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(1), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(2), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(3), 
uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(4), 
uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y,xShape1->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y,xShape3->getPosition().Y);
+    CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
+    CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y);
+    CPPUNIT_ASSERT(xShape0->getPosition().X > xShape1->getPosition().X);
+    CPPUNIT_ASSERT(xShape2->getPosition().X > xShape3->getPosition().X);
+    CPPUNIT_ASSERT((xShape2->getPosition().X >  xShape4->getPosition().X) && 
(xShape3->getPosition().X < xShape4->getPosition().X));
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to