diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:41 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 16:59:41 +0100 |
commit | f2574337dbf0d5d22d18ddbf0e8295c2ee6f4f3e (patch) | |
tree | 2421fa506d7678110b547679b5b60473f44238b1 /test | |
parent | a3e3f719efe2d7ca6afff7acea0dd3d264419865 (diff) | |
parent | 5d7f1bb1e74ae49ae7215588d836bd1ca2004b10 (diff) |
Merge commit 'ooo/DEV300_m103'
Conflicts:
smoketestdoc/com/sun/star/comp/smoketest/makefile.mk
smoketestdoc/data/Global.xml
smoketestdoc/data/OptionsDlg.xml
smoketestdoc/data/Test_10er.xml
smoketestoo_native/data/content.xml
smoketestoo_native/makefile.mk
Diffstat (limited to 'test')
-rw-r--r-- | test/prj/build.lst | 3 | ||||
-rw-r--r-- | test/prj/d.lst | 3 | ||||
-rw-r--r-- | test/source/cpp/makefile.mk | 11 | ||||
-rw-r--r-- | test/source/cpp/unoexceptionprotector/makefile.mk | 56 | ||||
-rw-r--r-- | test/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx | 96 |
5 files changed, 161 insertions, 8 deletions
diff --git a/test/prj/build.lst b/test/prj/build.lst index 7adea0c0727b..e22199a5c437 100644 --- a/test/prj/build.lst +++ b/test/prj/build.lst @@ -1,5 +1,6 @@ -te test : BOOST:boost cppu cppuhelper CPPUNIT:cppunit javaunohelper offuh ridljar sal solenv unoil NULL +te test : BOOST:boost cppu cppuhelper CPPUNIT:cppunit javaunohelper offuh ridljar sal solenv stlport unoil NULL te test\inc nmake - all inc NULL te test\source\cpp nmake - all source_cpp inc NULL +te test\source\cpp\unoexceptionprotector nmake - all source_cpp_unoexceptionprotector inc NULL te test\source\java\org\openoffice\test nmake - all source_java NULL te test\source\java\org\openoffice\test\tools nmake - all source_java_tools NULL diff --git a/test/prj/d.lst b/test/prj/d.lst index 54da2062a511..18a599fd5849 100644 --- a/test/prj/d.lst +++ b/test/prj/d.lst @@ -1,9 +1,12 @@ mkdir: %_DEST%\inc%_EXT%\test mkdir: %_DEST%\inc%_EXT%\test\detail ..\%__SRC%\bin\test.dll %_DEST%\bin%_EXT%\test.dll +..\%__SRC%\bin\unoexceptionprotector.dll %_DEST%\bin%_EXT%\unoexceptionprotector.dll ..\%__SRC%\lib\itest.lib %_DEST%\lib%_EXT%\itest.lib ..\%__SRC%\lib\libtest.dylib %_DEST%\lib%_EXT%\libtest.dylib ..\%__SRC%\lib\libtest.so %_DEST%\lib%_EXT%\libtest.so +..\%__SRC%\lib\unoexceptionprotector.dylib %_DEST%\lib%_EXT%\unoexceptionprotector.dylib +..\%__SRC%\lib\unoexceptionprotector.so %_DEST%\lib%_EXT%\unoexceptionprotector.so ..\inc\test\detail\testdllapi.hxx %_DEST%\inc%_EXT%\test\detail\testdllapi.hxx ..\inc\test\gettestargument.hxx %_DEST%\inc%_EXT%\test\gettestargument.hxx ..\inc\test\officeconnection.hxx %_DEST%\inc%_EXT%\test\officeconnection.hxx diff --git a/test/source/cpp/makefile.mk b/test/source/cpp/makefile.mk index 4c90dc678959..2073f1500c07 100644 --- a/test/source/cpp/makefile.mk +++ b/test/source/cpp/makefile.mk @@ -33,14 +33,11 @@ VISIBILITY_HIDDEN = TRUE .INCLUDE: settings.mk CDEFS += -DOOO_DLLIMPLEMENTATION_TEST -CFLAGSCXX += $(CPPUNIT_CFLAGS) -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) +.IF "$(USE_SYSTEM_STL)" != "YES" && "$(SYSTEM_CPPUNIT)" == "YES" +CFLAGSCXX += -DADAPT_EXT_STL +.END SLOFILES = \ $(SLO)/getargument.obj \ diff --git a/test/source/cpp/unoexceptionprotector/makefile.mk b/test/source/cpp/unoexceptionprotector/makefile.mk new file mode 100644 index 000000000000..7f62199f46dc --- /dev/null +++ b/test/source/cpp/unoexceptionprotector/makefile.mk @@ -0,0 +1,56 @@ +#************************************************************************* +# 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. +#***********************************************************************/ + +PRJ = ../../.. +PRJNAME = test +TARGET = unoexceptionprotector + +ENABLE_EXCEPTIONS = TRUE +VISIBILITY_HIDDEN = TRUE + +.INCLUDE: settings.mk + +DLLPRE = + +CFLAGSCXX += $(CPPUNIT_CFLAGS) +.IF "$(USE_SYSTEM_STL)" != "YES" && "$(SYSTEM_CPPUNIT)" == "YES" +CFLAGSCXX += -DADAPT_EXT_STL +.END + +SLOFILES = $(SLO)/unoexceptionprotector.obj + +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLOFILES) +SHL1RPATH = NONE +SHL1STDLIBS = \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(CPPUNITLIB) \ + $(SALLIB) +SHL1TARGET = unoexceptionprotector +SHL1USE_EXPORTS = name +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk diff --git a/test/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx b/test/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx new file mode 100644 index 000000000000..da54d62d6a2e --- /dev/null +++ b/test/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx @@ -0,0 +1,96 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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. +************************************************************************/ + +#include "precompiled_test.hxx" +#include "sal/config.h" + +#include <limits> +#include <string> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "cppuhelper/exc_hlp.hxx" +#include "osl/thread.h" +#include "rtl/string.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#include "cppunit/Message.h" +#include "cppunit/Protector.h" + +namespace { + +namespace css = com::sun::star; + +// Best effort conversion: +std::string convert(rtl::OUString const & s16) { + rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); + return std::string( + s8.getStr(), + ((static_cast< sal_uInt32 >(s8.getLength()) + > std::numeric_limits< std::string::size_type >::max()) + ? std::numeric_limits< std::string::size_type >::max() + : static_cast< std::string::size_type >(s8.getLength()))); +} + +class Prot: public CppUnit::Protector, private boost::noncopyable { +public: + Prot() {} + + virtual ~Prot() {} + + virtual bool protect( + CppUnit::Functor const & functor, + CppUnit::ProtectorContext const & context); +}; + +bool Prot::protect( + CppUnit::Functor const & functor, CppUnit::ProtectorContext const & context) +{ + try { + return functor(); + } catch (css::uno::Exception & e) { + css::uno::Any a(cppu::getCaughtException()); + reportError( + context, + CppUnit::Message( + convert( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "uncaught exception of type ")) + + a.getValueTypeName()), + convert(e.Message))); + } + return false; +} + +} + +extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector * SAL_CALL +unoexceptionprotector() { + return new Prot; +} |