[Libreoffice-commits] core.git: chart2/qa xmloff/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 29 17:03:45 UTC 2020
chart2/qa/extras/chart2export.cxx | 21 ++++++++++++++++++++
chart2/qa/extras/data/docx/testCustomlabeltext.docx |binary
xmloff/source/chart/SchXMLExport.cxx | 2 -
3 files changed, 21 insertions(+), 2 deletions(-)
New commits:
commit ff0f684393b56182e01614d23d4ef836338d3517
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Feb 26 10:26:43 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Sat Feb 29 18:03:11 2020 +0100
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 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 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
Binary files /dev/null and b/chart2/qa/extras/data/docx/testCustomlabeltext.docx differ
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 9c63a13b0217..51f399956ae0 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3317,7 +3317,6 @@ void SchXMLExportHelper_Impl::exportDataPoints(
{
SchXMLDataPointStruct aPoint;
aPoint.mnRepeat = nCurrIndex - nLastIndex - 1;
- aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries);
aDataPointVector.push_back( aPoint );
}
@@ -3367,7 +3366,6 @@ void SchXMLExportHelper_Impl::exportDataPoints(
// if we get here the property states are empty
SchXMLDataPointStruct aPoint;
- aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries);
aDataPointVector.push_back( aPoint );
nLastIndex = nCurrIndex;
More information about the Libreoffice-commits
mailing list