add test for fdo#64722, cp#1000058
Change-Id: Idccff4629b8af84e59d52fb3135e9217d3564cb9
This commit is contained in:
committed by
Markus Mohrhard
parent
6052c28240
commit
c47bbfce2d
@@ -55,6 +55,7 @@ public:
|
|||||||
void testEmbeddingsOleObjectGrabBag();
|
void testEmbeddingsOleObjectGrabBag();
|
||||||
void testGapWidthXLSX();
|
void testGapWidthXLSX();
|
||||||
void testSmoothedLines();
|
void testSmoothedLines();
|
||||||
|
void testLabelStringODS();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(Chart2ExportTest);
|
CPPUNIT_TEST_SUITE(Chart2ExportTest);
|
||||||
CPPUNIT_TEST(test);
|
CPPUNIT_TEST(test);
|
||||||
@@ -82,6 +83,7 @@ public:
|
|||||||
CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag);
|
CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag);
|
||||||
CPPUNIT_TEST(testGapWidthXLSX);
|
CPPUNIT_TEST(testGapWidthXLSX);
|
||||||
CPPUNIT_TEST(testSmoothedLines);
|
CPPUNIT_TEST(testSmoothedLines);
|
||||||
|
CPPUNIT_TEST(testLabelStringODS);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
protected:
|
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");
|
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_TEST_SUITE_REGISTRATION(Chart2ExportTest);
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@@ -35,6 +35,8 @@
|
|||||||
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
|
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
|
||||||
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
|
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
|
||||||
#include <com/sun/star/chart2/XDataSeriesContainer.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/chart/XChartDataArray.hpp>
|
||||||
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
|
||||||
#include <com/sun/star/chart/XChartDocument.hpp>
|
#include <com/sun/star/chart/XChartDocument.hpp>
|
||||||
@@ -213,6 +215,29 @@ Reference< chart2::XDataSeries > getDataSeriesFromDoc( uno::Reference< chart2::X
|
|||||||
return xSeries;
|
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::Sequence < OUString > getWriterChartColumnDescriptions( Reference< lang::XComponent > mxComponent )
|
||||||
{
|
{
|
||||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
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.
Reference in New Issue
Block a user