summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-03 08:01:55 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-02-08 07:52:27 +0100
commitb99f310d3b24dc45e3d84751e810c0bbff1d991b (patch)
tree6780680407253b0b9f7599843313730309b84368 /chart2/qa
parent48a8901a205000e9878c7ee5b4fb26e07ea0a607 (diff)
tdf#94235 Add support for series name in data series labels
including ODF/OOXML import/export (and test) Change-Id: Id5a5194630a67476f7c5390294400a00ea3ad42d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110338 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx34
-rw-r--r--chart2/qa/extras/data/ods/ser_labels.odsbin0 -> 29539 bytes
-rw-r--r--chart2/qa/extras/data/xlsx/ser_labels.xlsxbin0 -> 18412 bytes
3 files changed, 34 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index a702d5113b13..c8b4c03755e7 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -140,6 +140,7 @@ public:
void testAxisCrossBetweenDOCX();
void testPieChartDataPointExplosionXLSX();
void testCustomDataLabel();
+ void testDataSeriesName();
void testCustomPositionofDataLabel();
void testCustomDataLabelMultipleSeries();
void testLeaderLines();
@@ -288,6 +289,7 @@ public:
CPPUNIT_TEST(testAxisCrossBetweenDOCX);
CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
CPPUNIT_TEST(testCustomDataLabel);
+ CPPUNIT_TEST(testDataSeriesName);
CPPUNIT_TEST(testCustomPositionofDataLabel);
CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
CPPUNIT_TEST(testLeaderLines);
@@ -2310,6 +2312,38 @@ void Chart2ExportTest::testCustomDataLabel()
CPPUNIT_ASSERT_EQUAL(OUString(" <CELLREF"), aFields[1]->getString());
}
+/// Test for tdf#94235
+void Chart2ExportTest::testDataSeriesName()
+{
+ // ODF
+ {
+ load(u"/chart2/qa/extras/data/ods/", "ser_labels.ods");
+ reload("calc8");
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ chart2::DataPointLabel aDataPointLabel;
+ xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+ xPropertySet->getPropertyValue("Label") >>= aDataPointLabel;
+ CPPUNIT_ASSERT_EQUAL(sal_True, aDataPointLabel.ShowSeriesName);
+ }
+
+ // OOXML
+ {
+ load(u"/chart2/qa/extras/data/xlsx/", "ser_labels.xlsx");
+ reload("Calc Office Open XML");
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ chart2::DataPointLabel aDataPointLabel;
+ xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+ xPropertySet->getPropertyValue("Label") >>= aDataPointLabel;
+ CPPUNIT_ASSERT_EQUAL(sal_True, aDataPointLabel.ShowSeriesName);
+ }
+}
+
void Chart2ExportTest::testCustomPositionofDataLabel()
{
load(u"/chart2/qa/extras/data/xlsx/", "testCustomPosDataLabels.xlsx");
diff --git a/chart2/qa/extras/data/ods/ser_labels.ods b/chart2/qa/extras/data/ods/ser_labels.ods
new file mode 100644
index 000000000000..c7bd96638268
--- /dev/null
+++ b/chart2/qa/extras/data/ods/ser_labels.ods
Binary files differ
diff --git a/chart2/qa/extras/data/xlsx/ser_labels.xlsx b/chart2/qa/extras/data/xlsx/ser_labels.xlsx
new file mode 100644
index 000000000000..ba2315666eda
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/ser_labels.xlsx
Binary files differ