[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - chart2/qa xmloff/source

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 2 13:36:38 UTC 2020


 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 324b9e04799ba56f4f19535d2775c168b80b907c
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Feb 26 10:26:43 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Mar 2 14:36:06 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>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89818
    Tested-by: Jenkins

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
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 e277b73758b7..202ecf970fd3 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3293,7 +3293,6 @@ void SchXMLExportHelper_Impl::exportDataPoints(
             {
                 SchXMLDataPointStruct aPoint;
                 aPoint.mnRepeat = nCurrIndex - nLastIndex - 1;
-                aPoint.mCustomLabelText = lcl_getCustomLabelField(nCurrIndex, xSeries);
                 aDataPointVector.push_back( aPoint );
             }
 
@@ -3342,7 +3341,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