diff options
Diffstat (limited to 'chart2/qa')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 23 | ||||
-rw-r--r-- | chart2/qa/extras/data/docx/bubblechart.docx | bin | 0 -> 17740 bytes |
2 files changed, 23 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 871b41bc5376..e38612724ed0 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -39,6 +39,7 @@ public: void testODTChartSeries(); void testDOCChartSeries(); void testDOCXChartSeries(); + void testDOCXChartValuesSize(); void testPPTXChartSeries(); void testPPTXSparseChartSeries(); /** @@ -105,6 +106,7 @@ public: CPPUNIT_TEST(testODTChartSeries); CPPUNIT_TEST(testDOCChartSeries); CPPUNIT_TEST(testDOCXChartSeries); + CPPUNIT_TEST(testDOCXChartValuesSize); CPPUNIT_TEST(testPPTChartSeries); CPPUNIT_TEST(testPPTXChartSeries); CPPUNIT_TEST(testPPTXSparseChartSeries); @@ -375,6 +377,27 @@ void Chart2ImportTest::testDOCXChartSeries() CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[2][0].get<OUString>()); } +void Chart2ImportTest::testDOCXChartValuesSize() +{ + load( "/chart2/qa/extras/data/docx/", "bubblechart.docx" ); + Reference<chart2::XChartDocument> xChartDoc( getChartDocFromWriter(0), uno::UNO_QUERY ); + CPPUNIT_ASSERT( xChartDoc.is() ); + + uno::Reference< chart::XChartDataArray > xDataArray( xChartDoc->getDataProvider(), UNO_QUERY_THROW ); + Sequence<OUString> aColumnDesc = xDataArray->getColumnDescriptions(); + // Number of columns = 3 (Y-values, X-values and bubble sizes). + // Without the fix there would only be 2 columns (no bubble sizes). + CPPUNIT_ASSERT_EQUAL_MESSAGE( "There must be 3 columns and descriptions", static_cast<sal_Int32>(3), aColumnDesc.getLength() ); + Sequence<Sequence<double>> aData = xDataArray->getData(); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "There must be exactly 3 data points", static_cast<sal_Int32>(3), aData.getLength() ); + + std::vector<std::vector<double>> aExpected = { { 2.7, 0.7, 10.0 }, { 3.2, 1.8, 4.0 }, { 0.8, 2.6, 8.0 } }; + + for ( sal_Int32 nRowIdx = 0; nRowIdx < 3; ++nRowIdx ) + for( sal_Int32 nColIdx = 0; nColIdx < 3; ++nColIdx ) + CPPUNIT_ASSERT_DOUBLES_EQUAL( aExpected[nRowIdx][nColIdx], aData[nRowIdx][nColIdx], 1e-1 ); +} + void Chart2ImportTest::testPPTChartSeries() { //test chart series names for ppt diff --git a/chart2/qa/extras/data/docx/bubblechart.docx b/chart2/qa/extras/data/docx/bubblechart.docx Binary files differnew file mode 100644 index 000000000000..c2040730cfcc --- /dev/null +++ b/chart2/qa/extras/data/docx/bubblechart.docx |