[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - chart2/qa oox/source

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 18 11:01:13 UTC 2021


 chart2/qa/extras/chart2export.cxx                 |   26 +++++++++++++++++++++-
 chart2/qa/extras/chart2import.cxx                 |    2 -
 chart2/qa/extras/data/xlsx/custom_data_label.xlsx |binary
 oox/source/drawingml/chart/seriesconverter.cxx    |    1 
 4 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit fd46a1f8b0f55d167b087ac88b17060b8f18da7f
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Mon Aug 3 09:12:14 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Feb 18 12:00:32 2021 +0100

    tdf#134977 Chart OOXML: fix import of custom data label
    
    Use the data series properties for the default properties
    of the custom data labels.
    
    Change-Id: I651fa030276dfdec13b5801c0188bfd07c498b49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99987
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit bcda268cde1f8408c2066ce985acedfce3e3bc2e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111132
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 52001159e7e8..a7fbc4a4b21a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -175,6 +175,7 @@ public:
     void testTdf132594();
     void testTdf136267();
     void testTdf134255();
+    void testTdf134977();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(testErrorBarXLSX);
@@ -313,6 +314,7 @@ public:
     CPPUNIT_TEST(testTdf132594);
     CPPUNIT_TEST(testTdf136267);
     CPPUNIT_TEST(testTdf134255);
+    CPPUNIT_TEST(testTdf134977);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2242,7 +2244,7 @@ void Chart2ExportTest::testCustomDataLabel()
     CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
     aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
     aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
-    CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize);
+    CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor);
 
     CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType());
@@ -2860,6 +2862,28 @@ void Chart2ExportTest::testTdf134255()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "wrap", "square");
 }
 
+void Chart2ExportTest::testTdf134977()
+{
+    load("/chart2/qa/extras/data/xlsx/", "custom_data_label.xlsx");
+
+    //import test
+    uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+    CPPUNIT_ASSERT(xChartDoc.is());
+    Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+    CPPUNIT_ASSERT(xDataSeries.is());
+    uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+    uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
+    float nFontSize;
+    xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields;
+    aFields[0]->getPropertyValue("CharHeight") >>= nFontSize;
+    CPPUNIT_ASSERT_EQUAL(static_cast<float>(9), nFontSize);
+
+    //export test
+    xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:r/a:rPr", "sz", "900");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 757d993edf64..e4a805654f28 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -1885,7 +1885,7 @@ void Chart2ImportTest::testTdf115107()
     CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
     aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
     aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
-    CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize);
+    CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize);
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor);
 
     CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType());
diff --git a/chart2/qa/extras/data/xlsx/custom_data_label.xlsx b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx
new file mode 100644
index 000000000000..cc69aaf0dc66
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx differ
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 32ee4fbd2cd7..47e2f643b900 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -322,6 +322,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat
 
                     // Store properties
                     oox::PropertySet aPropertySet( xCustomLabel );
+                    convertTextProperty( aPropertySet, getFormatter(), mrModel.mxText->mxTextBody );
                     pRun->getTextCharacterProperties().pushToPropSet( aPropertySet, getFilter() );
 
                     TextField* pField = nullptr;


More information about the Libreoffice-commits mailing list