summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2022-07-21 10:51:47 +0200
committerRegina Henschel <rb.henschel@t-online.de>2022-07-21 12:41:01 +0200
commitc6965c5bcc95430c2a2d01051791d23f2c2f5a5b (patch)
treed8536d6bb5a64ab259e57746ceb8ece2903385cc /sd/qa
parent9426e90c2c339b16487c48cd885a3e4586e1e1f3 (diff)
tdf#145528 add round1Rect to SmartArt text area corrections
Some SmartArt types use text area rectangles different from defaults. The new rectangle is available in element <txXfrm>. This patch adds the needed corrections for type round1Rect. It is four times used in SmartArt 'Titled Matrix' with rotations 0deg, 90deg, 180deg and 270deg. Change-Id: I8c82b446a982ad93026e976b2a47d509b858858d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137287 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/pptx/tdf145528_SmartArt_Matrix.pptxbin0 -> 26693 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx36
2 files changed, 36 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf145528_SmartArt_Matrix.pptx b/sd/qa/unit/data/pptx/tdf145528_SmartArt_Matrix.pptx
new file mode 100644
index 000000000000..b48cc223cf0e
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf145528_SmartArt_Matrix.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 8c28518c3b70..1d2728b5bee4 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -124,6 +124,7 @@ public:
void testTdf149551Pyramid();
void testTdf149551Venn();
void testTdf149551Gear();
+ void testTdf145528Matrix();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -183,6 +184,7 @@ public:
CPPUNIT_TEST(testTdf149551Pyramid);
CPPUNIT_TEST(testTdf149551Venn);
CPPUNIT_TEST(testTdf149551Gear);
+ CPPUNIT_TEST(testTdf145528Matrix);
CPPUNIT_TEST_SUITE_END();
};
@@ -1950,6 +1952,40 @@ void SdImportTestSmartArt::testTdf149551Gear()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testTdf145528Matrix()
+{
+ // The file contains a diagram of type "Titled Matrix". Such is build from shapes of type
+ // 'round1Rect'.
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf145528_SmartArt_Matrix.pptx"), PPTX);
+ uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ // expected values
+ sal_Int32 nLeft[]{ 4001, 12001, 12001, 18501 };
+ sal_Int32 nTop[]{ 9999, 1999, 12499, 5999 };
+ // nWidth = 10292, nHeight = 4499
+ // Without the fix in place the values were
+ // nLeft {2001, 12001, 12001, 22001}
+ // nTop {7999. 1999, 13999, 7999}
+ // nWidth {6000, 10000, 10000, 6000}
+ // nHeight {10000, 6000, 6000, 10000}
+ tools::Rectangle aTextRect;
+ for (auto i : { 1, 2, 3, 4 }) // shape at index 0 is the background shape
+ {
+ uno::Reference<drawing::XShape> xShape = getChildShape(xGroup, i);
+ CPPUNIT_ASSERT(xShape.is());
+ auto pCustomShape
+ = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape));
+ CPPUNIT_ASSERT(pCustomShape);
+ pCustomShape->TakeTextAnchorRect(aTextRect);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(nLeft[i - 1], sal_Int32(aTextRect.Left()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(nTop[i - 1], sal_Int32(aTextRect.Top()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(10293), sal_Int32(aTextRect.GetWidth()), 4);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(4500), sal_Int32(aTextRect.GetHeight()), 4);
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();