[Libreoffice-commits] .: sc/qa
Michael Meeks
mmeeks at kemper.freedesktop.org
Sat Oct 16 14:10:21 PDT 2010
sc/qa/unit/export.map | 7 +++
sc/qa/unit/makefile.mk | 85 ++++++++++++++++++++++++++++++++++++++++++
sc/qa/unit/ucalc.cxx | 97 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 189 insertions(+)
New commits:
commit 87c97a7564db848e7fd6b5fc97a52a0330213637
Author: Michael Meeks <michael.meeks at novell.com>
Date: Sat Oct 16 22:06:58 2010 +0100
Add hacked up unit test pieces for NortySpock
diff --git a/sc/qa/unit/export.map b/sc/qa/unit/export.map
new file mode 100644
index 0000000..4ca70fa
--- /dev/null
+++ b/sc/qa/unit/export.map
@@ -0,0 +1,7 @@
+UDK_3.0 {
+ global:
+ registerAllTestFunction;
+
+ local:
+ *;
+};
diff --git a/sc/qa/unit/makefile.mk b/sc/qa/unit/makefile.mk
new file mode 100644
index 0000000..4ebd1f0
--- /dev/null
+++ b/sc/qa/unit/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.2 $
+#
+# last change: $Author: ihi $ $Date: 2007/11/23 13:58:12 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2007 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#*************************************************************************
+
+PRJ := ..$/..
+PRJNAME := configmgr
+TARGET := qa_unit
+
+ENABLE_EXCEPTIONS := TRUE
+
+.INCLUDE: settings.mk
+
+DLLPRE = # no leading "lib" on .so files
+
+SHL1TARGET = $(TARGET)
+SHL1OBJS = $(SLO)$/ucalc.obj
+SHL1STDLIBS= \
+ $(BASICLIB) \
+ $(SFXLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SVXCORELIB) \
+ $(EDITENGLIB) \
+ $(SVXLIB) \
+ $(BASEGFXLIB) \
+ $(DRAWINGLAYERLIB) \
+ $(VCLLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(TKLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
+ $(I18NISOLANGLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB) \
+ $(XMLOFFLIB) \
+ $(AVMEDIALIB) \
+ $(FORLIB) \
+ $(FORUILIB) \
+ $(CPPUNITLIB)
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1LIBS=$(SLB)$/scalc3.lib $(SLB)$/scalc3c.lib
+# SHL1VERSIONMAP = export.map
+DEF1NAME = $(SHL1TARGET)
+
+.INCLUDE: target.mk
+
+ALLTAR: test
+
+test .PHONY: $(SHL1TARGETN)
+ LD_LIBRARY_PATH=$(SOLARVER)$/$(INPATH)$/lib $(SOLARVER)$/$(INPATH)$/bin$/cppunittester $(PRJ)$/$(INPATH)$/lib$/$(TARGET)$(DLLPOST)
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
new file mode 100644
index 0000000..fe72d2d
--- /dev/null
+++ b/sc/qa/unit/ucalc.cxx
@@ -0,0 +1,97 @@
+/*
+ * Known problems:
+ *
+ * + We need to work out why cppuint can't run this
+ * + can it run even the most trivial of tests ?
+ * + what symbol is it prodding around for ? and do we export it ?
+ * + cf. objdump -T on the generated .so
+ * + build verbose=1 to find it ...
+ * + We are chancing our arm here; this is unlikely to work without
+ * UNO bootstrapping - which is quite 'exciting' ;-)
+ * + We need to resurrect the ubootstrap.[ch]xx files from old versions
+ * of patches/test/build-in-unit-testing-sc.diff
+ * + We need to re-enable the exports.map with the right symbol
+ */
+
+
+// TODO ...
+// officecfg: can we move this into our skeleton ?
+// Solve the Setup.xcu problem pleasantly [ custom version ? ]
+// Remove: Foo killed exception ! ...
+// deliver.pl
+// don't call regcomp if we don't have it.
+// find & kill signalfile stuff (?)
+// Consider - where to dump this code ?
+// - surely there is some Uno module we can use... ?
+// - 'unohelper' ?
+
+#include "sal/config.h"
+// #include "ubootstrap.hxx"
+#include "vcl/svapp.hxx"
+#include <scdll.hxx>
+#include <document.hxx>
+#include <cppunit/TestSuite.h>
+#include <cppunit/TestCase.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#define CATCH_FAIL(msg) \
+ catch (const css::uno::Exception &e) { \
+ t_print ("msg '%s'\n", rtl::OUStringToOString (e.Message, RTL_TEXTENCODING_UTF8).getStr()); \
+ CPPUNIT_FAIL( msg ); \
+ throw; \
+ }
+
+class Test: public CppUnit::TestFixture {
+ // UnitBootstrap *mpUnitBootstrap;
+public:
+ // init
+ virtual void setUp();
+ virtual void tearDown();
+
+ // tests
+ void createDocument();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(createDocument);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+};
+
+void Test::setUp()
+{
+// FIXME: we badly need to bootstrap UNO [!]
+// mpUnitBootstrap = new UnitBootstrap();
+// InitVCL (mpUnitBootstrap->getMSF());
+
+ ScDLL::Init();
+}
+
+void Test::tearDown()
+{
+ DeInitVCL ();
+
+ // delete mpUnitBootstrap;
+}
+
+void Test::createDocument()
+{
+ ScDocument *doc = new ScDocument();
+
+ rtl::OUString aTabName = rtl::OUString::createFromAscii ("foo");
+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
+ doc->InsertTab (0, aTabName));
+ double val = 1;
+ doc->SetValue (0, 0, 0, val);
+ doc->SetValue (0, 1, 0, val);
+ doc->SetString (0, 2, 0, rtl::OUString::createFromAscii ("=SUM(A1:A2)"));
+ doc->CalcAll();
+ double result;
+ doc->GetValue (0, 2, 0, result);
+ fprintf (stderr, "one plus one = %g\n", result);
+ CPPUNIT_ASSERT_MESSAGE ("calculation failed", result == 2.0);
+
+ delete doc;
+}
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
More information about the Libreoffice-commits
mailing list