add test for fdo#64722, cp#1000058
Change-Id: Idccff4629b8af84e59d52fb3135e9217d3564cb9
This commit is contained in:
parent
6052c28240
commit
c47bbfce2d
3 changed files with 49 additions and 0 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
BIN
chart2/qa/extras/data/ods/labelString.ods
Normal file
BIN
chart2/qa/extras/data/ods/labelString.ods
Normal file
Binary file not shown.
Loading…
Reference in a new issue