[Libreoffice-commits] .: sc/CppunitTest_sc_modelobj.mk sc/Module_sc.mk sc/qa test/inc test/Library_subsequenttest.mk test/Package_inc.mk test/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 06:12:19 PDT 2012


 sc/CppunitTest_sc_modelobj.mk             |  127 ++++++++++++++++++++++++++++++
 sc/Module_sc.mk                           |    1 
 sc/qa/extras/scmodelobj.cxx               |   69 ++++++++++++++++
 sc/qa/extras/testdocuments/ScModelObj.ods |binary
 test/Library_subsequenttest.mk            |    1 
 test/Package_inc.mk                       |    1 
 test/inc/test/sheet/xgoalseek.hxx         |   31 +++++++
 test/source/sheet/xgoalseek.cxx           |   36 ++++++++
 8 files changed, 266 insertions(+)

New commits:
commit ce6f47a4588e2c6e115fcc4980f575d3002ca603
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Sep 25 02:40:39 2012 +0200

    move XGoalSeek api test to c++
    
    Change-Id: I689be9776c4d1fe7d931446d62ea8b1fd733de92

diff --git a/sc/CppunitTest_sc_modelobj.mk b/sc/CppunitTest_sc_modelobj.mk
new file mode 100644
index 0000000..44ac9f5
--- /dev/null
+++ b/sc/CppunitTest_sc_modelobj.mk
@@ -0,0 +1,127 @@
+# -*- 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,sc_modelobj))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_modelobj, \
+    sc/qa/extras/scmodelobj \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_modelobj, \
+    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 \
+    subsequenttest \
+    ucbhelper \
+	unotest \
+    utl \
+    vbahelper \
+    vcl \
+    xo \
+	$(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_modelobj,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_modelobj,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_modelobj))
+
+$(eval $(call gb_CppunitTest_use_components,sc_modelobj,\
+	basic/util/sb \
+    comphelper/util/comphelp \
+    configmgr/source/configmgr \
+    dbaccess/util/dba \
+    fileaccess/source/fileacc \
+    filter/source/config/cache/filterconfig1 \
+    forms/util/frm \
+    framework/util/fwk \
+    i18npool/util/i18npool \
+    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 \
+    sc/util/vbaobj \
+    scripting/source/basprov/basprov \
+    scripting/util/scriptframe \
+    sfx2/util/sfx \
+    sot/util/sot \
+    svl/source/fsstor/fsstorage \
+    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 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_modelobj))
+
+$(eval $(call gb_CppunitTest_use_filter_configuration,sc_modelobj))
+
+$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_modelobj))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index f0c4252..e9ba88f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -69,6 +69,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
     CppunitTest_sc_tablesheetsobj \
     CppunitTest_sc_editfieldobj_cell \
     CppunitTest_sc_editfieldobj_header \
+    CppunitTest_sc_modelobj \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx
new file mode 100644
index 0000000..93bb0ca
--- /dev/null
+++ b/sc/qa/extras/scmodelobj.cxx
@@ -0,0 +1,69 @@
+/* -*- 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/unoapi_test.hxx>
+#include <test/sheet/xgoalseek.hxx>
+
+namespace sc_apitest {
+
+#define NUMBER_OF_TESTS 1
+
+class ScModelObj : public UnoApiTest, apitest::XGoalSeek
+{
+public:
+    virtual void setUp();
+    virtual void tearDown();
+
+    virtual uno::Reference< uno::XInterface > init();
+
+    CPPUNIT_TEST_SUITE(ScModelObj);
+    CPPUNIT_TEST(testSeekGoal);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    static sal_Int32 nTest;
+    static uno::Reference< lang::XComponent > mxComponent;
+};
+
+
+sal_Int32 ScModelObj::nTest = 0;
+uno::Reference< lang::XComponent > ScModelObj::mxComponent;
+
+uno::Reference< uno::XInterface > ScModelObj::init()
+{
+    rtl::OUString aFileURL;
+    createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScModelObj.ods")), aFileURL);
+    if(!mxComponent.is())
+        mxComponent = loadFromDesktop(aFileURL);
+    CPPUNIT_ASSERT(mxComponent.is());
+
+    return mxComponent;
+}
+
+void ScModelObj::setUp()
+{
+    nTest++;
+    UnoApiTest::setUp();
+}
+
+void ScModelObj::tearDown()
+{
+    if (nTest == NUMBER_OF_TESTS)
+        closeDocument(mxComponent);
+
+    UnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScModelObj);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/extras/testdocuments/ScModelObj.ods b/sc/qa/extras/testdocuments/ScModelObj.ods
new file mode 100644
index 0000000..56a2532
Binary files /dev/null and b/sc/qa/extras/testdocuments/ScModelObj.ods differ
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index ead6af3..aad5eba 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -69,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
     test/source/sheet/xcellrangedata \
     test/source/sheet/xcellrangereferrer \
     test/source/sheet/xcellrangesquery \
+    test/source/sheet/xgoalseek \
     test/source/sheet/xdatabaserange \
     test/source/sheet/xdatapilotdescriptor \
     test/source/sheet/xdatapilotfieldgrouping \
diff --git a/test/Package_inc.mk b/test/Package_inc.mk
index f217e98..3b4b7c3 100644
--- a/test/Package_inc.mk
+++ b/test/Package_inc.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_Package_add_file,test_inc,inc/test/unoapi_test.hxx,test/unoapi_
 $(eval $(call gb_Package_add_file,test_inc,inc/test/beans/xpropertyset.hxx,test/beans/xpropertyset.hxx))
 $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatapilotdescriptor.hxx,test/sheet/xdatapilotdescriptor.hxx))
 $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xcellrangesquery.hxx,test/sheet/xcellrangesquery.hxx))
+$(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xgoalseek.hxx,test/sheet/xgoalseek.hxx))
 $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedranges.hxx,test/sheet/xnamedranges.hxx))
 $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xnamedrange.hxx,test/sheet/xnamedrange.hxx))
 $(eval $(call gb_Package_add_file,test_inc,inc/test/sheet/xdatabaserange.hxx,test/sheet/xdatabaserange.hxx))
diff --git a/test/inc/test/sheet/xgoalseek.hxx b/test/inc/test/sheet/xgoalseek.hxx
new file mode 100644
index 0000000..71fce12
--- /dev/null
+++ b/test/inc/test/sheet/xgoalseek.hxx
@@ -0,0 +1,31 @@
+/* -*- 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 <com/sun/star/uno/Reference.hxx>
+#include <test/testdllapi.hxx>
+
+using namespace com::sun::star;
+
+namespace apitest {
+
+class OOO_DLLPUBLIC_TEST XGoalSeek
+{
+public:
+
+    virtual uno::Reference< uno::XInterface > init() = 0;
+
+    void testSeekGoal();
+
+protected:
+    virtual ~XGoalSeek() {}
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/test/source/sheet/xgoalseek.cxx b/test/source/sheet/xgoalseek.cxx
new file mode 100644
index 0000000..6bdcfbb
--- /dev/null
+++ b/test/source/sheet/xgoalseek.cxx
@@ -0,0 +1,36 @@
+/* -*- 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/sheet/xgoalseek.hxx"
+#include <com/sun/star/sheet/XGoalSeek.hpp>
+#include <com/sun/star/sheet/GoalResult.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+
+#include "cppunit/extensions/HelperMacros.h"
+
+using namespace com::sun::star::uno;
+
+namespace apitest {
+
+void XGoalSeek::testSeekGoal()
+{
+    uno::Reference< sheet::XGoalSeek > xGoalSeek(init(), UNO_QUERY_THROW);
+
+    table::CellAddress aFormulaAddr(0,3,5);
+    table::CellAddress aVariableAddr(0,3,4);
+    sheet::GoalResult aResult = xGoalSeek->seekGoal(aFormulaAddr, aVariableAddr, "4");
+
+    double nDivergence = 0.01;
+    CPPUNIT_ASSERT( aResult.Divergence < nDivergence );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(16, aResult.Result, nDivergence);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list