[Libreoffice-commits] .: 2 commits - svl/prj svl/qa

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Feb 23 13:32:19 PST 2011


 svl/prj/build.lst       |    1 
 svl/qa/unit/export.map  |    7 ++
 svl/qa/unit/makefile.mk |   96 ++++++++++++++++++++++++++++++++
 svl/qa/unit/svl.cxx     |  143 ++++++++++++++++++++++++++++++++++++++++++++++++
 svl/qa/unit/version.map |   34 +++++++++++
 5 files changed, 281 insertions(+)

New commits:
commit f50073aac85a376c385aa4373d812e7ffc285a05
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Feb 23 16:31:46 2011 -0500

    Run unit test as part of the build.
    
    For now, there is no test yet, but it's coming soon.

diff --git a/svl/prj/build.lst b/svl/prj/build.lst
index f2d4bf3..8d121c7 100644
--- a/svl/prj/build.lst
+++ b/svl/prj/build.lst
@@ -18,5 +18,6 @@ sl	svl\source\uno					nmake	-	all	svl_uno svl_inc NULL
 sl  svl\util                        nmake   -   all svl_util svl_usdde.u svl_psdde.p svl_conf svl_filepick svl_file svl__item svl_mem svl__misc svl_not svl_num svl__dde svl_sql svl_undo svl_uno NULL
 sl	svl\source\fsstor				nmake	-	all	svl_fsstor svl_inc NULL
 sl	svl\source\passwordcontainer	nmake	-	all	svl_passcont svl_inc NULL
+sl	svl\qa\unit	nmake	-	all	svl_qa_cppunit svl_util NULL
 
 
diff --git a/svl/qa/unit/makefile.mk b/svl/qa/unit/makefile.mk
index a086919..e039c41 100644
--- a/svl/qa/unit/makefile.mk
+++ b/svl/qa/unit/makefile.mk
@@ -34,7 +34,7 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE : settings.mk
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+CFLAGSCXX += $(CPPUNIT_CFLAGS) -I../../inc
 
 SHL1TARGET = $(TARGET)
 SHL1OBJS = $(SLO)$/svl.obj
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 363ba01..390d3a5 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -64,6 +64,11 @@
 #include <com/sun/star/sheet/GeneralFunction.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 
+#include <i18npool/lang.h>
+
+#include "svl/zforlist.hxx"
+#include "svl/zformat.hxx"
+
 #include <iostream>
 
 using namespace ::com::sun::star;
@@ -126,6 +131,7 @@ Test::~Test()
 
 void Test::testNumberFormat()
 {
+    SvNumberFormatter aFormatter(LANGUAGE_ENGLISH_US);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
commit 1fd9b57c03e1ba569c2003b2f7503693678ecb1e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Feb 23 15:52:51 2011 -0500

    Initial unit test skeleton, copied and modified from sc.

diff --git a/svl/qa/unit/export.map b/svl/qa/unit/export.map
new file mode 100644
index 0000000..4ca70fa
--- /dev/null
+++ b/svl/qa/unit/export.map
@@ -0,0 +1,7 @@
+UDK_3.0 {
+    global:
+        registerAllTestFunction;
+
+    local:
+        *;
+};
diff --git a/svl/qa/unit/makefile.mk b/svl/qa/unit/makefile.mk
new file mode 100644
index 0000000..a086919
--- /dev/null
+++ b/svl/qa/unit/makefile.mk
@@ -0,0 +1,96 @@
+# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+#
+# 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. 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
+#       Novell, Inc.
+# Portions created by the Initial Developer are Copyright (C) 2010 the
+# Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# 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.
+#
+
+PRJ=..$/..
+PRJNAME=svl
+TARGET=qa_unit
+
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+SHL1TARGET = $(TARGET)
+SHL1OBJS = $(SLO)$/svl.obj
+SHL1STDLIBS= \
+    $(UNOTOOLSLIB)          \
+    $(TOOLSLIB)             \
+    $(I18NISOLANGLIB)   \
+    $(UCBHELPERLIB)         \
+    $(COMPHELPERLIB)        \
+    $(CPPUHELPERLIB)        \
+    $(CPPULIB)                      \
+    $(SOTLIB)     \
+    $(SALLIB) \
+    $(CPPUNITLIB)
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1LIBS=$(SLB)$/svl.lib
+DEF1NAME = $(SHL1TARGET)
+SHL1VERSIONMAP=version.map
+
+.INCLUDE: target.mk
+
+.IF "$(OS)" == "WNT"
+my_file = file:///
+.ELSE
+my_file = file://
+.END
+
+ALLTAR: test
+
+$(MISC)$/$(TARGET)$/types.rdb .ERRREMOVE : $(SOLARBINDIR)$/types.rdb
+    $(MKDIRHIER) $(@:d)
+    $(GNUCOPY) $? $@
+
+$(MISC)/$(TARGET)/udkapi.rdb .ERRREMOVE : $(SOLARBINDIR)$/udkapi.rdb
+    $(MKDIRHIER) $(@:d)
+    $(GNUCOPY) $? $@
+
+#Make a services.rdb with the services we know we need to get up and running
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE : $(MISC)/$(TARGET)/udkapi.rdb makefile.mk
+    $(MKDIRHIER) $(@:d)
+    $(REGCOMP) -register -br $(MISC)/$(TARGET)/udkapi.rdb -r $@ -wop \
+        -c i18npool.uno$(DLLPOST)
+
+#Tweak things so that we use the .res files in the solver
+STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR)
+.EXPORT : STAR_RESOURCEPATH
+
+test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb $(MISC)$/$(TARGET)$/types.rdb $(MISC)/$(TARGET)/udkapi.rdb
+    @echo ----------------------------------------------------------
+    @echo - start unit test \#1 on library $(SHL1TARGETN)
+    @echo In the environment: STAR_RESOURCEPATH=$$STAR_RESOURCEPATH
+    @echo ----------------------------------------------------------
+    $(CPPUNITTESTER) $(SHL1TARGETN) -headless -invisible \
+        -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
+        -env:UNO_TYPES="$(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/udkapi.rdb" \
+        -env:OOO_BASE_DIR="$(my_file)$(PWD)/$(MISC)/$(TARGET)" \
+        -env:BRAND_BASE_DIR="$(my_file)$(PWD)/$(MISC)/$(TARGET)" \
+        -env:UNO_USER_PACKAGES_CACHE="$(my_file)$(PWD)/$(MISC)/$(TARGET)"
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
new file mode 100644
index 0000000..363ba01
--- /dev/null
+++ b/svl/qa/unit/svl.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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. 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
+ *       Novell, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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.
+ */
+
+// TODO ...
+//    officecfg: can we move this into our skeleton ?
+//          Solve the Setup.xcu problem pleasantly [ custom version ? ]
+//    deliver.pl
+//          don't call regcomp if we don't have it.
+//              In an ideal world
+//              a) scp2 goes away and logic moved into the deliver d.lst
+//              b) install set gets built incrementally as the build progresses
+//              c) the new .xml component registration stuff then removes
+//                 the need for manually calling regcomp and knowing what
+//                 services we need, and in what .so they are implemented
+
+#include "precompiled_svl.hxx"
+
+#ifdef WNT
+# include <prewin.h>
+# include <postwin.h>
+# undef ERROR
+#endif
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <sal/config.h>
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <rtl/ustrbuf.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/oslfile2streamwrap.hxx>
+
+#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+#include <com/sun/star/sheet/GeneralFunction.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <iostream>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::std::cout;
+using ::std::endl;
+
+namespace {
+
+::std::ostream& operator<< (::std::ostream& os, const OUString& str)
+{
+    return os << ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr();
+}
+
+
+class Test : public CppUnit::TestFixture {
+public:
+    Test();
+    ~Test();
+
+    virtual void setUp();
+    virtual void tearDown();
+
+    void testNumberFormat();
+
+    CPPUNIT_TEST_SUITE(Test);
+    CPPUNIT_TEST(testNumberFormat);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference< uno::XComponentContext > m_xContext;
+};
+
+Test::Test()
+{
+    m_xContext = cppu::defaultBootstrap_InitialComponentContext();
+
+    uno::Reference<lang::XMultiComponentFactory> xFactory(m_xContext->getServiceManager());
+    uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
+
+    //Without this we're crashing because callees are using
+    //getProcessServiceFactory.  In general those should be removed in favour
+    //of retaining references to the root ServiceFactory as its passed around
+    comphelper::setProcessServiceFactory(xSM);
+}
+
+void Test::setUp()
+{
+}
+
+void Test::tearDown()
+{
+}
+
+Test::~Test()
+{
+    uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
+}
+
+void Test::testNumberFormat()
+{
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/qa/unit/version.map b/svl/qa/unit/version.map
new file mode 100644
index 0000000..3308588
--- /dev/null
+++ b/svl/qa/unit/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3_0_0 {
+    global:
+        cppunitTestPlugIn;
+
+    local:
+        *;
+};


More information about the Libreoffice-commits mailing list