summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-07-09 17:30:21 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-07-12 09:32:32 +0200
commitfc476804ce32722b63a27f2f7120b1f28d905fe6 (patch)
tree9b690ccd5ce68ccd9a4442673df99c21dff0c71f /sd/qa
parent0fc020fb73c86a20608e8dff12af607e60327379 (diff)
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@collabora.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx42
1 files changed, 42 insertions, 0 deletions
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);