[Libreoffice-commits] core.git: chart2/qa xmloff/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 31 07:45:54 UTC 2020
chart2/qa/extras/chart2export.cxx | 18 ++++++++++++++++++
chart2/qa/extras/data/ods/tdf136024.ods |binary
xmloff/source/chart/SchXMLExport.cxx | 1 +
3 files changed, 19 insertions(+)
New commits:
commit 177b54c2de7626ae42b65441cb81f359407431a1
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Aug 28 14:18:57 2020 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon Aug 31 09:45:16 2020 +0200
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 at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
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
Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf136024.ods differ
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 2d65645d26c5..a2c18e494d19 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3315,6 +3315,7 @@ void SchXMLExportHelper_Impl::exportDataPoints(
aPoint.maStyleName = maAutoStyleNameQueue.front();
if(bExportNumFmt)
aPoint.mCustomLabelText = lcl_getCustomLabelField(nElement, xSeries);
+ aPoint.mCustomLabelPos = lcl_getCustomLabelPosition(nElement, xSeries);
maAutoStyleNameQueue.pop();
aDataPointVector.push_back( aPoint );
}
More information about the Libreoffice-commits
mailing list