summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-12-11 20:31:28 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-16 16:11:40 +0100
commit3184cfc493c6931725dce1de19ac958067b1fd25 (patch)
tree26913d99fb8f7368132b24d42027d09d662401f4 /chart2/qa
parentfbe77e5d61ca63a688c12be721e760935d78e780 (diff)
tdf#128621 OOXML Chart: export embedded shapes in chart
Use ShapeExport to export additional shapes (userShapes) in Chart. Change-Id: Ic70a7f84c4ac028b6f09a69bec2cf4949944b16c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107605 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx30
-rw-r--r--chart2/qa/extras/data/xlsx/tdf128621.xlsxbin0 -> 15011 bytes
2 files changed, 30 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index d92e06cdc01c..d0cd3be67d66 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -185,6 +185,7 @@ public:
void testTdf138204();
void testTdf138181();
void testCustomShapeText();
+ void testuserShapesXLSX();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -332,6 +333,7 @@ public:
CPPUNIT_TEST(testTdf138204);
CPPUNIT_TEST(testTdf138181);
CPPUNIT_TEST(testCustomShapeText);
+ CPPUNIT_TEST(testuserShapesXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -3056,6 +3058,34 @@ void Chart2ExportTest::testCustomShapeText()
CPPUNIT_ASSERT(!xRange->getString().isEmpty());
}
+void Chart2ExportTest::testuserShapesXLSX()
+{
+ load("/chart2/qa/extras/data/xlsx/", "tdf128621.xlsx");
+ reload("Calc Office Open XML");
+
+ Reference< chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ // test that the custom shape exists
+ Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
+ Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
+ Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xCustomShape.is());
+ // test type of shape
+ CPPUNIT_ASSERT(xCustomShape->getShapeType().endsWith("CustomShape"));
+ // test custom shape position
+ awt::Point aPosition = xCustomShape->getPosition();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1356, aPosition.X, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(9107, aPosition.Y, 300);
+ // test custom shape size
+ awt::Size aSize = xCustomShape->getSize();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(9520, aSize.Width, 300);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1805, aSize.Height, 300);
+ // test custom shape text
+ Reference< text::XText > xRange(xCustomShape, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(!xRange->getString().isEmpty());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/tdf128621.xlsx b/chart2/qa/extras/data/xlsx/tdf128621.xlsx
new file mode 100644
index 000000000000..93a6822da951
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/tdf128621.xlsx
Binary files differ