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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sun Mar 15 22:14:23 PDT 2015


 chart2/qa/extras/chart2import.cxx                 |   33 ++++++++++++++++++++++
 chart2/qa/extras/data/xlsx/dispBlanksAs_2007.xlsx |binary
 chart2/qa/extras/data/xlsx/dispBlanksAs_2013.xlsx |binary
 3 files changed, 33 insertions(+)

New commits:
commit 18e557487b2edcd49f012d89f9bcbe8fbcebef2e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 16 06:12:55 2015 +0100

    add test for fixed dispBlanksAs OOXML import
    
    Change-Id: I096e235560c81ef4c55cf14ead3544b977916c20

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 668c09b..686f808 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -19,6 +19,7 @@
 #include <com/sun/star/chart/XChartDataArray.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
 
 #include <com/sun/star/util/Color.hpp>
 
@@ -67,6 +68,8 @@ public:
     // where we fixed the handling of MSO 2007 vs OOXML
     void testAutoTitleDelDefaultValue2007XLSX();
     void testAutoTitleDelDefaultValue2013XLSX();
+    void testDispBlanksAsDefaultValue2007XLSX();
+    void testDispBlanksAsDefaultValue2013XLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ImportTest);
     CPPUNIT_TEST(Fdo60083);
@@ -100,6 +103,8 @@ public:
     CPPUNIT_TEST(testNumberFormatsXLSX);
     CPPUNIT_TEST(testAutoTitleDelDefaultValue2007XLSX);
     CPPUNIT_TEST(testAutoTitleDelDefaultValue2013XLSX);
+    CPPUNIT_TEST(testDispBlanksAsDefaultValue2007XLSX);
+    CPPUNIT_TEST(testDispBlanksAsDefaultValue2013XLSX);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -779,6 +784,34 @@ void Chart2ImportTest::testAutoTitleDelDefaultValue2013XLSX()
             !xTitle.is());
 }
 
+void Chart2ImportTest::testDispBlanksAsDefaultValue2007XLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "dispBlanksAs_2007.xlsx");
+    Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+    CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+    Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY);
+    CPPUNIT_ASSERT(xDiagram.is());
+    uno::Any aAny = xDiagram->getPropertyValue("MissingValueTreatment");
+    sal_Int32 nMissingValueTreatment = -2;
+    CPPUNIT_ASSERT(aAny >>= nMissingValueTreatment);
+    CPPUNIT_ASSERT_EQUAL(chart::MissingValueTreatment::LEAVE_GAP, nMissingValueTreatment);
+}
+
+void Chart2ImportTest::testDispBlanksAsDefaultValue2013XLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "dispBlanksAs_2013.xlsx");
+    Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+    CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+    Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY);
+    CPPUNIT_ASSERT(xDiagram.is());
+    uno::Any aAny = xDiagram->getPropertyValue("MissingValueTreatment");
+    sal_Int32 nMissingValueTreatment = -2;
+    CPPUNIT_ASSERT(aAny >>= nMissingValueTreatment);
+    CPPUNIT_ASSERT_EQUAL(chart::MissingValueTreatment::USE_ZERO, nMissingValueTreatment);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/dispBlanksAs_2007.xlsx b/chart2/qa/extras/data/xlsx/dispBlanksAs_2007.xlsx
new file mode 100644
index 0000000..64e673e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/dispBlanksAs_2007.xlsx differ
diff --git a/chart2/qa/extras/data/xlsx/dispBlanksAs_2013.xlsx b/chart2/qa/extras/data/xlsx/dispBlanksAs_2013.xlsx
new file mode 100644
index 0000000..86a0a35
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/dispBlanksAs_2013.xlsx differ


More information about the Libreoffice-commits mailing list