diff options
Diffstat (limited to 'chart2/qa/extras/chart2import.cxx')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 7d0f8f204a6a..bff7e81a521b 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -90,6 +90,8 @@ public: void testSecondaryAxisTitleDefaultRotationXLSX(); void testAxisTitleRotationXLSX(); + void testInternalDataProvider(); + CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); CPPUNIT_TEST(testSteppedLines); @@ -139,6 +141,9 @@ public: CPPUNIT_TEST(testAxisTitleDefaultRotationXLSX); CPPUNIT_TEST(testSecondaryAxisTitleDefaultRotationXLSX); CPPUNIT_TEST(testAxisTitleRotationXLSX); + + CPPUNIT_TEST(testInternalDataProvider); + CPPUNIT_TEST_SUITE_END(); private: @@ -1125,6 +1130,51 @@ void Chart2ImportTest::testAxisTitleRotationXLSX() } +void Chart2ImportTest::testInternalDataProvider() { + uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", "chart.odp"), uno::UNO_QUERY_THROW); + const uno::Reference< chart2::data::XDataProvider >& rxDataProvider = xChartDoc->getDataProvider(); + + // Parse 42 array + Reference<chart2::data::XDataSequence> xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{42;42;42;42}"); + Sequence<Any> xSequence = xDataSeq->getData(); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[0]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[1]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[2]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[3]); + + // Parse empty first and last + xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{\"\";42;42;\"\"}"); + xSequence = xDataSeq->getData(); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[0]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[1]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[2]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[3]); + + // Parse empty middle + xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{42;\"\";\"\";42}"); + xSequence = xDataSeq->getData(); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[0]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[1]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[2]); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[3]); + + // Parse mixed types, numeric only role + xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{42;\"hello\";0;\"world\"}"); + xSequence = xDataSeq->getData(); + CPPUNIT_ASSERT_EQUAL(uno::Any(42), xSequence[0]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[1]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[2]); + CPPUNIT_ASSERT_EQUAL(uno::Any(0), xSequence[3]); + + // Parse mixed types, mixed role + xDataSeq = rxDataProvider->createDataSequenceByValueArray("categories", "{42;\"hello\";0;\"world\"}"); + xSequence = xDataSeq->getData(); + CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("42")), xSequence[0]); + CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("hello")), xSequence[1]); + CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("0")), xSequence[2]); + CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("world")), xSequence[3]); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |