diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-11-26 17:44:24 +0100 |
---|---|---|
committer | Balazs Varga <varga.balazs3@nisz.hu> | 2020-11-30 10:23:29 +0100 |
commit | f1a5bb0b79c212a0459b1a17dd15f1159e663dbd (patch) | |
tree | 1b2935893234a26b1669cc2279e0e7ae416749e0 /chart2/qa/extras | |
parent | 79ec66700266a22966d9e308a716be56c9c3a4a7 (diff) |
tdf#138561 OOXML Chart import: fix custom shape position
and size within charts. Use default page size for custom
shapes, too, like in the case of other shapes (legend, titles,
etc.), until we get the actual size of the embedded chart.
Follow up commit: a01ccdfa5fd5a0260b7aedf955e1e5aa0df072c3
(tdf#138307 Chart import: fix disappeared text from custom shape)
Change-Id: Id6da7322326fbe8dfa570264107db59cc45dff31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106704
Reviewed-by: Balazs Varga <varga.balazs3@nisz.hu>
Tested-by: Balazs Varga <varga.balazs3@nisz.hu>
Diffstat (limited to 'chart2/qa/extras')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 19 | ||||
-rw-r--r-- | chart2/qa/extras/data/docx/testcustomshapepos.docx | bin | 0 -> 26204 bytes |
2 files changed, 19 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index cb8c08c0697e..b94b27f4506a 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -170,6 +170,7 @@ public: void testTdf137505(); void testTdf137734(); void testTdf137874(); + void testTdfCustomShapePos(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -289,6 +290,7 @@ public: CPPUNIT_TEST(testTdf137505); CPPUNIT_TEST(testTdf137734); CPPUNIT_TEST(testTdf137874); + CPPUNIT_TEST(testTdfCustomShapePos); CPPUNIT_TEST_SUITE_END(); @@ -2767,6 +2769,23 @@ void Chart2ImportTest::testTdf137874() CPPUNIT_ASSERT(xLegendEntry.is()); } +void Chart2ImportTest::testTdfCustomShapePos() +{ + load("/chart2/qa/extras/data/docx/", "testcustomshapepos.docx"); + Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), UNO_QUERY_THROW); + Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(0), UNO_QUERY_THROW); + + // test position and size of a custom shape within a chart + awt::Point aPosition = xCustomShape->getPosition(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8845, aPosition.X, 300); + CPPUNIT_ASSERT_DOUBLES_EQUAL(855, aPosition.Y, 300); + awt::Size aSize = xCustomShape->getSize(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(4831, aSize.Width, 300); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1550, aSize.Height, 300); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/docx/testcustomshapepos.docx b/chart2/qa/extras/data/docx/testcustomshapepos.docx Binary files differnew file mode 100644 index 000000000000..31c5284e11b9 --- /dev/null +++ b/chart2/qa/extras/data/docx/testcustomshapepos.docx |