[Libreoffice-commits] core.git: sd/qa

Hossein (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 12 07:33:10 UTC 2021


 sd/qa/unit/import-tests-smartart.cxx |   42 +++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

New commits:
commit fc476804ce32722b63a27f2f7120b1f28d905fe6
Author:     Hossein <hossein at libreoffice.org>
AuthorDate: Fri Jul 9 17:30:21 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jul 12 09:32:32 2021 +0200

    tdf#117761 Adding extra checks for SmartArt import (Snake Algorithm)
    
    * Improved tests for tdf#117761 (Snake Algorithm)
    * Added extra checks for proper arrangement of shapes in:
      * SdImportTestSmartArt::testBase()
        * File (LTR): sd/qa/unit/data/pptx/smartart1.pptx
      * SdImportTestSmartArt::testBaseRtoL()
        * File (RTL): sd/qa/unit/data/pptx/smartart-rightoleftblockdiagram.pptx
    * To run test:
      make CPPUNIT_TEST_NAME="testBaseRtoL" -sr CppunitTest_sd_import_tests_smartart
    
    Change-Id: I72510d1d22bbaf1e9aa036d85354a71bdba4c685
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118325
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 17aa03e16cd7..68555d365cae 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -211,8 +211,29 @@ void SdImportTestSmartArt::testBase()
     uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
     uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
+
+    /*
+     *  Arrangement
+     *     (LTR)
+     *  ╭─────────╮
+     *  │  0   1  │
+     *  │  2   3  │
+     *  │    4    │
+     *  ╰─────────╯
+     */
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y, xShape1->getPosition().Y);
     CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y, xShape3->getPosition().Y);
+
+    CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().X, xShape2->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(xShape1->getPosition().X, xShape3->getPosition().X);
+
+    CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y - xShape0->getPosition().Y,
+                         xShape4->getPosition().Y - xShape2->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape1->getPosition().X - xShape0->getPosition().X,
+                         xShape3->getPosition().X - xShape2->getPosition().X);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(xShape2->getPosition().X + xShape3->getPosition().X,
+                                 2 * xShape4->getPosition().X, 1);
+
     CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
     CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y);
     CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X);
@@ -630,8 +651,29 @@ void SdImportTestSmartArt::testBaseRtoL()
     uno::Reference<drawing::XShape> xShape2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
     uno::Reference<drawing::XShape> xShape3(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
     uno::Reference<drawing::XShape> xShape4(xShapeGroup->getByIndex(5), uno::UNO_QUERY_THROW);
+
+    /*
+     *  Arrangement
+     *     (RTL)
+     *  ╭─────────╮
+     *  │  1   0  │
+     *  │  3   2  │
+     *  │    4    │
+     *  ╰─────────╯
+     */
     CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y, xShape1->getPosition().Y);
     CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y, xShape3->getPosition().Y);
+
+    CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().X, xShape2->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(xShape1->getPosition().X, xShape3->getPosition().X);
+
+    CPPUNIT_ASSERT_EQUAL(xShape2->getPosition().Y - xShape0->getPosition().Y,
+                         xShape4->getPosition().Y - xShape2->getPosition().Y);
+    CPPUNIT_ASSERT_EQUAL(xShape1->getPosition().X - xShape0->getPosition().X,
+                         xShape3->getPosition().X - xShape2->getPosition().X);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(xShape2->getPosition().X + xShape3->getPosition().X,
+                                 2 * xShape4->getPosition().X, 1);
+
     CPPUNIT_ASSERT(xShape2->getPosition().Y > xShape0->getPosition().Y);
     CPPUNIT_ASSERT(xShape4->getPosition().Y > xShape2->getPosition().Y);
     CPPUNIT_ASSERT(xShape0->getPosition().X > xShape1->getPosition().X);


More information about the Libreoffice-commits mailing list