From 177b54c2de7626ae42b65441cb81f359407431a1 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Fri, 28 Aug 2020 14:18:57 +0200 Subject: tdf#136024 chart2: fix ODF export of custom label positions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit of pie and donut chart data labels. Follow-up of commit 5339d0800ccdcd325294e61f8ae9e67648beb035 (tdf#130590 Chart OOXML export: fix custom label position). Change-Id: Ic45204a1273e59a47d1376f5f6c250025e3de621 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101543 Tested-by: László Németh Reviewed-by: László Németh --- chart2/qa/extras/chart2export.cxx | 18 ++++++++++++++++++ chart2/qa/extras/data/ods/tdf136024.ods | Bin 0 -> 15430 bytes 2 files changed, 18 insertions(+) create mode 100644 chart2/qa/extras/data/ods/tdf136024.ods (limited to 'chart2') diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 6384ac17f0bc..fddfdc0c2e67 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -2312,6 +2313,23 @@ void Chart2ExportTest::testCustomPositionofDataLabel() double nY = aYVal.toDouble(); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.172648731408574, nY, 1e-7); } + + load("/chart2/qa/extras/data/ods/", "tdf136024.ods"); + { + reload("calc8"); + // tdf#136024: test custom position of pie chart data label after an ods export + Reference xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); + CPPUNIT_ASSERT(xDataSeries.is()); + uno::Reference xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); + + chart2::RelativePosition aCustomLabelPosition; + CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.0961935120945059, 1e-5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.209578842093566, 1e-5); + } } void Chart2ExportTest::testCustomDataLabelMultipleSeries() diff --git a/chart2/qa/extras/data/ods/tdf136024.ods b/chart2/qa/extras/data/ods/tdf136024.ods new file mode 100644 index 000000000000..c8d004f54469 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf136024.ods differ -- cgit