summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-07-20 13:15:57 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-07-23 21:21:59 +0200
commit0bdbd099bb52ae687196e06561e03c5c4d9c90eb (patch)
treea2f0eb990b9d7a4bec8d1649f23c10fd2d3708ed /chart2/qa
parentf7c4e8cbf840193acb7c188163f51c8a3a14e083 (diff)
tdf#103984 : For bubble charts append data column...
for "values-size" role too, after parsing in InternalDataProvider::createDataSequenceFromArray(). Without this, embedded bubble charts in documents(MSO) other than spreadsheets will be empty when imported. Also adds docx import chart2-unit-test in chart2import.cxx Change-Id: I63168074b30090a8b7cf977eb5af443f6b9ac240 Reviewed-on: https://gerrit.libreoffice.org/40258 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2import.cxx23
-rw-r--r--chart2/qa/extras/data/docx/bubblechart.docxbin0 -> 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
new file mode 100644
index 000000000000..c2040730cfcc
--- /dev/null
+++ b/chart2/qa/extras/data/docx/bubblechart.docx
Binary files differ