diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-01-30 23:58:57 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-01-31 10:43:22 +0100 |
commit | dff7a46fb46d1fa2a3ad674ee493ae2d59150fe3 (patch) | |
tree | a20c2913d75c8173ed24064c877bb14568359700 /chart2/qa | |
parent | 84b396a235671ea77f1a9fa0d131cb56d7662737 (diff) |
tdf#130032 Chart OOXML Import: fix data label custom position
in case of all chart types except pie chart.
Clean up commit 4223ff2be69f03e571464b0b09ad0d278918631b
(tdf#48436 Chart: add CustomLabelPosition UNO API property).
Note: use the correct default OOXML label placement in case of
radar charts.
Change-Id: I9a8f509304b3c70d879c8c6a95bc91d15ac28521
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87759
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/qa')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 25 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/testTdf130032.xlsx | bin | 0 -> 14208 bytes |
2 files changed, 25 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 47b2e0354d51..054b04209db2 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -153,6 +153,7 @@ public: void testTdf123206CustomLabelField(); void testTdf125444PercentageCustomLabel(); void testDataPointLabelCustomPos(); + void testTdf130032(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -254,6 +255,7 @@ public: CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST(testTdf125444PercentageCustomLabel); CPPUNIT_TEST(testDataPointLabelCustomPos); + CPPUNIT_TEST(testTdf130032); CPPUNIT_TEST_SUITE_END(); @@ -2353,6 +2355,7 @@ void Chart2ImportTest::testTdf125444PercentageCustomLabel() void Chart2ImportTest::testDataPointLabelCustomPos() { + // test CustomLabelPosition on Bar chart load("/chart2/qa/extras/data/xlsx/", "testDataPointLabelCustomPos.xlsx"); uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); CPPUNIT_ASSERT(xChartDoc.is()); @@ -2372,6 +2375,28 @@ void Chart2ImportTest::testDataPointLabelCustomPos() CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::OUTSIDE, aPlacement); } +void Chart2ImportTest::testTdf130032() +{ + // test CustomLabelPosition on Line chart + load("/chart2/qa/extras/data/xlsx/", "testTdf130032.xlsx"); + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); + CPPUNIT_ASSERT(xDataSeries.is()); + + uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(1), uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xPropertySet.is()); + + chart2::RelativePosition aCustomLabelPosition; + xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition; + CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.0438333333333334, 1e-7); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.086794050743657, 1e-7); + + sal_Int32 aPlacement; + xPropertySet->getPropertyValue("LabelPlacement") >>= aPlacement; + CPPUNIT_ASSERT_EQUAL(chart::DataLabelPlacement::RIGHT, aPlacement); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/testTdf130032.xlsx b/chart2/qa/extras/data/xlsx/testTdf130032.xlsx Binary files differnew file mode 100644 index 000000000000..03a3dbf403c3 --- /dev/null +++ b/chart2/qa/extras/data/xlsx/testTdf130032.xlsx |