diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-05 18:33:07 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-04-05 18:35:20 +0200 |
commit | c47bbfce2deea8bda80f06c961be531aee4b23ce (patch) | |
tree | 4eb9562d5bd23589bca1894113d929c9e261cd93 | |
parent | 6052c282400029f550f5e8ec938f1137edcd1e96 (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 ead4350c9110..fa1c90ce7cd4 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -55,6 +55,7 @@ public: void testEmbeddingsOleObjectGrabBag(); void testGapWidthXLSX(); void testSmoothedLines(); + void testLabelStringODS(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(test); @@ -82,6 +83,7 @@ public: CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag); CPPUNIT_TEST(testGapWidthXLSX); CPPUNIT_TEST(testSmoothedLines); + CPPUNIT_TEST(testLabelStringODS); CPPUNIT_TEST_SUITE_END(); protected: @@ -782,6 +784,28 @@ void Chart2ExportTest::testSmoothedLines() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:smooth", "val", "0"); } +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 |