summaryrefslogtreecommitdiff
path: root/svl/qa
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-02-23 15:52:51 -0500
committerKohei Yoshida <kyoshida@novell.com>2011-02-23 15:52:51 -0500
commitd2a16264ec6cb1ca5e8178096b72053a357cb3fb (patch)
tree99f87cb908a551fa394fc04432a1f0c6d469db01 /svl/qa
parentffa8d10bd87a34f6f09e4dea59d61a6dd8fea4f4 (diff)
Initial unit test skeleton, copied and modified from sc.
Diffstat (limited to 'svl/qa')
-rw-r--r--svl/qa/unit/export.map7
-rw-r--r--svl/qa/unit/makefile.mk96
-rw-r--r--svl/qa/unit/svl.cxx137
-rw-r--r--svl/qa/unit/version.map34
4 files changed, 274 insertions, 0 deletions
diff --git a/svl/qa/unit/export.map b/svl/qa/unit/export.map
new file mode 100644
index 000000000000..4ca70fa85463
--- /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 000000000000..a08691972366
--- /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 000000000000..363ba012bba9
--- /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 000000000000..3308588ef6f8
--- /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:
+ *;
+};