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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 18 14:59:01 UTC 2018


 chart2/qa/extras/chart2import.cxx                   |   31 ++++++++++++++++++++
 chart2/qa/extras/data/xlsx/deleted_data_labels.xlsx |binary
 2 files changed, 31 insertions(+)

New commits:
commit 8b83659bb8f3368a1df949d5bc84d7b2dd0370b4
Author:     Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sun Nov 18 05:13:51 2018 +0100
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Sun Nov 18 15:58:39 2018 +0100

    tdf#102186, add test for deleted data labels
    
    Change-Id: Ie4849b62f96cf6829aa845997bbc9647d94f4dbb
    Reviewed-on: https://gerrit.libreoffice.org/63514
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index c85bcc67c06a..661d0d801b87 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -115,6 +115,7 @@ public:
     void testTdf121205();
 
     void testTdf114179();
+    void testDeletedDataLabel();
 
     CPPUNIT_TEST_SUITE(Chart2ImportTest);
     CPPUNIT_TEST(Fdo60083);
@@ -184,6 +185,7 @@ public:
     CPPUNIT_TEST(testTdf121205);
 
     CPPUNIT_TEST(testTdf114179);
+    CPPUNIT_TEST(testDeletedDataLabel);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1638,6 +1640,35 @@ void Chart2ImportTest::testTdf114179()
     CPPUNIT_ASSERT( aSize.Height > 0);
 }
 
+namespace {
+
+void checkDataLabelProperties(const Reference<chart2::XDataSeries>& xDataSeries, sal_Int32 nDataPointIndex, bool bValueVisible)
+{
+    uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(nDataPointIndex), uno::UNO_QUERY_THROW);
+    chart2::DataPointLabel aLabel;
+    xPropertySet->getPropertyValue("Label") >>= aLabel;
+    CPPUNIT_ASSERT_EQUAL(bValueVisible, static_cast<bool>(aLabel.ShowNumber));
+    CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(aLabel.ShowNumberInPercent));
+}
+
+}
+
+void Chart2ImportTest::testDeletedDataLabel()
+{
+    load("/chart2/qa/extras/data/xlsx/", "deleted_data_labels.xlsx");
+    uno::Reference< chart2::XChartDocument > xChartDoc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW );
+    Reference<chart2::XDataSeries> xDataSeries0 = getDataSeriesFromDoc(xChartDoc, 0);
+    CPPUNIT_ASSERT(xDataSeries0.is());
+    checkDataLabelProperties(xDataSeries0, 0, true);
+    checkDataLabelProperties(xDataSeries0, 1, false);
+    checkDataLabelProperties(xDataSeries0, 2, true);
+    Reference<chart2::XDataSeries> xDataSeries1 = getDataSeriesFromDoc(xChartDoc, 1);
+    CPPUNIT_ASSERT(xDataSeries1.is());
+    checkDataLabelProperties(xDataSeries1, 0, false);
+    checkDataLabelProperties(xDataSeries1, 1, false);
+    checkDataLabelProperties(xDataSeries1, 2, false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/deleted_data_labels.xlsx b/chart2/qa/extras/data/xlsx/deleted_data_labels.xlsx
new file mode 100644
index 000000000000..587c956082d5
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/deleted_data_labels.xlsx differ


More information about the Libreoffice-commits mailing list