summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-02-26 10:26:43 +0100
committerLászló Németh <nemeth@numbertext.org>2020-02-29 18:03:11 +0100
commitff0f684393b56182e01614d23d4ef836338d3517 (patch)
treea06f831733f94ff3afe2858e7c2970106680077c /chart2
parent294babdbbe0a10c732cd5247c5636638c97a4c30 (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>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2export.cxx21
-rw-r--r--chart2/qa/extras/data/docx/testCustomlabeltext.docxbin0 -> 26031 bytes
2 files changed, 21 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 90b20d363b80..46c3e186d912 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -154,6 +154,7 @@ public:
void testTdf122031();
void testTdf115012();
void testTdf123206_customLabelText();
+ void testCustomLabelText();
void testDeletedLegendEntries();
void testTdf130225();
void testTdf126076();
@@ -274,6 +275,7 @@ public:
CPPUNIT_TEST(testTdf122031);
CPPUNIT_TEST(testTdf115012);
CPPUNIT_TEST(testTdf123206_customLabelText);
+ CPPUNIT_TEST(testCustomLabelText);
CPPUNIT_TEST(testDeletedLegendEntries);
CPPUNIT_TEST(testTdf130225);
CPPUNIT_TEST(testTdf126076);
@@ -2484,6 +2486,25 @@ 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");
+}
+
void Chart2ExportTest::testDeletedLegendEntries()
{
load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx");
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