summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-03 11:47:22 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-07-03 11:50:13 -0400
commitd53a9dc1cc64d00b38884168b2003a7da29773e3 (patch)
tree36f40a996f2b46059c184ecc4aa9e6870743021c /chart2/qa
parent4cf0e29ccf5191b7ba4ed84750108e5361bcde38 (diff)
bnc#812796: Write test for this.
Right now, we skip hidden data series when importing OOXML charts into our internal data table. This of course means that if/when we add support for hidden columns in the internal data table, we may want to change this. Change-Id: Ida1b77821fbc2f8f937244576b52521b59d6ab89
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2import.cxx39
-rw-r--r--chart2/qa/extras/charttest.hxx1
-rwxr-xr-xchart2/qa/extras/data/pptx/stacked-bar-chart-hidden-series.pptxbin0 -> 54370 bytes
3 files changed, 40 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 41a9a2f61ed0..d83e8c270de6 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -34,6 +34,12 @@ public:
void testDOCChartSeries();
void testDOCXChartSeries();
void testPPTXChartSeries();
+ /**
+ * Original data contains 3 series but 2 of them are hidden. For now, we
+ * detect and skip those hidden series on import (since we don't support
+ * hidden columns for internal data table yet).
+ */
+ void testPPTXHiddenDataSeries();
void testPPTChartSeries();
void testODPChartSeries();
void testBnc864396();
@@ -62,6 +68,7 @@ public:
*/
CPPUNIT_TEST(testPPTChartSeries);
CPPUNIT_TEST(testPPTXChartSeries);
+ CPPUNIT_TEST(testPPTXHiddenDataSeries);
CPPUNIT_TEST(testODPChartSeries);
CPPUNIT_TEST(testBnc864396);
CPPUNIT_TEST(testSimpleStrictXLSX);
@@ -324,6 +331,38 @@ void Chart2ImportTest::testPPTXChartSeries()
CPPUNIT_ASSERT_EQUAL(OUString("Column 3"), aLabels[2][0].get<OUString>());
}
+void Chart2ImportTest::testPPTXHiddenDataSeries()
+{
+ load("/chart2/qa/extras/data/pptx/", "stacked-bar-chart-hidden-series.pptx");
+ Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
+ CPPUNIT_ASSERT(xCT.is());
+
+ // There should be only one data series present.
+ std::vector<uno::Sequence<uno::Any> > aLabels = getDataSeriesLabelsFromChartType(xCT);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aLabels.size());
+ CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[0][0].get<OUString>());
+
+ // Test the internal data.
+ CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
+
+ Reference<chart2::XInternalDataProvider> xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xInternalProvider.is());
+
+ Reference<chart::XComplexDescriptionAccess> xDescAccess(xInternalProvider, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDescAccess.is());
+
+ // Get the category labels.
+ Sequence<Sequence<OUString> > aCategories = xDescAccess->getComplexRowDescriptions();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCategories.getLength());
+ CPPUNIT_ASSERT_EQUAL(OUString("Category 1"), aCategories[0][0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("Category 2"), aCategories[1][0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("Category 3"), aCategories[2][0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("Category 4"), aCategories[3][0]);
+}
+
void Chart2ImportTest::testODPChartSeries()
{
//test chart series names for odp
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 9728454289f7..4ac6db3f730e 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -44,6 +44,7 @@
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
diff --git a/chart2/qa/extras/data/pptx/stacked-bar-chart-hidden-series.pptx b/chart2/qa/extras/data/pptx/stacked-bar-chart-hidden-series.pptx
new file mode 100755
index 000000000000..20ba89a0b7d6
--- /dev/null
+++ b/chart2/qa/extras/data/pptx/stacked-bar-chart-hidden-series.pptx
Binary files differ