summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2022-07-20 13:16:04 +0200
committerRegina Henschel <rb.henschel@t-online.de>2022-07-20 20:48:22 +0200
commit2f3b87d18a688b022a18a8b20b69b10cd6af7748 (patch)
treede11c13071091a41ad5cb9a965ef4fc944968e17 /sd
parent92914312cfb36a86ceb6308a2966f033152fd927 (diff)
tdf#149551 Unit tests for insets in SmartArt
This is followup to commit 7e23cbdb. That commit contains for several types of shapes a correction of the position and size of the text area rectangle. That commit fixes bugs tdf#59802, tdf#136234, tdf#118009 and duplicate tdf#142841 were the here tested shape types are involved. Change-Id: I7c8c9676cf3dbdcc3f91fe25d75901b63d0ca4da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137264 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf149551_SmartArt_Gear.pptxbin0 -> 25465 bytes
-rw-r--r--sd/qa/unit/data/pptx/tdf149551_SmartArt_Pie.pptxbin0 -> 26243 bytes
-rw-r--r--sd/qa/unit/data/pptx/tdf149551_SmartArt_Pyramid.pptxbin0 -> 24863 bytes
-rw-r--r--sd/qa/unit/data/pptx/tdf149551_SmartArt_Venn.pptxbin0 -> 26124 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx106
5 files changed, 106 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf149551_SmartArt_Gear.pptx b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Gear.pptx
new file mode 100644
index 000000000000..2b4781972a04
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Gear.pptx
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pie.pptx b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pie.pptx
new file mode 100644
index 000000000000..d7fa44431597
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pie.pptx
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pyramid.pptx b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pyramid.pptx
new file mode 100644
index 000000000000..4e9157e82ac3
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pyramid.pptx
Binary files differ
diff --git a/sd/qa/unit/data/pptx/tdf149551_SmartArt_Venn.pptx b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Venn.pptx
new file mode 100644
index 000000000000..12e033a8b903
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf149551_SmartArt_Venn.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index e41a635dff8b..8c28518c3b70 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -17,6 +17,7 @@
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <svx/svdoashp.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdogrp.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -119,6 +120,10 @@ public:
void testAutofitSync();
void testSnakeRows();
void testCompositeInferRight();
+ void testTdf149551Pie();
+ void testTdf149551Pyramid();
+ void testTdf149551Venn();
+ void testTdf149551Gear();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -174,6 +179,10 @@ public:
CPPUNIT_TEST(testAutofitSync);
CPPUNIT_TEST(testSnakeRows);
CPPUNIT_TEST(testCompositeInferRight);
+ CPPUNIT_TEST(testTdf149551Pie);
+ CPPUNIT_TEST(testTdf149551Pyramid);
+ CPPUNIT_TEST(testTdf149551Venn);
+ CPPUNIT_TEST(testTdf149551Gear);
CPPUNIT_TEST_SUITE_END();
};
@@ -1844,6 +1853,103 @@ void SdImportTestSmartArt::testCompositeInferRight()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testTdf149551Pie()
+{
+ // The file contains a diagram of type "Basic Pie".
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pie.pptx"), PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // shape at index 0 is the background shape
+ uno::Reference<drawing::XShape> xShape = getChildShape(xGroup, 1);
+ CPPUNIT_ASSERT(xShape.is());
+ auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape));
+ CPPUNIT_ASSERT(pCustomShape);
+ tools::Rectangle aTextRect;
+ pCustomShape->TakeTextAnchorRect(aTextRect);
+ // without fix the text area rectangle had LT [7787,3420] and RB[16677,12312]. The values from
+ // txXfrm were ignored.
+ // The used tolerance is estimated.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(12658), sal_Int32(aTextRect.Left()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(5073), sal_Int32(aTextRect.Top()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(15627), sal_Int32(aTextRect.Right()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(7990), sal_Int32(aTextRect.Bottom()), 4);
+
+ xDocShRef->DoClose();
+}
+
+void SdImportTestSmartArt::testTdf149551Pyramid()
+{
+ // The file contains a diagram of type "Basic Pyramid".
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149551_SmartArt_Pyramid.pptx"),
+ PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // shape at index 0 is the background shape
+ uno::Reference<drawing::XShape> xShape = getChildShape(xGroup, 1);
+ CPPUNIT_ASSERT(xShape.is());
+ auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape));
+ CPPUNIT_ASSERT(pCustomShape);
+ tools::Rectangle aTextRect;
+ pCustomShape->TakeTextAnchorRect(aTextRect);
+ // without fix the text area rectangle had LT [9369,2700] and RB[14632,6185]. The values from
+ // txXfrm were ignored.
+ // The used tolerance is estimated.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(7591), sal_Int32(aTextRect.Left()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1515), sal_Int32(aTextRect.Top()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(16410), sal_Int32(aTextRect.Right()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(7370), sal_Int32(aTextRect.Bottom()), 4);
+
+ xDocShRef->DoClose();
+}
+
+void SdImportTestSmartArt::testTdf149551Venn()
+{
+ // The file contains a diagram of type "Stacked Venn".
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149551_SmartArt_Venn.pptx"), PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // shape at index 0 is the background shape
+ uno::Reference<drawing::XShape> xShape = getChildShape(xGroup, 1);
+ CPPUNIT_ASSERT(xShape.is());
+ auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape));
+ CPPUNIT_ASSERT(pCustomShape);
+ tools::Rectangle aTextRect;
+ pCustomShape->TakeTextAnchorRect(aTextRect);
+ // without fix the text area rectangle had LT [6865,3396] and RB[17136,4600]. The values from
+ // txXfrm were ignored.
+ // The used tolerance is estimated.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(8772), sal_Int32(aTextRect.Left()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(1834), sal_Int32(aTextRect.Top()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(15229), sal_Int32(aTextRect.Right()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(6162), sal_Int32(aTextRect.Bottom()), 4);
+
+ xDocShRef->DoClose();
+}
+
+void SdImportTestSmartArt::testTdf149551Gear()
+{
+ // The file contains a diagram of type "Gear".
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149551_SmartArt_Gear.pptx"), PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // shape at index 0 is the background shape
+ uno::Reference<drawing::XShape> xShape = getChildShape(xGroup, 1);
+ CPPUNIT_ASSERT(xShape.is());
+ auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape));
+ CPPUNIT_ASSERT(pCustomShape);
+ tools::Rectangle aTextRect;
+ pCustomShape->TakeTextAnchorRect(aTextRect);
+ // without fix the text area rectangle had LT [4101,1014] and RB[8019,4932]. The values from
+ // txXfrm were ignored.
+ // The used tolerance is estimated.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(5501), sal_Int32(aTextRect.Left()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(4500), sal_Int32(aTextRect.Top()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(11000), sal_Int32(aTextRect.Right()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(9999), sal_Int32(aTextRect.Bottom()), 4);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();