summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-02-10 14:22:11 +0100
committerLászló Németh <nemeth@numbertext.org>2020-02-17 17:58:40 +0100
commit5339d0800ccdcd325294e61f8ae9e67648beb035 (patch)
treed61a9f4c877acde76f727e17a3b23ce565618bc3 /chart2
parent2658b0e5ffdff795d910f373feb5c55ad01b7d09 (diff)
tdf#130590 Chart OOXML export: fix custom label position
in case of all chart types except pie chart. Follow-up of commit 4223ff2be69f03e571464b0b09ad0d278918631b (tdf#48436 Chart: add CustomLabelPosition UNO API property) Change-Id: I3ff1ca13928315f27988ae27c462a2f05354bc49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88371 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.cxx19
-rw-r--r--chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsxbin0 -> 14332 bytes
2 files changed, 19 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 1ff1064046e1..b9d5873052ba 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -134,6 +134,7 @@ public:
void testAxisCrossBetweenXSLX();
void testPieChartDataPointExplosionXLSX();
void testCustomDataLabel();
+ void testCustomPositionofDataLabel();
void testCustomDataLabelMultipleSeries();
void testNumberFormatExportPPTX();
void testLabelSeparatorExportDOCX();
@@ -251,6 +252,7 @@ public:
CPPUNIT_TEST(testAxisCrossBetweenXSLX);
CPPUNIT_TEST(testPieChartDataPointExplosionXLSX);
CPPUNIT_TEST(testCustomDataLabel);
+ CPPUNIT_TEST(testCustomPositionofDataLabel);
CPPUNIT_TEST(testCustomDataLabelMultipleSeries);
CPPUNIT_TEST(testNumberFormatExportPPTX);
CPPUNIT_TEST(testLabelSeparatorExportDOCX);
@@ -2170,6 +2172,23 @@ void Chart2ExportTest::testCustomDataLabel()
CPPUNIT_ASSERT_EQUAL(OUString(" <CELLREF"), aFields[1]->getString());
}
+void Chart2ExportTest::testCustomPositionofDataLabel()
+{
+ load("/chart2/qa/extras/data/xlsx/", "testCustomPosDataLabels.xlsx");
+ xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // test custom position of data label
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "2");
+ OUString aXVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:layout/c:manualLayout/c:x", "val");
+ double nX = aXVal.toDouble();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.11027682973075476, nX, 1e-7);
+
+ OUString aYVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser/c:dLbls/c:dLbl[1]/c:layout/c:manualLayout/c:y", "val");
+ double nY = aYVal.toDouble();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0742140311063737, nY, 1e-7);
+}
+
void Chart2ExportTest::testCustomDataLabelMultipleSeries()
{
load("/chart2/qa/extras/data/pptx/", "tdf115107-2.pptx");
diff --git a/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx b/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx
new file mode 100644
index 000000000000..caa08956cd27
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/testCustomPosDataLabels.xlsx
Binary files differ