[Libreoffice-commits] core.git: chart2/qa

Markus Mohrhard markus.mohrhard at collabora.co.uk
Wed Apr 16 17:47:30 PDT 2014


 chart2/qa/extras/chart2import.cxx |   13 +++++++++++++
 chart2/qa/extras/charttest.hxx    |   27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

New commits:
commit 326f8dc37bc11591e7d683b21085da7ee15b8072
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Apr 17 02:42:15 2014 +0200

    add test case for fdo#70609
    
    Change-Id: I85ddd43f5c8e88c6f6bf19284b0822f8bbea1d44

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index bdebe51..4d7f4b0 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -35,6 +35,7 @@ public:
     void testODPChartSeries();
     void testBnc864396();
     void testSimpleStrictXLSX();
+    void testDelayedCellImport(); // chart range referencing content on later sheets
 
     CPPUNIT_TEST_SUITE(Chart2ImportTest);
     CPPUNIT_TEST(Fdo60083);
@@ -57,6 +58,7 @@ public:
     CPPUNIT_TEST(testODPChartSeries);
     CPPUNIT_TEST(testBnc864396);
     CPPUNIT_TEST(testSimpleStrictXLSX);
+    CPPUNIT_TEST(testDelayedCellImport);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -311,6 +313,17 @@ void Chart2ImportTest::testSimpleStrictXLSX()
 
 }
 
+void Chart2ImportTest::testDelayedCellImport()
+{
+    load("/chart2/qa/extras/data/xlsx/", "fdo70609.xlsx");
+    uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
+    Reference< chart2::data::XDataSequence > xDataSeq =
+        getDataSequenceFromDocByRole(xChartDoc, "values-x");
+
+    OUString aRange = xDataSeq->getSourceRangeRepresentation();
+    CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$C$5:$C$9"), aRange);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 471346c..b3a0d31 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -238,6 +238,33 @@ Reference< chart2::data::XDataSequence > getLabelDataSequenceFromDoc(
     return Reference< chart2::data::XDataSequence > ();
 }
 
+Reference< chart2::data::XDataSequence > getDataSequenceFromDocByRole(
+        Reference< chart2::XChartDocument > xChartDoc, const OUString& rRole,
+        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]->getValues();
+        uno::Reference< beans::XPropertySet > xProps(xLabelSeq, uno::UNO_QUERY);
+        if(!xProps.is())
+            continue;
+
+        OUString aRoleName = xProps->getPropertyValue("Role").get<OUString>();
+
+        if(aRoleName == rRole)
+            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);


More information about the Libreoffice-commits mailing list