summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-10 19:46:37 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-06-10 19:48:16 -0400
commit81d2c208a4e6f9df87e2ee70c6e6da146742178a (patch)
treea2e6b205753e67a8056ab9ae9a19177c44512869 /chart2/qa
parentad2cc2323fb887c438031d863ab16df7afd49fb8 (diff)
New unit test for Draw document with chart. Disabled due to weird crash.
No idea why it crashes whatsoever.... Change-Id: Ic46d5a98f21cacb03adb3bc0d6da239bde5d8ce2
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2export.cxx46
-rw-r--r--chart2/qa/extras/charttest.hxx33
-rw-r--r--chart2/qa/extras/data/odg/scatter-plot-labels.odgbin0 -> 12861 bytes
3 files changed, 79 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 4443b06f4680..297950b837e2 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -50,6 +50,7 @@ public:
void testShapeFollowedByChart();
void testPieChartDataLabels();
void testSeriesIdxOrder();
+ void testScatterPlotLabels();
void testErrorBarDataRangeODS();
void testChartCrash();
void testPieChartRotation();
@@ -82,6 +83,7 @@ public:
CPPUNIT_TEST(testShapeFollowedByChart);
CPPUNIT_TEST(testPieChartDataLabels);
CPPUNIT_TEST(testSeriesIdxOrder);
+// CPPUNIT_TEST(testScatterPlotLabels); TODO : This test crashes for some unknown reason.
CPPUNIT_TEST(testErrorBarDataRangeODS);
CPPUNIT_TEST(testChartCrash);
CPPUNIT_TEST(testPieChartRotation);
@@ -712,6 +714,50 @@ void Chart2ExportTest::testSeriesIdxOrder()
assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:order[1]", "val", "1");
}
+void Chart2ExportTest::testScatterPlotLabels()
+{
+ load("/chart2/qa/extras/data/odg/", "scatter-plot-labels.odg");
+ Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
+ CPPUNIT_ASSERT(xCT.is());
+
+ OUString aLabelRole = xCT->getRoleOfSequenceForSeriesLabel();
+
+ fprintf(stdout, "Chart2ExportTest::testScatterPlotLabels: label role = '%s\n",
+ rtl::OUStringToOString(aLabelRole, RTL_TEXTENCODING_UTF8).getStr());
+
+ Reference<chart2::XDataSeriesContainer> xDSCont(xCT, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDSCont.is());
+ Sequence<uno::Reference<chart2::XDataSeries> > aDataSeriesSeq = xDSCont->getDataSeries();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aDataSeriesSeq.getLength());
+
+ for (sal_Int32 i = 0; i < aDataSeriesSeq.getLength(); ++i)
+ {
+ uno::Reference<chart2::data::XDataSource> xDSrc(aDataSeriesSeq[i], uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDSrc.is());
+ uno::Sequence<Reference<chart2::data::XLabeledDataSequence> > aDataSeqs = xDSrc->getDataSequences();
+ for (sal_Int32 j = 0; j < aDataSeqs.getLength(); ++j)
+ {
+ Reference<chart2::data::XDataSequence> xValues = aDataSeqs[j]->getValues();
+ CPPUNIT_ASSERT(xValues.is());
+ Reference<beans::XPropertySet> xPropSet(xValues, uno::UNO_QUERY);
+ if (!xPropSet.is())
+ continue;
+
+ OUString aRoleName;
+ xPropSet->getPropertyValue("Role") >>= aRoleName;
+ if (aRoleName == aLabelRole)
+ {
+ // TODO : Check the data series labels.
+ }
+ }
+ }
+
+ CPPUNIT_ASSERT(false);
+}
+
void Chart2ExportTest::testErrorBarDataRangeODS()
{
load("/chart2/qa/extras/data/ods/", "ErrorBarRange.ods");
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 3121b6c6a055..6a52df0f9187 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -65,6 +65,8 @@ public:
uno::Reference< chart::XChartDocument > getChartDocFromImpress( const char* pDir, const char* pName );
+ uno::Reference<chart::XChartDocument> getChartDocFromDrawImpress( sal_Int32 nPage, sal_Int32 nShape );
+
virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE;
@@ -92,6 +94,10 @@ void ChartTest::load( const OUString& aDir, const OUString& aName )
{
maServiceName = "com.sun.star.text.TextDocument";
}
+ else if (extension == "odg")
+ {
+ maServiceName = "com.sun.star.drawing.DrawingDocument";
+ }
mxComponent = loadFromDesktop(getURLFromSrc(aDir) + aName, maServiceName);
CPPUNIT_ASSERT(mxComponent.is());
@@ -304,6 +310,33 @@ uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const
return xChartDoc;
}
+uno::Reference<chart::XChartDocument> ChartTest::getChartDocFromDrawImpress(
+ sal_Int32 nPage, sal_Int32 nShape )
+{
+ uno::Reference<chart::XChartDocument> xEmpty;
+
+ uno::Reference<drawing::XDrawPagesSupplier> xPages(mxComponent, uno::UNO_QUERY);
+ if (!xPages.is())
+ return xEmpty;
+
+ uno::Reference<drawing::XDrawPage> xPage(
+ xPages->getDrawPages()->getByIndex(nPage), uno::UNO_QUERY_THROW);
+ if (!xPage.is())
+ return xEmpty;
+
+ uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(nShape), uno::UNO_QUERY);
+ if (!xShapeProps.is())
+ return xEmpty;
+
+ uno::Reference<frame::XModel> xDocModel;
+ xShapeProps->getPropertyValue("Model") >>= xDocModel;
+ if (!xDocModel.is())
+ return xEmpty;
+
+ uno::Reference<chart::XChartDocument> xChartDoc(xDocModel, uno::UNO_QUERY);
+ return xChartDoc;
+}
+
uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const char* pDir, const char* pName )
{
uno::Reference< chart::XChartDocument > xChartDoc = getChartDocFromImpress( pDir, pName );
diff --git a/chart2/qa/extras/data/odg/scatter-plot-labels.odg b/chart2/qa/extras/data/odg/scatter-plot-labels.odg
new file mode 100644
index 000000000000..af0dfee11384
--- /dev/null
+++ b/chart2/qa/extras/data/odg/scatter-plot-labels.odg
Binary files differ