summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-02-28 12:14:05 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-28 17:45:36 +0100
commit97ca239014e50d26bb2553ebeb96e0bc57e27d2d (patch)
treea6e2bde4722946abc69992d89170bac350a44817
parent7dd7bd7d9ff03fe2038943f5460a95163bec5e04 (diff)
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 <xiscofauli@libreoffice.org>
-rw-r--r--chart2/qa/extras/chart2import2.cxx25
-rw-r--r--chart2/qa/extras/data/ods/tdf146463.odsbin0 -> 21780 bytes
2 files changed, 25 insertions, 0 deletions
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
--- /dev/null
+++ b/chart2/qa/extras/data/ods/tdf146463.ods
Binary files differ