chart2/qa/extras/chart2export.cxx | 20 ++++++++++++++++++++ chart2/qa/extras/data/docx/testCustomlabeltext.docx |binary xmloff/source/chart/SchXMLExport.cxx | 2 -- 3 files changed, 20 insertions(+), 2 deletions(-)
New commits: commit 9fa1b7487cacd93c952c957ab2ab973f5624ca0d Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Wed Feb 26 10:26:43 2020 +0100 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Wed Mar 4 15:20:28 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89818 Tested-by: Jenkins (cherry picked from commit 324b9e04799ba56f4f19535d2775c168b80b907c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89794 diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index a7403e715cc4..7bffcf5352ff 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -137,6 +137,7 @@ public: void testTdf122031(); void testTdf115012(); void testTdf123206_customLabelText(); + void testCustomLabelText(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -237,6 +238,7 @@ public: CPPUNIT_TEST(testTdf122031); CPPUNIT_TEST(testTdf115012); CPPUNIT_TEST(testTdf123206_customLabelText); + CPPUNIT_TEST(testCustomLabelText); CPPUNIT_TEST_SUITE_END(); @@ -2207,6 +2209,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 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 e17d903e3ae8..99b06df7f7fa 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3349,7 +3349,6 @@ void SchXMLExportHelper_Impl::exportDataPoints( { SchXMLDataPointStruct aPoint; aPoint.mnRepeat = nCurrIndex - nLastIndex - 1; - aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries); aDataPointVector.push_back( aPoint ); } @@ -3398,7 +3397,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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits