summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-08-28 14:18:57 +0200
committerLászló Németh <nemeth@numbertext.org>2020-08-31 09:45:16 +0200
commit177b54c2de7626ae42b65441cb81f359407431a1 (patch)
tree93bc7123592f380ca20be94f99a0607d58ac529a /chart2
parente2f4e65a7b8024c00b049eebf0d87637efda7f24 (diff)
tdf#136024 chart2: fix ODF export of custom label positions
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx18
-rw-r--r--chart2/qa/extras/data/ods/tdf136024.odsbin0 -> 15430 bytes
2 files changed, 18 insertions, 0 deletions
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 <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp>
#include <com/sun/star/chart2/DataPointCustomLabelFieldType.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
@@ -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<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ uno::Reference<beans::XPropertySet> 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
--- /dev/null
+++ b/chart2/qa/extras/data/ods/tdf136024.ods
Binary files differ