summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-02-26 10:26:43 +0100
committerXisco Faulí <xiscofauli@libreoffice.org>2020-03-02 14:36:06 +0100
commit324b9e04799ba56f4f19535d2775c168b80b907c (patch)
treef518664140218e7ad16f8dc400b51554ae31115f /chart2
parentd630cec38cfbb986aaa8f70af17d350754ff1ec5 (diff)
tdf#130955 chart export: fix repeated custom labels
Do not add mCustomLabelText to aDataPointVector when we write leading empty data points, it is enough to add them, when we write data-point with style. Note: this fixes also DOCX import, when the embedded charts are imported by using ODF export in the background. Regression from commit: 7d2c7e7af04d9604d86d2d605ef95b9abb10966c (tdf#123206 Store custom label as chart:data-label) Change-Id: Ib3b370236323a57ac6800035d71321f7ee5dbe41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89504 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89818 Tested-by: Jenkins
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx20
-rw-r--r--chart2/qa/extras/data/docx/testCustomlabeltext.docxbin0 -> 26031 bytes
2 files changed, 20 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 1645c1c1d1ae..6eb00cbc6799 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -150,6 +150,7 @@ public:
void testTdf122031();
void testTdf115012();
void testTdf123206_customLabelText();
+ void testCustomLabelText();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -263,6 +264,7 @@ public:
CPPUNIT_TEST(testTdf122031);
CPPUNIT_TEST(testTdf115012);
CPPUNIT_TEST(testTdf123206_customLabelText);
+ CPPUNIT_TEST(testCustomLabelText);
CPPUNIT_TEST_SUITE_END();
@@ -2402,6 +2404,24 @@ void Chart2ExportTest::testTdf123206_customLabelText()
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t", "kiscica");
}
+void Chart2ExportTest::testCustomLabelText()
+{
+ load("/chart2/qa/extras/data/docx/", "testCustomlabeltext.docx");
+
+ Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ xmlDocPtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:idx", "val", "2");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/c:rich/a:p/a:r[1]/a:t", "3.5");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:tx/c:rich/a:p/a:r[3]/a:t", "CustomLabel 1");
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:idx", "val", "3");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r[1]/a:t", "4.5");
+ assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r[3]/a:t", "CustomLabel 2");
+}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testCustomlabeltext.docx b/chart2/qa/extras/data/docx/testCustomlabeltext.docx
new file mode 100644
index 000000000000..db28209c9c20
--- /dev/null
+++ b/chart2/qa/extras/data/docx/testCustomlabeltext.docx
Binary files differ