Kaydet (Commit) 0bdbd099 authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Markus Mohrhard

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/40258Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst f7c4e8cb
...@@ -39,6 +39,7 @@ public: ...@@ -39,6 +39,7 @@ public:
void testODTChartSeries(); void testODTChartSeries();
void testDOCChartSeries(); void testDOCChartSeries();
void testDOCXChartSeries(); void testDOCXChartSeries();
void testDOCXChartValuesSize();
void testPPTXChartSeries(); void testPPTXChartSeries();
void testPPTXSparseChartSeries(); void testPPTXSparseChartSeries();
/** /**
...@@ -105,6 +106,7 @@ public: ...@@ -105,6 +106,7 @@ public:
CPPUNIT_TEST(testODTChartSeries); CPPUNIT_TEST(testODTChartSeries);
CPPUNIT_TEST(testDOCChartSeries); CPPUNIT_TEST(testDOCChartSeries);
CPPUNIT_TEST(testDOCXChartSeries); CPPUNIT_TEST(testDOCXChartSeries);
CPPUNIT_TEST(testDOCXChartValuesSize);
CPPUNIT_TEST(testPPTChartSeries); CPPUNIT_TEST(testPPTChartSeries);
CPPUNIT_TEST(testPPTXChartSeries); CPPUNIT_TEST(testPPTXChartSeries);
CPPUNIT_TEST(testPPTXSparseChartSeries); CPPUNIT_TEST(testPPTXSparseChartSeries);
...@@ -375,6 +377,27 @@ void Chart2ImportTest::testDOCXChartSeries() ...@@ -375,6 +377,27 @@ void Chart2ImportTest::testDOCXChartSeries()
CPPUNIT_ASSERT_EQUAL(OUString("Series 3"), aLabels[2][0].get<OUString>()); 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() void Chart2ImportTest::testPPTChartSeries()
{ {
//test chart series names for ppt //test chart series names for ppt
......
...@@ -566,7 +566,7 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co ...@@ -566,7 +566,7 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co
} }
if (rRole == "values-y" || rRole == "values-first" || rRole == "values-last" || if (rRole == "values-y" || rRole == "values-first" || rRole == "values-last" ||
rRole == "values-min" || rRole == "values-max") rRole == "values-min" || rRole == "values-max" || rRole == "values-size")
{ {
// Column values. Append a new data column and populate it. // Column values. Append a new data column and populate it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment