[Libreoffice-commits] core.git: chart2/qa oox/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 30 08:10:41 UTC 2019


 chart2/qa/extras/chart2export.cxx         |   16 +++++++++++++++-
 chart2/qa/extras/data/xlsx/tdf122915.xlsx |binary
 oox/source/export/chartexport.cxx         |    2 +-
 3 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 2eac095e2a672db180dc816350c1585a65245c7c
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Mon Jan 28 10:09:51 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Jan 30 09:10:17 2019 +0100

    tdf#122915 Chart OOXML: Export individual data label prop
    
    Export the xLabelPropSet instead of the xPropset and the
    individual data label formatting will not be disappeared.
    
    Change-Id: Ic8c64543ad1e8b40d6d6a5cb7a9a244923e028f1
    Reviewed-on: https://gerrit.libreoffice.org/66995
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index e01ce9381ef9..dc36c3ad3c29 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -82,6 +82,7 @@ public:
     void testDataLabelDoughnutChartDOCX();
     void testDataLabelAreaChartDOCX();
     void testDataLabelDefaultLineChartDOCX();
+    void testIndividualDataLabelProps();
     void testChartTitlePropertiesColorFillDOCX();
     void testChartTitlePropertiesGradientFillDOCX();
     void testChartTitlePropertiesBitmapFillDOCX();
@@ -170,6 +171,7 @@ public:
     CPPUNIT_TEST(testDataLabelDoughnutChartDOCX);
     CPPUNIT_TEST(testDataLabelAreaChartDOCX);
     CPPUNIT_TEST(testDataLabelDefaultLineChartDOCX);
+    CPPUNIT_TEST(testIndividualDataLabelProps);
     CPPUNIT_TEST(testChartTitlePropertiesColorFillDOCX);
     CPPUNIT_TEST(testChartTitlePropertiesGradientFillDOCX);
     CPPUNIT_TEST(testChartTitlePropertiesBitmapFillDOCX);
@@ -1094,6 +1096,17 @@ void Chart2ExportTest::testDataLabelDefaultLineChartDOCX()
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Line chart's default label placement should be 'right'.", chart::DataLabelPlacement::RIGHT, nLabelPlacement );
 }
 
+void Chart2ExportTest::testIndividualDataLabelProps()
+{
+    load("/chart2/qa/extras/data/xlsx/", "tdf122915.xlsx");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr", "b", "1");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr", "sz", "1600");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "ff0000");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[3]/c:dLbls/c:dLbl/c:txPr/a:p/a:pPr/a:defRPr/a:latin", "typeface", "Times New Roman");
+}
+
 void Chart2ExportTest::testChartTitlePropertiesColorFillDOCX()
 {
     load("/chart2/qa/extras/data/docx/", "testChartTitlePropertiesColorFill.docx");
@@ -1736,7 +1749,8 @@ void Chart2ExportTest::testCustomDataLabel()
     load("/chart2/qa/extras/data/pptx/", "tdf115107.pptx");
     xmlDocPtr pXmlDoc = parseExport("ppt/charts/chart1", "Impress MS PowerPoint 2007 XML");
     CPPUNIT_ASSERT(pXmlDoc);
-    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl[1]/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "404040");
+    // Check the data labels font color for the complete data series
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:txPr/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr", "val", "404040");
 
     Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xChartDoc.is());
diff --git a/chart2/qa/extras/data/xlsx/tdf122915.xlsx b/chart2/qa/extras/data/xlsx/tdf122915.xlsx
new file mode 100755
index 000000000000..ff20e04baf22
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf122915.xlsx differ
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 5e09117183f0..cd344de5ab21 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3247,7 +3247,7 @@ void ChartExport::exportDataLabels(
         }
 
         // Individual label property that overwrites the baseline.
-        exportTextProps( xPropSet );
+        exportTextProps( xLabelPropSet );
         writeLabelProperties(pFS, this, xLabelPropSet, aParam);
         pFS->endElement(FSNS(XML_c, XML_dLbl));
     }


More information about the Libreoffice-commits mailing list