diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-05 18:33:07 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-05 18:33:07 +0200 |
commit | 379c457af064826c5423504d4e460ffd94bdd277 (patch) | |
tree | 65eaf1154490f52ceb1b9164b8d0aacc3ce55085 | |
parent | a9b16d7f593abe5424180356ab7f24214bed2d8c (diff) |
add test for fdo#64722, cp#1000058
Change-Id: Idccff4629b8af84e59d52fb3135e9217d3564cb9
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 24 | ||||
-rw-r--r-- | chart2/qa/extras/charttest.hxx | 25 | ||||
-rw-r--r-- | chart2/qa/extras/data/ods/labelString.ods | bin | 0 -> 17401 bytes |
3 files changed, 49 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 7697bab4cbe7..7c60e88286e3 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -54,6 +54,7 @@ public: void testPieChartRotation(); void testEmbeddingsOleObjectGrabBag(); void testGapWidthXLSX(); + void testLabelStringODS(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(test); @@ -80,6 +81,7 @@ public: CPPUNIT_TEST(testPieChartRotation); CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag); CPPUNIT_TEST(testGapWidthXLSX); + CPPUNIT_TEST(testLabelStringODS); CPPUNIT_TEST_SUITE_END(); protected: @@ -772,6 +774,28 @@ void Chart2ExportTest::testGapWidthXLSX() checkSheetForGapWidthAndOverlap(xChartDoc, 50, 30); } +void Chart2ExportTest::testLabelStringODS() +{ + load("/chart2/qa/extras/data/ods/", "labelString.ods"); + + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent ); + Reference< chart2::data::XDataSequence > xLabelSeq = + getLabelDataSequenceFromDoc(xChartDoc); + CPPUNIT_ASSERT(xLabelSeq.is()); + + OUString aLabelString = xLabelSeq->getSourceRangeRepresentation(); + CPPUNIT_ASSERT_EQUAL(OUString("\"LabelName\""), aLabelString); + + reload("calc8"); + + xChartDoc = getChartDocFromSheet( 0, mxComponent ); + xLabelSeq = getLabelDataSequenceFromDoc(xChartDoc); + CPPUNIT_ASSERT(xLabelSeq.is()); + + aLabelString = xLabelSeq->getSourceRangeRepresentation(); + CPPUNIT_ASSERT_EQUAL(OUString("\"LabelName\""), aLabelString); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index 73b5748ab511..471346cdd30a 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -35,6 +35,8 @@ #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> +#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/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/chart/XChartDocument.hpp> @@ -213,6 +215,29 @@ Reference< chart2::XDataSeries > getDataSeriesFromDoc( uno::Reference< chart2::X return xSeries; } +Reference< chart2::data::XDataSequence > getLabelDataSequenceFromDoc( + Reference< chart2::XChartDocument > xChartDoc, + sal_Int32 nDataSeries = 0, sal_Int32 nChartType = 0, sal_Int32 nCooSys = 0 ) +{ + Reference< chart2::XDataSeries > xDataSeries = + getDataSeriesFromDoc( xChartDoc, nDataSeries, nChartType, nCooSys ); + CPPUNIT_ASSERT(xDataSeries.is()); + Reference< chart2::data::XDataSource > xDataSource( xDataSeries, uno::UNO_QUERY_THROW ); + Sequence< Reference< chart2::data::XLabeledDataSequence > > xDataSequences = + xDataSource->getDataSequences(); + for(sal_Int32 i = 0; i < xDataSequences.getLength(); ++i) + { + Reference< chart2::data::XDataSequence> xLabelSeq = xDataSequences[i]->getLabel(); + if(!xLabelSeq.is()) + continue; + + return xLabelSeq; + } + + CPPUNIT_FAIL("no Label sequence found"); + return Reference< chart2::data::XDataSequence > (); +} + uno::Sequence < OUString > getWriterChartColumnDescriptions( Reference< lang::XComponent > mxComponent ) { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/chart2/qa/extras/data/ods/labelString.ods b/chart2/qa/extras/data/ods/labelString.ods Binary files differnew file mode 100644 index 000000000000..2b7e03c8ebd4 --- /dev/null +++ b/chart2/qa/extras/data/ods/labelString.ods |