chart2/qa/extras/chart2import2.cxx | 25 +++++++++++++++++++++++++ chart2/qa/extras/data/ods/tdf146463.ods |binary 2 files changed, 25 insertions(+)
New commits: commit 97ca239014e50d26bb2553ebeb96e0bc57e27d2d Author: Xisco Fauli <[email protected]> AuthorDate: Mon Feb 28 12:14:05 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Feb 28 17:45:36 2022 +0100 tdf#146463: chart2_import2: Add unittest Change-Id: I1c8879eaab8cfc3d623a27d7d5d3d8a9cffb003b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130693 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/chart2/qa/extras/chart2import2.cxx b/chart2/qa/extras/chart2import2.cxx index 17b762824f43..e35473717655 100644 --- a/chart2/qa/extras/chart2import2.cxx +++ b/chart2/qa/extras/chart2import2.cxx @@ -55,6 +55,7 @@ public: void testTdf137505(); void testTdf137734(); void testTdf137874(); + void testTdf146463(); void testTdfCustomShapePos(); void testTdf121281(); void testTdf139658(); @@ -95,6 +96,7 @@ public: CPPUNIT_TEST(testTdf137505); CPPUNIT_TEST(testTdf137734); CPPUNIT_TEST(testTdf137874); + CPPUNIT_TEST(testTdf146463); CPPUNIT_TEST(testTdfCustomShapePos); CPPUNIT_TEST(testTdf121281); CPPUNIT_TEST(testTdf139658); @@ -792,6 +794,29 @@ void Chart2ImportTest2::testTdf137874() CPPUNIT_ASSERT(xLegendEntry.is()); } +void Chart2ImportTest2::testTdf146463() +{ + load(u"/chart2/qa/extras/data/ods/", "tdf146463.ods"); + Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent), + UNO_QUERY_THROW); + Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xLegend = getShapeByName(xShapes, "CID/D=0:Legend="); + CPPUNIT_ASSERT(xLegend.is()); + + awt::Size aSize = xLegend->getSize(); + + // Without the fix in place, this test would have failed with + // - Expected: 598 + // - Actual : 7072 + CPPUNIT_ASSERT_DOUBLES_EQUAL(598, aSize.Height, 30); + CPPUNIT_ASSERT_DOUBLES_EQUAL(4256, aSize.Width, 30); + awt::Point aPosition = xLegend->getPosition(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(11534, aPosition.X, 30); + CPPUNIT_ASSERT_DOUBLES_EQUAL(4201, aPosition.Y, 30); +} + void Chart2ImportTest2::testTdfCustomShapePos() { load(u"/chart2/qa/extras/data/docx/", "testcustomshapepos.docx"); diff --git a/chart2/qa/extras/data/ods/tdf146463.ods b/chart2/qa/extras/data/ods/tdf146463.ods new file mode 100644 index 000000000000..6214f4a50075 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf146463.ods differ
