[Libreoffice-commits] core.git: 2 commits - chart2/CppunitTest_chart2_importtest.mk chart2/Module_chart2.mk chart2/qa offapi/com

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Mar 5 02:15:56 PST 2013


 chart2/CppunitTest_chart2_importtest.mk         |  139 +++++++++++++++++++
 chart2/Module_chart2.mk                         |    4 
 chart2/qa/extras/chart2import.cxx               |  172 ++++++++++++++++++++++++
 chart2/qa/extras/data/ods/error_bar_simple.ods  |binary
 offapi/com/sun/star/chart2/CoordinateSystem.idl |    2 
 5 files changed, 316 insertions(+), 1 deletion(-)

New commits:
commit 7cd6f8f7ad868d2c69bd528d21aa0d8190299270
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Mar 5 11:11:44 2013 +0100

    start for an initial chart2 import test
    
    Change-Id: Iedd531186fccd73704eb3137195a22d3ca005293

diff --git a/chart2/CppunitTest_chart2_importtest.mk b/chart2/CppunitTest_chart2_importtest.mk
new file mode 100644
index 0000000..c15973a
--- /dev/null
+++ b/chart2/CppunitTest_chart2_importtest.mk
@@ -0,0 +1,139 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+#       Markus Mohrhard <markus.mohrhard at googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,chart2_import))
+
+$(eval $(call gb_CppunitTest_use_external,chart2_import,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,chart2_import, \
+    chart2/qa/extras/chart2import \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,chart2_import, \
+    avmedia \
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    drawinglayer \
+    editeng \
+    fileacc \
+    for \
+    forui \
+    i18nisolang1 \
+    msfilter \
+    oox \
+    sal \
+    salhelper \
+    sax \
+    sb \
+    sc \
+    sfx \
+    sot \
+    svl \
+    svt \
+    svx \
+    svxcore \
+    test \
+    tl \
+    tk \
+    ucbhelper \
+    unotest \
+    utl \
+    vbahelper \
+    vcl \
+    xo \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,chart2_import,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,chart2_import,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,chart2_import))
+
+$(eval $(call gb_CppunitTest_use_components,chart2_import,\
+    basic/util/sb \
+    chart2/source/controller/chartcontroller \
+    chart2/source/chartcore \
+    comphelper/util/comphelp \
+    configmgr/source/configmgr \
+    dbaccess/util/dba \
+    embeddedobj/util/embobj \
+    eventattacher/source/evtatt \
+    fileaccess/source/fileacc \
+    filter/source/config/cache/filterconfig1 \
+    forms/util/frm \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    linguistic/source/lng \
+    oox/util/oox \
+    package/source/xstor/xstor \
+    package/util/package2 \
+    sax/source/expatwrap/expwrap \
+    sax/source/fastparser/fastsax \
+    sc/util/sc \
+    sc/util/scd \
+    sc/util/scfilt \
+    $(if $(filter TRUE,$(DISABLE_SCRIPTING)),, \
+	    sc/util/vbaobj) \
+    scaddins/source/analysis/analysis \
+    scaddins/source/datefunc/date \
+    scripting/source/basprov/basprov \
+    scripting/util/scriptframe \
+    sfx2/util/sfx \
+    sot/util/sot \
+    svl/source/fsstor/fsstorage \
+    svl/util/svl \
+    svx/util/svx \
+    toolkit/util/tk \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+    ucb/source/ucp/tdoc/ucptdoc1 \
+    unotools/util/utl \
+    unoxml/source/rdf/unordf \
+    unoxml/source/service/unoxml \
+    xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,chart2_import))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,chart2_import))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,chart2_import))
+
+# vim: set noet sw=4 ts=4:
diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk
index 19a7dbc..fc6eb1d 100644
--- a/chart2/Module_chart2.mk
+++ b/chart2/Module_chart2.mk
@@ -35,6 +35,10 @@ $(eval $(call gb_Module_add_targets,chart2,\
     Package_uiconfig \
 ))
 
+$(eval $(call gb_Module_add_slowcheck_targets,chart2,\
+    CppunitTest_chart2_importtest \
+))
+
 $(eval $(call gb_Module_add_subsequentcheck_targets,chart2,\
     JunitTest_chart2_unoapi \
 ))
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
new file mode 100644
index 0000000..1a6db5b
--- /dev/null
+++ b/chart2/qa/extras/chart2import.cxx
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/table/XTableChartsSupplier.hpp>
+#include <com/sun/star/table/XTableCharts.hpp>
+#include <com/sun/star/table/XTableChart.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+class Chart2ImportTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+public:
+    void Fdo60083();
+
+    virtual void setUp();
+    virtual void tearDown();
+
+    CPPUNIT_TEST_SUITE(Chart2ImportTest);
+    CPPUNIT_TEST(Fdo60083);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    void load( const char* pDir, const char* pName );
+
+    Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent );
+    Reference< chart2::XDataSeries > getDataSeriesFromDoc( Reference< chart2::XChartDocument > xChartDoc,
+            sal_Int32 nDataSeries, sal_Int32 nChartType = 0, sal_Int32 nCooSys = 0 );
+
+    Reference< lang::XComponent > mxComponent;
+};
+
+// error bar import
+// split method up into smaller chunks for more detailed tests
+void Chart2ImportTest::Fdo60083()
+{
+    load("/chart2/qa/extras/data/ods/", "error_bar_simple.ods");
+    uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent );
+    CPPUNIT_ASSERT(xChartDoc.is());
+
+    Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc( xChartDoc, 0 );
+    CPPUNIT_ASSERT( xDataSeries.is() );
+
+    Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
+    CPPUNIT_ASSERT( xPropSet.is() );
+
+    // test that y error bars are there
+    Reference< beans::XPropertySet > xErrorBarYProps;
+    xPropSet->getPropertyValue("ErrorBarY") >>= xErrorBarYProps;
+    CPPUNIT_ASSERT(xErrorBarYProps.is());
+
+    // test that x error bars are not imported
+    Reference< beans::XPropertySet > xErrorBarXProps;
+    xPropSet->getPropertyValue("ErrorBarX") >>= xErrorBarXProps;
+    CPPUNIT_ASSERT(!xErrorBarXProps.is());
+}
+
+Reference< chart2::XChartDocument > Chart2ImportTest::getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > xComponent )
+{
+    // let us assume that we only have one chart per sheet
+
+    uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xDoc.is());
+
+    uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xIA.is());
+
+    uno::Reference< table::XTableChartsSupplier > xChartSupplier( xIA->getByIndex(nSheet), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xChartSupplier.is());
+
+    uno::Reference< table::XTableCharts > xCharts = xChartSupplier->getCharts();
+    CPPUNIT_ASSERT(xCharts.is());
+
+    uno::Reference< container::XIndexAccess > xIACharts(xCharts, UNO_QUERY_THROW);
+    uno::Reference< table::XTableChart > xChart( xIACharts->getByIndex(0), UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xChart.is());
+
+    uno::Reference< document::XEmbeddedObjectSupplier > xEmbObjectSupplier(xChart, UNO_QUERY_THROW);
+    CPPUNIT_ASSERT(xEmbObjectSupplier.is());
+
+    uno::Reference< lang::XComponent > xChartComp( xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW );
+    CPPUNIT_ASSERT(xChartComp.is());
+
+    uno::Reference< chart2::XChartDocument > xChartDoc ( xChartComp, UNO_QUERY_THROW );
+
+    CPPUNIT_ASSERT(xChartDoc.is());
+    return xChartDoc;
+}
+
+Reference< chart2::XDataSeries > Chart2ImportTest::getDataSeriesFromDoc( uno::Reference< chart2::XChartDocument > xChartDoc,
+                                                                sal_Int32 nDataSeries, sal_Int32 nChartType, sal_Int32 nCooSys )
+{
+    CPPUNIT_ASSERT( xChartDoc.is() );
+
+    Reference <chart2::XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+    CPPUNIT_ASSERT( xDiagram.is() );
+
+    Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
+    CPPUNIT_ASSERT( xCooSysContainer.is() );
+
+    Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
+    CPPUNIT_ASSERT( xCooSysSequence.getLength() > nCooSys );
+
+    Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[nCooSys], UNO_QUERY_THROW );
+    CPPUNIT_ASSERT( xChartTypeContainer.is() );
+
+    Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
+    CPPUNIT_ASSERT( xChartTypeSequence.getLength() > nChartType );
+
+    Reference< chart2::XDataSeriesContainer > xDataSequenceContainer( xChartTypeSequence[nChartType], UNO_QUERY_THROW );
+    CPPUNIT_ASSERT ( xDataSequenceContainer.is() );
+
+    Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSequenceContainer->getDataSeries() );
+    CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
+
+    Reference< chart2::XDataSeries > xSeries = xSeriesSequence[nDataSeries];
+
+    return xSeries;
+}
+
+void Chart2ImportTest::load( const char* pDir, const char* pName )
+{
+    mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
+    CPPUNIT_ASSERT(mxComponent.is());
+}
+
+void Chart2ImportTest::setUp()
+{
+    test::BootstrapFixture::setUp();
+
+    mxDesktop.set( com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
+}
+
+void Chart2ImportTest::tearDown()
+{
+    if(mxComponent.is())
+        mxComponent->dispose();
+
+    test::BootstrapFixture::tearDown();
+
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/data/ods/error_bar_simple.ods b/chart2/qa/extras/data/ods/error_bar_simple.ods
new file mode 100644
index 0000000..1cf0df7
Binary files /dev/null and b/chart2/qa/extras/data/ods/error_bar_simple.ods differ
commit b6d79264399cbb11f0c030ce18e486914a5515df
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Mar 5 11:01:54 2013 +0100

    fix typo in API documentation
    
    Change-Id: Ia466bf9d9dfeae04ba5dede377a2fad79405da82

diff --git a/offapi/com/sun/star/chart2/CoordinateSystem.idl b/offapi/com/sun/star/chart2/CoordinateSystem.idl
index e264476..4d0d7cd 100644
--- a/offapi/com/sun/star/chart2/CoordinateSystem.idl
+++ b/offapi/com/sun/star/chart2/CoordinateSystem.idl
@@ -40,7 +40,7 @@ service CoordinateSystem
      */
     interface XCoordinateSystem;
 
-    /** a coordinate system can contain several chart types, which than do contain the data series.
+    /** a coordinate system can contain several chart types, which then do contain the data series.
     */
     interface com::sun::star::chart2::XChartTypeContainer;
 


More information about the Libreoffice-commits mailing list