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

Kohei Yoshida kohei.yoshida at collabora.com
Tue Jun 10 16:48:06 PDT 2014


 chart2/CppunitTest_chart2_export.mk               |   16 ++++++-
 chart2/qa/extras/chart2export.cxx                 |   46 ++++++++++++++++++++++
 chart2/qa/extras/charttest.hxx                    |   33 +++++++++++++++
 chart2/qa/extras/data/odg/scatter-plot-labels.odg |binary
 4 files changed, 93 insertions(+), 2 deletions(-)

New commits:
commit 81d2c208a4e6f9df87e2ee70c6e6da146742178a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Jun 10 19:46:37 2014 -0400

    New unit test for Draw document with chart.  Disabled due to weird crash.
    
    No idea why it crashes whatsoever....
    
    Change-Id: Ic46d5a98f21cacb03adb3bc0d6da239bde5d8ce2

diff --git a/chart2/CppunitTest_chart2_export.mk b/chart2/CppunitTest_chart2_export.mk
index b2bf0a0..c6bf682 100644
--- a/chart2/CppunitTest_chart2_export.mk
+++ b/chart2/CppunitTest_chart2_export.mk
@@ -13,7 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,chart2_export))
 
 $(eval $(call gb_CppunitTest_use_externals,chart2_export, \
 	boost_headers \
-    libxml2 \
+	libxml2 \
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,chart2_export, \
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,chart2_export, \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,chart2_export, \
+    $(call gb_Helper_optional,AVMEDIA,avmedia) \
     basegfx \
     comphelper \
     cppu \
@@ -31,12 +32,15 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_export, \
     forui \
     i18nlangtag \
     msfilter \
+    vcl \
     oox \
     sal \
     salhelper \
     sax \
     sb \
     sc \
+    sw \
+    sd \
     sfx \
     sot \
     svl \
@@ -50,7 +54,6 @@ $(eval $(call gb_CppunitTest_use_libraries,chart2_export, \
     unotest \
     utl \
     vbahelper \
-    vcl \
     xo \
     sw \
     $(gb_UWINAPI) \
@@ -70,15 +73,20 @@ $(eval $(call gb_CppunitTest_use_vcl,chart2_export))
 
 $(eval $(call gb_CppunitTest_use_components,chart2_export,\
     basic/util/sb \
+    animations/source/animcore/animcore \
     chart2/source/controller/chartcontroller \
     chart2/source/chartcore \
     comphelper/util/comphelp \
     configmgr/source/configmgr \
+    dtrans/util/mcnttype \
     dbaccess/util/dba \
     embeddedobj/util/embobj \
     eventattacher/source/evtatt \
     filter/source/config/cache/filterconfig1 \
+    filter/source/odfflatxml/odfflatxml \
     filter/source/storagefilterdetect/storagefd \
+    filter/source/xmlfilteradaptor/xmlfa \
+    filter/source/xmlfilterdetect/xmlfd \
     forms/util/frm \
     framework/util/fwk \
     i18npool/util/i18npool \
@@ -93,6 +101,9 @@ $(eval $(call gb_CppunitTest_use_components,chart2_export,\
     sw/util/sw \
     sw/util/swd \
     sw/util/msword \
+    sd/util/sd \
+    sd/util/sdfilt \
+    sd/util/sdd \
     $(if $(filter TRUE,$(DISABLE_SCRIPTING)),, \
 	    sc/util/vbaobj) \
     scaddins/source/analysis/analysis \
@@ -115,6 +126,7 @@ $(eval $(call gb_CppunitTest_use_components,chart2_export,\
     unoxml/source/service/unoxml \
     writerfilter/util/writerfilter \
     xmloff/util/xo \
+    xmlscript/util/xmlscript \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,chart2_export))
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 4443b06..297950b 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 3121b6c..6a52df0 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 0000000..af0dfee
Binary files /dev/null and b/chart2/qa/extras/data/odg/scatter-plot-labels.odg differ


More information about the Libreoffice-commits mailing list