diff options
author | sb <sb@openoffice.org> | 2010-03-10 10:44:50 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-03-10 10:44:50 +0100 |
commit | d99069c4d5cc7a27cc7e918fe8aa528a5fa57b41 (patch) | |
tree | 191032479d87c8f348f0cc3dd586c8f6f46285e8 /cppu | |
parent | 9d09cf39be3e28e14f28e88a01cc4bdb83eb449d (diff) |
sb120: #i83192# removed cppu/test, superseded by testtools tests
Diffstat (limited to 'cppu')
74 files changed, 0 insertions, 10621 deletions
diff --git a/cppu/test/AffineBridge/AffineBridge.test.pl b/cppu/test/AffineBridge/AffineBridge.test.pl deleted file mode 100755 index 6b667efd299c..000000000000 --- a/cppu/test/AffineBridge/AffineBridge.test.pl +++ /dev/null @@ -1,72 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests = ( - "EnvStack.tester :A:affine :A:affine \"-enter:A[0,not entered]-leave:A[0,not entered]\" :A:affine", # initially not entered&leave - "EnvStack.tester :affine:A :affine:A \"-enter:affine:A[1,OK]-leave:affine:A[1,OK]\" :affine", # enter - "EnvStack.tester \"\" :affine:A \"-into:affine:A[1,OK]\" :affine", # call into - "EnvStack.tester :affine :A \"-into:A[0,wrong thread]\" :affine", # call out - "EnvStack.tester \"\" :affine:affine:A \"-into:affine:affine:A[0,wrong thread]\" :affine", # wrong thread - "env.tester.bin CPP:affine" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/AffineBridge/makefile.mk b/cppu/test/AffineBridge/makefile.mk deleted file mode 100644 index f282d05cf357..000000000000 --- a/cppu/test/AffineBridge/makefile.mk +++ /dev/null @@ -1,42 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := AffineBridge.test.pl - - -.INCLUDE : settings.mk - - -.INCLUDE : target.mk - - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): AffineBridge.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/AntiEnvGuard/AntiEnvGuard.test.cxx b/cppu/test/AntiEnvGuard/AntiEnvGuard.test.cxx deleted file mode 100644 index 885600141255..000000000000 --- a/cppu/test/AntiEnvGuard/AntiEnvGuard.test.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "sal/main.h" - -#include "cppu/EnvGuards.hxx" -#include "uno/environment.hxx" - -#include <iostream> - - -using namespace com::sun::star; - -static rtl::OUString s_message; - - -static void s_test__ctor(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__ctor")); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("uno")); - - rtl::OUString current_EnvDcp; - { - cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe")), NULL)); - - { - cppu::AntiEnvGuard antiGuard; - - current_EnvDcp = uno::Environment::getCurrent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).getTypeName(); - } - } - - if (current_EnvDcp == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += current_EnvDcp; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -static void s_test__dtor(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__dtor")); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe")); - - rtl::OUString current_EnvDcp; - { - cppu::EnvGuard envGuard(uno::Environment(ref, NULL)); - - { - cppu::AntiEnvGuard antiGuard; - } - current_EnvDcp = uno::Environment::getCurrent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).getTypeName(); - } - - - if (current_EnvDcp == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += current_EnvDcp; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__ctor(); - s_test__dtor(); - - int ret; - if (s_message.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_message, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/AntiEnvGuard/makefile.mk b/cppu/test/AntiEnvGuard/makefile.mk deleted file mode 100644 index 3164ca17650d..000000000000 --- a/cppu/test/AntiEnvGuard/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := AntiEnvGuard.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/AntiEnvGuard.test.obj -APP1STDLIBS := $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/EnvDcp/EnvDcp.test.cxx b/cppu/test/EnvDcp/EnvDcp.test.cxx deleted file mode 100644 index d9f78468ef3f..000000000000 --- a/cppu/test/EnvDcp/EnvDcp.test.cxx +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "sal/main.h" - -#include "cppu/EnvDcp.hxx" - -#include <iostream> - - -static rtl::OUString s_message; - -static void s_test__getTypeName(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__getTypeName")); - - rtl::OUString envDcp(RTL_CONSTASCII_USTRINGPARAM("acaQEQWE123:asda:2342")); - - rtl::OUString typeName(cppu::EnvDcp::getTypeName(envDcp)); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("acaQEQWE123")); - - if (typeName == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += typeName; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -static void s_test__getPurpose(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__getPurpose")); - - rtl::OUString envDcp(RTL_CONSTASCII_USTRINGPARAM("acaQEQWE123:asda:2342")); - - rtl::OUString purpose(cppu::EnvDcp::getPurpose(envDcp)); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM(":asda:2342")); - - if (purpose == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += purpose; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__getTypeName(); - s_test__getPurpose(); - - int ret; - if (s_message.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_message, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/EnvDcp/makefile.mk b/cppu/test/EnvDcp/makefile.mk deleted file mode 100644 index cc0db62e93fe..000000000000 --- a/cppu/test/EnvDcp/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := EnvDcp.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/EnvDcp.test.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/EnvGuard/EnvGuard.test.cxx b/cppu/test/EnvGuard/EnvGuard.test.cxx deleted file mode 100644 index ec926fa56670..000000000000 --- a/cppu/test/EnvGuard/EnvGuard.test.cxx +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "sal/main.h" - -#include "cppu/EnvGuards.hxx" -#include "uno/environment.hxx" - -#include <iostream> - - -using namespace com::sun::star; - -static rtl::OUString s_message; - - -static void s_test__entered(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__entered")); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe")); - - rtl::OUString current_EnvDcp; - { - cppu::EnvGuard envGuard(uno::Environment(ref, NULL)); - - current_EnvDcp = uno::Environment::getCurrent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).getTypeName(); - } - - if (current_EnvDcp == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += current_EnvDcp; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -static void s_test__left(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__left")); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("uno")); - - rtl::OUString current_EnvDcp; - { - cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe")), NULL)); - } - current_EnvDcp = uno::Environment::getCurrent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).getTypeName(); - - - if (current_EnvDcp == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += current_EnvDcp; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -static void s_test__clear(void) -{ - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__clear")); - - rtl::OUString ref(RTL_CONSTASCII_USTRINGPARAM("uno")); - - rtl::OUString current_EnvDcp; - { - cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe")), NULL)); - - envGuard.clear(); - current_EnvDcp = uno::Environment::getCurrent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).getTypeName(); - } - - - if (current_EnvDcp == ref) - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t got: \"")); - s_message += current_EnvDcp; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t expected: \"")); - s_message += ref; - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__entered(); - s_test__left(); - s_test__clear(); - - int ret; - if (s_message.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_message, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/EnvGuard/makefile.mk b/cppu/test/EnvGuard/makefile.mk deleted file mode 100644 index bb851af3fb25..000000000000 --- a/cppu/test/EnvGuard/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := EnvGuard.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/EnvGuard.test.obj -APP1STDLIBS := $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/EnvStack/EnvStack.test.pl b/cppu/test/EnvStack/EnvStack.test.pl deleted file mode 100755 index 842b2ebab5da..000000000000 --- a/cppu/test/EnvStack/EnvStack.test.pl +++ /dev/null @@ -1,89 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests = ( - "EnvStack.tester \"\" \"\" \"\"", - "EnvStack.tester \":A:a\" \":A:b\" \"-enter:A-enter:A:a-out:A:a-into:A:b-leave:A:a-leave:A\"", - "EnvStack.tester \":A:B:a\" \":A:B:b\" \"-enter:A-enter:A:B-enter:A:B:a-out:A:B:a-into:A:B:b-leave:A:B:a-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C:a\" \":A:B:C:b\" \"-enter:A-enter:A:B-enter:A:B:C-enter:A:B:C:a-out:A:B:C:a-into:A:B:C:b-leave:A:B:C:a-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C:D:a\" \":A:B:C:D:b\" \"-enter:A-enter:A:B-enter:A:B:C-enter:A:B:C:D-enter:A:B:C:D:a-out:A:B:C:D:a-into:A:B:C:D:b-leave:A:B:C:D:a-leave:A:B:C:D-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A:a:b\" \":A:c:d\" \"-enter:A-enter:A:a-enter:A:a:b-out:A:a:b-out:A:a-into:A:c-into:A:c:d-leave:A:a:b-leave:A:a-leave:A\"", - "EnvStack.tester \":A:B:a:b\" \":A:B:c:d\" \"-enter:A-enter:A:B-enter:A:B:a-enter:A:B:a:b-out:A:B:a:b-out:A:B:a-into:A:B:c-into:A:B:c:d-leave:A:B:a:b-leave:A:B:a-leave:A:B-leave:A\"", - "EnvStack.tester \":A\" \"\" \"-enter:A-out:A-leave:A\"", - "EnvStack.tester \":A:B\" \"\" \"-enter:A-enter:A:B-out:A:B-out:A-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C\" \"\" \"-enter:A-enter:A:B-enter:A:B:C-out:A:B:C-out:A:B-out:A-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C:D\" \"\" \"-enter:A-enter:A:B-enter:A:B:C-enter:A:B:C:D-out:A:B:C:D-out:A:B:C-out:A:B-out:A-leave:A:B:C:D-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \"\" \":a\" \"-into:a\"", - "EnvStack.tester \"\" \":a:b\" \"-into:a-into:a:b\"", - "EnvStack.tester \"\" \":a:b:c\" \"-into:a-into:a:b-into:a:b:c\"", - "EnvStack.tester \"\" \":a:b:c:d\" \"-into:a-into:a:b-into:a:b:c-into:a:b:c:d\"", - "EnvStack.tester \":A\" \":a\" \"-enter:A-out:A-into:a-leave:A\"", - "EnvStack.tester \":A:B\" \":a:b\" \"-enter:A-enter:A:B-out:A:B-out:A-into:a-into:a:b-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C\" \":a:b:c\" \"-enter:A-enter:A:B-enter:A:B:C-out:A:B:C-out:A:B-out:A-into:a-into:a:b-into:a:b:c-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C:D\" \":a:b:c:d\" \"-enter:A-enter:A:B-enter:A:B:C-enter:A:B:C:D-out:A:B:C:D-out:A:B:C-out:A:B-out:A-into:a-into:a:b-into:a:b:c-into:a:b:c:d-leave:A:B:C:D-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A\" \":A\" \"-enter:A-leave:A\"", - "EnvStack.tester \":A:B\" \":A:B\" \"-enter:A-enter:A:B-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C\" \":A:B:C\" \"-enter:A-enter:A:B-enter:A:B:C-leave:A:B:C-leave:A:B-leave:A\"", - "EnvStack.tester \":A:B:C:D\" \":A:B:C:D\" \"-enter:A-enter:A:B-enter:A:B:C-enter:A:B:C:D-leave:A:B:C:D-leave:A:B:C-leave:A:B-leave:A\"" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/EnvStack/makefile.mk b/cppu/test/EnvStack/makefile.mk deleted file mode 100644 index 6e6990b97716..000000000000 --- a/cppu/test/EnvStack/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := EnvStack.test.pl - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -.INCLUDE : target.mk - - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): EnvStack.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/EnvStack_tester/EnvStack.tester.cxx b/cppu/test/EnvStack_tester/EnvStack.tester.cxx deleted file mode 100644 index caa6660a91b6..000000000000 --- a/cppu/test/EnvStack_tester/EnvStack.tester.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" - -#include "uno/lbnames.h" -#include "uno/environment.hxx" -#include "cppu/EnvDcp.hxx" -#include <com/sun/star/uno/Exception.hpp> - - -#define CPPU_test_EnvStack_tester_IMPL -#include "EnvStack.tester.hxx" - - -using namespace com::sun::star; - - -static rtl::OUString s_getCurrentEnvDcp(void) -{ - uno::Environment env(uno::Environment::getCurrent()); - rtl::OUString env_dcp(env.getTypeName()); - - return env_dcp; -} - -extern "C" { static void s_getCurrentEnvDcp_v(va_list * pParam) -{ - rtl_uString ** ppEnvDcp = va_arg(*pParam, rtl_uString **); - - rtl::OUString env_dcp(s_getCurrentEnvDcp()); - - rtl_uString_assign(ppEnvDcp, env_dcp.pData); -}} - -static rtl::OUString s_test__uno_Environment_invoke(rtl::OUString const & src_purpose, - rtl::OUString const & dst_purpose, - rtl::OUString const & ref) -{ - rtl::OUString result; - rtl::OUString target_envDcp; - - rtl::OUString src_envDcp(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)); - src_envDcp += src_purpose; - - rtl::OUString dst_envDcp(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)); - dst_envDcp += dst_purpose; - - uno::Environment cur_Env(src_envDcp.pData, NULL); - uno_Environment_enter(cur_Env.get()); - cur_Env.clear(); - - uno::Environment dst_Env(dst_envDcp.pData, NULL); - uno_Environment_invoke(dst_Env.get(), s_getCurrentEnvDcp_v, &target_envDcp.pData); - dst_Env.clear(); - - uno_Environment_enter(NULL); - - - if (cppu::EnvDcp::getPurpose(target_envDcp).equals(dst_purpose) - && g_commentStack.equals(ref)) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PASSED\n")); - - else - { - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FAILED -> ")); - result += target_envDcp; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\texpected: \"")); - result += ref; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tgot: \"")); - result += g_commentStack; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } - - - - return result; -} - -static rtl::OUString s_test__uno_Environment_invoke_v(va_list param) -{ - rtl::OUString const * pSrc_purpose = va_arg(param, rtl::OUString const *); - rtl::OUString const * pDst_purpose = va_arg(param, rtl::OUString const *); - rtl::OUString const * pRef = va_arg(param, rtl::OUString const *); - - - rtl::OUString result; - - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s_test__uno_Environment_invoke_v")); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - \"")); - result += *pSrc_purpose; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" -> \"")); - result += *pDst_purpose; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - - result += s_test__uno_Environment_invoke(*pSrc_purpose, *pDst_purpose, *pRef); - - return result; -} - -static rtl::OUString s_do_a_test(rtl::OUString (* pTest)(va_list), ...) -{ - rtl::OUString result; - - va_list param; - - va_start(param, pTest); - try { - result += pTest(param); - } - catch (uno::Exception & exception) - { - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FAILED with exception: ")); - result += exception.Message; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - } - va_end(param); - - return result; -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - int result = 0; - rtl::OString message; - - if (argc >= 4 && argc <= 5) - { - rtl::OUString src_purpose(argv[1], rtl_str_getLength(argv[1]), RTL_TEXTENCODING_ASCII_US); - rtl::OUString dst_purpose(argv[2], rtl_str_getLength(argv[2]), RTL_TEXTENCODING_ASCII_US); - rtl::OUString ref (argv[3], rtl_str_getLength(argv[3]), RTL_TEXTENCODING_ASCII_US); - - if (argc == 5) - { - rtl::OUString test_env(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)); - test_env += rtl::OUString(argv[4], rtl_str_getLength(argv[4]), RTL_TEXTENCODING_ASCII_US); - g_env = uno::Environment(test_env); - } - - - message += rtl::OUStringToOString( - s_do_a_test(s_test__uno_Environment_invoke_v, &src_purpose, &dst_purpose, &ref), - RTL_TEXTENCODING_ASCII_US); - - - if (g_env.is()) - g_env.clear(); - - - if (message.indexOf(rtl::OString("FAILED")) == -1) - message += rtl::OString("TESTS PASSED\n"); - - else - { - message += rtl::OString("TESTS _NOT_ PASSED\n"); - result = -1; - } - } - else - { - message = "usage: EnvStack.tester <source purpose>" - " <destination purpose>" - " <reference string>" - " [<reference environment>]\n\n"; - } - - std::cout << message.getStr(); - - - return result; -} - diff --git a/cppu/test/EnvStack_tester/EnvStack.tester.hxx b/cppu/test/EnvStack_tester/EnvStack.tester.hxx deleted file mode 100644 index 1500ffe4723f..000000000000 --- a/cppu/test/EnvStack_tester/EnvStack.tester.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_cppu_test_EnvStack_tester_hxx -#define INCLUDED_cppu_test_EnvStack_tester_hxx - -#include "uno/environment.hxx" - - -#ifdef CPPU_test_EnvStack_tester_IMPL -# define CPPU_test_EnvStack_tester_EXPORT SAL_DLLPUBLIC_EXPORT - -#elif defined(CPPU_test_EnvStack_Test_LIB) -# define CPPU_test_EnvStack_tester_EXPORT extern - -#elif defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) -# define CPPU_test_EnvStack_tester_EXPORT extern __attribute__ ((weak)) - -#elif defined(__SUNPRO_CC) -# define CPPU_test_EnvStack_tester_EXPORT extern - extern rtl::OUString g_commentStack; - extern com::sun::star::uno::Environment g_env; - -# pragma weak g_commentStack -# pragma weak g_env - -#else -# define CPPU_test_EnvStack_tester_EXPORT SAL_DLLPUBLIC_IMPORT - -#endif - -CPPU_test_EnvStack_tester_EXPORT rtl::OUString g_commentStack; -CPPU_test_EnvStack_tester_EXPORT com::sun::star::uno::Environment g_env; - - - -#endif diff --git a/cppu/test/EnvStack_tester/ProbeEnv.cxx b/cppu/test/EnvStack_tester/ProbeEnv.cxx deleted file mode 100644 index a6b1ce1aaac2..000000000000 --- a/cppu/test/EnvStack_tester/ProbeEnv.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "cppu/EnvDcp.hxx" - -#include "cppu/helper/purpenv/Environment.hxx" -#include "cppu/helper/purpenv/Mapping.hxx" - -#include "EnvStack.tester.hxx" - - -#define LOG_LIFECYCLE_TestEnv -#ifdef LOG_LIFECYCLE_TestEnv -# include <iostream> -# define LOG_LIFECYCLE_TestEnv_emit(x) x - -#else -# define LOG_LIFECYCLE_TestEnv_emit(x) - -#endif - - -class SAL_DLLPRIVATE TestEnv : public cppu::Enterable -{ - virtual ~TestEnv(void); - -public: - explicit TestEnv(uno_Environment * pEnv); - - uno_Environment * m_pEnv; - -protected: - virtual void v_enter(void); - virtual void v_leave(void); - - virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam); - virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam); - - virtual int v_isValid (rtl::OUString * pReason); -}; - -TestEnv::TestEnv(uno_Environment * pEnv) - : m_pEnv(pEnv) -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::TestEnv(...)", this)); -} - -TestEnv::~TestEnv(void) -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::~TestEnv(void)", this)); -} - - -static void s_checkGEnvValidity(void) -{ - if (g_env.is()) - { - rtl::OUString reason; - int result = g_env.isValid(&reason); - - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[")); - g_commentStack += rtl::OUString::valueOf((sal_Int32)result); - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - g_commentStack += reason; - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]")); - } -} - -void TestEnv::v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) -{ - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-into")); - g_commentStack += cppu::EnvDcp::getPurpose(m_pEnv->pTypeName); - - s_checkGEnvValidity(); - - pCallee(pParam); -} - -void TestEnv::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam) -{ - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-out")); - g_commentStack += cppu::EnvDcp::getPurpose(m_pEnv->pTypeName); - - s_checkGEnvValidity(); - - pCallee(pParam); -} - -void TestEnv::v_enter(void) -{ - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-enter")); - g_commentStack += cppu::EnvDcp::getPurpose(m_pEnv->pTypeName); - - s_checkGEnvValidity(); -} - -void TestEnv::v_leave(void) -{ - g_commentStack += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-leave")); - g_commentStack += cppu::EnvDcp::getPurpose(m_pEnv->pTypeName); - - s_checkGEnvValidity(); -} - -int TestEnv::v_isValid(rtl::OUString * /*pReason*/) -{ - return 1; -} - -extern "C" void SAL_CALL uno_initEnvironment(uno_Environment * pEnv) SAL_THROW_EXTERN_C() -{ - cppu::helper::purpenv::Environment_initWithEnterable(pEnv, new TestEnv(pEnv)); -} - -extern "C" void uno_ext_getMapping(uno_Mapping ** ppMapping, - uno_Environment * pFrom, - uno_Environment * pTo ) -{ - cppu::helper::purpenv::createMapping(ppMapping, pFrom, pTo); -} - diff --git a/cppu/test/EnvStack_tester/ProbeEnv.def b/cppu/test/EnvStack_tester/ProbeEnv.def deleted file mode 100644 index 1444d92c13fa..000000000000 --- a/cppu/test/EnvStack_tester/ProbeEnv.def +++ /dev/null @@ -1,8 +0,0 @@ -HEAPSIZE 0 -EXPORTS - uno_initEnvironment - uno_ext_getMapping - - - - diff --git a/cppu/test/EnvStack_tester/makefile.mk b/cppu/test/EnvStack_tester/makefile.mk deleted file mode 100644 index 1ae0e4e89250..000000000000 --- a/cppu/test/EnvStack_tester/makefile.mk +++ /dev/null @@ -1,126 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := EnvStack.tester - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk -.INCLUDE : ../../source/helper/purpenv/export.mk - -.IF "$(COM)" == "GCC" -LINKFLAGS += -rdynamic -.ENDIF - - -ENVINCPRE := -I$(OUT)$/inc$/$(TARGET) - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/EnvStack.tester.obj -APP1STDLIBS := $(CPPULIB) $(SALLIB) - - -SHL1TARGET := $(HLD_DLLPRE)A_uno_uno -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(SLO)$/ProbeEnv.obj -SHL1STDLIBS := $(purpenv_helper_LIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -.IF "$(GUI)"=="WNT" -SHL1STDLIBS += $(BIN)$/EnvStack.tester.lib -.ENDIF -SHL1DEF := ProbeEnv.def - -SHL2TARGET := $(HLD_DLLPRE)B_uno_uno -SHL2IMPLIB := i$(SHL2TARGET) -SHL2OBJS := $(SHL1OBJS) -SHL2STDLIBS := $(SHL1STDLIBS) -SHL2DEF := $(SHL1DEF) - -SHL3TARGET := $(HLD_DLLPRE)C_uno_uno -SHL3IMPLIB := i$(SHL3TARGET) -SHL3OBJS := $(SHL1OBJS) -SHL3STDLIBS := $(SHL1STDLIBS) -SHL3DEF := $(SHL1DEF) - -SHL4TARGET := $(HLD_DLLPRE)D_uno_uno -SHL4IMPLIB := i$(SHL4TARGET) -SHL4OBJS := $(SHL1OBJS) -SHL4STDLIBS := $(SHL1STDLIBS) -SHL4DEF := $(SHL1DEF) - -SHL5TARGET := $(HLD_DLLPRE)a_uno_uno -SHL5IMPLIB := i$(SHL5TARGET) -SHL5OBJS := $(SHL1OBJS) -SHL5STDLIBS := $(SHL1STDLIBS) -SHL5DEF := $(SHL1DEF) - -SHL6TARGET := $(HLD_DLLPRE)b_uno_uno -SHL6IMPLIB := i$(SHL6TARGET) -SHL6OBJS := $(SHL1OBJS) -SHL6STDLIBS := $(SHL1STDLIBS) -SHL6DEF := $(SHL1DEF) - -SHL7TARGET := $(HLD_DLLPRE)c_uno_uno -SHL7IMPLIB := i$(SHL7TARGET) -SHL7OBJS := $(SHL1OBJS) -SHL7STDLIBS := $(SHL1STDLIBS) -SHL7DEF := $(SHL1DEF) - -SHL8TARGET := $(HLD_DLLPRE)d_uno_uno -SHL8IMPLIB := i$(SHL8TARGET) -SHL8OBJS := $(SHL1OBJS) -SHL8STDLIBS := $(SHL1STDLIBS) -SHL8DEF := $(SHL1DEF) - - -.INCLUDE : target.mk - - -ALLTAR: \ - $(SHL1TARGETN) \ - $(SHL2TARGETN) \ - $(SHL3TARGETN) \ - $(SHL4TARGETN) \ - $(SHL5TARGETN) \ - $(SHL6TARGETN) \ - $(SHL7TARGETN) \ - $(SHL8TARGETN) - - -$(SHL1TARGETN) : $(APP1TARGETN) -$(SHL2TARGETN) : $(APP1TARGETN) -$(SHL3TARGETN) : $(APP1TARGETN) -$(SHL4TARGETN) : $(APP1TARGETN) -$(SHL5TARGETN) : $(APP1TARGETN) -$(SHL6TARGETN) : $(APP1TARGETN) -$(SHL7TARGETN) : $(APP1TARGETN) -$(SHL8TARGETN) : $(APP1TARGETN) diff --git a/cppu/test/Environment.test.cxx b/cppu/test/Environment.test.cxx deleted file mode 100644 index 446ffda7f545..000000000000 --- a/cppu/test/Environment.test.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// Test for uno/environment.hxx respectively com::sun::star::uno::Environment - -#include "uno/environment.hxx" -#include "uno/lbnames.h" -#include "sal/main.h" - -#include <iostream> - - -using namespace com::sun::star; - -static rtl::OUString s_comment; - -static void s_test__constructor_oustring_context(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__constructor_outstring_context\n")); - - uno::Environment environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)), NULL); - - if (!environment.get()) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get an Environment - FAILURE\n")); -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__constructor_oustring_context(); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/FreeReference/FreeReference.test.cxx b/cppu/test/FreeReference/FreeReference.test.cxx deleted file mode 100644 index 1d80f573b0f3..000000000000 --- a/cppu/test/FreeReference/FreeReference.test.cxx +++ /dev/null @@ -1,414 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" - -#include "uno/environment.hxx" - -#include "cppu/FreeReference.hxx" -#include "cppu/EnvGuards.hxx" - -#include "../ObjectFactory/ObjectFactory.hxx" - - - -using namespace com::sun::star; - -static rtl::OUString s_comment; -static uno::Environment s_env; - -extern "C" { -static void s_callee_in(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_in method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: ")); - s_comment += uno::Environment::getCurrent().getTypeName(); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: ")); - s_comment += reason; - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - } -} - -static void s_callee_out(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_out method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: ")); - s_comment += uno::Environment::getCurrent().getTypeName(); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (!valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: is in\n")); - } -} -} - -static cppu::FreeReference<uno::XInterface> s_get_envObject(void) -{ - cppu::EnvGuard envGuard(s_env); - - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - - cppu::FreeReference<uno::XInterface> env_obj(pObject, SAL_NO_ACQUIRE); - - return env_obj; -} - -static cppu::FreeReference<uno::XInterface> s_get_flatObject(void) -{ - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_out)); - - return cppu::FreeReference<uno::XInterface>(pObject, SAL_NO_ACQUIRE); -} - - -static void s_test_operator_arrow(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_operator_arrow:\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - - env_obj->acquire(); - env_obj->release(); -} - - -static void s_test_operator_assign_empty_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_operator_assign_empty_reference\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - cppu::FreeReference<uno::XInterface> empty_ref; - - flat_obj = empty_ref; -} - -static void s_test_operator_assign_inner_reference_inside(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_operator_assign_inner_reference_inside\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - { - cppu::EnvGuard envGuard(s_env); - env_obj = flat_obj; - } -} - -static void s_test_method_clear_inner_reference_inside(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_clear_inner_reference_inside\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - - { - cppu::EnvGuard envGuard(s_env); - env_obj.clear(); - } -} - -static void s_test_method_clear_inner_reference_outside(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_clear_inner_reference_outside\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - - env_obj.clear(); -} - -static void s_test_method_clear_outer_reference_inside(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_clear_outer_reference_inside\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - { - cppu::EnvGuard envGuard(s_env); - flat_obj.clear(); - } -} - -static void s_test_method_clear_outer_reference_outside(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_clear_outer_reference_outside\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - flat_obj.clear(); -} - -static void s_test_method_set_inside_with_inner_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_set_inside_with_inner_reference\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - - { - cppu::EnvGuard envGuard(s_env); - uno::XInterface * pObject2 = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - { - uno::Reference<uno::XInterface> ref(pObject2, SAL_NO_ACQUIRE); - - env_obj.set(ref); - } - } -} - -static void s_test_method_set_inside_with_outer_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_set_inside_with_outer_reference\n")); - - cppu::FreeReference<uno::XInterface> env_obj(s_get_envObject()); - - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_out)); - { - uno::Reference<uno::XInterface> ref(pObject, SAL_NO_ACQUIRE); - - env_obj.set(ref); - } -} - -static void s_test_method_set_with_empty_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_set_outside_with_empty_reference\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - { - uno::Reference<uno::XInterface> ref; - - flat_obj.set(ref); - } -} - -static void s_test_method_set_outside_with_inner_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_set_outside_with_inner_reference\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - { - cppu::EnvGuard envGuard(s_env); - - uno::XInterface * pObject2 = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - { - uno::Reference<uno::XInterface> ref(pObject2, SAL_NO_ACQUIRE); - - flat_obj.set(ref); - } - } -} - -static void s_test_method_set_outside_with_outer_reference(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_method_set_outside_with_outer_reference\n")); - - cppu::FreeReference<uno::XInterface> flat_obj(s_get_flatObject()); - - uno::XInterface * pObject2 = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_out)); - { - uno::Reference<uno::XInterface> ref(pObject2, SAL_NO_ACQUIRE); - - flat_obj.set(ref); - } -} - -static void s_test_operator_equal(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_operator_equal\n")); - - - cppu::FreeReference<uno::XInterface> env_obj; - uno::XInterface * pObject = NULL; - { - cppu::EnvGuard envGuard(s_env); - pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - - env_obj = cppu::FreeReference<uno::XInterface>(pObject, SAL_NO_ACQUIRE); - } - - - uno::Mapping mapping(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV) ":unsafe")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV)))); - uno::Reference<uno::XInterface> tmp; - uno::XInterface * pMappedObject = reinterpret_cast<uno::XInterface *>(mapping.mapInterface(pObject, ::getCppuType(&tmp))); - - - cppu::FreeReference<uno::XInterface> flat_obj(pMappedObject, SAL_NO_ACQUIRE); - - { - cppu::EnvGuard envGuard(s_env); - - if (!(env_obj == flat_obj)) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\trefs are not equal inside - FAILURE\n")); - } - - if (!(env_obj == flat_obj)) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\trefs are not equal outside - FAILURE\n")); -} - -static void s_test_operator_unequal(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_operator_unequal\n")); - - - uno::XInterface * pObject = NULL; - cppu::FreeReference<uno::XInterface> env_obj; - { - cppu::EnvGuard envGuard(s_env); - - pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - - env_obj = cppu::FreeReference<uno::XInterface>(pObject, SAL_NO_ACQUIRE); - } - - - uno::Mapping mapping(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV) ":unsafe")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV)))); - uno::Reference<uno::XInterface> tmp; - uno::XInterface * pMappedObject = reinterpret_cast<uno::XInterface *>(mapping.mapInterface(pObject, ::getCppuType(&tmp))); - - - cppu::FreeReference<uno::XInterface> flat_obj(pMappedObject, SAL_NO_ACQUIRE); - - { - cppu::EnvGuard envGuard(s_env); - - if (env_obj != flat_obj) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\trefs are not equal inside - FAILURE\n")); - } - - if (env_obj != flat_obj) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\trefs are not equal outside - FAILURE\n")); -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).enter(); - - s_env = uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe"))); - - - rtl::OUString result; - s_test_operator_arrow(); - s_test_operator_equal(); - s_test_operator_unequal(); - - s_test_operator_assign_empty_reference(); - s_test_operator_assign_inner_reference_inside(); - - s_test_method_set_with_empty_reference(); - s_test_method_set_inside_with_inner_reference(); - s_test_method_set_inside_with_outer_reference(); - s_test_method_set_outside_with_inner_reference(); - s_test_method_set_outside_with_outer_reference(); - - s_test_method_clear_inner_reference_inside(); - s_test_method_clear_inner_reference_outside(); - s_test_method_clear_outer_reference_inside(); - s_test_method_clear_outer_reference_outside(); - - s_env.clear(); - - - uno_Environment_enter(NULL); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/FreeReference/makefile.mk b/cppu/test/FreeReference/makefile.mk deleted file mode 100644 index 3d9a4069718b..000000000000 --- a/cppu/test/FreeReference/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := FreeReference.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -ObjectFactory_LIB := -lObjectFactory.$(COMID) - -.ELSE -ObjectFactory_LIB := $(LIBPRE) iObjectFactory.$(COMID).lib - -.ENDIF - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/FreeReference.test.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/IdentityMapping.test.cxx b/cppu/test/IdentityMapping.test.cxx deleted file mode 100644 index 3b232ce0461e..000000000000 --- a/cppu/test/IdentityMapping.test.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// Test for uno/mapping.hxx respectively com::sun::star::uno::Mapping - - -#include <iostream> - -#include "sal/main.h" - -#include "uno/mapping.hxx" - - -using namespace com::sun::star; - -static rtl::OUString s_comment; - -static void s_test__get_identity_mapping(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__get_identity_mapping\n")); - - uno::Mapping mapping(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))), - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)))); - - if (!mapping.get()) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get a Mapping - FAILURE\n")); -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__get_identity_mapping(); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/Map/Map.test.cxx b/cppu/test/Map/Map.test.cxx deleted file mode 100644 index 171d72f99f34..000000000000 --- a/cppu/test/Map/Map.test.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" - -#include "uno/environment.hxx" - -#include "cppu/Map.hxx" -#include "cppu/EnvGuards.hxx" - -#include "../ObjectFactory/ObjectFactory.hxx" - - -using namespace com::sun::star; - - -static rtl::OUString s_comment; -static uno::Environment s_env; - -extern "C" { -static void s_callee_in(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_in method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: \"")); - s_comment += uno::Environment::getCurrent().getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: ")); - s_comment += reason; - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - } -} - -static void s_callee_out(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_out method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: \"")); - s_comment += uno::Environment::getCurrent().getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (!valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: is in\n")); -} -} - -static uno::Reference<uno::XInterface> s_get_envObject(void) -{ - cppu::EnvGuard envGuard(s_env); - - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - - return uno::Reference<uno::XInterface>(pObject, SAL_NO_ACQUIRE); -} - -static uno::XInterface * s_x_get_flatObject(void) -{ - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_out)); - - return pObject; -} - -static uno::Reference<uno::XInterface> s_get_flatObject(void) -{ - return uno::Reference<uno::XInterface>(s_x_get_flatObject(), SAL_NO_ACQUIRE); -} - - -static void s_test__mapOut(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__mapOut:\n")); - - uno::Reference<uno::XInterface> obj; - - { - cppu::EnvGuard envGuard(s_env); - obj.set(cppu::mapOut(s_get_envObject().get(), - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)))), - SAL_NO_ACQUIRE); - } - - obj->acquire(); - obj->release(); -} - -static void s_test__mapIn(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__unshield:\n")); - - uno::Reference<uno::XInterface> obj; - - { - cppu::EnvGuard envGuard(s_env); - uno::XInterface * pObj = s_x_get_flatObject(); - obj.set(cppu::mapIn(pObj, - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)))), - SAL_NO_ACQUIRE); - - envGuard.clear(); - - pObj->release(); - } - - { - cppu::EnvGuard envGuard(s_env); - obj.clear(); - } -} - -static void s_test__mapOutAny(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__shieldAny:\n")); - - uno::Any out; - - { - cppu::EnvGuard envGuard(s_env); - uno::Any any; - any <<= s_get_envObject(); - cppu::mapOutAny(any, - &out, - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)))); - } - - uno::Reference<uno::XInterface> obj; - out >>= obj; - - obj->acquire(); - obj->release(); -} - -static void s_test__mapInAny(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__unshieldAny:\n")); - - uno::Any out; - { - uno::Any any(s_get_flatObject()); - - { - cppu::EnvGuard envGuard(s_env); - cppu::mapInAny(any, - &out, - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)))); - } - } - - { - cppu::EnvGuard envGuard(s_env); - - uno::Reference<uno::XInterface> obj; - out >>= obj; - - obj.clear(); - } -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).enter(); - - s_env = uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe"))); - - s_test__mapOut(); - s_test__mapOutAny(); - s_test__mapIn(); - s_test__mapInAny(); - - s_env.clear(); - - - uno_Environment_enter(NULL); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/Map/makefile.mk b/cppu/test/Map/makefile.mk deleted file mode 100644 index 6344efc48243..000000000000 --- a/cppu/test/Map/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := Map.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -ObjectFactory_LIB := -lObjectFactory.$(COMID) - -.ELSE -ObjectFactory_LIB := $(LIBPRE) iObjectFactory.$(COMID).lib - -.ENDIF - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/Map.test.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/Mapping.test.cxx b/cppu/test/Mapping.test.cxx deleted file mode 100644 index 1b763dd71cf2..000000000000 --- a/cppu/test/Mapping.test.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// Test for uno/mapping.hxx respectively com::sun::star::uno::Mapping - - -#include <iostream> - -#include "sal/main.h" - -#include "uno/mapping.hxx" - - -using namespace com::sun::star; - -static rtl::OUString s_comment; - -static void s_test__constructor_env_env(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__constructor_env_env\n")); - - uno::Mapping mapping(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))), - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)))); - - if (!mapping.get()) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get a Mapping - FAILURE\n")); -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__constructor_env_env(); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/ObjectFactory/CppObject.cxx b/cppu/test/ObjectFactory/CppObject.cxx deleted file mode 100644 index 541a4172e3d8..000000000000 --- a/cppu/test/ObjectFactory/CppObject.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "cppu/EnvDcp.hxx" -#include "cppuhelper/implbase1.hxx" - -#include "com/sun/star/uno/XComponentContext.hpp" - -#include "CppObject.hxx" - - -using namespace ::com::sun::star; - - -#ifdef LOG_LIFECYCLE -#define LOG_LIFECYCLE_CppObject -#endif - -#define LOG_LIFECYCLE_CppObject -#ifdef LOG_LIFECYCLE_CppObject -# include <iostream> -# define LOG_LIFECYCLE_CppObject_emit(x) x - -#else -# define LOG_LIFECYCLE_CppObject_emit(x) - -#endif - -CppObject::CppObject(Callee * pCallee) SAL_THROW((uno::RuntimeException)) - : m_nRef (1), - m_pCallee(pCallee) -{ - LOG_LIFECYCLE_CppObject_emit(fprintf(stderr, "LIFE: %s -> %p\n", "CppObject::CppObject", this)); -} - -CppObject::~CppObject() SAL_THROW((uno::RuntimeException)) -{ - LOG_LIFECYCLE_CppObject_emit(fprintf(stderr, "LIFE: %s -> %p\n", "CppObject::~CppObject", this)); -} - -void SAL_CALL CppObject::acquire() throw () -{ - m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::acquire")).pData); - - osl_incrementInterlockedCount(&m_nRef); -} - -void SAL_CALL CppObject::release() throw () -{ - m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::release")).pData); - - if (osl_decrementInterlockedCount(&m_nRef) == 0) - delete this; -} - -uno::Any SAL_CALL CppObject::queryInterface(uno::Type const & rType ) throw (uno::RuntimeException) -{ - m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::queryInterface")).pData); - - void * bla = this; - - return uno::Any(&bla, rType); -} - - -uno::XInterface * CppObject::s_create(Callee * pCallee) -{ - return new CppObject(pCallee); -} - -void CppObject::s_call(uno::XInterface * pXInterface) -{ - uno::Reference<uno::XInterface> tmp; - - pXInterface->queryInterface(::getCppuType(&tmp)); -} diff --git a/cppu/test/ObjectFactory/CppObject.hxx b/cppu/test/ObjectFactory/CppObject.hxx deleted file mode 100644 index f8f5786daa31..000000000000 --- a/cppu/test/ObjectFactory/CppObject.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CppObject_hxx -#define INCLUDED_CppObject_hxx - - -#include "com/sun/star/uno/XComponentContext.hpp" - - -#include "callee.hxx" - -namespace cssu = ::com::sun::star::uno; - - -class CppObject: public cssu::XInterface -{ -public: - static cssu::XInterface * s_create (Callee * pCallee); - static void s_release(cssu::XInterface * pXInterface); - static void s_call (cssu::XInterface * pXInterface); - - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); - - virtual cssu::Any SAL_CALL queryInterface(cssu::Type const & rType ) throw (cssu::RuntimeException); - -protected: - oslInterlockedCount m_nRef; - - explicit CppObject(Callee * pCallee) SAL_THROW((cssu::RuntimeException)); - virtual ~CppObject(void) SAL_THROW((cssu::RuntimeException)); - - Callee * m_pCallee; -}; - - -#endif diff --git a/cppu/test/ObjectFactory/ObjectFactory.cxx b/cppu/test/ObjectFactory/ObjectFactory.cxx deleted file mode 100644 index d4f251d028ee..000000000000 --- a/cppu/test/ObjectFactory/ObjectFactory.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#define CPPU_test_ObjectFactory_IMPL - -#include "UnoObject.hxx" -#include "CppObject.hxx" -#include "ObjectFactory.hxx" - - -using namespace com::sun::star; - - - -CPPU_test_ObjectFactory_EXPORT void * createObject(rtl::OUString const & envDcp, Callee * pCallee) -{ - void * result; - - if (envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))))) - result = CppObject::s_create(pCallee); - - else if (envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)))) - result = UnoObject_create(pCallee); - - else - abort(); - - return result; -} - -CPPU_test_ObjectFactory_EXPORT void callObject(rtl::OUString const & envDcp, void * pObject) -{ - if (envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))))) - CppObject::s_call(reinterpret_cast<uno::XInterface *>(pObject)); - - else if (envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)))) - UnoObject_call(reinterpret_cast<uno_Interface *>(pObject)); - - else - abort(); -} - diff --git a/cppu/test/ObjectFactory/ObjectFactory.hxx b/cppu/test/ObjectFactory/ObjectFactory.hxx deleted file mode 100644 index 768c4c430f9c..000000000000 --- a/cppu/test/ObjectFactory/ObjectFactory.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_ObjectFactory_hxx -#define INCLUDED_ObjectFactory_hxx - - -#include "callee.hxx" - - -#ifdef CPPU_test_ObjectFactory_IMPL -# define CPPU_test_ObjectFactory_EXPORT SAL_DLLPUBLIC_EXPORT - -#else -# define CPPU_test_ObjectFactory_EXPORT SAL_DLLPUBLIC_IMPORT - -#endif - - -CPPU_test_ObjectFactory_EXPORT void * createObject(rtl::OUString const & envDcp, Callee * pCallee); -CPPU_test_ObjectFactory_EXPORT void callObject (rtl::OUString const & envDcp, void *); - - -#endif diff --git a/cppu/test/ObjectFactory/UnoObject.cxx b/cppu/test/ObjectFactory/UnoObject.cxx deleted file mode 100644 index 9fa22c4ca52e..000000000000 --- a/cppu/test/ObjectFactory/UnoObject.cxx +++ /dev/null @@ -1,227 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "osl/interlck.h" -#include "uno/environment.h" -#include "uno/mapping.h" -#include "uno/dispatcher.h" -#include "typelib/typedescription.h" -#include "rtl/alloc.h" -#include "com/sun/star/uno/Any.hxx" - -#include "UnoObject.hxx" -#include "callee.hxx" - - -using namespace com::sun::star; - - -#ifdef LOG_LIFECYCLE -# define LOG_LIFECYCLE_UnoObject -#endif - -#define LOG_LIFECYCLE_UnoObject -#ifdef LOG_LIFECYCLE_UnoObject -# include <iostream> -# define LOG_LIFECYCLE_UnoObject_emit(x) x - -#else -# define LOG_LIFECYCLE_UnoObject_emit(x) - -#endif - - -struct UnoObject : public uno_Interface -{ - oslInterlockedCount m_nCount; - Callee * m_pCallee; -}; - - - -static bool s_isQueryInterfaceCall(rtl_uString * pMethod, - void * pArgs[], - const sal_Char * pQueriedType) -{ - static rtl::OString aPattern("com.sun.star.uno.XInterface::queryInterface"); - - bool bIsQueryInterfaceCall = - rtl_ustr_ascii_shortenedCompare_WithLength( - rtl_uString_getStr( pMethod ), - rtl_uString_getLength( pMethod ), - aPattern.getStr(), - aPattern.getLength() ) == 0; - - if (bIsQueryInterfaceCall) - { - typelib_TypeDescriptionReference * pTDR - = *(typelib_TypeDescriptionReference **)pArgs[ 0 ]; - - bIsQueryInterfaceCall = - rtl_ustr_ascii_compare( - rtl_uString_getStr( pTDR->pTypeName ), - pQueriedType ) == 0; - } - - return bIsQueryInterfaceCall; -} - -static void s_UnoObject_delete(UnoObject * pUnoObject) -{ - LOG_LIFECYCLE_UnoObject_emit(fprintf(stderr, "LIFE: %s -> %p\n", "s_UnoObject_delete", pUnoObject)); - - rtl_freeMemory(pUnoObject); -} - - -extern "C" { -static void SAL_CALL s_UnoObject_acquire(uno_Interface * pUnoI) -{ - UnoObject * pUnoObject = (UnoObject *)pUnoI; - - pUnoObject->m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::acquire")).pData); - - osl_incrementInterlockedCount(&pUnoObject->m_nCount); -} - -static void SAL_CALL s_UnoObject_release(uno_Interface * pUnoI) -{ - UnoObject * pUnoObject = (UnoObject *)pUnoI; - - pUnoObject->m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::release")).pData); - - if (osl_decrementInterlockedCount(&pUnoObject->m_nCount) == 0) - s_UnoObject_delete(pUnoObject); -} - -static void SAL_CALL s_UnoObject_dispatch( - uno_Interface * pUnoI, - typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException ) -{ - UnoObject * pUnoObject = (UnoObject *)pUnoI; - *ppException = NULL; - - pUnoObject->m_pCallee(rtl::OUString(pMemberType->pTypeName).pData); - - if (s_isQueryInterfaceCall(pMemberType->pTypeName, pArgs, "com.sun.star.uno.XInterface")) - { - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_typedescriptionreference_acquire(type_XInterface); - - uno::Any * pRet = (uno::Any *)pReturn; - pRet->pType = type_XInterface; - pRet->pData = &pRet->pReserved; - pRet->pReserved = pUnoObject; - - s_UnoObject_acquire(pUnoObject); - } - else - abort(); -} -} - -uno_Interface * UnoObject_create(Callee * pCallee) -{ - UnoObject * pUnoObject = (UnoObject *)rtl_allocateMemory(sizeof(UnoObject)); - - LOG_LIFECYCLE_UnoObject_emit(fprintf(stderr, "LIFE: %s -> %p\n", "UnoObject_create", pUnoObject)); - - pUnoObject->m_nCount = 1; - pUnoObject->m_pCallee = pCallee; - - pUnoObject->acquire = s_UnoObject_acquire; - pUnoObject->release = s_UnoObject_release; - pUnoObject->pDispatcher = s_UnoObject_dispatch; - - pUnoObject->m_pCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UnoObject_create")).pData); - - return pUnoObject; -} - -void UnoObject_release(uno_Interface * pUnoI) -{ - pUnoI->release(pUnoI); -} - - -void UnoObject_call(uno_Interface * pUnoI) -{ - uno_Any exception; - uno_Any * pException = &exception; - - uno_Interface * pUno_XInv = NULL; - - { - typelib_TypeDescription * g_pQITD = NULL; - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); - typelib_typedescriptionreference_getDescription( - &g_pQITD, pTXInterfaceDescr->ppAllMembers[ 0 ] ); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); - - - - uno_Any result; - - void * args[ 1 ]; - args[ 0 ] = &type_XInterface; - - pUnoI->pDispatcher(pUnoI, g_pQITD, &result, args, &pException); - - - typelib_TypeDescriptionReference * ret_type = result.pType; - switch (ret_type->eTypeClass) - { - case typelib_TypeClass_VOID: // common case - typelib_typedescriptionreference_release( ret_type ); - break; - case typelib_TypeClass_INTERFACE: - // tweaky... avoiding acquire/ release pair - typelib_typedescriptionreference_release( ret_type ); - pUno_XInv = (uno_Interface *) result.pReserved; // serving acquired interface - break; - default: - uno_any_destruct(&result, 0); - break; - } - } - - - pUno_XInv->release(pUno_XInv); -} diff --git a/cppu/test/ObjectFactory/UnoObject.hxx b/cppu/test/ObjectFactory/UnoObject.hxx deleted file mode 100644 index e2d9fba5aa6b..000000000000 --- a/cppu/test/ObjectFactory/UnoObject.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_UnoObject_hxx -#define INCLUDED_UnoObject_hxx - - -#include "rtl/ustring.hxx" -#include "uno/dispatcher.h" - -#include "callee.hxx" - - -uno_Interface * UnoObject_create (Callee * pCallee); -void UnoObject_release(uno_Interface * pUnoI); -void UnoObject_call (uno_Interface * pUnoI); - - -#endif diff --git a/cppu/test/ObjectFactory/callee.hxx b/cppu/test/ObjectFactory/callee.hxx deleted file mode 100644 index beb31d4f4dd9..000000000000 --- a/cppu/test/ObjectFactory/callee.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_callee_hxx -#define INCLUDED_callee_hxx - - -#include <rtl/ustring.hxx> - - -extern "C" { -typedef void Callee(rtl_uString * pMethod_name); -} - -#endif diff --git a/cppu/test/ObjectFactory/empty.def b/cppu/test/ObjectFactory/empty.def deleted file mode 100644 index b191c70cf03c..000000000000 --- a/cppu/test/ObjectFactory/empty.def +++ /dev/null @@ -1,5 +0,0 @@ -HEAPSIZE 0 -EXPORTS - - - diff --git a/cppu/test/ObjectFactory/makefile.mk b/cppu/test/ObjectFactory/makefile.mk deleted file mode 100644 index 1064c760d538..000000000000 --- a/cppu/test/ObjectFactory/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := ObjectFactory - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - -SHL1TARGET := ObjectFactory.$(COMID) -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(SLO)$/UnoObject.obj $(SLO)$/CppObject.obj $(SLO)$/ObjectFactory.obj -SHL1STDLIBS := $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -SHL1DEF := empty.def - - -.INCLUDE : target.mk - - diff --git a/cppu/test/Shield/Shield.test.cxx b/cppu/test/Shield/Shield.test.cxx deleted file mode 100644 index d08b60e59a45..000000000000 --- a/cppu/test/Shield/Shield.test.cxx +++ /dev/null @@ -1,249 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" - -#include "uno/environment.hxx" - -#include "cppu/Shield.hxx" -#include "cppu/EnvGuards.hxx" - -#include "../ObjectFactory/ObjectFactory.hxx" - - -using namespace com::sun::star; - - -static rtl::OUString s_comment; -static uno::Environment s_env; - -extern "C" { -static void s_callee_in(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_in method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: \"")); - s_comment += uno::Environment::getCurrent().getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: ")); - s_comment += reason; - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - } -} - -static void s_callee_out(rtl_uString * pMethod_name) -{ - rtl::OUString method_name(pMethod_name); - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\ts_callee_out method:\"")); - s_comment += method_name; - - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" env: \"")); - s_comment += uno::Environment::getCurrent().getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")); - - if (!s_env.is()) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: s_env not set")); - return; - } - - rtl::OUString reason; - int valid = s_env.isValid(&reason); - - if (!valid) - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - else - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE: is in\n")); -} -} - -static uno::Reference<uno::XInterface> s_get_envObject(void) -{ - cppu::EnvGuard envGuard(s_env); - - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_in)); - - return uno::Reference<uno::XInterface>(pObject, SAL_NO_ACQUIRE); -} - -static uno::XInterface * s_x_get_flatObject(void) -{ - uno::XInterface * pObject = reinterpret_cast<uno::XInterface *>( - createObject(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))), - s_callee_out)); - - return pObject; -} - -static uno::Reference<uno::XInterface> s_get_flatObject(void) -{ - return uno::Reference<uno::XInterface>(s_x_get_flatObject(), SAL_NO_ACQUIRE); -} - - -static void s_test__shield(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__shield:\n")); - - uno::Reference<uno::XInterface> obj; - - { - cppu::EnvGuard envGuard(s_env); - obj.set(cppu::shield(s_get_envObject().get()), SAL_NO_ACQUIRE); - } - - obj->acquire(); - obj->release(); -} - -static void s_test__unshield(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__unshield:\n")); - - uno::Reference<uno::XInterface> obj; - - { - cppu::EnvGuard envGuard(s_env); - uno::XInterface * pObj = s_x_get_flatObject(); - obj.set(cppu::unshield(pObj), SAL_NO_ACQUIRE); - - envGuard.clear(); - pObj->release(); - } - - { - cppu::EnvGuard envGuard(s_env); - obj.clear(); - } -} - -static void s_test__shieldAny(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__shieldAny:\n")); - - uno::Any out; - - { - cppu::EnvGuard envGuard(s_env); - uno::Any any; - any <<= s_get_envObject(); - cppu::shieldAny(any, &out); - } - - uno::Reference<uno::XInterface> obj; - out >>= obj; - - obj->acquire(); - obj->release(); -} - -static void s_test__unshieldAny(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test__unshieldAny:\n")); - - uno::Any out; - { - uno::Any any(s_get_flatObject()); - - { - cppu::EnvGuard envGuard(s_env); - cppu::unshieldAny(any, &out); - } - } - - { - cppu::EnvGuard envGuard(s_env); - - uno::Reference<uno::XInterface> obj; - out >>= obj; - - obj.clear(); - } -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))).enter(); - - s_env = uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe"))); - - s_test__shield(); - s_test__shieldAny(); - s_test__unshield(); - s_test__unshieldAny(); - - s_env.clear(); - - - uno_Environment_enter(NULL); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/Shield/makefile.mk b/cppu/test/Shield/makefile.mk deleted file mode 100644 index 119516ced695..000000000000 --- a/cppu/test/Shield/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := Shield.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -ObjectFactory_LIB := -lObjectFactory.$(COMID) - -.ELSE -ObjectFactory_LIB := $(LIBPRE) iObjectFactory.$(COMID).lib - -.ENDIF - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/Shield.test.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/UnsafeBridge/UnsafeBridge.test.pl b/cppu/test/UnsafeBridge/UnsafeBridge.test.pl deleted file mode 100755 index b61b92013387..000000000000 --- a/cppu/test/UnsafeBridge/UnsafeBridge.test.pl +++ /dev/null @@ -1,72 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests = ( - "EnvStack.tester :A:unsafe :A:unsafe \"-enter:A[0,not entered]-leave:A[0,not entered]\" :A:unsafe", # initially not entered&leave - "EnvStack.tester :unsafe:A :unsafe:A \"-enter:unsafe:A[1,OK]-leave:unsafe:A[1,OK]\" :unsafe", # enter - "EnvStack.tester \"\" :unsafe:A \"-into:unsafe:A[1,OK]\" :unsafe", # call into - "EnvStack.tester :unsafe :A \"-into:A[0,not entered]\" :unsafe", # call out - "EnvStack.tester \"\" :unsafe:affine:A \"-into:unsafe:affine:A[0,wrong thread]\" :unsafe", # wrong thread - "env.tester.bin CPP:unsafe" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/UnsafeBridge/makefile.mk b/cppu/test/UnsafeBridge/makefile.mk deleted file mode 100644 index 33a1c5c32299..000000000000 --- a/cppu/test/UnsafeBridge/makefile.mk +++ /dev/null @@ -1,42 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := UnsafeBridge.test.pl - - -.INCLUDE : settings.mk - - -.INCLUDE : target.mk - - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): UnsafeBridge.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/alignment.idl b/cppu/test/alignment.idl deleted file mode 100644 index 424c232fb14f..000000000000 --- a/cppu/test/alignment.idl +++ /dev/null @@ -1,205 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -#ifndef _TEST_ALIGNMENT_IDL_ -#define _TEST_ALIGNMENT_IDL_ - -#include <com/sun/star/uno/XInterface.idl> - -module test -{ -module alignment -{ - -struct C1 -{ - short n1; -}; -struct C2 : C1 -{ - long n2; -}; -struct C3 : C2 -{ - double d3; - long n3; -}; -struct C4 : C3 -{ - long n4; - double d4; -}; -struct C5 : C4 -{ - hyper n5; - boolean b5; -}; - -struct C6 : C1 -{ - C5 c; - boolean b6; -}; -struct C7 : C1 -{ - C1 c; - boolean b6; -}; -struct C8 : C1 -{ - any a; - boolean b6; -}; -struct C9 : C1 -{ - string s; - boolean b6; -}; -struct C10 : C1 -{ - float f; - boolean b6; -}; -struct C11 : C1 -{ - double d; - boolean b6; -}; -struct C12 : C1 -{ - hyper n; - boolean b6; -}; -struct C13 : C1 -{ - unsigned hyper n; - boolean b6; -}; -struct C14 : C1 -{ - ::com::sun::star::uno::XInterface x; - boolean b6; -}; - -struct C1x -{ - short sx; - double dx; -}; - -struct C6x : C1x -{ - C5 c; - boolean b6; -}; -struct C7x : C1x -{ - C1 c; - boolean b6; -}; -struct C8x : C1x -{ - any a; - boolean b6; -}; -struct C9x : C1x -{ - string s; - boolean b6; -}; -struct C10x : C1x -{ - float f; - boolean b6; -}; -struct C11x : C1x -{ - double d; - boolean b6; -}; -struct C12x : C1x -{ - hyper n; - boolean b6; -}; -struct C13x : C1x -{ - unsigned hyper n; - boolean b6; -}; -struct C14x : C1x -{ - ::com::sun::star::uno::XInterface x; - boolean b6; -}; - - -struct D -{ - short d; - long e; -}; -struct E -{ - boolean a; - boolean b; - boolean c; - short d; - long e; -}; - -struct M -{ - long n; - short o; -}; - -struct N : M -{ - short p; -}; -struct N2 -{ - M m; - short p; -}; -struct O : M -{ - double p; -}; -struct O2 : O -{ - double p2; -}; -struct P : N -{ - double p2; -}; - -}; // alignment -}; // test - -#endif diff --git a/cppu/test/alignment/diagnose.h b/cppu/test/alignment/diagnose.h deleted file mode 100644 index 1568f70adf47..000000000000 --- a/cppu/test/alignment/diagnose.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -#ifndef DIAGNOSE_H -#define DIAGNOSE_H - -#include <sal/types.h> -#include <stdio.h> - -#if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD)) && defined(INTEL) -#define ALIGNMENT(s, n) __alignof__ (s) -#else -#define ALIGNMENT(s, n) n -#endif - -#define OFFSET_OF( s, m ) ((sal_Size)((char *)&((s *)16)->m -16)) - -#define BINTEST_VERIFY( c ) \ - if (! (c)) { fprintf( stderr, "### binary compatibility test failed: " #c " [line %d]!!!\n", __LINE__ ); abort(); } - -#if OSL_DEBUG_LEVEL > 1 - -#define BINTEST_VERIFYOFFSET( s, m, n ) \ - fprintf( stderr, "> OFFSET_OF(" #s ", " #m ") = %lu\n", static_cast< unsigned long >(OFFSET_OF(s, m)) ); \ - if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %d instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); } -#define BINTEST_VERIFYSIZE( s, n ) \ - fprintf( stderr, "> sizeof (" #s ") = %lu\n", static_cast< unsigned long >(sizeof(s)) ); \ - if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %d instead of expected %d!!!\n", sizeof(s), n ); abort(); } -#define BINTEST_VERIFYALIGNMENT( s, n ) \ - fprintf( stderr, "> alignment of " #s " = %d\n", ALIGNMENT(s, n) ); \ - if (ALIGNMENT(s, n) != n) { fprintf( stderr, "### alignment of " #s " = %d instead of expected %d!!!\n", ALIGNMENT(s, n), n ); abort(); } - -#else - -#define BINTEST_VERIFYOFFSET( s, m, n ) \ - if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %lu instead of expected %lu!!!\n", static_cast< unsigned long >(OFFSET_OF(s, m)), static_cast< unsigned long >(n) ); abort(); } -#define BINTEST_VERIFYSIZE( s, n ) \ - if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %lu instead of expected %lu!!!\n", static_cast< unsigned long >(sizeof(s)), static_cast< unsigned long >(n) ); abort(); } -#define BINTEST_VERIFYALIGNMENT( s, n ) \ - if (ALIGNMENT(s, n) != n) { fprintf( stderr, "### alignment of " #s " = %d instead of expected %d!!!\n", ALIGNMENT(s, n), n ); abort(); } - -#endif - -#endif diff --git a/cppu/test/alignment/makefile.mk b/cppu/test/alignment/makefile.mk deleted file mode 100644 index 03e4d2de23a8..000000000000 --- a/cppu/test/alignment/makefile.mk +++ /dev/null @@ -1,84 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -# -# build /test first, then /test/alignment -# - -PRJ=..$/.. -PRJNAME=cppu -TARGET=alignment -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -NO_BSYMBOLIC=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -UNOUCRDEP=$(BIN)$/testcppu.rdb -UNOUCRRDB=$(BIN)$/testcppu.rdb -UNOUCROUT=$(INCCOM)$/test$/alignment -INCPRE+=$(INCCOM)$/test -I$(INCCOM)$/test$/alignment -I$(PRJ)$/test$/alignment - -.IF "$(src_env)" == "" -merge_rdb=$(SOLARBINDIR)$/udkapi.rdb -.ELSE -merge_rdb=$(SOLARBINDIR)$/applicat.rdb -.ENDIF - -DEPOBJFILES= \ - $(OBJ)$/pass1.obj \ - $(OBJ)$/pass2.obj - -APP1OBJS = $(OBJ)$/pass1.obj -APP1STDLIBS += $(CPPUHELPERLIB) $(CPPULIB) $(REGLIB) $(SALHELPERLIB) $(SALLIB) -APP1TARGET = pass1 - -APP2OBJS = $(OBJ)$/pass2.obj -APP2STDLIBS = $(SALLIB) -APP2TARGET = pass2 - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALLTAR: execute_pass2 -.ELSE -ALL: ALLDEP -.ENDIF - -.INCLUDE : target.mk - -$(MISC)$/pass2.cxx: $(APP1TARGETN) - regmerge $(UNOUCRRDB) / $(merge_rdb) - cppumaker @$(mktmp $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) $(foreach,c,$(shell @$(APP1TARGETN) -env:UNO_TYPES={$(subst,\,\\ $(UNOUCRRDB))} $(subst,\,\\ $(MISC)$/pass2.cxx) dump_types) -T$c) $(UNOUCRRDB)) - -execute_pass2: $(APP2TARGETN) - $(APP2TARGETN) - diff --git a/cppu/test/alignment/pass1.cxx b/cppu/test/alignment/pass1.cxx deleted file mode 100644 index f60446c82639..000000000000 --- a/cppu/test/alignment/pass1.cxx +++ /dev/null @@ -1,240 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "sal/main.h" - -#include <stdio.h> -#include <vector> - -#include <rtl/string.hxx> -#include <rtl/strbuf.hxx> -#include <rtl/bootstrap.hxx> -#include <rtl/process.h> - -#include <registry/reflread.hxx> - -// starting the executable: -// -env:UNO_CFG_URL=local;<absolute_path>..\\..\\test\\cfg_data;<absolute_path>\\cfg_update -// -env:UNO_TYPES=cpputest.rdb - -#include <cppuhelper/bootstrap.hxx> - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/registry/XSimpleRegistry.hpp> - -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) -#define OSTR(x) ::rtl::OUStringToOString( x, RTL_TEXTENCODING_ASCII_US ) - - -using namespace ::cppu; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -static void find_all_structs( - Reference< registry::XRegistryKey > const & xKey, - ::std::vector< OUString > * pNames ) -{ - if (xKey.is() && xKey->isValid()) - { - if (xKey->getValueType() == registry::RegistryValueType_BINARY) - { - Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() ); - RegistryTypeReader aReader( - (const sal_uInt8 *)aBytes.getConstArray(), - aBytes.getLength(), sal_False ); - - switch (aReader.getTypeClass()) - { - case RT_TYPE_EXCEPTION: - case RT_TYPE_STRUCT: - pNames->push_back( aReader.getTypeName().replace( '/', '.' ) ); - break; - default: - break; - } - } - - Sequence< Reference< registry::XRegistryKey > > keys( xKey->openKeys() ); - Reference< registry::XRegistryKey > const * pKeys = keys.getConstArray(); - for ( sal_Int32 nPos = keys.getLength(); nPos--; ) - { - find_all_structs( pKeys[ nPos ], pNames ); - } - } -} - -static OString makeIncludeName( OUString const & name ) SAL_THROW( () ) -{ - return OSTR(name.replace( '.', '/' )); -} -static OString makeCppName( OUString const & name ) SAL_THROW( () ) -{ - OStringBuffer buf( 64 ); - OString str( OSTR(name) ); - sal_Int32 n = 0; - do - { - buf.append( str.getToken( 0, '.', n ) ); - if (n >= 0) - buf.append( "::" ); - } - while (n >= 0); - return buf.makeStringAndClear(); -} - -//================================================================================================== -SAL_IMPLEMENT_MAIN() -{ - sal_Int32 argc = rtl_getAppCommandArgCount(); - if (argc < 1) - { - fprintf( stderr, "usage: pass1 pass2_source [typelist_to_stdout]\n" ); - return 1; - } - - try - { - // determine types rdb - OUString rdb_name; - Bootstrap bootstrap; - if (!bootstrap.getFrom( OUSTR("UNO_TYPES"), rdb_name ) || !rdb_name.getLength()) - { - fprintf( - stderr, - "### no UNO_TYPES registry found!!!\n\n" - "usage: pass1 pass2_source [typelist_to_stdout]\n" ); - return 1; - } - - Reference< XComponentContext > xContext( defaultBootstrap_InitialComponentContext() ); - - // read out all struct names from given registry - Reference< registry::XSimpleRegistry > xSimReg( createSimpleRegistry() ); - OSL_ASSERT( xSimReg.is() ); - xSimReg->open( rdb_name, sal_True, sal_False ); - OSL_ASSERT( xSimReg->isValid() ); - Reference< registry::XRegistryKey > xKey( xSimReg->getRootKey() ); - OSL_ASSERT( xKey.is() && xKey->isValid() ); - - ::std::vector< OUString > names; - names.reserve( 128 ); - find_all_structs( xKey->openKey( OUSTR("UCR") ), &names ); - - OUString fileName; - OSL_VERIFY( osl_Process_E_None == rtl_getAppCommandArg( 0, &fileName.pData ) ); - bool bDumpStdOut = (argc > 1); - - // generate pass2 output file [and type list] - OString str( OSTR(fileName) ); - FILE * hPass2 = fopen( str.getStr(), "w" ); - OSL_ASSERT( hPass2 ); - - size_t nPos; - for ( nPos = names.size(); nPos--; ) - { - OUString const & name = names[ nPos ]; - if (bDumpStdOut) - { - // type name on stdout - OString str2( OSTR(name) ); - fprintf( stdout, "%s\n", str2.getStr() ); - } - // all includes - OString includeName( makeIncludeName( name ) ); - fprintf( hPass2, "#include <%s.hdl>\n", includeName.getStr() ); - } - // include diagnose.h - fprintf( - hPass2, - "\n#include <diagnose.h>\n" - "#include \"sal/main.h\"\n\n" - "SAL_IMPLEMENT_MAIN()\n{\n" ); - // generate all type checks - for ( nPos = names.size(); nPos--; ) - { - OUString const & name = names[ nPos ]; - typelib_TypeDescription * pTD = 0; - typelib_typedescription_getByName( &pTD, name.pData ); - if (pTD) - { - if (! pTD->bComplete) - { - typelib_typedescription_complete( &pTD ); - } - typelib_CompoundTypeDescription * pCTD = (typelib_CompoundTypeDescription *)pTD; - - OString cppName( makeCppName( name ) ); - fprintf( - hPass2, "\tBINTEST_VERIFYSIZE( %s, %ld );\n", - cppName.getStr(), static_cast< long >(pTD->nSize) ); - fprintf( - hPass2, "\tBINTEST_VERIFYALIGNMENT( %s, %ld );\n", - cppName.getStr(), static_cast< long >(pTD->nAlignment) ); - // offset checks - for ( sal_Int32 nPos2 = pCTD->nMembers; nPos2--; ) - { - OString memberName( OSTR(pCTD->ppMemberNames[ nPos2 ]) ); - fprintf( - hPass2, "\tBINTEST_VERIFYOFFSET( %s, %s, %ld );\n", - cppName.getStr(), memberName.getStr(), - static_cast< long >(pCTD->pMemberOffsets[ nPos2 ]) ); - } - typelib_typedescription_release( pTD ); - } - else - { - OString str2( OSTR(name) ); - fprintf( stderr, "### cannot dump type %s!!!\n", str2.getStr() ); - } - } - fprintf( - hPass2, - "\n\tfprintf( stdout, \"> alignment test succeeded.\\n\" );\n" - "\treturn 0;\n}\n\n" ); - fclose( hPass2 ); - - Reference< lang::XComponent > xComp( xContext, UNO_QUERY ); - if (xComp.is()) - { - xComp->dispose(); - } - return 0; - } - catch (Exception & exc) - { - OString str( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - ::fprintf( stderr, "# caught exception: %s\n", str.getStr() ); - return 1; - } -} diff --git a/cppu/test/cascade_mapping/TestMapping.cxx b/cppu/test/cascade_mapping/TestMapping.cxx deleted file mode 100644 index 724946c5b8c0..000000000000 --- a/cppu/test/cascade_mapping/TestMapping.cxx +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "osl/interlck.h" -#include "uno/dispatcher.h" -#include "uno/mapping.hxx" - -#include "TestProxy.hxx" - - -#ifdef LOG_LIFECYCLE -#define LOG_LIFECYCLE_TestMapping -#endif - -#define LOG_LIFECYCLE_TestMapping -#ifdef LOG_LIFECYCLE_TestMapping -# include <iostream> -# define LOG_LIFECYCLE_TestMapping_emit(x) x - -#else -# define LOG_LIFECYCLE_TestMapping_emit(x) - -#endif - - -class SAL_DLLPRIVATE TestMapping : public uno_Mapping -{ -private: - oslInterlockedCount m_nCount; - uno_ExtEnvironment * m_pFrom; - uno_ExtEnvironment * m_pTo; - -public: - explicit TestMapping(uno_Environment * pFrom, uno_Environment * pTo); - ~TestMapping(void); - - void acquire() SAL_THROW(()); - void release() SAL_THROW(()); - - void SAL_CALL mapInterface(uno_Interface ** ppOut, - uno_Interface * pUnoI, - typelib_InterfaceTypeDescription * pTypeDescr - ) - SAL_THROW_EXTERN_C(); -}; - - -extern "C" { -static void SAL_CALL s_mapInterface( - uno_Mapping * pMapping, - void ** ppOut, - void * pUnoI, - typelib_InterfaceTypeDescription * pTypeDescr ) - SAL_THROW_EXTERN_C() -{ - TestMapping * pTestMapping = static_cast<TestMapping *>(pMapping); - pTestMapping->mapInterface((uno_Interface **)ppOut, (uno_Interface *)pUnoI, pTypeDescr); -} - - -static void SAL_CALL s_acquire(uno_Mapping * pMapping) SAL_THROW_EXTERN_C() -{ - TestMapping * pTestMapping = static_cast<TestMapping *>(pMapping); - pTestMapping->acquire(); -} - - -static void SAL_CALL s_release(uno_Mapping * pMapping) SAL_THROW_EXTERN_C() -{ - TestMapping * pTestMapping = static_cast<TestMapping * >(pMapping); - pTestMapping->release(); -} - -static void SAL_CALL s_free(uno_Mapping * pMapping) SAL_THROW_EXTERN_C() -{ - TestMapping * pTestMapping = static_cast<TestMapping * >(pMapping); - delete pTestMapping; -} -} - -TestMapping::TestMapping(uno_Environment * pFrom, uno_Environment * pTo) - SAL_THROW( () ) - : m_nCount(1), - m_pFrom(reinterpret_cast<uno_ExtEnvironment *>(pFrom)), - m_pTo (reinterpret_cast<uno_ExtEnvironment *>(pTo)) -{ - LOG_LIFECYCLE_TestMapping_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestMapping::TestMapping", this)); - - m_pFrom->aBase.acquire(&m_pFrom->aBase); - m_pTo ->aBase.acquire(&m_pTo ->aBase); - - uno_Mapping::acquire = s_acquire; - uno_Mapping::release = s_release; - uno_Mapping::mapInterface = s_mapInterface; -} - -TestMapping::~TestMapping(void) -{ - LOG_LIFECYCLE_TestMapping_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestMapping::~TestMapping", this)); - - m_pFrom->aBase.release(&m_pFrom->aBase); - m_pTo ->aBase.release(&m_pTo ->aBase); -} - - -void TestMapping::acquire() SAL_THROW(()) -{ - if (osl_incrementInterlockedCount(&m_nCount) == 1) - { - uno_Mapping * pMapping = this; - - ::uno_registerMapping(&pMapping, s_free, &m_pFrom->aBase, &m_pTo->aBase, NULL); - } -} - -void TestMapping::release() SAL_THROW(()) -{ - if (osl_decrementInterlockedCount(&m_nCount) == 0) - ::uno_revokeMapping(this); -} - - -void SAL_CALL TestMapping::mapInterface( - uno_Interface ** ppOut, - uno_Interface * pUnoI, - typelib_InterfaceTypeDescription * pTypeDescr ) - SAL_THROW_EXTERN_C() -{ - // get object id of uno interface to be wrapped - rtl_uString * pOId = 0; - m_pFrom->getObjectIdentifier(m_pFrom, &pOId, pUnoI); - - OSL_ASSERT(pOId); - - if (*ppOut) - { - (*ppOut)->release(*ppOut); - *ppOut = 0; - } - - // try to get any known interface from target environment - m_pTo->getRegisteredInterface(m_pTo, (void **)ppOut, pOId, pTypeDescr); - if (!*ppOut) // not yet there, register new proxy interface - { - // try to publish a new proxy (ref count initially 1) - TestProxy * pTestProxy = new TestProxy(pUnoI, pOId, pTypeDescr, m_pTo, m_pFrom); - - // proxy may be exchanged during registration - m_pTo->registerProxyInterface(m_pTo,(void **)&pTestProxy, TestProxy_free, pOId, pTypeDescr); - - *ppOut = pTestProxy; - } - - rtl_uString_release(pOId); -} - - -extern "C" void SAL_DLLPUBLIC_EXPORT SAL_CALL uno_initEnvironment(uno_Environment * /*pEnv*/) - SAL_THROW_EXTERN_C() -{ -} - -extern "C" void uno_ext_getMapping(uno_Mapping ** ppMapping, - uno_Environment * pFrom, - uno_Environment * pTo ) -{ - *ppMapping = new TestMapping(pFrom, pTo); - - ::uno_registerMapping(ppMapping, s_free, pFrom, pTo, NULL); -} diff --git a/cppu/test/cascade_mapping/TestMapping.def b/cppu/test/cascade_mapping/TestMapping.def deleted file mode 100644 index e8b4824657f9..000000000000 --- a/cppu/test/cascade_mapping/TestMapping.def +++ /dev/null @@ -1,11 +0,0 @@ -LIBRARY cppu3 -DESCRIPTION 'StarView 3.00 680 m124' -DATA READ WRITE SHARED -HEAPSIZE 0 -EXPORTS - uno_initEnvironment - uno_ext_getMapping - - - - diff --git a/cppu/test/cascade_mapping/TestProxy.cxx b/cppu/test/cascade_mapping/TestProxy.cxx deleted file mode 100644 index d72e11c2ecab..000000000000 --- a/cppu/test/cascade_mapping/TestProxy.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "uno/mapping.hxx" -#include "cppu/EnvDcp.hxx" - -#include "../mapping_tester/Mapping.tester.hxx" - -#include "TestProxy.hxx" - - -#ifdef LOG_LIFECYCLE -#define LOG_LIFECYCLE_TestProxy -#endif - -#define LOG_LIFECYCLE_TestProxy -#ifdef LOG_LIFECYCLE_TestProxy -# include <iostream> -# define LOG_LIFECYCLE_TestProxy_emit(x) x - -#else -# define LOG_LIFECYCLE_TestProxy_emit(x) - -#endif - - -using namespace com::sun::star; - -extern "C" void SAL_CALL TestProxy_free(uno_ExtEnvironment * /*pEnv*/, void * pObject) - SAL_THROW_EXTERN_C() -{ - TestProxy * pTestProxy = reinterpret_cast<TestProxy *>(pObject); - delete pTestProxy; -} - - -extern "C" { -static void SAL_CALL s_acquire(uno_Interface * pUnoI) SAL_THROW_EXTERN_C() -{ - TestProxy * pTestProxy = static_cast<TestProxy *>(pUnoI); - pTestProxy->acquire(); -} - -static void SAL_CALL s_release(uno_Interface * pUnoI) SAL_THROW_EXTERN_C() -{ - TestProxy * pTestProxy = static_cast<TestProxy *>(pUnoI); - pTestProxy->release(); -} - -static void SAL_CALL s_dispatch(uno_Interface * pUnoI, - typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException) - SAL_THROW_EXTERN_C() -{ - TestProxy * pThis = static_cast<TestProxy *>(pUnoI); - pThis->dispatch(pMemberType, pReturn, pArgs, ppException); -} -} - -TestProxy::TestProxy(uno_Interface * pObject, - rtl::OUString const & oid, - typelib_InterfaceTypeDescription * pTypeDescr, - uno_ExtEnvironment * pFrom_extEnv, - uno_ExtEnvironment * pTo_extEnv) - : m_nCount (1), - m_from_envDcp(pFrom_extEnv->aBase.pTypeName), - m_to_envDcp (pTo_extEnv ->aBase.pTypeName), - m_oid (oid), - m_pTypeDescr (pTypeDescr) -{ - LOG_LIFECYCLE_TestProxy_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestProxy::TestProxy", this)); - - // uno_Interface - uno_Interface::acquire = s_acquire; - uno_Interface::release = s_release; - uno_Interface::pDispatcher = s_dispatch; - - m_theObject = pObject; - m_theObject->acquire(m_theObject); - - typelib_typedescription_acquire(&pTypeDescr->aBase); - - m_pFrom_extEnv = pFrom_extEnv; - m_pFrom_extEnv->aBase.acquire(&m_pFrom_extEnv->aBase); - - m_pTo_extEnv = pTo_extEnv; - m_pTo_extEnv->aBase.acquire(&m_pTo_extEnv->aBase); - - m_pTo_extEnv->registerInterface(m_pTo_extEnv, reinterpret_cast<void **>(&pObject), oid.pData, pTypeDescr); -} - -TestProxy::~TestProxy(void) -{ - LOG_LIFECYCLE_TestProxy_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestProxy::~TestProxy", this)); - - m_pTo_extEnv->revokeInterface(m_pTo_extEnv, reinterpret_cast<void *>(m_theObject)); - - typelib_typedescription_release(&m_pTypeDescr->aBase); - m_theObject->release(m_theObject); - m_pFrom_extEnv->aBase.release(&m_pFrom_extEnv->aBase); - m_pTo_extEnv ->aBase.release(&m_pTo_extEnv->aBase); -} - -void TestProxy::acquire() SAL_THROW(()) -{ - if (osl_incrementInterlockedCount(&m_nCount) == 1) - { - uno_Interface * pThis = this; - m_pTo_extEnv->registerProxyInterface(m_pTo_extEnv, - (void **)&pThis, - TestProxy_free, - m_oid.pData, - m_pTypeDescr); - OSL_ASSERT(pThis == this); - } -} - -void TestProxy::release() SAL_THROW(()) -{ - if (osl_decrementInterlockedCount(&m_nCount) == 0) - { - m_pFrom_extEnv->revokeInterface(m_pFrom_extEnv, this); - } -} - -void TestProxy::dispatch(typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException) -{ - { - rtl::OUString arrow(RTL_CONSTASCII_USTRINGPARAM("-->")); - - if (!g_custom.getLength()) - g_custom += m_from_envDcp; - - g_custom += arrow; - g_custom += m_to_envDcp; - - m_theObject->pDispatcher(m_theObject, pMemberType, pReturn, pArgs, ppException); - - uno_Any * any = (uno_Any *)pReturn; - - void * pout = NULL; - - uno::Mapping mapping(m_to_envDcp, m_from_envDcp); - mapping.mapInterface(&pout, any->pReserved, any->pType); - - ((uno_Interface *)any->pReserved)->release((uno_Interface*)any->pReserved); - any->pReserved = pout; - } -} - diff --git a/cppu/test/cascade_mapping/TestProxy.hxx b/cppu/test/cascade_mapping/TestProxy.hxx deleted file mode 100644 index 3dae15ee8620..000000000000 --- a/cppu/test/cascade_mapping/TestProxy.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_TestProxy_hxx -#define INCLUDED_TestProxy_hxx - -#include "osl/interlck.h" -#include "uno/dispatcher.h" -#include "uno/environment.hxx" - - -extern "C" void SAL_CALL TestProxy_free(uno_ExtEnvironment * pEnv, void * pObject) SAL_THROW_EXTERN_C(); - - -class SAL_DLLPRIVATE TestProxy : public uno_Interface -{ -private: - uno_Interface * m_theObject; - uno_ExtEnvironment * m_pFrom_extEnv; - uno_ExtEnvironment * m_pTo_extEnv; - oslInterlockedCount m_nCount; - rtl::OUString m_from_envDcp; - rtl::OUString m_to_envDcp; - rtl::OUString m_oid; - typelib_InterfaceTypeDescription * m_pTypeDescr; - -public: - explicit TestProxy(uno_Interface * pObject, - rtl::OUString const & oid, - typelib_InterfaceTypeDescription * pTypeDescr, - uno_ExtEnvironment * pFrom_env, - uno_ExtEnvironment * pExtEnvironment); - ~TestProxy(void); - - - void acquire() SAL_THROW(()); - void release() SAL_THROW(()); - - void dispatch(typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException); -}; - - -#endif diff --git a/cppu/test/cascade_mapping/cascade_mapping.test.pl b/cppu/test/cascade_mapping/cascade_mapping.test.pl deleted file mode 100755 index 265010a56abb..000000000000 --- a/cppu/test/cascade_mapping/cascade_mapping.test.pl +++ /dev/null @@ -1,91 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests=( -"mapping.tester uno:test uno -s path.test \"uno:test-->uno\"", -"mapping.tester uno uno:test -s path.test \"uno-->uno:test\"", -"mapping.tester uno:test:bla uno -s path.test \"uno:test:bla-->uno:test-->uno\"", -"mapping.tester uno uno:test:bla -s path.test \"uno-->uno:test-->uno:test:bla\"", -"mapping.tester uno:test:bla:blubb uno -s path.test \"uno:test:bla:blubb-->uno:test:bla-->uno:test-->uno\"", -"mapping.tester uno uno:test:bla:blubb -s path.test \"uno-->uno:test-->uno:test:bla-->uno:test:bla:blubb\"", -"mapping.tester uno:bla uno:test -s path.test \"uno:bla-->uno-->uno:test\"", -"mapping.tester uno:test uno:bla -s path.test \"uno:test-->uno-->uno:bla\"", -"mapping.tester uno:test:blubb uno:bla -s path.test \"uno:test:blubb-->uno:test-->uno-->uno:bla\"", -"mapping.tester uno:test uno:bla:blubb -s path.test \"uno:test-->uno-->uno:bla-->uno:bla:blubb\"", -"mapping.tester uno:test:bla uno:test:blubb -s path.test \"uno:test:bla-->uno:test-->uno:test:blubb\"", -"mapping.tester CPP:bla uno -s path.test \"CPP:bla-->uno:bla-->uno\"", -"mapping.tester uno CPP:bla -s path.test \"uno-->uno:bla-->CPP:bla\"", -"mapping.tester CPP uno:bla -s path.test \"CPP-->uno-->uno:bla\"", -"mapping.tester CPP:bla uno:blubb -s path.test \"CPP:bla-->uno:bla-->uno-->uno:blubb\"", -"mapping.tester CPP:test:bla uno:test:blubb -s path.test \"CPP:test:bla-->uno:test:bla-->uno:test-->uno:test:blubb\"", -"mapping.tester CPP:bla CPP -s path.test \"CPP:bla-->uno:bla-->uno-->CPP\"", -"mapping.tester CPP CPP:bla -s path.test \"CPP-->uno-->uno:bla-->CPP:bla\"", -"mapping.tester CPP:bla:test CPP -s path.test \"CPP:bla:test-->uno:bla:test-->uno:bla-->uno-->CPP\"", -"mapping.tester CPP CPP:bla:test -s path.test \"CPP-->uno-->uno:bla-->uno:bla:test-->CPP:bla:test\"", -"mapping.tester CPP:bla CPP:blubb -s path.test \"CPP:bla-->uno:bla-->uno-->uno:blubb-->CPP:blubb\"", -"mapping.tester CPP:test:bla CPP:blubb -s path.test \"CPP:test:bla-->uno:test:bla-->uno:test-->uno-->uno:blubb-->CPP:blubb\"", -"mapping.tester CPP:bla CPP:test:blubb -s path.test \"CPP:bla-->uno:bla-->uno-->uno:test-->uno:test:blubb-->CPP:test:blubb\"", -"mapping.tester CPP:bae:bla CPP:test:blubb -s path.test \"CPP:bae:bla-->uno:bae:bla-->uno:bae-->uno-->uno:test-->uno:test:blubb-->CPP:test:blubb\"", -"mapping.tester CPP:test:bla CPP:test:blubb -s path.test \"CPP:test:bla-->uno:test:bla-->uno:test-->uno:test:blubb-->CPP:test:blubb\"" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/cascade_mapping/makefile.mk b/cppu/test/cascade_mapping/makefile.mk deleted file mode 100644 index 1d5434a6b940..000000000000 --- a/cppu/test/cascade_mapping/makefile.mk +++ /dev/null @@ -1,90 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := cascade_mappping.test.pl - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE - - -.INCLUDE : settings.mk - -CFLAGS += -fPIC - -VERSIONOBJ := # NO GetVersionInfo symbols :-) -ENVINCPRE := -I$(OUT)$/inc$/$(TARGET) - -HLD_DLLPRE := $(DLLPRE) -DLLPRE := - - -SHL1TARGET := path.test -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(OBJ)$/path.test.obj -SHL1DEF := path.test.def -SHL1STDLIBS := $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) -.IF "$(GUI)"=="WNT" -SHL1STDLIBS += $(BIN)$/mapping.tester.lib -.ENDIF - -SHL2TARGET := $(HLD_DLLPRE)bla_uno_uno -SHL2IMPLIB := i$(SHL2TARGET) -SHL2OBJS := $(SLO)$/TestMapping.obj $(SLO)$/TestProxy.obj -SHL2STDLIBS := $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -SHL2DEF := TestMapping.def -.IF "$(GUI)"=="WNT" -SHL2STDLIBS += $(BIN)$/mapping.tester.lib -.ENDIF - -SHL3TARGET := $(HLD_DLLPRE)blubb_uno_uno -SHL3IMPLIB := i$(SHL3TARGET) -SHL3OBJS := $(SHL2OBJS) -SHL3STDLIBS := $(SHL2STDLIBS) -SHL3DEF := $(SHL2DEF) - -SHL4TARGET := $(HLD_DLLPRE)bae_uno_uno -SHL4IMPLIB := i$(SHL4TARGET) -SHL4OBJS := $(SHL2OBJS) -SHL4STDLIBS := $(SHL2STDLIBS) -SHL4DEF := $(SHL2DEF) - -SHL5TARGET := $(HLD_DLLPRE)test_uno_uno -SHL5IMPLIB := i$(SHL5TARGET) -SHL5OBJS := $(SHL2OBJS) -SHL5STDLIBS := $(SHL2STDLIBS) -SHL5DEF := $(SHL2DEF) - - -.INCLUDE : target.mk - - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): cascade_mapping.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/cascade_mapping/path.test.cxx b/cppu/test/cascade_mapping/path.test.cxx deleted file mode 100644 index 1b2ddb1ebdfe..000000000000 --- a/cppu/test/cascade_mapping/path.test.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "rtl/ustring.hxx" - -#include "../mapping_tester/Mapping.tester.hxx" - - -D_CALLEE -{ - rtl::OUString const method_name(pMethod_name); - - if (g_check) - { - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tmethod: ")); - g_result += method_name; - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - mapping purpose path test --> ")); - - if (g_ref.compareTo(g_custom) == 0) - { - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - } - else - { - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\t\texpected: ")); - g_result += g_ref; - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\t\t got: ")); - g_result += g_custom; - g_result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - } - } -} - diff --git a/cppu/test/cascade_mapping/path.test.def b/cppu/test/cascade_mapping/path.test.def deleted file mode 100644 index ab7d8b00c62c..000000000000 --- a/cppu/test/cascade_mapping/path.test.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY cppu3 -DESCRIPTION 'StarView 3.00 680 m124' -DATA READ WRITE SHARED -HEAPSIZE 0 -EXPORTS - CALLEE - - diff --git a/cppu/test/cpputest.idl b/cppu/test/cpputest.idl deleted file mode 100644 index 89302cb02585..000000000000 --- a/cppu/test/cpputest.idl +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -#ifndef _TEST_CPPUTEST_IDL_ -#define _TEST_CPPUTEST_IDL_ - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/uno/TypeClass.idl> - -module test -{ - -struct Test1 -{ - short nInt16; - double dDouble; - boolean bBool; -}; - -struct Test2 -{ - short nInt16; - Test1 aTest1; -}; - -typedef Test1 TdTest1; - -struct Test3 -{ - byte nInt8; - float nFloat; - double nDouble; - short nInt16; - string aString; - unsigned short nuInt16; - hyper nInt64; - long nInt32; - unsigned hyper nuInt64; - unsigned long nuInt32; - com::sun::star::uno::TypeClass eType; - char wChar; - TdTest1 td; - boolean bBool; - any aAny; -}; - - -struct Base -{ - long n; - short o; -}; - -struct Base1 : Base -{ - short p; -}; - -struct Base2 : Base1 -{ - double p2; -}; - -interface XSimpleInterface : com::sun::star::uno::XInterface -{ - void method(); -}; - -}; //module test - -#endif diff --git a/cppu/test/env_substs/env_subst.test.cxx b/cppu/test/env_substs/env_subst.test.cxx deleted file mode 100644 index 585fcbf02d8a..000000000000 --- a/cppu/test/env_substs/env_subst.test.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include "sal/main.h" - -#include "uno/environment.hxx" - -#include <iostream> - - -using namespace com::sun::star; - -static rtl::OUString s_comment; - -static void s_test_substituting(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_substituting\n")); - - putenv(strdup("UNO_ENV_SUBST:uno:unsafe=uno:affine")); - - uno::Environment env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:unsafe"))); - if (!env.getTypeName().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:affine")))) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE - expected \"uno:affine\" instead of \"")); - s_comment += env.getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -static void s_test_not_substituting(void) -{ - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_not_substituting\n")); - - putenv(strdup("UNO_ENV_SUBST:uno:unsafe=uno:affine")); - - uno::Environment env(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:affine"))); - if (!env.getTypeName().equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:affine")))) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE - expected \"uno:affine\" instead of \"")); - s_comment += env.getTypeName(); - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n")); - } -} - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test_substituting(); - s_test_not_substituting(); - - - int ret; - if (s_comment.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - - std::cerr - << argv[0] - << std::endl - << rtl::OUStringToOString(s_comment, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} - diff --git a/cppu/test/env_substs/makefile.mk b/cppu/test/env_substs/makefile.mk deleted file mode 100644 index 58564ba8cce2..000000000000 --- a/cppu/test/env_substs/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := env_subst.test - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/env_subst.test.obj -APP1STDLIBS := $(CPPULIB) $(SALLIB) - - -.INCLUDE : target.mk diff --git a/cppu/test/env_tester/TestEnvironment.cxx b/cppu/test/env_tester/TestEnvironment.cxx deleted file mode 100644 index f91f78659316..000000000000 --- a/cppu/test/env_tester/TestEnvironment.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "uno/environment.h" - - -extern "C" void SAL_CALL uno_initEnvironment(uno_Environment * /*pEnv*/) - SAL_THROW_EXTERN_C() -{ -} diff --git a/cppu/test/env_tester/TestEnvironment.def b/cppu/test/env_tester/TestEnvironment.def deleted file mode 100644 index f59a32c4a174..000000000000 --- a/cppu/test/env_tester/TestEnvironment.def +++ /dev/null @@ -1,7 +0,0 @@ -LIBRARY cppu3 -DESCRIPTION 'StarView 3.00 680 m124' -DATA READ WRITE SHARED -HEAPSIZE 0 -EXPORTS - uno_initEnvironment - diff --git a/cppu/test/env_tester/env.tester.cxx b/cppu/test/env_tester/env.tester.cxx deleted file mode 100644 index fcc4cbfcd845..000000000000 --- a/cppu/test/env_tester/env.tester.cxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" -#include "rtl/ustring.hxx" -#include "rtl/string.hxx" -#include "rtl/alloc.h" -#include "uno/environment.hxx" -#include "uno/lbnames.h" - -using namespace com::sun::star; - - -static rtl::OUString s_replaceCPP(rtl::OUString const & str) -{ - rtl::OUString cpp(RTL_CONSTASCII_USTRINGPARAM("CPP")); - - rtl::OUString result; - - sal_Int32 index_old = 0; - sal_Int32 index = str.indexOf(cpp, index_old); - while (index != -1) - { - result += str.copy(index_old, index - index_old); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CPPU_STRINGIFY(CPPU_ENV))); - - index_old = index + 3; - index = str.indexOf(cpp, index_old); - } - result += str.copy(index_old); - - return result; -} - - -rtl::OUString register_test(rtl::OUString const & envDcp); -rtl::OUString purpenv_test(rtl::OUString const & envDcp); - - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - int ret = 0; - rtl::OUString message; - - if (argc == 2) - { - message = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - rtl::OUString envDcp(argv[1], rtl_str_getLength(argv[1]), RTL_TEXTENCODING_ASCII_US); - envDcp = s_replaceCPP(envDcp); - - - message += register_test(envDcp); - message += purpenv_test(envDcp); - - if (message.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE"))) == -1) - { - message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS PASSED\n")); - ret = 0; - } - else - { - message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TESTS _NOT_ PASSED\n")); - ret = -1; - } - } - else - message = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<env. descriptor>")); - - std::cerr - << argv[0] - << " " - << rtl::OUStringToOString(message, RTL_TEXTENCODING_ASCII_US).getStr() - << std::endl; - - return ret; -} diff --git a/cppu/test/env_tester/makefile.mk b/cppu/test/env_tester/makefile.mk deleted file mode 100644 index c418749e66bf..000000000000 --- a/cppu/test/env_tester/makefile.mk +++ /dev/null @@ -1,67 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := env.tester.bin - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE - - -.INCLUDE : settings.mk -.INCLUDE : ../../source/helper/purpenv/export.mk - - -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -ObjectFactory_LIB := -lObjectFactory.$(COMID) - -.ELSE -ObjectFactory_LIB := $(LIBPRE) iObjectFactory.$(COMID).lib - -.ENDIF - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/env.tester.obj $(OBJ)$/purpenv.test.obj $(OBJ)$/register.test.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(CPPULIB) $(SALLIB) - - -SHL1TARGET := purpA_uno_uno -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(SLO)$/TestEnvironment.obj -SHL1STDLIBS := $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -SHL1DEF := TestEnvironment.def - -SHL2TARGET := purpB_uno_uno -SHL2IMPLIB := i$(SHL2TARGET) -SHL2OBJS := $(SHL1OBJS) -SHL2STDLIBS := $(SHL1STDLIBS) -SHL2DEF := $(SHL1DEF) - - -.INCLUDE : target.mk diff --git a/cppu/test/env_tester/purpenv.test.cxx b/cppu/test/env_tester/purpenv.test.cxx deleted file mode 100644 index 42da4d300189..000000000000 --- a/cppu/test/env_tester/purpenv.test.cxx +++ /dev/null @@ -1,401 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" - -#include "uno/environment.hxx" -#include "uno/dispatcher.h" - -#include "typelib/typedescription.h" - -#include "com/sun/star/uno/Any.h" - -#include "../ObjectFactory/ObjectFactory.hxx" - - -using namespace com::sun::star; - - -static rtl::OUString g_usret(RTL_CONSTASCII_USTRINGPARAM("\n")); -static rtl::OUString g_ustab(RTL_CONSTASCII_USTRINGPARAM("\t")); -static rtl::OUString g_comment; -static uno::Environment g_env; -static bool g_check = 0; - -extern "C" { static void s_callee(rtl_uString * pMethod_name) -{ - if (g_check) - { - g_comment += g_ustab; - g_comment += g_ustab; - g_comment += rtl::OUString(pMethod_name); - - rtl::OUString reason; - int valid = g_env.isValid(&reason); - - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[")); - g_comment += rtl::OUString::valueOf((sal_Int32)valid); - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - g_comment += reason; - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]")); - - if (!valid) - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE")); - - g_comment += g_usret; - } -}} - - -static rtl::OUString s_test_registerInterface(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_registerInterface")); - g_comment += g_usret; - - rtl::OUString id(RTL_CONSTASCII_USTRINGPARAM("blabla")); - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_TypeDescription * pRet = NULL; - typelib_typedescriptionreference_getDescription(&pRet, type_XInterface); - - void * pObject = createObject(envDcp, s_callee); - g_check = 1; - g_env.get()->pExtEnv->registerInterface(g_env.get()->pExtEnv, - &pObject, - id.pData, - (struct _typelib_InterfaceTypeDescription *)pRet); - g_check = 0; - - g_env.get()->pExtEnv->revokeInterface(g_env.get()->pExtEnv, pObject); - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - - g_env.clear(); - - return g_comment; -} - -extern "C" { static void s_freeFunc(struct _uno_ExtEnvironment * /*pEnv*/, void * /*pProxy*/ ) -{ - if (g_check) - { - g_comment += g_ustab; - g_comment += g_ustab; - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("s_freeFunc")); - - rtl::OUString reason; - int valid = g_env.isValid(&reason); - - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[")); - g_comment += rtl::OUString::valueOf((sal_Int32)valid); - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - g_comment += reason; - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]")); - - if (!valid) - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - FAILURE")); - - g_comment += g_usret; - } -}} - -static rtl::OUString s_test_registerProxyInterface(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_registerProxyInterface")); - g_comment += g_usret; - - rtl::OUString id(RTL_CONSTASCII_USTRINGPARAM("blabla")); - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_TypeDescription * pRet = NULL; - typelib_typedescriptionreference_getDescription(&pRet, type_XInterface); - - void * pObject = createObject(envDcp, s_callee); - g_check = 1; - g_env.get()->pExtEnv->registerProxyInterface(g_env.get()->pExtEnv, - &pObject, - s_freeFunc, - id.pData, - (typelib_InterfaceTypeDescription *)pRet); - g_check = 0; - - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - g_check = 1; - g_env.get()->pExtEnv->revokeInterface(g_env.get()->pExtEnv, pObject); - g_check = 0; - - g_env.clear(); - - - return g_comment; -} - -static rtl::OUString s_test_revokeInterface(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_revokeInterface")); - g_comment += g_usret; - - rtl::OUString id(RTL_CONSTASCII_USTRINGPARAM("blabla")); - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_TypeDescription * pRet = NULL; - typelib_typedescriptionreference_getDescription(&pRet, type_XInterface); - - void * pObject = createObject(envDcp, s_callee); - g_env.get()->pExtEnv->registerInterface(g_env.get()->pExtEnv, - &pObject, - id.pData, - (struct _typelib_InterfaceTypeDescription *)pRet); - - g_check = 1; - g_env.get()->pExtEnv->revokeInterface(g_env.get()->pExtEnv, pObject); - g_check = 0; - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_getObjectIdentifier(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_getObjectIdentifier")); - g_comment += g_usret; - - rtl::OUString oId; - void * pObject = createObject(envDcp, s_callee); - g_check = 1; - g_env.get()->pExtEnv->getObjectIdentifier(g_env.get()->pExtEnv, &oId.pData, pObject); - g_check = 0; - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_getRegisteredInterface(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_getRegisteredInterface")); - g_comment += g_usret; - - rtl::OUString id(RTL_CONSTASCII_USTRINGPARAM("blabla")); - - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_TypeDescription * pRet = NULL; - typelib_typedescriptionreference_getDescription(&pRet, type_XInterface); - - void * pObject = createObject(envDcp, s_callee); - g_env.get()->pExtEnv->registerInterface(g_env.get()->pExtEnv, - &pObject, - id.pData, - (typelib_InterfaceTypeDescription *)pRet); - - - g_check = 1; - g_env.get()->pExtEnv->getRegisteredInterface(g_env.get()->pExtEnv, &pObject, id.pData, - (typelib_InterfaceTypeDescription *)pRet); - g_check = 0; - - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - g_env.get()->pExtEnv->revokeInterface(g_env.get()->pExtEnv, pObject); - - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_getRegisteredInterfaces(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_getRegisteredInterfaces")); - g_comment += g_usret; - - rtl::OUString id(RTL_CONSTASCII_USTRINGPARAM("blabla")); - - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_TypeDescription * pRet = NULL; - typelib_typedescriptionreference_getDescription(&pRet, type_XInterface); - - void * pObject = createObject(envDcp, s_callee); - g_env.get()->pExtEnv->registerInterface(g_env.get()->pExtEnv, - &pObject, - id.pData, - (typelib_InterfaceTypeDescription *)pRet); - - g_check = 1; - void ** ppObject; - sal_Int32 nCount; - g_env.get()->pExtEnv->getRegisteredInterfaces(g_env.get()->pExtEnv, &ppObject, &nCount, rtl_allocateMemory); - g_check = 0; - - - if (nCount != 1) - { - g_comment += g_ustab; - g_comment += g_ustab; - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("more than one object registered -> FAILURE")); - g_comment += g_usret; - } - - if (*ppObject != pObject) - { - g_comment += g_ustab; - g_comment += g_ustab; - g_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("returned object is not the registerd one -> FAILURE")); - g_comment += g_usret; - } - - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, *ppObject); - - g_env.get()->pExtEnv->revokeInterface(g_env.get()->pExtEnv, pObject); - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - - rtl_freeMemory(ppObject); - - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_computeObjectIdentifier(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_computeObjectIdentifier")); - g_comment += g_usret; - - rtl::OUString oId; - void * pObject = createObject(envDcp, s_callee); - g_check = 1; - g_env.get()->pExtEnv->computeObjectIdentifier(g_env.get()->pExtEnv, &oId.pData, pObject); - g_check = 0; - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_acquire(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_acquire")); - g_comment += g_usret; - void * pObject = createObject(envDcp, s_callee); - - g_check = 1; - g_env.get()->pExtEnv->acquireInterface(g_env.get()->pExtEnv, pObject); - g_check = 0; - - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - g_env.clear(); - - return g_comment; -} - -static rtl::OUString s_test_release(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - g_comment = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\ts_test_release")); - g_comment += g_usret; - void * pObject = createObject(envDcp, s_callee); - - g_check = 1; - g_env.get()->pExtEnv->releaseInterface(g_env.get()->pExtEnv, pObject); - g_check = 0; - - g_env.clear(); - - return g_comment; -} - - -rtl::OUString purpenv_test(rtl::OUString const & envDcp) -{ - g_env = uno::Environment(envDcp); - - rtl::OUString result; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("purpenv_test")); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - result += s_test_registerInterface(envDcp); - result += g_usret; - - result += s_test_registerProxyInterface(envDcp); - result += g_usret; - - result += s_test_revokeInterface(envDcp); - result += g_usret; - - result += s_test_getObjectIdentifier(envDcp); - result += g_usret; - - result += s_test_getRegisteredInterface(envDcp); - result += g_usret; - - result += s_test_getRegisteredInterfaces(envDcp); - result += g_usret; - - result += s_test_computeObjectIdentifier(envDcp); - result += g_usret; - - result += s_test_acquire(envDcp); - result += g_usret; - - result += s_test_release(envDcp); - result += g_usret; - - return result; -} diff --git a/cppu/test/env_tester/register.test.cxx b/cppu/test/env_tester/register.test.cxx deleted file mode 100644 index a98a14cac69b..000000000000 --- a/cppu/test/env_tester/register.test.cxx +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <iostream> - -#include "sal/main.h" -#include "rtl/ustring.hxx" -#include "rtl/string.hxx" -#include "rtl/alloc.h" -#include "uno/environment.hxx" -#include "uno/lbnames.h" - -using namespace com::sun::star; - - -static rtl::OUString s_test_getEnvironment(rtl::OUString const & envDcp, void * pContext) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\ts_test_getEnvironment(")); - result += envDcp; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += rtl::OUString::valueOf((long)pContext); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")\n")); - - uno::Environment env(envDcp, pContext); - - if (!env.is()) - { - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE: couldn't get env.\n")); - return result; - } - - if (rtl::OUString(env.getTypeName()).compareTo(envDcp)) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE: got environment has wrong descriptor.\n")); - - if (env.getContext() != pContext) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE: got environment has wrong context.\n")); - - - return result; -} - -static rtl::OUString s_test_regetEnvironment(rtl::OUString const & envDcp1, - rtl::OUString const & envDcp2 , - void * pContext1, void * pContext2) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\ts_test_regetEnvironment(")); - result += envDcp1; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += envDcp2; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += rtl::OUString::valueOf((long)pContext1); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", " )); - result += rtl::OUString::valueOf((long)pContext2); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")\n")); - - uno::Environment env1(envDcp1, pContext1); - uno::Environment env2(envDcp2, pContext2); - - if (! ((pContext1 == pContext2 && envDcp1 == envDcp2) ? env1.get() == env2.get() : env1.get() != env2.get()) - && env1.is() && env2.is()) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE:\n")); - - return result; -} - -static rtl::OUString s_test_regetEnvironment(rtl::OUString const & envDcp, void * pContext) -{ - return s_test_regetEnvironment(envDcp, envDcp, pContext, pContext); -} - -// static rtl::OUString s_test_regetEnvironment(rtl::OUString const & envDcp, void * pContext1, void * pContext2) -// { -// return s_test_regetEnvironment(envDcp, envDcp, pContext1, pContext2); -// } - -static rtl::OUString s_test_regetEnvironment(rtl::OUString const & envDcp1, rtl::OUString const & envDcp2, void * pContext) -{ - return s_test_regetEnvironment(envDcp1, envDcp2, pContext, pContext); -} - - -static int s_is_registered(rtl::OUString const & envDcp, void * pContext) -{ - int result = 0; - - uno_Environment ** ppEnvs = NULL; - sal_Int32 nLen = 0; - - uno_getRegisteredEnvironments(&ppEnvs, &nLen, rtl_allocateMemory, envDcp.pData); - for (sal_Int32 i = 0; !result && i < nLen; ++ i) - { - result = result || (ppEnvs[i]->pContext == pContext && !rtl::OUString(ppEnvs[i]->pTypeName).compareTo(envDcp)); - - ppEnvs[i]->release(ppEnvs[i]); - } - rtl_freeMemory(ppEnvs); - - return result; -} - -static rtl::OUString s_test_uno_getRegisteredEnvironments_registered(rtl::OUString const & envDcp, void * pContext) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\ts_test_uno_getRegisteredEnvironments_registered(")); - result += envDcp; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += rtl::OUString::valueOf((long)pContext); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")\n")); - - uno::Environment env(envDcp, pContext); - - if (!env.is() || !s_is_registered(envDcp, pContext)) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE:\n")); - - return result; -} - -static rtl::OUString s_test_uno_getRegisteredEnvironments_notRegistered(rtl::OUString const & envDcp, void * pContext) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\ts_test_uno_getRegisteredEnvironments_notRegistered(")); - result += envDcp; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += rtl::OUString::valueOf((long)pContext); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")\n")); - - uno::Environment env(envDcp, pContext); - - if (!env.is() && !s_is_registered(envDcp, pContext)) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE:\n")); - - return result; -} - - -static rtl::OUString s_test_uno_createEnvironment(rtl::OUString const & envDcp, void * pContext) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\ts_test_uno_createEnvironment(")); - result += envDcp; - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(", ")); - result += rtl::OUString::valueOf((long)pContext); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")\n")); - - uno_Environment * pEnv = NULL; - uno_createEnvironment(&pEnv, envDcp.pData, pContext); - - if (!pEnv && !s_is_registered(envDcp, pContext)) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tFAILURE:\n")); - - if (pEnv) - pEnv->release(pEnv); - - return result; -} - - -rtl::OUString register_test(rtl::OUString const & envDcp) -{ - rtl::OUString env_A(envDcp); - env_A += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":purpA")); - - rtl::OUString env_B(envDcp); - env_B += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":purpB")); - - rtl::OUString result; - - result = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("registration_test")); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")); - - result += s_test_getEnvironment(envDcp, NULL); - result += s_test_getEnvironment(env_A, NULL); - result += s_test_getEnvironment(env_B, NULL); - - result += s_test_regetEnvironment(envDcp, NULL); - result += s_test_regetEnvironment(envDcp, (void *)0x1); - result += s_test_regetEnvironment(env_A, NULL) ; - result += s_test_regetEnvironment(env_A, (void *)0x1); - result += s_test_regetEnvironment(env_B, NULL) ; - result += s_test_regetEnvironment(env_B, (void *)0x1); - - result += s_test_regetEnvironment(envDcp, env_A, (void *)NULL); - result += s_test_regetEnvironment(envDcp, env_A, (void *)0x1) ; - result += s_test_regetEnvironment(envDcp, env_B, (void *)NULL); - result += s_test_regetEnvironment(envDcp, env_B, (void *)0x1) ; - result += s_test_regetEnvironment(env_A, env_B, (void *)NULL); - result += s_test_regetEnvironment(env_A, env_B, (void *)0x1) ; - - result += s_test_regetEnvironment(env_A, env_B, (void *)NULL, (void *)0x1); - - result += s_test_uno_getRegisteredEnvironments_registered(envDcp, (void *)NULL); - result += s_test_uno_getRegisteredEnvironments_registered(envDcp, (void *)0x1) ; - result += s_test_uno_getRegisteredEnvironments_registered(env_A, (void *)NULL); - result += s_test_uno_getRegisteredEnvironments_registered(env_A, (void *)0x1) ; - result += s_test_uno_getRegisteredEnvironments_registered(env_B, (void *)NULL); - result += s_test_uno_getRegisteredEnvironments_registered(env_B, (void *)0x1) ; - - result += s_test_uno_getRegisteredEnvironments_notRegistered(envDcp, NULL) ; - result += s_test_uno_getRegisteredEnvironments_notRegistered(envDcp, (void *)0x1); - result += s_test_uno_getRegisteredEnvironments_notRegistered(env_A, NULL) ; - result += s_test_uno_getRegisteredEnvironments_notRegistered(env_A, (void *)0x1); - result += s_test_uno_getRegisteredEnvironments_notRegistered(env_B, NULL) ; - result += s_test_uno_getRegisteredEnvironments_notRegistered(env_B, (void *)0x1); - - result += s_test_uno_createEnvironment(envDcp, NULL) ; - result += s_test_uno_createEnvironment(envDcp, (void *)0x1); - result += s_test_uno_createEnvironment(env_A, NULL) ; - result += s_test_uno_createEnvironment(env_A, (void *)0x1); - result += s_test_uno_createEnvironment(env_B, NULL) ; - result += s_test_uno_createEnvironment(env_B, (void *)0x1); - - return result; -} diff --git a/cppu/test/language_binding.idl b/cppu/test/language_binding.idl deleted file mode 100644 index 2a708ad56ee6..000000000000 --- a/cppu/test/language_binding.idl +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -#ifndef _TEST_LANGUAGE_BINDING_IDL_ -#define _TEST_LANGUAGE_BINDING_IDL_ - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/lang/IllegalArgumentException.idl> - -module test -{ - -enum TestEnum -{ - TEST, - ONE, - TWO, - CHECK, - LOLA, - PALOO, - ZA -}; - -/** - * simple c++ types - */ -struct TestSimple -{ - boolean Bool; - char Char; - byte Byte; - short Short; - unsigned short UShort; - long Long; - unsigned long ULong; - hyper Hyper; - unsigned hyper UHyper; - float Float; - double Double; - test::TestEnum Enum; -}; -/** - * equal to max size returned in registers on x86_64 - */ -struct SmallStruct -{ - hyper a; - hyper b; -}; -/** - * equal to max size returned in registers on ia64 - */ -struct MediumStruct -{ - hyper a; - hyper b; - hyper c; - hyper d; -}; -/** - * bigger than max size returned in registers on ia64 - */ -struct BigStruct -{ - hyper a; - hyper b; - hyper c; - hyper d; - hyper e; - hyper f; - hyper g; - hyper h; -}; -/** - * all floats, ia64 claims to handle them specially - */ -struct AllFloats -{ - float a; - float b; - float c; - float d; -}; - -/** - * complex c++ types - */ -struct TestElement : test::TestSimple -{ - string String; - com::sun::star::uno::XInterface Interface; - any Any; -}; -struct TestDataElements : test::TestElement -{ - sequence<test::TestElement > Sequence; -}; - -typedef TestDataElements TestData; - -/** - * Monster test interface to test language binding calls. - * - * @author Daniel Boelzle - */ -interface XLBTestBase : com::sun::star::uno::XInterface -{ - /** - * in parameter test, tests by calls reference also (complex types) - */ - [oneway] void setValues( [in] boolean bBool, [in] char cChar, [in] byte nByte, - [in] short nShort, [in] unsigned short nUShort, - [in] long nLong, [in] unsigned long nULong, - [in] hyper nHyper, [in] unsigned hyper nUHyper, - [in] float fFloat, [in] double fDouble, - [in] test::TestEnum eEnum, [in] string aString, - [in] com::sun::star::uno::XInterface xInterface, [in] any aAny, - [in] sequence<test::TestElement > aSequence, - [in] test::TestData aStruct ); - /** - * inout parameter test - */ - test::TestData setValues2( [inout] boolean bBool, [inout] char cChar, [inout] byte nByte, - [inout] short nShort, [inout] unsigned short nUShort, - [inout] long nLong, [inout] unsigned long nULong, - [inout] hyper nHyper, [inout] unsigned hyper nUHyper, - [inout] float fFloat, [inout] double fDouble, - [inout] test::TestEnum eEnum, [inout] string aString, - [inout] com::sun::star::uno::XInterface xInterface, [inout] any aAny, - [inout] sequence<test::TestElement > aSequence, - [inout] test::TestData aStruct ); - - /** - * out parameter test - */ - test::TestData getValues( [out] boolean bBool, [out] char cChar, [out] byte nByte, - [out] short nShort, [out] unsigned short nUShort, - [out] long nLong, [out] unsigned long nULong, - [out] hyper nHyper, [out] unsigned hyper nUHyper, - [out] float fFloat, [out] double fDouble, - [out] test::TestEnum eEnum, [out] string aString, - [out] com::sun::star::uno::XInterface xInterface, [out] any aAny, - [out] sequence<test::TestElement > aSequence, - [out] test::TestData aStruct ); - - /** - * register return test 1 - */ - test::SmallStruct echoSmallStruct( [in] test::SmallStruct aStruct ); - - /** - * register return test 2 - */ - test::MediumStruct echoMediumStruct( [in] test::MediumStruct aStruct ); - - /** - * register return test 3 - */ - test::BigStruct echoBigStruct( [in] test::BigStruct aStruct ); - - /** - * register return test 4 - */ - test::AllFloats echoAllFloats( [in] test::AllFloats aStruct ); - - [attribute] boolean Bool; - [attribute] byte Byte; - [attribute] char Char; - [attribute] short Short; - [attribute] unsigned short UShort; - [attribute] long Long; - [attribute] unsigned long ULong; - [attribute] hyper Hyper; - [attribute] unsigned hyper UHyper; - [attribute] float Float; - [attribute] double Double; - [attribute] test::TestEnum Enum; - [attribute] string String; - [attribute] com::sun::star::uno::XInterface Interface; - [attribute] any Any; - [attribute] sequence<test::TestElement > Sequence; - [attribute] test::TestData Struct; -}; - - -/** - * Inherting from monster; adds raiseException(). - * - * @author Daniel Boelzle - */ -interface XLanguageBindingTest : test::XLBTestBase -{ - /** - * params are there only for dummy, to test if all temp out params will be released. - */ - test::TestData raiseException( [out] boolean bBool, [out] char cChar, [out] byte nByte, - [out] short nShort, [out] unsigned short nUShort, - [out] long nLong, [out] unsigned long nULong, - [out] hyper nHyper, [out] unsigned hyper nUHyper, - [out] float fFloat, [out] double fDouble, - [out] test::TestEnum eEnum, [out] string aString, - [out] com::sun::star::uno::XInterface xInterface, [out] any aAny, - [out] sequence<test::TestElement > aSequence, - [out] test::TestData aStruct ) - raises( com::sun::star::lang::IllegalArgumentException ); - - /** - * raises runtime exception - */ - [attribute] long RuntimeException; -}; - -}; // test - - -#endif diff --git a/cppu/test/makefile.mk b/cppu/test/makefile.mk deleted file mode 100644 index 8eecf6bbf452..000000000000 --- a/cppu/test/makefile.mk +++ /dev/null @@ -1,156 +0,0 @@ -#************************************************************************* -# -# 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=testcppu -TARGET= testcppu -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -NO_BSYMBOLIC=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb -UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb -UNOUCROUT=$(OUT)$/inc$/test -INCPRE+=$(OUT)$/inc$/test - -OBJFILES= \ - $(OBJ)$/testcppu.obj \ - $(OBJ)$/test_di.obj \ - $(OBJ)$/test_Cincludes.obj -# $(OBJ)$/test_cuno.obj \ -# $(OBJ)$/test_sec.obj \ - -APP1TARGET= testcppu -APP1OBJS= \ - $(OBJ)$/testcppu.obj \ - $(OBJ)$/test_di.obj -# $(OBJ)$/test_cuno.obj -# $(OBJ)$/test_sec.obj - -APP1STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALHELPERLIB) \ - $(SALLIB) - -APP1DEF=$(MISC)$/$(APP1TARGET).def - -ALLIDLFILES:= \ - cpputest.idl \ - language_binding.idl \ - alignment.idl - - -APP2TARGET := Mapping.test -APP2OBJS := $(OBJ)$/Mapping.test.obj -APP2STDLIBS := $(CPPULIB) $(SALLIB) - -APP3TARGET := Environment.test -APP3OBJS := $(OBJ)$/Environment.test.obj -APP3STDLIBS := $(CPPULIB) $(SALLIB) - -APP4TARGET := IdentityMapping.test -APP4OBJS := $(OBJ)$/IdentityMapping.test.obj -APP4STDLIBS := $(CPPULIB) $(SALLIB) - - - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALL : $(BIN)$/testcppu.rdb unoheader ALLTAR -.ELSE -ALL: ALLDEP -.ENDIF - -.IF "$(COM)" == "MSC" -.IF "$(debug)" != "" -CFLAGS += /Ob0 -.ENDIF -.ENDIF - -.IF "$(extra_mapping)" != "" -CFLAGS += -DEXTRA_MAPPING -.ENDIF - -.INCLUDE : target.mk - -CPPUMAKERFLAGS = -L - -TYPES:= -Ttest.XLanguageBindingTest \ - -Ttest.XSimpleInterface \ - -Ttest.Test1 \ - -Ttest.Test2 \ - -Ttest.TdTest1 \ - -Ttest.Test3 \ - -Ttest.Base \ - -Ttest.Base1 \ - -Ttest.Base2 \ - -Tcom.sun.star.lang.XMultiServiceFactory \ - -Tcom.sun.star.lang.XSingleServiceFactory \ - -Tcom.sun.star.lang.XInitialization \ - -Tcom.sun.star.lang.XServiceInfo \ - -Tcom.sun.star.lang.XEventListener \ - -Tcom.sun.star.lang.XTypeProvider \ - -Tcom.sun.star.lang.DisposedException \ - -Tcom.sun.star.registry.XSimpleRegistry \ - -Tcom.sun.star.registry.XRegistryKey \ - -Tcom.sun.star.loader.XImplementationLoader \ - -Tcom.sun.star.registry.XImplementationRegistration \ - -Tcom.sun.star.lang.XComponent \ - -Tcom.sun.star.uno.XComponentContext \ - -Tcom.sun.star.container.XSet \ - -Tcom.sun.star.container.XNameContainer \ - -Tcom.sun.star.uno.TypeClass \ - -Tcom.sun.star.uno.XReference \ - -Tcom.sun.star.uno.XAdapter \ - -Tcom.sun.star.uno.XAggregation \ - -Tcom.sun.star.uno.XWeak \ - -Tcom.sun.star.beans.XPropertySet \ - -Tcom.sun.star.reflection.XIdlClassProvider \ - -Tcom.sun.star.container.XHierarchicalNameAccess \ - -Tcom.sun.star.uno.XCurrentContext - -$(BIN)$/testcppu.rdb: $(ALLIDLFILES) - idlc -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? - regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} - regmerge $@ / $(UNOUCRRDB) - touch $@ - -# regcomp -register -r $@ -c javaloader.dll -# regcomp -register -r $@ -c jen.dll - -unoheader: $(BIN)$/testcppu.rdb - cppumaker $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) $(TYPES) $(BIN)$/testcppu.rdb -# cunomaker -BUCR -O$(UNOUCROUT) $(TYPES) $(BIN)$/testcppu.rdb - diff --git a/cppu/test/mapping_tester/Mapping.tester.hxx b/cppu/test/mapping_tester/Mapping.tester.hxx deleted file mode 100644 index 6a2573a105f8..000000000000 --- a/cppu/test/mapping_tester/Mapping.tester.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_Mapping_tester_hxx -#define INCLUDED_Mapping_tester_hxx - - -#include "../ObjectFactory/callee.hxx" - - -#ifdef CPPU_TEST_MAPPING_TESTER_TESTS_IMPL -# define CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT SAL_DLLPUBLIC_EXPORT - -#elif defined(CPPU_TEST_MAPPING_TESTER_TESTS_LIB) -# define CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT extern - -#elif defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) -# define CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT extern __attribute__ ((weak)) - -#elif defined(__SUNPRO_CC) -# define CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT extern - extern rtl::OUString g_from_envDcp; - extern rtl::OUString g_to_envDcp; - extern rtl::OUString g_ref; - extern rtl::OUString g_custom; - extern rtl::OUString g_result; - extern int g_check; -# pragma weak g_from_envDcp -# pragma weak g_to_envDcp -# pragma weak g_ref -# pragma weak g_custom -# pragma weak g_result -# pragma weak g_check - -#else -# define CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT SAL_DLLPUBLIC_IMPORT - -#endif - -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT rtl::OUString g_from_envDcp; -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT rtl::OUString g_to_envDcp; -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT rtl::OUString g_ref; -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT rtl::OUString g_custom; -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT rtl::OUString g_result; -CPPU_TEST_MAPPING_TESTER_TESTS_EXPORT int g_check; - - -#define D_CALLEE extern "C" void CALLEE(rtl_uString * pMethod_name) - - -#endif diff --git a/cppu/test/mapping_tester/makefile.mk b/cppu/test/mapping_tester/makefile.mk deleted file mode 100644 index db62dcd5b14a..000000000000 --- a/cppu/test/mapping_tester/makefile.mk +++ /dev/null @@ -1,63 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := mapping.tester - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE - - -.INCLUDE : settings.mk - -VERSIONOBJ := # NO GetVersionInfo symbols :-) -ENVINCPRE := -I$(OUT)$/inc$/$(TARGET) -#CDEFS += -DLOG_LIFECYCLE - -.IF "$(COM)" == "GCC" -LINKFLAGS += -rdynamic -.ENDIF - - -.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC" -ObjectFactory_LIB := -lObjectFactory.$(COMID) - -.ELSE -ObjectFactory_LIB := $(LIBPRE) iObjectFactory.$(COMID).lib - -.ENDIF - - -APP1TARGET := mapping.tester -APP1OBJS := $(OBJ)$/mapping.tester.obj -APP1STDLIBS := $(ObjectFactory_LIB) $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) - - -.INCLUDE : target.mk - - diff --git a/cppu/test/mapping_tester/mapping.tester.cxx b/cppu/test/mapping_tester/mapping.tester.cxx deleted file mode 100644 index bed213daefba..000000000000 --- a/cppu/test/mapping_tester/mapping.tester.cxx +++ /dev/null @@ -1,456 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#define CPPU_TEST_MAPPING_TESTER_TESTS_IMPL - - -#include <iostream> - -#include "sal/main.h" -#include "osl/module.hxx" -#include "rtl/ustring.hxx" -#include "uno/environment.hxx" -#include "uno/mapping.hxx" - -#include "../ObjectFactory/ObjectFactory.hxx" -#include "Mapping.tester.hxx" - -using namespace ::com::sun::star; - - - -static uno::Mapping s_getMapping(rtl::OUString const & from_envDcp, - rtl::OUString const & to_envDcp, - uno::Environment * pSourceEnv, - uno::Environment * pTargetEnv) -{ - uno::Environment sourceEnv(from_envDcp); - uno::Environment targetEnv(to_envDcp); - - uno::Mapping mapping(sourceEnv, targetEnv); - - if (pSourceEnv) - *pSourceEnv = sourceEnv; - - if (pTargetEnv) - *pTargetEnv = targetEnv; - - return mapping; -} - -static void * s_mapObject(rtl::OUString const & from_envDcp, - rtl::OUString const & to_envDcp, - void * object, - uno::Environment * pSourceEnv, - uno::Environment * pTargetEnv) -{ - uno::Mapping mapping(s_getMapping(from_envDcp, to_envDcp, pSourceEnv, pTargetEnv)); - - void * mapped_object = NULL; - - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); - mapping.mapInterface(&mapped_object, object, pTXInterfaceDescr); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); - - return mapped_object; -} - - -static rtl::OUString s_test_regetMapping(void) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tmapping reget test --> ")); - - uno::Mapping mapping1(g_from_envDcp, g_to_envDcp); - uno::Mapping mapping2(g_from_envDcp, g_to_envDcp); - - if (mapping2.get() == mapping1.get()) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - - else - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - - result += g_result; - - return result; -} - -static rtl::OUString s_test_mapObject(Callee * pCallee) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tobject map test --> ")); - - void * pObject = createObject(g_to_envDcp, pCallee); - - uno::Environment sourceEnv; - uno::Environment targetEnv; - void * mapped_object = s_mapObject(g_to_envDcp, g_from_envDcp, pObject, &sourceEnv, &targetEnv); - sourceEnv.get()->pExtEnv->releaseInterface(sourceEnv.get()->pExtEnv, pObject); - sourceEnv.clear(); - - if (mapped_object) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - - else - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, mapped_object); - - result += g_result; - - return result; -} - -static rtl::OUString s_test_remapObject(Callee * pCallee) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tobject remap test --> ")); - - void * pObject = createObject(g_to_envDcp, pCallee); - - uno::Environment sourceEnv; - uno::Environment targetEnv; - void * mapped_object1 = s_mapObject(g_to_envDcp, g_from_envDcp, pObject, &sourceEnv, &targetEnv); - void * mapped_object2 = s_mapObject(g_to_envDcp, g_from_envDcp, pObject, NULL, NULL); - sourceEnv.get()->pExtEnv->releaseInterface(sourceEnv.get()->pExtEnv, pObject); - sourceEnv.clear(); - - if (mapped_object2 == mapped_object1) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - - else - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, mapped_object1); - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, mapped_object2); - - result += g_result; - - return result; -} - -static rtl::OUString s_test_mapBackObject(Callee * pCallee) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tobject map back test --> ")); - - void * pObject = createObject(g_to_envDcp, pCallee); - - uno::Environment to_sourceEnv; - uno::Environment to_targetEnv; - void * mapped_object = s_mapObject(g_to_envDcp, - g_from_envDcp, - pObject, - &to_sourceEnv, - &to_targetEnv); - - uno::Environment back_sourceEnv; - uno::Environment back_targetEnv; - void * mapped_back_object = s_mapObject(g_from_envDcp, - g_to_envDcp, - mapped_object, - &back_sourceEnv, - &back_targetEnv); - - if (back_targetEnv.get() != to_sourceEnv.get()) - abort(); - - if (back_sourceEnv.get() != to_targetEnv.get()) - abort(); - - if (pObject == mapped_back_object) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - - else - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - - to_sourceEnv .get()->pExtEnv->releaseInterface(to_sourceEnv .get()->pExtEnv, pObject); - to_targetEnv .get()->pExtEnv->releaseInterface(to_targetEnv .get()->pExtEnv, mapped_object); - back_targetEnv.get()->pExtEnv->releaseInterface(back_targetEnv.get()->pExtEnv, mapped_back_object); - - result += g_result; - - return result; -} - -static rtl::OUString s_test_objectRegistered(Callee * pCallee) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tobject registered test --> ")); - - void * pObject = createObject(g_to_envDcp, pCallee); - - uno::Environment sourceEnv; - uno::Environment targetEnv; - void * mapped_object = s_mapObject(g_to_envDcp, - g_from_envDcp, - pObject, - &sourceEnv, - &targetEnv); - - if (sourceEnv.get() == targetEnv.get()) - { - if (mapped_object != pObject) - abort(); - } - else - { - typelib_TypeDescriptionReference * type_XInterface = - * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; - TYPELIB_DANGER_GET( (typelib_TypeDescription **) &pTXInterfaceDescr, type_XInterface ); - - rtl_uString * pOId = 0; - targetEnv.get()->pExtEnv->getObjectIdentifier(targetEnv.get()->pExtEnv, &pOId, mapped_object); - - void * pOut = NULL; - - targetEnv.get()->pExtEnv->getRegisteredInterface(targetEnv.get()->pExtEnv, - &pOut, - pOId, - pTXInterfaceDescr); - - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *) pTXInterfaceDescr ); - - if (mapped_object == pOut) - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OKAY\n")); - - else - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED\n")); - - - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, pOut); - } - - sourceEnv.get()->pExtEnv->releaseInterface(sourceEnv.get()->pExtEnv, pObject); - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, mapped_object); - - result += g_result; - - return result; -} - - -// static void s_test_mappingNotEqual(char const * source1Name, char const * dest1Name, -// char const * source2Name, char const * dest2Name) -// { -// rtl::OUString source1EnvName(source1Name, rtl_str_getLength(source1Name), RTL_TEXTENCODING_ASCII_US); -// rtl::OUString dest1EnvName (dest1Name, rtl_str_getLength(dest1Name), RTL_TEXTENCODING_ASCII_US); - -// rtl::OUString source2EnvName(source2Name, rtl_str_getLength(source2Name), RTL_TEXTENCODING_ASCII_US); -// rtl::OUString dest2EnvName (dest2Name, rtl_str_getLength(dest2Name), RTL_TEXTENCODING_ASCII_US); - -// uno::Mapping mapping1(s_getMapping(source1EnvName, dest1EnvName, NULL, NULL)); -// uno::Mapping mapping2(s_getMapping(source2EnvName, dest2EnvName, NULL, NULL)); - -// if (mapping2.get() == mapping1.get()) -// { -// // fprintf(stderr, "***************** can not reget mapping\n"); -// abort(); -// } -// } - -static rtl::OUString s_test_call(Callee * pCallee) -{ - g_result = rtl::OUString(); - g_custom = rtl::OUString(); - - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\tobject call test --> ")); - - void * pObject = createObject(g_to_envDcp, pCallee); - - uno::Environment sourceEnv; - uno::Environment targetEnv; - void * mapped_object = s_mapObject(g_to_envDcp, g_from_envDcp, pObject, &sourceEnv, &targetEnv); - sourceEnv.get()->pExtEnv->releaseInterface(sourceEnv.get()->pExtEnv, pObject); - sourceEnv.clear(); - - g_check = 1; - callObject(g_from_envDcp, mapped_object); - g_check = 0; - - targetEnv.get()->pExtEnv->releaseInterface(targetEnv.get()->pExtEnv, mapped_object); - - result += g_result; - - return result; -} - - -static rtl::OString test_mapping_a(char const * pfrom_envDcp, - char const * pto_envDcp, - Callee * pCallee, - char const * pRef) -{ - g_from_envDcp = rtl::OUString(pfrom_envDcp, rtl_str_getLength(pfrom_envDcp), RTL_TEXTENCODING_ASCII_US); - g_to_envDcp = rtl::OUString(pto_envDcp, rtl_str_getLength(pto_envDcp), RTL_TEXTENCODING_ASCII_US); - g_ref = rtl::OUString(pRef, rtl_str_getLength(pRef), RTL_TEXTENCODING_ASCII_US); - - rtl::OUString result; - - g_check = 0; - - result += s_test_regetMapping (); - result += s_test_objectRegistered(pCallee); - result += s_test_remapObject (pCallee); - result += s_test_mapBackObject (pCallee); - result += s_test_mapObject (pCallee); - result += s_test_call (pCallee); - - return rtl::OUStringToOString(result, RTL_TEXTENCODING_ASCII_US); -} - - -static rtl::OString s_replaceCPP(rtl::OString const & str) -{ - rtl::OString result; - - sal_Int32 index_old = 0; - sal_Int32 index = str.indexOf("CPP", index_old); - while (index != -1) - { - result += str.copy(index_old, index - index_old); - result += rtl::OString(CPPU_STRINGIFY(CPPU_ENV)); - - index_old = index + 3; - index = str.indexOf("CPP", index_old); - } - result += str.copy(index_old); - - return result; -} - - -extern "C" { static void s_dummy(rtl_uString * pMethod_name) -{ - rtl::OUString result(RTL_CONSTASCII_USTRINGPARAM("\t\tmethod: ")); - result += rtl::OUString(pMethod_name); - result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" -dummy-\n")); - - g_result = result; -}} - -static Callee * s_pCustomCallee = s_dummy; - -extern "C" { static void s_callee(rtl_uString * pMethod_name) -{ - if (rtl::OUString(pMethod_name).equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::queryInterface")))) - { - rtl::OUString tmp; - - if (!g_from_envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)))) - { - tmp += g_from_envDcp; - tmp += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-->")); - } - - tmp += g_custom; - - if (!g_to_envDcp.match(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)))) - { - tmp += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-->")); - tmp += g_to_envDcp; - } - - g_custom = tmp; - s_pCustomCallee(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface::queryInterface")).pData); - } - else - s_pCustomCallee(pMethod_name); -}} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - int ret = 0; - rtl::OString message; - - if (argc == 3 || argc == 6) - { - rtl::OString from_envDcp(argv[1]); - from_envDcp = s_replaceCPP(from_envDcp); - - rtl::OString to_envDcp(argv[2]); - to_envDcp = s_replaceCPP(to_envDcp); - - osl::Module module; - - rtl::OString ref; - if (argc == 6 && rtl::OString(argv[3]).equals(rtl::OString("-s"))) - { - rtl::OUString libName(argv[4], rtl_str_getLength(argv[4]), RTL_TEXTENCODING_ASCII_US); - libName += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLEXTENSION)); - module.load(libName); - - s_pCustomCallee = (Callee *)module.getFunctionSymbol(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CALLEE"))); - if (!s_pCustomCallee) - abort(); - - ref = s_replaceCPP(rtl::OString(argv[5])); - } - - message += rtl::OString("TESTING: "); - message += from_envDcp; - message += rtl::OString("-->"); - message += to_envDcp; - message += rtl::OString("\n"); - - message += test_mapping_a(from_envDcp.getStr(), to_envDcp.getStr(), s_callee, ref); - - if (message.indexOf(rtl::OString("FAILED")) == -1) - message += rtl::OString("TESTS PASSED\n"); - - else - { - message += rtl::OString("TESTS _NOT_ PASSED\n"); - ret = -1; - } - } - else - message = "Usage: <source env. dcp> <destination env. dcp> [-s testfun <ref. string>]\n"; - - - std::cout << message.getStr(); - - return ret; -} diff --git a/cppu/test/purpenvhelper/TestEnv.cxx b/cppu/test/purpenvhelper/TestEnv.cxx deleted file mode 100644 index 65a91230dd03..000000000000 --- a/cppu/test/purpenvhelper/TestEnv.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - - -#include "cppu/EnvDcp.hxx" - -#include "cppu/helper/purpenv/Environment.hxx" -#include "cppu/helper/purpenv/Mapping.hxx" - - - -#define LOG_LIFECYCLE_TestEnv -#ifdef LOG_LIFECYCLE_TestEnv -# include <iostream> -# define LOG_LIFECYCLE_TestEnv_emit(x) x - -#else -# define LOG_LIFECYCLE_TestEnv_emit(x) - -#endif - - -class SAL_DLLPRIVATE TestEnv : public cppu::Enterable -{ - int m_inCount; - - virtual ~TestEnv(void); - -public: - explicit TestEnv(void); - -protected: - virtual void v_enter(void); - virtual void v_leave(void); - - virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam); - virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam); - - virtual int v_isValid (rtl::OUString * pReason); -}; - -TestEnv::TestEnv(void) - : m_inCount(0) -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::TestEnv(...)", this)); -} - -TestEnv::~TestEnv(void) -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::~TestEnv(void)", this)); -} - - -void TestEnv::v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam) -{ - ++ m_inCount; - pCallee(pParam); - -- m_inCount; -} - -void TestEnv::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam) -{ - -- m_inCount; - pCallee(pParam); - ++ m_inCount; -} - -void TestEnv::v_enter(void) -{ - ++ m_inCount; -} - -void TestEnv::v_leave(void) -{ - -- m_inCount; -} - -int TestEnv::v_isValid(rtl::OUString * pReason) -{ - int result = m_inCount & 1; - - if (result) - *pReason = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OK")); - - else - *pReason = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not entered/invoked")); - - return result; -} - -extern "C" void SAL_CALL uno_initEnvironment(uno_Environment * pEnv) SAL_THROW_EXTERN_C() -{ - cppu::helper::purpenv::Environment_initWithEnterable(pEnv, new TestEnv()); -} - -extern "C" void uno_ext_getMapping(uno_Mapping ** ppMapping, - uno_Environment * pFrom, - uno_Environment * pTo ) -{ - cppu::helper::purpenv::createMapping(ppMapping, pFrom, pTo); -} - diff --git a/cppu/test/purpenvhelper/TestEnv.def b/cppu/test/purpenvhelper/TestEnv.def deleted file mode 100644 index 1444d92c13fa..000000000000 --- a/cppu/test/purpenvhelper/TestEnv.def +++ /dev/null @@ -1,8 +0,0 @@ -HEAPSIZE 0 -EXPORTS - uno_initEnvironment - uno_ext_getMapping - - - - diff --git a/cppu/test/purpenvhelper/makefile.mk b/cppu/test/purpenvhelper/makefile.mk deleted file mode 100644 index 3d9b9eaedcbf..000000000000 --- a/cppu/test/purpenvhelper/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := purpenvhelper.test.pl - - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk -.INCLUDE : ../../source/helper/purpenv/export.mk - - -SHL1TARGET := TestEnv_uno_uno -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(SLO)$/TestEnv.obj -SHL1STDLIBS := $(purpenv_helper_LIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -SHL1DEF := TestEnv.def - - -.INCLUDE : target.mk - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): purpenvhelper.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/purpenvhelper/purpenvhelper.test.pl b/cppu/test/purpenvhelper/purpenvhelper.test.pl deleted file mode 100755 index aa5605f71416..000000000000 --- a/cppu/test/purpenvhelper/purpenvhelper.test.pl +++ /dev/null @@ -1,67 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests=( - "env.tester.bin uno:TestEnv" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/purpose_envs/makefile.mk b/cppu/test/purpose_envs/makefile.mk deleted file mode 100644 index 6e9fe8ebb067..000000000000 --- a/cppu/test/purpose_envs/makefile.mk +++ /dev/null @@ -1,44 +0,0 @@ -#************************************************************************* -# -# 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 := cppu -TARGET := purpose_envs.test.pl - -ENABLE_EXCEPTIONS := TRUE -NO_BSYMBOLIC := TRUE - - -.INCLUDE : settings.mk - - -.INCLUDE : target.mk - -ALLTAR: $(BIN)$/$(TARGET) - -$(BIN)$/$(TARGET): purpose_envs.test.pl - @+$(COPY) $^ $@ diff --git a/cppu/test/purpose_envs/purpose_envs.test.pl b/cppu/test/purpose_envs/purpose_envs.test.pl deleted file mode 100755 index 28abe2b72398..000000000000 --- a/cppu/test/purpose_envs/purpose_envs.test.pl +++ /dev/null @@ -1,67 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# 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. -# -#************************************************************************* - -my $rc = 0; -my $comment = ""; - - -@tests=( -"env.tester.bin uno" -); - -foreach $test (@tests) { - $output = ""; - - $cmd = $test; - open TESTER, $cmd . "|"; - while (<TESTER>) { - chomp; - - $output = $output . "\t" . $_ . "\n"; - } - close TESTER ; - - if ($? != 0) { - $comment = $comment . "TEST FAILED: " . $cmd . "\n"; - $comment = $comment . $output; - } - $rc = $rc + $?; -} - - -print $comment; - -if ($rc == 0) { - print "*********** SUCCESS\n"; -} -else { - print "*********** FAILURE\n"; -} diff --git a/cppu/test/surrogate.hxx b/cppu/test/surrogate.hxx deleted file mode 100644 index 3f479d3e5009..000000000000 --- a/cppu/test/surrogate.hxx +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <uno/dispatcher.h> -#include <uno/mapping.hxx> -#include <uno/environment.h> -#include <uno/data.h> -#include <osl/diagnose.h> -#include <osl/interlck.h> - -#include <com/sun/star/uno/Reference.hxx> - -/* -//================================================================================================== -struct UnoMediator : public uno_Interface -{ - oslInterlockedCount nRef; - uno_Interface * pDest; - - UnoMediator( uno_Interface * pDest ); - ~UnoMediator(); -}; - -//-------------------------------------------------------------------------------------------------- -inline static void SAL_CALL UnoMediator_acquire( uno_Interface * pUnoI ) -{ - osl_incrementInterlockedCount( &((UnoMediator *)pUnoI)->nRef ); -} -//-------------------------------------------------------------------------------------------------- -inline static void SAL_CALL UnoMediator_release( uno_Interface * pUnoI ) -{ - if (! osl_decrementInterlockedCount( &((UnoMediator *)pUnoI)->nRef )) - delete (UnoMediator *)pUnoI; -} -//-------------------------------------------------------------------------------------------------- -inline static void SAL_CALL UnoMediator_dispatch( - uno_Interface * pUnoI, const typelib_TypeDescription * pMemberType, - void * pReturn, void * pArgs[], uno_Any ** ppException ) -{ - (*((UnoMediator *)pUnoI)->pDest->pDispatcher)( - ((UnoMediator *)pUnoI)->pDest, pMemberType, pReturn, pArgs, ppException ); -} - -//__________________________________________________________________________________________________ -UnoMediator::UnoMediator( uno_Interface * pDest_ ) - : nRef( 0 ) - , pDest( pDest_ ) -{ - (*pDest->acquire)( pDest ); - uno_Interface::acquire = UnoMediator_acquire; - uno_Interface::release = UnoMediator_release; - uno_Interface::pDispatcher = UnoMediator_dispatch; -} -//__________________________________________________________________________________________________ -UnoMediator::~UnoMediator() -{ - (*pDest->release)( pDest ); -} -*/ - -//################################################################################################## - -template< class T > -inline sal_Bool makeSurrogate( com::sun::star::uno::Reference< T > & rOut, - const com::sun::star::uno::Reference< T > & rOriginal ) -{ - rOut.clear(); - - typelib_TypeDescription * pTD = 0; - const com::sun::star::uno::Type & rType = ::getCppuType( &rOriginal ); - TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() ); - OSL_ENSURE( pTD, "### cannot get typedescription!" ); - if (pTD) - { - uno_Environment * pCppEnv1 = 0; - uno_Environment * pCppEnv2 = 0; - - ::rtl::OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); - uno_getEnvironment( &pCppEnv1, aCppEnvTypeName.pData, 0 ); - uno_createEnvironment( &pCppEnv2, aCppEnvTypeName.pData, 0 ); // anonymous - - ::com::sun::star::uno::Mapping aMapping( pCppEnv1, pCppEnv2, ::rtl::OUString::createFromAscii("prot") ); - T * p = (T *)aMapping.mapInterface( rOriginal.get(), (typelib_InterfaceTypeDescription *)pTD ); - if (p) - { - rOut = p; - p->release(); - } - - (*pCppEnv2->release)( pCppEnv2 ); - (*pCppEnv1->release)( pCppEnv1 ); - - TYPELIB_DANGER_RELEASE( pTD ); - } -/* - ::com::sun::star::uno::Mapping aCpp2Uno( CPPU_CURRENT_LANGUAGE_BINDING_NAME, UNO_LB_UNO ); - ::com::sun::star::uno::Mapping aUno2Cpp( UNO_LB_UNO, CPPU_CURRENT_LANGUAGE_BINDING_NAME ); - OSL_ENSURE( aCpp2Uno.is() && aUno2Cpp.is(), "### cannot get mappings!" ); - if (aCpp2Uno.is() && aUno2Cpp.is()) - { - typelib_TypeDescription * pTD = 0; - const com::sun::star::uno::Type & rType = ::getCppuType( &rOriginal ); - TYPELIB_DANGER_GET( &pTD, rType.getTypeLibType() ); - OSL_ENSURE( pTD, "### cannot get typedescription!" ); - if (pTD) - { - uno_Interface * pUno = (uno_Interface *)aCpp2Uno.mapInterface( - rOriginal.get(), (typelib_InterfaceTypeDescription *)pTD ); - if (pUno) - { - UnoMediator * pPseudo = new UnoMediator( pUno ); - (*pPseudo->acquire)( pPseudo ); - OSL_ENSURE( uno_equals( &pUno, &pPseudo, pTD, 0 ), "### interfaces don't belong to same object, but they do!?" ); - (*pUno->release)( pUno ); - - T * pCpp = (T *)aUno2Cpp.mapInterface( - pPseudo, (typelib_InterfaceTypeDescription *)pTD ); - (*pPseudo->release)( pPseudo ); - - if (pCpp) - { - rOut = pCpp; - pCpp->release(); - } - } - TYPELIB_DANGER_RELEASE( pTD ); - } - } -*/ - return rOut.is(); -} diff --git a/cppu/test/test_Cincludes.c b/cppu/test/test_Cincludes.c deleted file mode 100644 index bacdbc67209e..000000000000 --- a/cppu/test/test_Cincludes.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <uno/any2.h> -#include <uno/data.h> -#include <uno/dispatcher.h> -#include <uno/environment.h> -#include <uno/mapping.h> -#include <uno/sequence2.h> -#include <uno/threadpool.h> -#include <typelib/typedescription.h> - diff --git a/cppu/test/test_cuno.c b/cppu/test/test_cuno.c deleted file mode 100644 index 5757e0c229bb..000000000000 --- a/cppu/test/test_cuno.c +++ /dev/null @@ -1,784 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#include <stdio.h> -#include <osl/diagnose.h> -#include <osl/time.h> -#include <osl/interlck.h> -#include <rtl/alloc.h> -// -/* -#include <uno/dispatcher.h> -#include <uno/environment.h> -#include <uno/mapping.hxx> -*/ -#include <uno/data.h> -#include <uno/any2.h> -#include <uno/sequence2.h> - -#include <test/XLanguageBindingTest.h> - - -typedef struct _InstanceData -{ - void const * m_XInterface[2]; - void const * m_XLBTestBase[2]; - void const * m_XLanguageBindingTest[2]; - - sal_Int32 m_refCount; - typelib_TypeDescription* m_pTDXInterface; - typelib_TypeDescription* m_pTDSeqTestElement; - typelib_TypeDescription* m_pTDTestDataElements; - test_TestDataElements m_data, m_structData; -} InstanceData; - -#define GET_THIS( p ) (InstanceData *)((void **)p)[1] - -//================================================================================================== -static void SAL_CALL c_acquire( void * p ) - SAL_THROW_EXTERN_C( ) -{ - CUNO_CALL( ((com_sun_star_uno_XInterface *)p) )->acquire( (com_sun_star_uno_XInterface *)p ); -} -//================================================================================================== -static void SAL_CALL c_release( void * p ) - SAL_THROW_EXTERN_C( ) -{ - CUNO_CALL( ((com_sun_star_uno_XInterface *)p) )->release( (com_sun_star_uno_XInterface *)p ); -} -//================================================================================================== -static void * SAL_CALL c_queryInterface( void * p, typelib_TypeDescriptionReference * pType ) - SAL_THROW_EXTERN_C( ) -{ - uno_Any aExc; - com_sun_star_uno_XInterface * pRet = NULL; - - if (CUNO_EXCEPTION_OCCURED( CUNO_CALL( ((com_sun_star_uno_XInterface *)p) )->queryInterface( (com_sun_star_uno_XInterface *)p, &aExc, &pRet, pType ) )) - { - uno_any_destruct( &aExc, c_release ); - return NULL; - } - else - { - return pRet; - } -} - -void defaultConstructData(test_TestDataElements* pData, typelib_TypeDescriptionReference * pElemType) -{ - pData->_Base._Base.Bool = sal_False; - pData->_Base._Base.Char = 0; - pData->_Base._Base.Byte = 0; - pData->_Base._Base.Short = 0; - pData->_Base._Base.UShort = 0; - pData->_Base._Base.Long = 0; - pData->_Base._Base.ULong = 0; - pData->_Base._Base.Hyper = 0; - pData->_Base._Base.UHyper = 0; - pData->_Base._Base.Float = 0; - pData->_Base._Base.Double = 0; - pData->_Base._Base.Enum = test_TestEnum_TEST; - pData->_Base.String = 0; - rtl_uString_new(&pData->_Base.String); - pData->_Base.Interface = 0; - uno_any_construct(&pData->_Base.Any, 0, 0, 0); -/* pData->Sequence = 0; */ - uno_type_sequence_construct( - &pData->Sequence, pElemType, 0, 0, c_acquire ); -} - -void assign1( test_TestSimple* rData, - sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test_TestEnum eEnum) -{ - rData->Bool = bBool; - rData->Char = cChar; - rData->Byte = nByte; - rData->Short = nShort; - rData->UShort = nUShort; - rData->Long = nLong; - rData->ULong = nULong; - rData->Hyper = nHyper; - rData->UHyper = nUHyper; - rData->Float = fFloat; - rData->Double = fDouble; - rData->Enum = eEnum; -} - -void assign2( test_TestElement* rData, - sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test_TestEnum eEnum, rtl_uString* rStr, - com_sun_star_uno_XInterface* xTest, - uno_Any* rAny, - typelib_TypeDescription* pTDIface) -{ - assign1( (test_TestSimple *)rData, - bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum ); - rtl_uString_assign(&rData->String, rStr); -/* uno_assignData(&rData->Interface, pTDIface, &xTest, pTDIface, c_queryInterface, c_acquire, c_release); */ - if ( rData->Interface ) - CUNO_CALL(rData->Interface)->release(rData->Interface); - - if ( xTest ) - { - CUNO_CALL(xTest)->acquire(xTest); - rData->Interface = xTest; - } else - { - rData->Interface = 0; - } - - uno_type_any_assign(&rData->Any, rAny->pData, rAny->pType, c_acquire, c_release); -} - -void assign3( test_TestDataElements* rData, - sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test_TestEnum eEnum, rtl_uString* rStr, - com_sun_star_uno_XInterface* xTest, - uno_Any* rAny, - /* sequence< test_TestElement >*/uno_Sequence* rSequence, - typelib_TypeDescription* pTDIface, - typelib_TypeDescription* pTDSeqElem) -{ - assign2( (test_TestElement *)rData, - bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum,rStr, xTest, rAny, pTDIface ); - uno_sequence_assign(&rData->Sequence, rSequence, pTDSeqElem, c_release); -} - -/* XInterface =============================================================================== */ - -/* XInterface::acquire */ -cuno_ErrorCode SAL_CALL XInterface_acquire( com_sun_star_uno_XInterface* pIFace) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - osl_incrementInterlockedCount( &pImpl->m_refCount ); - return CUNO_ERROR_NONE; -} - -/* XInterface::release */ -cuno_ErrorCode SAL_CALL XInterface_release( com_sun_star_uno_XInterface * pIFace ) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - if( osl_decrementInterlockedCount( &pImpl->m_refCount ) == 0) - { - uno_destructData(&pImpl->m_data, pImpl->m_pTDTestDataElements, c_release); - uno_destructData(&pImpl->m_structData, pImpl->m_pTDTestDataElements, c_release); - typelib_typedescription_release(pImpl->m_pTDXInterface); - typelib_typedescription_release(pImpl->m_pTDSeqTestElement); - typelib_typedescription_release(pImpl->m_pTDTestDataElements); - rtl_freeMemory( pImpl ); - } - return CUNO_ERROR_NONE; -} - -/* XInterface::queryInterface */ -cuno_ErrorCode SAL_CALL XInterface_queryInterface( com_sun_star_uno_XInterface * pIFace, uno_Any * pExc, com_sun_star_uno_XInterface ** pRet, typelib_TypeDescriptionReference * pTypeRef) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - com_sun_star_uno_XInterface * pIFaceRet = 0; - if ( pTypeRef ) - { - if( ! rtl_ustr_ascii_compare_WithLength( pTypeRef->pTypeName->buffer, pTypeRef->pTypeName->length, - "com.sun.star.uno.XInterface" ) ) - pIFaceRet = (com_sun_star_uno_XInterface *)&pImpl->m_XInterface; - else if( !rtl_ustr_ascii_compare_WithLength( pTypeRef->pTypeName->buffer, pTypeRef->pTypeName->length, - "test.XLBTestBase" ) ) - pIFaceRet = (com_sun_star_uno_XInterface *)&pImpl->m_XLBTestBase; - else if( !rtl_ustr_ascii_compare_WithLength( pTypeRef->pTypeName->buffer, pTypeRef->pTypeName->length, - "test.XLanguageBindingTest" ) ) - pIFaceRet = (com_sun_star_uno_XInterface *)&pImpl->m_XLanguageBindingTest; - - if( pIFaceRet ) - { - CUNO_CALL(pIFaceRet)->acquire( pIFaceRet ); - *pRet = pIFaceRet; - } else - { - *pRet = 0; - } - } - return CUNO_ERROR_NONE; -} - -/* XLBTestBase =============================================================================== */ - -/* XLBTestBase::getBool */ -cuno_ErrorCode SAL_CALL XLBTestBase_getBool( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Bool *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Bool; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setBool */ -cuno_ErrorCode SAL_CALL XLBTestBase_setBool( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Bool value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Bool = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getByte */ -cuno_ErrorCode SAL_CALL XLBTestBase_getByte( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int8 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Byte; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setByte */ -cuno_ErrorCode SAL_CALL XLBTestBase_setByte( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int8 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Byte = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getChar */ -cuno_ErrorCode SAL_CALL XLBTestBase_getChar( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Unicode *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Char; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setChar */ -cuno_ErrorCode SAL_CALL XLBTestBase_setChar( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Unicode value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Char = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getShort */ -cuno_ErrorCode SAL_CALL XLBTestBase_getShort( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int16 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Short; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setShort */ -cuno_ErrorCode SAL_CALL XLBTestBase_setShort( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int16 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Short = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getUShort */ -cuno_ErrorCode SAL_CALL XLBTestBase_getUShort( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt16 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.UShort; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setUShort */ -cuno_ErrorCode SAL_CALL XLBTestBase_setUShort( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt16 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.UShort = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getLong */ -cuno_ErrorCode SAL_CALL XLBTestBase_getLong( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int32 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Long; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setLong */ -cuno_ErrorCode SAL_CALL XLBTestBase_setLong( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int32 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Long = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getULong */ -cuno_ErrorCode SAL_CALL XLBTestBase_getULong( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt32 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.ULong; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setULong */ -cuno_ErrorCode SAL_CALL XLBTestBase_setULong( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt32 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.ULong = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getHyper */ -cuno_ErrorCode SAL_CALL XLBTestBase_getHyper( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int64 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Hyper; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setHyper */ -cuno_ErrorCode SAL_CALL XLBTestBase_setHyper( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Int64 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Hyper = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getUHyper */ -cuno_ErrorCode SAL_CALL XLBTestBase_getUHyper( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt64 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.UHyper; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setUHyper */ -cuno_ErrorCode SAL_CALL XLBTestBase_setUHyper( test_XLBTestBase * pIFace, uno_Any * pExc, sal_uInt64 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.UHyper = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getFloat */ -cuno_ErrorCode SAL_CALL XLBTestBase_getFloat( test_XLBTestBase * pIFace, uno_Any * pExc, float *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Float; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setFloat */ -cuno_ErrorCode SAL_CALL XLBTestBase_setFloat( test_XLBTestBase * pIFace, uno_Any * pExc, float value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Float = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getDouble */ -cuno_ErrorCode SAL_CALL XLBTestBase_getDouble( test_XLBTestBase * pIFace, uno_Any * pExc, double *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Double; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setDouble */ -cuno_ErrorCode SAL_CALL XLBTestBase_setDouble( test_XLBTestBase * pIFace, uno_Any * pExc, double value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Double = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getEnum */ -cuno_ErrorCode SAL_CALL XLBTestBase_getEnum( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestEnum *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = pImpl->m_data._Base._Base.Enum; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setEnum */ -cuno_ErrorCode SAL_CALL XLBTestBase_setEnum( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestEnum value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - pImpl->m_data._Base._Base.Enum = value; - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getString */ -cuno_ErrorCode SAL_CALL XLBTestBase_getString( test_XLBTestBase * pIFace, uno_Any * pExc, rtl_uString **pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - *pRet = 0; - rtl_uString_newFromString(pRet, pImpl->m_data._Base.String); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setString */ -cuno_ErrorCode SAL_CALL XLBTestBase_setString( test_XLBTestBase * pIFace, uno_Any * pExc, rtl_uString *value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - rtl_uString_assign(&pImpl->m_data._Base.String, value); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getInterface */ -cuno_ErrorCode SAL_CALL XLBTestBase_getInterface( test_XLBTestBase * pIFace, uno_Any * pExc, com_sun_star_uno_XInterface **pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); -/* uno_copyData(pRet, &pImpl->m_data._Base.Interface, pImpl->m_pTDXInterface, c_acquire); */ - if ( pImpl->m_data._Base.Interface ) - { - CUNO_CALL(pImpl->m_data._Base.Interface)->acquire(pImpl->m_data._Base.Interface); - *pRet = pImpl->m_data._Base.Interface; - } else - { - *pRet = 0; - } - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setInterface */ -cuno_ErrorCode SAL_CALL XLBTestBase_setInterface( test_XLBTestBase * pIFace, uno_Any * pExc, com_sun_star_uno_XInterface *value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); -/* uno_assignData(&pImpl->m_data._Base.Interface, pImpl->m_pTDXInterface, &value, pImpl->m_pTDXInterface, c_queryInterface, c_acquire, c_release); */ - if ( pImpl->m_data._Base.Interface ) - CUNO_CALL(pImpl->m_data._Base.Interface)->release(pImpl->m_data._Base.Interface); - - if ( value ) - { - CUNO_CALL(value)->acquire(value); - pImpl->m_data._Base.Interface = value; - } else - { - pImpl->m_data._Base.Interface = 0; - } - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getAny */ -cuno_ErrorCode SAL_CALL XLBTestBase_getAny( test_XLBTestBase * pIFace, uno_Any * pExc, uno_Any *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - typelib_TypeDescription* pTD = 0; - typelib_typedescriptionreference_getDescription(&pTD, pImpl->m_data._Base.Any.pType); - uno_any_construct(pRet, pImpl->m_data._Base.Any.pData, pTD, c_acquire); - typelib_typedescription_release(pTD); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setAny */ -cuno_ErrorCode SAL_CALL XLBTestBase_setAny( test_XLBTestBase * pIFace, uno_Any * pExc, uno_Any *value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - typelib_TypeDescription* pTD = 0; - typelib_typedescriptionreference_getDescription(&pTD, value->pType); - uno_any_assign(&pImpl->m_data._Base.Any, value->pData, pTD, c_acquire, c_release); - typelib_typedescription_release(pTD); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getSequence */ -cuno_ErrorCode SAL_CALL XLBTestBase_getSequence( test_XLBTestBase * pIFace, uno_Any * pExc, /*sequence< test.TestElement >*/uno_Sequence **pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - uno_sequence_construct(pRet, pImpl->m_pTDSeqTestElement, pImpl->m_data.Sequence->elements, pImpl->m_data.Sequence->nElements, c_acquire); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setSequence */ -cuno_ErrorCode SAL_CALL XLBTestBase_setSequence( test_XLBTestBase * pIFace, uno_Any * pExc, /*sequence< test.TestElement >*/uno_Sequence *value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - uno_sequence_assign(&pImpl->m_data.Sequence, value, pImpl->m_pTDSeqTestElement, c_release); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getStruct */ -cuno_ErrorCode SAL_CALL XLBTestBase_getStruct( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestDataElements *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - uno_copyData(pRet, &pImpl->m_structData, pImpl->m_pTDTestDataElements, c_acquire); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setStruct */ -cuno_ErrorCode SAL_CALL XLBTestBase_setStruct( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestDataElements *value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - uno_assignData(&pImpl->m_structData, pImpl->m_pTDTestDataElements, value, pImpl->m_pTDTestDataElements, c_queryInterface, c_acquire, c_release); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setValues */ -cuno_ErrorCode SAL_CALL XLBTestBase_setValues( test_XLBTestBase * pIFace, uno_Any * pExc, sal_Bool aBool, sal_Unicode aChar, sal_Int8 aByte, sal_Int16 aShort, sal_uInt16 aUShort, sal_Int32 aLong, sal_uInt32 aULong, sal_Int64 aHyper, sal_uInt64 aUHyper, float aFloat, double aDouble, test_TestEnum aEnum, rtl_uString* aString, com_sun_star_uno_XInterface *aInterface, uno_Any * aAny, /*sequence< test.TestElement >*/ uno_Sequence * aSequence, test_TestDataElements *aStruct) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - assign3(&pImpl->m_data, aBool, aChar, aByte, aShort, aUShort, aLong, aULong, aHyper, aUHyper, aFloat, aDouble, - aEnum, aString, aInterface, aAny,aSequence, pImpl->m_pTDXInterface, pImpl->m_pTDSeqTestElement); - uno_assignData(&pImpl->m_structData, pImpl->m_pTDTestDataElements, aStruct, pImpl->m_pTDTestDataElements, c_queryInterface, c_acquire, c_release); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::setValues2 */ -cuno_ErrorCode SAL_CALL XLBTestBase_setValues2( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestDataElements* pRet, sal_Bool* aBool, sal_Unicode* aChar, sal_Int8* aByte, sal_Int16* aShort, sal_uInt16* aUShort, sal_Int32* aLong, sal_uInt32* aULong, sal_Int64* aHyper, sal_uInt64* aUHyper, float* aFloat, double* aDouble, test_TestEnum* aEnum, rtl_uString** aString, com_sun_star_uno_XInterface **aInterface, uno_Any * aAny, /*sequence< test.TestElement >*/ uno_Sequence ** aSequence, test_TestDataElements * aStruct) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - assign3(&pImpl->m_data, *aBool, *aChar, *aByte, *aShort, *aUShort, *aLong, *aULong, *aHyper, *aUHyper, *aFloat, *aDouble, - *aEnum, *aString, *aInterface, aAny, *aSequence, pImpl->m_pTDXInterface, pImpl->m_pTDSeqTestElement); - uno_assignData(&pImpl->m_structData, pImpl->m_pTDTestDataElements, aStruct, pImpl->m_pTDTestDataElements, c_queryInterface, c_acquire, c_release); - uno_copyData(pRet, &pImpl->m_structData, pImpl->m_pTDTestDataElements, c_acquire); - return CUNO_ERROR_NONE; -} -/* XLBTestBase::getValues */ -cuno_ErrorCode SAL_CALL XLBTestBase_getValues( test_XLBTestBase * pIFace, uno_Any * pExc, test_TestDataElements* pRet, sal_Bool* aBool, sal_Unicode* aChar, sal_Int8* aByte, sal_Int16* aShort, sal_uInt16* aUShort, sal_Int32* aLong, sal_uInt32* aULong, sal_Int64* aHyper, sal_uInt64* aUHyper, float* aFloat, double* aDouble, test_TestEnum* aEnum, rtl_uString** aString, com_sun_star_uno_XInterface **aInterface, uno_Any * aAny, /*sequence< test.TestElement >*/ uno_Sequence ** aSequence, test_TestDataElements * aStruct) -{ - typelib_TypeDescription* pTD = 0; - InstanceData * pImpl = GET_THIS( pIFace ); - *aBool = pImpl->m_data._Base._Base.Bool; - *aChar = pImpl->m_data._Base._Base.Char; - *aByte = pImpl->m_data._Base._Base.Byte; - *aShort = pImpl->m_data._Base._Base.Short; - *aUShort = pImpl->m_data._Base._Base.UShort; - *aLong = pImpl->m_data._Base._Base.Long; - *aULong = pImpl->m_data._Base._Base.ULong; - *aHyper = pImpl->m_data._Base._Base.Hyper; - *aUHyper = pImpl->m_data._Base._Base.UHyper; - *aFloat = pImpl->m_data._Base._Base.Float; - *aDouble = pImpl->m_data._Base._Base.Double; - *aEnum = pImpl->m_data._Base._Base.Enum; - *aString = 0; - rtl_uString_newFromString(aString, pImpl->m_data._Base.String); -/* uno_copyData(aInterface, &pImpl->m_data._Base.Interface, pImpl->m_pTDXInterface, c_acquire); */ - if ( pImpl->m_data._Base.Interface ) - { - CUNO_CALL(pImpl->m_data._Base.Interface)->acquire(pImpl->m_data._Base.Interface); - *aInterface = pImpl->m_data._Base.Interface; - } else - { - *aInterface = 0; - } - typelib_typedescriptionreference_getDescription(&pTD, pImpl->m_data._Base.Any.pType); - uno_any_construct(aAny, pImpl->m_data._Base.Any.pData, pTD, c_acquire); - typelib_typedescription_release(pTD); - uno_sequence_construct(aSequence, pImpl->m_pTDSeqTestElement, pImpl->m_data.Sequence->elements, pImpl->m_data.Sequence->nElements, c_acquire); - uno_copyData(aStruct, &pImpl->m_structData, pImpl->m_pTDTestDataElements, c_acquire); - uno_copyData(pRet, &pImpl->m_structData, pImpl->m_pTDTestDataElements, c_acquire); - return CUNO_ERROR_NONE; -} - -/* XLanguageBindingTest =============================================================================== */ - -/* XLanguageBindingTest::getRuntimeException */ -cuno_ErrorCode SAL_CALL XLanguageBindingTest_getRuntimeException( test_XLanguageBindingTest * pIFace, uno_Any * pExc, sal_Int32 *pRet) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - com_sun_star_uno_RuntimeException aExc; - typelib_TypeDescription * pTD = 0; - rtl_uString * pTypeName = 0; - uno_Any excp; - - rtl_uString_newFromAscii( &pTypeName, "com.sun.star.uno.RuntimeException"); - typelib_typedescription_getByName(&pTD, pTypeName); - - aExc._Base.Message = 0; - rtl_uString_newFromAscii(&aExc._Base.Message, "dum dum dum ich tanz im kreis herum..."); - aExc._Base.Context = 0; - if (CUNO_EXCEPTION_OCCURED( CUNO_CALL(pIFace)->getInterface( (test_XLBTestBase *)pIFace, &excp, &aExc._Base.Context) )) - { - /* ... */ - uno_any_destruct( &excp, 0 ); - } - - uno_any_construct(pExc, &aExc, pTD, c_acquire); - uno_destructData(&aExc, pTD, c_release); - typelib_typedescription_release(pTD); - rtl_uString_release(pTypeName); - - return CUNO_ERROR_EXCEPTION; -} -/* XLanguageBindingTest::setRuntimeException */ -cuno_ErrorCode SAL_CALL XLanguageBindingTest_setRuntimeException( test_XLanguageBindingTest * pIFace, uno_Any * pExc, sal_Int32 value) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - com_sun_star_uno_RuntimeException aExc; - typelib_TypeDescription * pTD = 0; - rtl_uString * pTypeName = 0; - uno_Any excp; - - rtl_uString_newFromAscii( &pTypeName, "com.sun.star.uno.RuntimeException"); - typelib_typedescription_getByName(&pTD, pTypeName); - - aExc._Base.Message = 0; - rtl_uString_newFromAscii(&aExc._Base.Message, "dum dum dum ich tanz im kreis herum..."); - aExc._Base.Context = 0; - if (CUNO_EXCEPTION_OCCURED( CUNO_CALL(pIFace)->getInterface( (test_XLBTestBase *)pIFace, &excp, &aExc._Base.Context) )) - { - /* ... */ - uno_any_destruct( &excp, 0 ); - } - - uno_any_construct(pExc, &aExc, pTD, c_acquire); - uno_destructData(&aExc, pTD, c_release); - typelib_typedescription_release(pTD); - rtl_uString_release(pTypeName); - - return CUNO_ERROR_EXCEPTION; -} -/* XLanguageBindingTest::raiseException */ -cuno_ErrorCode SAL_CALL XLanguageBindingTest_raiseException( test_XLanguageBindingTest * pIFace, uno_Any * pExc, test_TestDataElements* pRet, sal_Bool* aBool, sal_Unicode* aChar, sal_Int8* aByte, sal_Int16* aShort, sal_uInt16* aUShort, sal_Int32* aLong, sal_uInt32* aULong, sal_Int64* aHyper, sal_uInt64* aUHyper, float* aFloat, double* aDouble, test_TestEnum* aEnum, rtl_uString ** aString, com_sun_star_uno_XInterface ** aInterface, uno_Any* aAny, /*sequence< test.TestElement >*/ uno_Sequence ** aSequence, test_TestDataElements* AStruct) -{ - InstanceData * pImpl = GET_THIS( pIFace ); - com_sun_star_lang_IllegalArgumentException aExc; - typelib_TypeDescription * pTD = 0; - rtl_uString * pTypeName = 0; - uno_Any excp; - - rtl_uString_newFromAscii( &pTypeName, "com.sun.star.lang.IllegalArgumentException"); - typelib_typedescription_getByName(&pTD, pTypeName); - - aExc.ArgumentPosition = 5; - aExc._Base.Message = 0; - rtl_uString_newFromAscii(&aExc._Base.Message, "dum dum dum ich tanz im kreis herum..."); - aExc._Base.Context = 0; - if (CUNO_EXCEPTION_OCCURED( CUNO_CALL(pIFace)->getInterface( (test_XLBTestBase *)pIFace, &excp, &aExc._Base.Context) )) - { - /* ... */ - uno_any_destruct( &excp, 0 ); - } - - uno_any_construct(pExc, &aExc, pTD, c_acquire); - uno_destructData(&aExc, pTD, c_release); - typelib_typedescription_release(pTD); - rtl_uString_release(pTypeName); - - return CUNO_ERROR_EXCEPTION; -} - - -static const com_sun_star_uno_XInterface_ftab s_XInterface_ftab={ - XInterface_queryInterface, - XInterface_acquire, - XInterface_release, - }; -static const test_XLBTestBase_ftab s_XLBTestBase_ftab={ - XInterface_queryInterface, - XInterface_acquire, - XInterface_release, - XLBTestBase_getBool, - XLBTestBase_setBool, - XLBTestBase_getByte, - XLBTestBase_setByte, - XLBTestBase_getChar, - XLBTestBase_setChar, - XLBTestBase_getShort, - XLBTestBase_setShort, - XLBTestBase_getUShort, - XLBTestBase_setUShort, - XLBTestBase_getLong, - XLBTestBase_setLong, - XLBTestBase_getULong, - XLBTestBase_setULong, - XLBTestBase_getHyper, - XLBTestBase_setHyper, - XLBTestBase_getUHyper, - XLBTestBase_setUHyper, - XLBTestBase_getFloat, - XLBTestBase_setFloat, - XLBTestBase_getDouble, - XLBTestBase_setDouble, - XLBTestBase_getEnum, - XLBTestBase_setEnum, - XLBTestBase_getString, - XLBTestBase_setString, - XLBTestBase_getInterface, - XLBTestBase_setInterface, - XLBTestBase_getAny, - XLBTestBase_setAny, - XLBTestBase_getSequence, - XLBTestBase_setSequence, - XLBTestBase_getStruct, - XLBTestBase_setStruct, - XLBTestBase_setValues, - XLBTestBase_setValues2, - XLBTestBase_getValues - }; -static const test_XLanguageBindingTest_ftab s_XLanguageBindingTest_ftab={ - XInterface_queryInterface, - XInterface_acquire, - XInterface_release, - XLBTestBase_getBool, - XLBTestBase_setBool, - XLBTestBase_getByte, - XLBTestBase_setByte, - XLBTestBase_getChar, - XLBTestBase_setChar, - XLBTestBase_getShort, - XLBTestBase_setShort, - XLBTestBase_getUShort, - XLBTestBase_setUShort, - XLBTestBase_getLong, - XLBTestBase_setLong, - XLBTestBase_getULong, - XLBTestBase_setULong, - XLBTestBase_getHyper, - XLBTestBase_setHyper, - XLBTestBase_getUHyper, - XLBTestBase_setUHyper, - XLBTestBase_getFloat, - XLBTestBase_setFloat, - XLBTestBase_getDouble, - XLBTestBase_setDouble, - XLBTestBase_getEnum, - XLBTestBase_setEnum, - XLBTestBase_getString, - XLBTestBase_setString, - XLBTestBase_getInterface, - XLBTestBase_setInterface, - XLBTestBase_getAny, - XLBTestBase_setAny, - XLBTestBase_getSequence, - XLBTestBase_setSequence, - XLBTestBase_getStruct, - XLBTestBase_setStruct, - XLBTestBase_setValues, - XLBTestBase_setValues2, - XLBTestBase_getValues, - XLanguageBindingTest_getRuntimeException, - XLanguageBindingTest_setRuntimeException, - XLanguageBindingTest_raiseException - }; - -com_sun_star_uno_XInterface* SAL_CALL createTestObject() -{ - InstanceData *pObj; - rtl_uString* usXInterface = 0; - rtl_uString* usSeqTestElement = 0; - rtl_uString* usTestDataElements = 0; - - /* Create a data instance of the component */ - pObj= (InstanceData*)rtl_allocateMemory( sizeof( InstanceData) ); - pObj->m_XInterface[0] = &s_XInterface_ftab; - pObj->m_XInterface[1] = pObj; - pObj->m_XLBTestBase[0] = &s_XLBTestBase_ftab; - pObj->m_XLBTestBase[1] = pObj; - pObj->m_XLanguageBindingTest[0] = &s_XLanguageBindingTest_ftab; - pObj->m_XLanguageBindingTest[1] = pObj; - - /* Initalize the reference counter member and other component data */ - pObj->m_refCount= 1; - - pObj->m_pTDXInterface = 0; - rtl_uString_newFromAscii( &usXInterface, "com.sun.star.uno.XInterface"); - typelib_typedescription_getByName(&pObj->m_pTDXInterface, usXInterface); - - pObj->m_pTDSeqTestElement = 0; - rtl_uString_newFromAscii( &usSeqTestElement, "[]test.TestElement"); - typelib_typedescription_getByName(&pObj->m_pTDSeqTestElement, usSeqTestElement); - - pObj->m_pTDTestDataElements = 0; - rtl_uString_newFromAscii( &usTestDataElements, "test.TestDataElements"); - typelib_typedescription_getByName(&pObj->m_pTDTestDataElements, usTestDataElements); - - defaultConstructData(&pObj->m_data, pObj->m_pTDSeqTestElement->pWeakRef); - defaultConstructData(&pObj->m_structData, pObj->m_pTDSeqTestElement->pWeakRef); - - rtl_uString_release(usXInterface); - rtl_uString_release(usSeqTestElement); - rtl_uString_release(usTestDataElements); - return (com_sun_star_uno_XInterface *)&pObj->m_XInterface; -} - diff --git a/cppu/test/test_di.cxx b/cppu/test/test_di.cxx deleted file mode 100644 index 88e8f9ac639d..000000000000 --- a/cppu/test/test_di.cxx +++ /dev/null @@ -1,888 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 -# undef OSL_DEBUG_LEVEL -# define OSL_DEBUG_LEVEL 2 -#endif - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include <stdio.h> -#include <string.h> -#include <rtl/ustring.hxx> -#include <osl/diagnose.h> -#include <osl/time.h> -#include <sal/types.h> -// -#include <uno/dispatcher.h> -#include <uno/environment.h> -#include <uno/mapping.hxx> -#include <uno/data.h> - -// #include <uno/cuno.h> -// #include <test/XLanguageBindingTest.h> - -#include <cppuhelper/weak.hxx> -#include <cppuhelper/queryinterface.hxx> -#include <cppu/macros.hxx> -#include <test/XLanguageBindingTest.hpp> - -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/DisposedException.hpp> - - -using namespace test; -using namespace cppu; -using namespace osl; -using namespace rtl; -using namespace com::sun::star; -using namespace com::sun::star::uno; - - -//================================================================================================== -sal_Bool equals( const test::TestElement & rData1, const test::TestElement & rData2 ) -{ - OSL_ENSURE( rData1.Bool == rData2.Bool, "### bool does not match!" ); - OSL_ENSURE( rData1.Char == rData2.Char, "### char does not match!" ); - OSL_ENSURE( rData1.Byte == rData2.Byte, "### byte does not match!" ); - OSL_ENSURE( rData1.Short == rData2.Short, "### short does not match!" ); - OSL_ENSURE( rData1.UShort == rData2.UShort, "### unsigned short does not match!" ); - OSL_ENSURE( rData1.Long == rData2.Long, "### long does not match!" ); - OSL_ENSURE( rData1.ULong == rData2.ULong, "### unsigned long does not match!" ); - OSL_ENSURE( rData1.Hyper == rData2.Hyper, "### hyper does not match!" ); - OSL_ENSURE( rData1.UHyper == rData2.UHyper, "### unsigned hyper does not match!" ); - OSL_ENSURE( rData1.Float == rData2.Float, "### float does not match!" ); - OSL_ENSURE( rData1.Double == rData2.Double, "### double does not match!" ); - OSL_ENSURE( rData1.Enum == rData2.Enum, "### enum does not match!" ); - OSL_ENSURE( rData1.String == rData2.String, "### string does not match!" ); - OSL_ENSURE( rData1.Interface == rData2.Interface, "### interface does not match!" ); - OSL_ENSURE( rData1.Any == rData2.Any, "### any does not match!" ); - - return (rData1.Bool == rData2.Bool && - rData1.Char == rData2.Char && - rData1.Byte == rData2.Byte && - rData1.Short == rData2.Short && - rData1.UShort == rData2.UShort && - rData1.Long == rData2.Long && - rData1.ULong == rData2.ULong && - rData1.Hyper == rData2.Hyper && - rData1.UHyper == rData2.UHyper && - rData1.Float == rData2.Float && - rData1.Double == rData2.Double && - rData1.Enum == rData2.Enum && - rData1.String == rData2.String && - rData1.Interface == rData2.Interface && - rData1.Any == rData2.Any); -} -//================================================================================================== -sal_Bool equals( const test::TestData & rData1, const test::TestData & rData2 ) -{ - sal_Int32 nLen; - - if ((rData1.Sequence == rData2.Sequence) && - equals( (const test::TestElement &)rData1, (const test::TestElement &)rData2 ) && - (nLen = rData1.Sequence.getLength()) == rData2.Sequence.getLength()) - { - // once again by hand sequence == - const test::TestElement * pElements1 = rData1.Sequence.getConstArray(); - const test::TestElement * pElements2 = rData2.Sequence.getConstArray(); - for ( ; nLen--; ) - { - if (! equals( pElements1[nLen], pElements2[nLen] )) - { - OSL_ENSURE( sal_False, "### sequence element did not match!" ); - return sal_False; - } - } - return sal_True; - } - return sal_False; -} -//================================================================================================== -void assign( test::TestElement & rData, - sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test::TestEnum eEnum, const ::rtl::OUString& rStr, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - const ::com::sun::star::uno::Any& rAny ) -{ - rData.Bool = bBool; - rData.Char = cChar; - rData.Byte = nByte; - rData.Short = nShort; - rData.UShort = nUShort; - rData.Long = nLong; - rData.ULong = nULong; - rData.Hyper = nHyper; - rData.UHyper = nUHyper; - rData.Float = fFloat; - rData.Double = fDouble; - rData.Enum = eEnum; - rData.String = rStr; - rData.Interface = xTest; - rData.Any = rAny; -} -//================================================================================================== -void assign( test::TestData & rData, - sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test::TestEnum eEnum, const ::rtl::OUString& rStr, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - const ::com::sun::star::uno::Any& rAny, - const com::sun::star::uno::Sequence< test::TestElement >& rSequence ) -{ - assign( (test::TestElement &)rData, - bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum, rStr, xTest, rAny ); - rData.Sequence = rSequence; -} - -//================================================================================================== -class TestDummy : public OWeakObject -{ -public: - sal_Int32 getRefCount() const - { return m_refCount; } - - virtual ~TestDummy() - { OSL_TRACE( "> scalar TestDummy dtor <\n" ); } -}; -//================================================================================================== -class Test_Impl : public cppu::WeakImplHelper1< XLanguageBindingTest > -{ - test::TestData _aData, _aStructData; - -public: - sal_Int32 getRefCount() const - { return m_refCount; } - - virtual ~Test_Impl() - { OSL_TRACE( "> scalar Test_Impl dtor <\n" ); } - - // XLBTestBase - virtual void SAL_CALL setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test::TestEnum eEnum, const ::rtl::OUString& rStr, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - const ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Sequence<test::TestElement >& rSequence, - const test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException); - - virtual test::TestData SAL_CALL setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, - sal_Int16& nShort, sal_uInt16& nUShort, - sal_Int32& nLong, sal_uInt32& nULong, - sal_Int64& nHyper, sal_uInt64& nUHyper, - float& fFloat, double& fDouble, - test::TestEnum& eEnum, rtl::OUString& rStr, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - ::com::sun::star::uno::Any& rAny, - ::com::sun::star::uno::Sequence<test::TestElement >& rSequence, - test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException); - - virtual test::TestData SAL_CALL getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, - sal_Int16& nShort, sal_uInt16& nUShort, - sal_Int32& nLong, sal_uInt32& nULong, - sal_Int64& nHyper, sal_uInt64& nUHyper, - float& fFloat, double& fDouble, - test::TestEnum& eEnum, rtl::OUString& rStr, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - ::com::sun::star::uno::Any& rAny, - ::com::sun::star::uno::Sequence< test::TestElement >& rSequence, - test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException); - - virtual test::SmallStruct echoSmallStruct(const test::SmallStruct& rStruct) throw(com::sun::star::uno::RuntimeException) - { return rStruct; } - virtual test::MediumStruct echoMediumStruct(const test::MediumStruct& rStruct) throw(com::sun::star::uno::RuntimeException) - { return rStruct; } - virtual test::BigStruct echoBigStruct(const test::BigStruct& rStruct) throw(com::sun::star::uno::RuntimeException) - { return rStruct; } - virtual test::AllFloats echoAllFloats(const test::AllFloats& rStruct) throw(com::sun::star::uno::RuntimeException) - { return rStruct; } - - virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException) - { return _aData.Bool; } - virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException) - { return _aData.Byte; } - virtual sal_Unicode SAL_CALL getChar() throw(com::sun::star::uno::RuntimeException) - { return _aData.Char; } - virtual sal_Int16 SAL_CALL getShort() throw(com::sun::star::uno::RuntimeException) - { return _aData.Short; } - virtual sal_uInt16 SAL_CALL getUShort() throw(com::sun::star::uno::RuntimeException) - { return _aData.UShort; } - virtual sal_Int32 SAL_CALL getLong() throw(com::sun::star::uno::RuntimeException) - { return _aData.Long; } - virtual sal_uInt32 SAL_CALL getULong() throw(com::sun::star::uno::RuntimeException) - { return _aData.ULong; } - virtual sal_Int64 SAL_CALL getHyper() throw(com::sun::star::uno::RuntimeException) - { return _aData.Hyper; } - virtual sal_uInt64 SAL_CALL getUHyper() throw(com::sun::star::uno::RuntimeException) - { return _aData.UHyper; } - virtual float SAL_CALL getFloat() throw(com::sun::star::uno::RuntimeException) - { return _aData.Float; } - virtual double SAL_CALL getDouble() throw(com::sun::star::uno::RuntimeException) - { return _aData.Double; } - virtual test::TestEnum SAL_CALL getEnum() throw(com::sun::star::uno::RuntimeException) - { return _aData.Enum; } - virtual rtl::OUString SAL_CALL getString() throw(com::sun::star::uno::RuntimeException) - { return _aData.String; } - virtual com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getInterface( ) throw(com::sun::star::uno::RuntimeException) - { return _aData.Interface; } - virtual com::sun::star::uno::Any SAL_CALL getAny() throw(com::sun::star::uno::RuntimeException) - { return _aData.Any; } - virtual com::sun::star::uno::Sequence< test::TestElement > SAL_CALL getSequence() throw(com::sun::star::uno::RuntimeException) - { return _aData.Sequence; } - virtual test::TestData SAL_CALL getStruct() throw(com::sun::star::uno::RuntimeException) - { return _aStructData; } - - virtual void SAL_CALL setBool( sal_Bool _bool ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Bool = _bool; } - virtual void SAL_CALL setByte( sal_Int8 _byte ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Byte = _byte; } - virtual void SAL_CALL setChar( sal_Unicode _char ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Char = _char; } - virtual void SAL_CALL setShort( sal_Int16 _short ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Short = _short; } - virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) throw(::com::sun::star::uno::RuntimeException) - { _aData.UShort = _ushort; } - virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Long = _long; } - virtual void SAL_CALL setULong( sal_uInt32 _ulong ) throw(::com::sun::star::uno::RuntimeException) - { _aData.ULong = _ulong; } - virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Hyper = _hyper; } - virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) throw(::com::sun::star::uno::RuntimeException) - { _aData.UHyper = _uhyper; } - virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Float = _float; } - virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Double = _double; } - virtual void SAL_CALL setEnum( test::TestEnum _enum ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Enum = _enum; } - virtual void SAL_CALL setString( const ::rtl::OUString& _string ) throw(::com::sun::star::uno::RuntimeException) - { _aData.String = _string; } - virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _interface ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Interface = _interface; } - virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Any = _any; } - virtual void SAL_CALL setSequence( const ::com::sun::star::uno::Sequence<test::TestElement >& _sequence ) throw(::com::sun::star::uno::RuntimeException) - { _aData.Sequence = _sequence; } - virtual void SAL_CALL setStruct( const test::TestData& _struct ) throw(::com::sun::star::uno::RuntimeException) - { _aStructData = _struct; } - - // XLanguageBindingTest - virtual test::TestData SAL_CALL raiseException( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, sal_Int16& nShort, sal_uInt16& nUShort, sal_Int32& nLong, sal_uInt32& nULong, sal_Int64& nHyper, sal_uInt64& nUHyper, float& fFloat, double& fDouble, test::TestEnum& eEnum, ::rtl::OUString& aString, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInterface, ::com::sun::star::uno::Any& aAny, ::com::sun::star::uno::Sequence<test::TestElement >& aSequence,test::TestData& aStruct ) - throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - virtual sal_Int32 SAL_CALL getRuntimeException() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRuntimeException( sal_Int32 _runtimeexception ) throw(::com::sun::star::uno::RuntimeException); -}; -//__________________________________________________________________________________________________ -void Test_Impl::setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte, - sal_Int16 nShort, sal_uInt16 nUShort, - sal_Int32 nLong, sal_uInt32 nULong, - sal_Int64 nHyper, sal_uInt64 nUHyper, - float fFloat, double fDouble, - test::TestEnum eEnum, const ::rtl::OUString& rStr, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - const ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Sequence<test::TestElement >& rSequence, - const test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException) -{ - assign( _aData, - bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum, rStr, xTest, rAny, rSequence ); - _aStructData = rStruct; -} -//__________________________________________________________________________________________________ -test::TestData Test_Impl::setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, - sal_Int16& nShort, sal_uInt16& nUShort, - sal_Int32& nLong, sal_uInt32& nULong, - sal_Int64& nHyper, sal_uInt64& nUHyper, - float& fFloat, double& fDouble, - test::TestEnum& eEnum, rtl::OUString& rStr, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - ::com::sun::star::uno::Any& rAny, - ::com::sun::star::uno::Sequence<test::TestElement >& rSequence, - test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException) -{ - assign( _aData, - bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum, rStr, xTest, rAny, rSequence ); - _aStructData = rStruct; - return _aStructData; -} -//__________________________________________________________________________________________________ -test::TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte, - sal_Int16& nShort, sal_uInt16& nUShort, - sal_Int32& nLong, sal_uInt32& nULong, - sal_Int64& nHyper, sal_uInt64& nUHyper, - float& fFloat, double& fDouble, - test::TestEnum& eEnum, rtl::OUString& rStr, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest, - ::com::sun::star::uno::Any& rAny, - ::com::sun::star::uno::Sequence<test::TestElement >& rSequence, - test::TestData& rStruct ) - throw(com::sun::star::uno::RuntimeException) -{ - bBool = _aData.Bool; - cChar = _aData.Char; - nByte = _aData.Byte; - nShort = _aData.Short; - nUShort = _aData.UShort; - nLong = _aData.Long; - nULong = _aData.ULong; - nHyper = _aData.Hyper; - nUHyper = _aData.UHyper; - fFloat = _aData.Float; - fDouble = _aData.Double; - eEnum = _aData.Enum; - rStr = _aData.String; - xTest = _aData.Interface; - rAny = _aData.Any; - rSequence = _aData.Sequence; - rStruct = _aStructData; - return _aStructData; -} - -//================================================================================================== -static sal_Bool performTest( - const Reference< XLanguageBindingTest > & xLBT, - const Reference< XInterface > & xDummyInterface ) -{ - OSL_ENSURE( xLBT.is() && xDummyInterface.is(), "### no test interfaces!" ); - if (xLBT.is() && xDummyInterface.is()) - { - // this data is never ever granted access to by calls other than equals(), assign()! - test::TestData aData; // test against this data - - assign( (test::TestElement &)aData, - sal_True, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, - SAL_CONST_INT64(0x123456789abcdef0), - SAL_CONST_UINT64(0xfedcba9876543210), - (float)17.0815, 3.1415926359, TestEnum_LOLA, - OUString::createFromAscii("dumdidum"), xDummyInterface, - makeAny( xDummyInterface ) ); - aData.Sequence = Sequence<test::TestElement >( (const test::TestElement *)&aData, 1 ); - OSL_ENSURE( aData.Any == xDummyInterface, "### unexpected any!" ); - OSL_ENSURE( !(aData.Any != xDummyInterface), "### unexpected any!" ); - - // aData complete ==> never touched again - //================================================================================ - - // this is a manually copy of aData for first setting... - test::TestData aSetData0( aData ); // copy ctor - // assignment - test::TestData aSetData1 = aSetData0; - - test::TestData aSetData; - assign( (test::TestElement &)aSetData, - aSetData1.Bool, aSetData1.Char, aSetData1.Byte, aSetData1.Short, aSetData1.UShort, - aSetData1.Long, aSetData1.ULong, aSetData1.Hyper, aSetData1.UHyper, - aSetData1.Float, aSetData1.Double, - aSetData1.Enum, aSetData1.String, aSetData1.Interface, aSetData1.Any ); - // switch over to new sequence allocation - aSetData.Sequence = Sequence<test::TestElement >( (const test::TestElement *)&aSetData, 1 ); - - xLBT->setValues( - aSetData.Bool, aSetData.Char, aSetData.Byte, aSetData.Short, aSetData.UShort, - aSetData.Long, aSetData.ULong, aSetData.Hyper, aSetData.UHyper, aSetData.Float, aSetData.Double, - aSetData.Enum, aSetData.String, aSetData.Interface, aSetData.Any, aSetData.Sequence, aSetData ); - - { - test::TestData aRet, aRet2; - xLBT->getValues( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - - OSL_ASSERT( equals( aData, aRet ) && equals( aData, aRet2 ) ); - - // set last retrieved values - test::TestData aSV2ret = xLBT->setValues2( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - - OSL_ASSERT( equals( aData, aSV2ret ) && equals( aData, aRet2 ) ); - } - { - test::TestData aRet, aRet2; - test::TestData aGVret = xLBT->getValues( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); - - OSL_ASSERT( equals( aData, aRet ) && equals( aData, aRet2 ) && equals( aData, aGVret ) ); - - // set last retrieved values - xLBT->setBool( aRet.Bool ); - xLBT->setChar( aRet.Char ); - xLBT->setByte( aRet.Byte ); - xLBT->setShort( aRet.Short ); - xLBT->setUShort( aRet.UShort ); - xLBT->setLong( aRet.Long ); - xLBT->setULong( aRet.ULong ); - xLBT->setHyper( aRet.Hyper ); - xLBT->setUHyper( aRet.UHyper ); - xLBT->setFloat( aRet.Float ); - xLBT->setDouble( aRet.Double ); - xLBT->setEnum( aRet.Enum ); - xLBT->setString( aRet.String ); - xLBT->setInterface( aRet.Interface ); - xLBT->setAny( aRet.Any ); - xLBT->setSequence( aRet.Sequence ); - xLBT->setStruct( aRet2 ); - } - { - test::TestData aRet, aRet2; - aRet.Hyper = xLBT->getHyper(); - aRet.UHyper = xLBT->getUHyper(); - aRet.Float = xLBT->getFloat(); - aRet.Double = xLBT->getDouble(); - aRet.Byte = xLBT->getByte(); - aRet.Char = xLBT->getChar(); - aRet.Bool = xLBT->getBool(); - aRet.Short = xLBT->getShort(); - aRet.UShort = xLBT->getUShort(); - aRet.Long = xLBT->getLong(); - aRet.ULong = xLBT->getULong(); - aRet.Enum = xLBT->getEnum(); - aRet.String = xLBT->getString(); - aRet.Interface = xLBT->getInterface(); - aRet.Any = xLBT->getAny(); - aRet.Sequence = xLBT->getSequence(); - aRet2 = xLBT->getStruct(); - - OSL_ASSERT( equals( aData, aRet ) && equals( aData, aRet2 ) ); - } - { - test::SmallStruct aIn(1, 2); - test::SmallStruct aOut = xLBT->echoSmallStruct(aIn); - OSL_ASSERT( memcmp(&aIn, &aOut, sizeof(test::SmallStruct)) == 0 ); - } - { - test::MediumStruct aIn(1, 2, 3, 4); - test::MediumStruct aOut = xLBT->echoMediumStruct(aIn); - OSL_ASSERT( memcmp(&aIn, &aOut, sizeof(test::MediumStruct)) == 0 ); - } - { - test::BigStruct aIn(1, 2, 3, 4, 5, 6, 7, 8); - test::BigStruct aOut = xLBT->echoBigStruct(aIn); - OSL_ASSERT( memcmp(&aIn, &aOut, sizeof(test::BigStruct)) == 0 ); - } - { - test::AllFloats aIn(1.1, 2.2, 3.3, 4.4); - test::AllFloats aOut = xLBT->echoAllFloats(aIn); - return( memcmp(&aIn, &aOut, sizeof(test::AllFloats)) == 0 ); - } - } - return sal_False; -} - -//__________________________________________________________________________________________________ -test::TestData Test_Impl::raiseException( sal_Bool& /*bBool*/, sal_Unicode& /*cChar*/, sal_Int8& /*nByte*/, sal_Int16& /*nShort*/, sal_uInt16& /*nUShort*/, sal_Int32& /*nLong*/, sal_uInt32& /*nULong*/, sal_Int64& /*nHyper*/, sal_uInt64& /*nUHyper*/, float& /*fFloat*/, double& /*fDouble*/, test::TestEnum& /*eEnum*/, ::rtl::OUString& /*aString*/, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /*xInterface*/, ::com::sun::star::uno::Any& /*aAny*/, ::com::sun::star::uno::Sequence< test::TestElement >& /*aSequence*/, test::TestData& /*aStruct*/ ) - throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - lang::IllegalArgumentException aExc; - aExc.ArgumentPosition = 5; - aExc.Message = OUString::createFromAscii( "dum dum dum ich tanz im kreis herum..." ); - aExc.Context = getInterface(); - throw aExc; -} -//__________________________________________________________________________________________________ -sal_Int32 Test_Impl::getRuntimeException() throw(::com::sun::star::uno::RuntimeException) -{ - lang::DisposedException aExc; - aExc.Message = OUString::createFromAscii( "dum dum dum ich tanz im kreis herum..." ); - aExc.Context = getInterface(); - throw aExc; -} -//__________________________________________________________________________________________________ -void Test_Impl::setRuntimeException( sal_Int32 /*_runtimeexception*/ ) throw(::com::sun::star::uno::RuntimeException) -{ - lang::DisposedException aExc; - aExc.Message = OUString::createFromAscii( "dum dum dum ich tanz im kreis herum..." ); - aExc.Context = getInterface(); - throw aExc; -} - -static void raising1( const Reference< XLanguageBindingTest > & xLBT ) -{ - test::TestData aRet, aRet2; - xLBT->raiseException( - aRet.Bool, aRet.Char, aRet.Byte, aRet.Short, aRet.UShort, - aRet.Long, aRet.ULong, aRet.Hyper, aRet.UHyper, aRet.Float, aRet.Double, - aRet.Enum, aRet.String, aRet.Interface, aRet.Any, aRet.Sequence, aRet2 ); -} -static void raising2( const Reference< XLanguageBindingTest > & xLBT ) -{ - try - { - raising1( xLBT ); - } - catch (RuntimeException &) - { - } - catch (...) - { - throw; - } -} -//================================================================================================== -sal_Bool raiseException( const Reference< XLanguageBindingTest > & xLBT ) -{ - try - { - xLBT->getRuntimeException(); - } - catch (lang::DisposedException & exc) - { - OSL_ENSURE( exc.Context == xLBT->getInterface() && - exc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...") ), - "### unexpected exception content!" ); - } - catch (RuntimeException &) - { - } - catch (Exception &) - { - return sal_False; - } - catch (...) - { - return sal_False; - } - - sal_Int32 nCount = 0; - try - { - try - { - try - { - raising2( xLBT ); - } - catch (RuntimeException &) - { - } - catch (lang::IllegalArgumentException aExc) - { - ++nCount; - OSL_ENSURE( aExc.ArgumentPosition == 5 && - aExc.Context == xLBT->getInterface() && - aExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...") ), - "### unexpected exception content!" ); - - /** it is certain, that the RuntimeException testing will fail, if no */ - xLBT->getRuntimeException(); - } - } - catch (const RuntimeException & rExc) - { - ++nCount; - OSL_ENSURE( rExc.Context == xLBT->getInterface() && - rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...") ), - "### unexpected exception content!" ); - - /** it is certain, that the RuntimeException testing will fail, if no */ - xLBT->setRuntimeException( 0xcafebabe ); - } - catch (lang::IllegalArgumentException &) - { - } - } - catch (Exception & rExc) - { - ++nCount; - OSL_ENSURE( rExc.Context == xLBT->getInterface() && - rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...") ), - "### unexpected exception content!" ); - return (nCount == 3 && - rExc.Context == xLBT->getInterface() && - rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dum dum dum ich tanz im kreis herum...") )); - } - return sal_False; -} - -//================================================================================================== -static void checkInvalidInterfaceQuery( - Reference< XInterface > const & xObj ) -{ - try - { - Any aRet( xObj->queryInterface( ::getCppuType( (const lang::IllegalArgumentException *)0 ) ) ); - OSL_ASSERT( ! aRet.hasValue() ); - } - catch (RuntimeException &) - { - } - try - { - Reference< lang::XComponent > xComp( xObj, UNO_QUERY_THROW ); - OSL_ASSERT( 0 ); - } - catch (RuntimeException & /*exc*/) - { -// OString str( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); -// OSL_TRACE( str.getStr() ); - } -} - -//================================================================================================== -static bool perform_test( - Reference< XLanguageBindingTest > const & xObj, - Reference< XInterface > const & xDummy ) -{ - checkInvalidInterfaceQuery( xObj ); - - if (performTest( xObj, xDummy )) - { - ::fprintf( stderr, "> invocation test succeeded!\n" ); - if (raiseException( xObj )) - { - ::fprintf( stderr, "> exception test succeeded!\n" ); - return true; - } - else - { - ::fprintf( stderr, "> exception test failed!\n" ); - } - } - - ::fprintf( stderr, "> dynamic invocation test failed!\n" ); - return false; -} - -//================================================================================================== -void test_CppBridge(void) -{ - // C++-UNO test - { - TestDummy * p = new TestDummy(); - Reference< XInterface > xDummy( *p ); - { - Test_Impl * p2 = new Test_Impl(); - Reference< XLanguageBindingTest > xOriginal( p2 ); - checkInvalidInterfaceQuery( xOriginal ); - { - const char * pExtraMapping = ""; - - Reference< XLanguageBindingTest > xMapped; - { - uno_Interface * pUnoI = 0; - - OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); - OUString aUnoEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ); - - uno_Environment * pCppEnv = 0; - uno_Environment * pUnoEnv = 0; - ::uno_getEnvironment( &pCppEnv, aCppEnvTypeName.pData, 0 ); - ::uno_getEnvironment( &pUnoEnv, aUnoEnvTypeName.pData, 0 ); - - // C++ -> UNO - Mapping mapping( pCppEnv, pUnoEnv ); - mapping.mapInterface( (void **)&pUnoI, xOriginal.get(), ::getCppuType( &xOriginal ) ); - -#ifdef EXTRA_MAPPING - // UNO -> ano C++a - ::uno_createEnvironment( &pCppEnv, aCppEnvTypeName.pData, 0 ); - mapping = Mapping( pUnoEnv, pCppEnv ); - mapping.mapInterface( (void **)&xMapped, pUnoI, ::getCppuType( &xMapped ) ); - // ano C++a -> ano UNOa - ::uno_createEnvironment( &pUnoEnv, aUnoEnvTypeName.pData, 0 ); - mapping = Mapping( pCppEnv, pUnoEnv ); - mapping.mapInterface( (void **)&pUnoI, xMapped.get(), ::getCppuType( &xMapped ) ); - pExtraMapping = " <-> c++ <-> uno"; -#endif - - // ano UNOa -> ano C++b - ::uno_createEnvironment( &pCppEnv, aCppEnvTypeName.pData, 0 ); - mapping = Mapping( pUnoEnv, pCppEnv ); - mapping.mapInterface( (void **)&xMapped, pUnoI, ::getCppuType( &xMapped ) ); - (*pUnoI->release)( pUnoI ); - (*pCppEnv->release)( pCppEnv ); - (*pUnoEnv->release)( pUnoEnv ); - } - - if (perform_test( xMapped, xDummy )) - { - ::fprintf( stderr, "> C++-UNO test (c++ <-> uno%s <-> c++ [component impl]) succeeded!\n", pExtraMapping ); - } - else - { - ::fprintf( stderr, "> C++-UNO test (c++ <-> uno%s <-> c++ [component impl]) failed!\n", pExtraMapping ); - exit( 1 ); - } - } - OSL_ENSURE( p2->getRefCount() == 1, "### test object ref count > 1 !" ); - } - OSL_ENSURE( p->getRefCount() == 1, "### dummy object ref count > 1 !" ); - } -} - -//================================================================================================== -void test_CBridge(void) -{ - // C-UNO test - { - TestDummy * p = new TestDummy(); - Reference< XInterface > xDummy( *p ); - { - Test_Impl * p2 = new Test_Impl(); - Reference< XLanguageBindingTest > xOriginal( p2 ); - checkInvalidInterfaceQuery( xOriginal ); - { - Reference< XLanguageBindingTest > xMapped; - { - uno_Interface * pUnoI2 = 0; - void * pC = 0; - uno_Interface * pUnoI1 = 0; - - OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); - OUString aCEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_C) ); - OUString aUnoEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ); - - // C++ -> UNO - uno_Environment * pCppEnv = 0; - uno_Environment * pUnoEnv = 0; - ::uno_getEnvironment( &pCppEnv, aCppEnvTypeName.pData, 0 ); - ::uno_getEnvironment( &pUnoEnv, aUnoEnvTypeName.pData, 0 ); - Mapping aCpp2Uno( pCppEnv, pUnoEnv ); - aCpp2Uno.mapInterface( (void **)&pUnoI1, xOriginal.get(), ::getCppuType( &xOriginal ) ); - (*pCppEnv->release)( pCppEnv ); - - // UNO -> C - uno_Environment * pCEnv = 0; - ::uno_getEnvironment( &pCEnv, aCEnvTypeName.pData, 0 ); - Mapping aUno2C( pUnoEnv, pCEnv ); - aUno2C.mapInterface( &pC, pUnoI1, ::getCppuType( &xOriginal ) ); - (*pUnoI1->release)( pUnoI1 ); - (*pUnoEnv->release)( pUnoEnv ); - - // C -> ano UNO - uno_Environment * pAnoUnoEnv = 0; - ::uno_createEnvironment( &pAnoUnoEnv, aUnoEnvTypeName.pData, 0 ); // anonymous - Mapping aC2Uno( pCEnv, pAnoUnoEnv ); - aC2Uno.mapInterface( (void **)&pUnoI2, pC, ::getCppuType( &xOriginal ) ); - (*pCEnv->pExtEnv->releaseInterface)( pCEnv->pExtEnv, pC ); - (*pCEnv->release)( pCEnv ); - - // ano UNO -> ano C++ - uno_Environment * pAnoCppEnv = 0; - ::uno_createEnvironment( &pAnoCppEnv, aCppEnvTypeName.pData, 0 ); - Mapping aUno2Cpp( pAnoUnoEnv, pAnoCppEnv ); - (*pAnoCppEnv->release)( pAnoCppEnv ); - (*pAnoUnoEnv->release)( pAnoUnoEnv ); - aUno2Cpp.mapInterface( (void **)&xMapped, pUnoI2, ::getCppuType( &xOriginal ) ); - (*pUnoI2->release)( pUnoI2 ); - } - - if (perform_test( xMapped, xDummy )) - { - ::fprintf( stderr, "> C-UNO test (c++ <-> uno <-> c <-> uno <-> c++ [component impl]) succeeded!\n" ); - } - else - { - ::fprintf( stderr, "> C-UNO test (c++ <-> uno <-> c <-> uno <-> c++ [component impl]) failed!\n" ); - exit( 1 ); - } - } - OSL_ENSURE( p->getRefCount() == 1, "### test object ref count > 1 !" ); - } - OSL_ENSURE( p->getRefCount() == 1, "### dummy object ref count > 1 !" ); - } -} -#if 0 -//================================================================================================== -extern "C" com_sun_star_uno_XInterface* SAL_CALL createTestObject(); - -void test_CBridge2(void) -{ - // C-UNO test - { - TestDummy * p = new TestDummy(); - Reference< XInterface > xDummy( *p ); - { - com_sun_star_uno_XInterface* pXIface = createTestObject(); - test_XLanguageBindingTest* pXLBTest = 0; - uno_Any aExc; - Reference< XLanguageBindingTest > xMapped; - - OSL_ENSURE( pXIface != 0, "create test object failed\n"); - - /* Get interface XFoo2 */ - if (CUNO_EXCEPTION_OCCURED( CUNO_CALL(pXIface)->queryInterface( pXIface, &aExc, (com_sun_star_uno_XInterface**)&pXLBTest, ::getCppuType( &xMapped ).getTypeLibType()) )) - { - uno_any_destruct( &aExc, 0 ); - } - OSL_ENSURE( pXLBTest != 0, "query_Interface XLanguageBindingTest failed\n"); - - Mapping aC2Cpp( - OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_C) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ) ); - aC2Cpp.mapInterface( (void **)&xMapped, pXLBTest, ::getCppuType( &xMapped ) ); - - OSL_ENSURE( xMapped.is(), "mapping interface failed\n"); - - if (perform_test( xMapped, xDummy )) - { - ::fprintf( stderr, "> second C-UNO test (c++ <-> uno <-> c [component impl]) succeeded!\n" ); - } - else - { - ::fprintf( stderr, "> second C-UNO test (c++ <-> uno <-> c [component impl]) failed!\n" ); - exit( 1 ); - } - - - CUNO_CALL(pXIface)->release( pXIface ); - CUNO_CALL(pXLBTest)->release( (com_sun_star_uno_XInterface *)pXLBTest ); - } - OSL_ENSURE( p->getRefCount() == 1, "### dummy object ref count > 1 !" ); - } - -} -#endif - diff --git a/cppu/test/test_sec.cxx b/cppu/test/test_sec.cxx deleted file mode 100644 index 0bc3585e23d0..000000000000 --- a/cppu/test/test_sec.cxx +++ /dev/null @@ -1,211 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include <stdio.h> - - -#include <uno/current_context.hxx> - -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/loader/XImplementationLoader.hpp> -#include <com/sun/star/container/XNameContainer.hpp> - -using namespace rtl; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::security; -using namespace com::sun::star::lang; -using namespace com::sun::star::loader; -using namespace com::sun::star::registry; -using namespace com::sun::star::container; - - -static inline void out( const sal_Char * p ) -{ - ::fprintf( stderr, p ); -} -static inline void out( const OUString & r ) -{ - OString aStr( OUStringToOString( r, RTL_TEXTENCODING_ASCII_US ) ); - out( aStr.getStr() ); -} - - -static Reference< XInterface > load( - const Reference< XMultiServiceFactory > & xMgr, - const char * service, - const char * implName, const char * activator, const char * loc ) throw () -{ - Reference< XInterface > xRet( - xMgr->createInstance( OUString::createFromAscii( service ) ) ); - if (xRet.is()) - return xRet; - - try - { - Reference< XImplementationLoader > xLoader( - xMgr->createInstance( OUString::createFromAscii( activator ) ), UNO_QUERY ); - if (xLoader.is()) - { - Reference< XSingleServiceFactory > xFac( xLoader->activate( - OUString::createFromAscii( implName ), OUString(), - OUString::createFromAscii( loc ), - Reference< XRegistryKey >() ), UNO_QUERY ); - if (xFac.is()) - return xFac->createInstance(); - } - else - { - out( "### cannot activate loader \"" ); - out( activator ); - out( "\"!\n" ); - } - } - catch (Exception &) - { - out( "### cannot activate service \"" ); - out( service ); - out( "\"!\n" ); - } - return Reference< XInterface >(); -} - -static void setEnv( const Reference< XMultiServiceFactory > & xMgr ) throw () -{ - OSL_ASSERT( xMgr.is() ); - Reference< XNameContainer > xContext( getCurrentContext(), UNO_QUERY ); - OSL_ASSERT( xContext.is() ); - - try - { - xContext->insertByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.ServiceManager") ), - makeAny( xMgr ) ); - xContext->insertByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.security.AccessController") ), - makeAny( load( xMgr, - "com.sun.star.security.AccessController", - "com.sun.star.comp.security.AccessController", - "com.sun.star.loader.Java2", - "com.sun.star.comp.security.AccessController" ) ) ); - xContext->insertByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.security.auth.login.LoginContext") ), - makeAny( load( xMgr, - "com.sun.star.security.auth.login.LoginContext", - "com.sun.star.comp.security.auth.login.LoginContext", - "com.sun.star.loader.Java2", - "com.sun.star.comp.security.auth.login.LoginContext" ) ) ); - } - catch (Exception & rExc) - { - out( "### exception occured: " ); - out( rExc.Message ); - out( "\n" ); - } -} - -//################################################################################################## -//################################################################################################## -//################################################################################################## - -struct PrivAction : WeakImplHelper1< XPrivilegedAction > -{ - virtual Any SAL_CALL run() - throw (Exception) - { - throw IllegalArgumentException( - OUString::createFromAscii("testtest"), (OWeakObject *)this, (sal_Int16)5 ); - } -}; - -struct Thread1 : public OThread -{ - Reference< XMultiServiceFactory > _xMgr; - - Thread1( const Reference< XMultiServiceFactory > & xMgr ) - : _xMgr( xMgr ) - {} - - void f() - { - Reference< XNameAccess > xAccess( getCurrentContext(), UNO_QUERY ); - OSL_ASSERT( xAccess->getByName( OUString::createFromAscii("a") ) == (sal_Int16)5 ); - Reference< XNameContainer > xCont( getCurrentContext(), UNO_QUERY ); - xCont->insertByName( OUString::createFromAscii("b"), makeAny( (sal_Int32)6 ) ); - } - virtual void SAL_CALL run() - { - try - { - setEnv( _xMgr ); - Reference< XNameContainer > xCont( getCurrentContext(), UNO_QUERY ); - xCont->insertByName( OUString::createFromAscii("a"), makeAny( (sal_Int32)5 ) ); - f(); - Reference< XNameAccess > xAccess( getCurrentContext(), UNO_QUERY ); - OSL_ASSERT( xAccess->getByName( OUString::createFromAscii("b") ) == (sal_Int16)6 ); - -// checkPermission( -// Permission( OUString::createFromAscii("java.io.FilePermission"), -// OUString::createFromAscii("f:\\userprofiles.dat"), -// OUString::createFromAscii("read") ) ); - -// try -// { -// Reference< XCurrentContext > xContext( getCurrentContext() ); -// Reference< XAccessController > xACC( xContext->getAccessController() ); -// xACC->doPrivileged( new PrivAction(), Reference< XAccessControlContext >() ); -// } -// catch (IllegalArgumentException & r) -// { -// OSL_ASSERT( r.ArgumentPosition == 5 && -// r.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("testtest") )); -// } - } - catch (RuntimeException & rExc) - { - out( rExc.Message ); - } - } -}; - - -void test_security( const Reference< XMultiServiceFactory > & xMgr ) throw () -{ - setEnv( xMgr ); - OSL_ASSERT( getCurrentContext()->getServiceManager().is() ); - - Thread1 thread1( xMgr ); - thread1.create(); - thread1.join(); - out( "> exiting...\n" ); -} diff --git a/cppu/test/testcppu.cxx b/cppu/test/testcppu.cxx deleted file mode 100644 index b132ab0cb281..000000000000 --- a/cppu/test/testcppu.cxx +++ /dev/null @@ -1,1241 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 -# undef OSL_DEBUG_LEVEL -# define OSL_DEBUG_LEVEL 2 -#endif - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" - -#include "sal/main.h" - -#include <stdio.h> - -#include <uno/environment.h> -#include <uno/mapping.hxx> - -#include <uno/dispatcher.h> -#include <rtl/alloc.h> -#include <rtl/unload.h> - -#include <cppuhelper/queryinterface.hxx> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/uno/Uik.hpp> -#include <rtl/ustring.hxx> -#include <osl/diagnose.h> -#include <osl/interlck.h> -#include <sal/types.h> - -#include <test/Test1.hpp> -#include <test/Test2.hpp> -#include <test/TdTest1.hpp> -#include <test/Test3.hpp> -#include <test/Base.hpp> -#include <test/Base1.hpp> -#include <test/Base2.hpp> - -#include <uno/current_context.hxx> -#include <cppuhelper/bootstrap.hxx> -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/uno/XCurrentContext.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <test/XSimpleInterface.hpp> -#include <test/XLanguageBindingTest.hpp> -#include <com/sun/star/registry/XSimpleRegistry.hpp> - -using namespace test; -using namespace rtl; -using namespace osl; - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace test; - - -sal_Int32 getSize( const Type & rT ) -{ - sal_Int32 nSize; - typelib_TypeDescription * pTD = 0; - typelib_typedescriptionreference_getDescription( &pTD, rT.getTypeLibType() ); - nSize = pTD->nSize; - typelib_typedescription_release( pTD ); - return nSize; -} - -/* - * main. - */ -void testCppu() -{ - Any a(false); -#if 0 - // the following don't compile, which is ok: - a.get<sal_Unicode>(); - a.get<sal_uInt16>(); - a.has<sal_Unicode>(); - a.has<sal_uInt16>(); - Any a_( static_cast<sal_Unicode>('a') ); -#endif - OSL_ASSERT( a.getValueTypeClass() == TypeClass_BOOLEAN ); - OSL_ASSERT( !a.get<bool>() && !a.get<sal_Bool>() ); - a <<= sal_False; - OSL_ASSERT( a.getValueTypeClass() == TypeClass_BOOLEAN ); - OSL_ASSERT( !a.get<bool>() && !a.get<sal_Bool>() ); - a = Any(sal_False); - OSL_ASSERT( a.getValueTypeClass() == TypeClass_BOOLEAN ); - OSL_ASSERT( !a.get<bool>() && !a.get<sal_Bool>() ); - Any b( static_cast<sal_Int8>(32) ); - OSL_ASSERT( b.getValueTypeClass() == TypeClass_BYTE ); - OSL_ASSERT( b.get<sal_Int64>() == 32 && - b.get<sal_uInt64>() == 32 && - b.get<sal_Int32>() == 32 && - b.get<sal_uInt32>() == 32 && - b.get<sal_Int16>() == 32 && - b.get<sal_Int8>() == 32 ); - OSL_ASSERT( b.has<sal_Int64>() && - b.has<sal_uInt64>() && - b.has<sal_Int32>() && - b.has<sal_uInt32>() && - b.has<sal_Int16>() && - b.has<sal_Int8>() ); - b <<= true; - OSL_ASSERT( b.getValueTypeClass() == TypeClass_BOOLEAN ); - OSL_ASSERT( b.get<bool>() && b.get<sal_Bool>() ); - try { - b.get<sal_Int8>(); - OSL_ASSERT(false); - } - catch (RuntimeException & /*exc*/) { -// exc; - } - try { - const Sequence<beans::PropertyValue> seq( - b.get< Sequence<beans::PropertyValue> >() ); - OSL_ASSERT(false); - } - catch (RuntimeException & /*exc*/) { -// exc; - } - - sal_Int32 big = 0x7fffffff; - try - { - Sequence< Sequence< Any > > seq( big ); - } - catch (::std::bad_alloc &) - { - } - try - { - Sequence< Sequence< Any > > seq( 0, big ); - } - catch (::std::bad_alloc &) - { - } - try - { - Sequence< Sequence< Any > > seq; - seq.realloc( big ); - } - catch (::std::bad_alloc &) - { - } - - { - // test the size of types - OSL_ENSURE( sizeof( Uik ) == getSize( getCppuType( (Uik *)0) ), - "bad sizeof uik" ); - OSL_ENSURE( sizeof( Test1 ) == getSize( getCppuType( (Test1*)0).getTypeLibType() ), - "bad sizeof test1" ); -// OSL_ENSURE( sizeof( TdTest1 ) == getSize( get_test_TdTest1_Type().getTypeLibType() ), -// "bad sizeof TypedefTest1" ); - OSL_ENSURE( sizeof( Test2 ) == getSize( getCppuType( (Test2*)0).getTypeLibType() ), - "bad sizeof test2" ); - -/* find the error -sal_Int32 nPos; -nPos = (sal_Int32)&((Test3 *)0)->nInt8; -nPos = (sal_Int32)&((Test3 *)0)->nFloat; -nPos = (sal_Int32)&((Test3 *)0)->nuInt8; -nPos = (sal_Int32)&((Test3 *)0)->nDouble; -nPos = (sal_Int32)&((Test3 *)0)->nInt16; -nPos = (sal_Int32)&((Test3 *)0)->aString; -nPos = (sal_Int32)&((Test3 *)0)->nuInt16; -nPos = (sal_Int32)&((Test3 *)0)->nInt64; -nPos = (sal_Int32)&((Test3 *)0)->nInt32; -nPos = (sal_Int32)&((Test3 *)0)->nuInt64; -nPos = (sal_Int32)&((Test3 *)0)->nuInt32; -nPos = (sal_Int32)&((Test3 *)0)->eType; -nPos = (sal_Int32)&((Test3 *)0)->wChar; -nPos = (sal_Int32)&((Test3 *)0)->td; -nPos = (sal_Int32)&((Test3 *)0)->bBool; -nPos = (sal_Int32)&((Test3 *)0)->aAny; -*/ - OSL_ENSURE( sizeof( Test3 ) == getSize( getCppuType( (Test3*)0).getTypeLibType() ), - "bad sizeof test3" ); - } - - { - // test the default constructor - Test1 a1; - a1.nInt16 = 4; - a1.dDouble = 3.6; - a1.bBool = sal_True; - uno_type_constructData( &a1, getCppuType( (Test1*)0).getTypeLibType() ); - OSL_ASSERT( a1.nInt16 == 0 && a1.dDouble == 0.0 && a1.bBool == sal_False); - - Test2 a2; - a2.nInt16 = 2; - a2.aTest1.nInt16 = 4; - a2.aTest1.dDouble = 3.6; - a2.aTest1.dDouble = sal_True; - uno_type_constructData( &a2, getCppuType( (Test2*)0).getTypeLibType() ); - OSL_ASSERT( a2.nInt16 == 0 && a2.aTest1.nInt16 == 0 && a2.aTest1.dDouble == 0.0 && a2.aTest1.bBool == sal_False); - - Test3 * pa3 = (Test3 *)new char[ sizeof( Test3 ) ]; - Test3 & a3 = *pa3; - a3.nInt8 = 2; - a3.nFloat = (float)2; - a3.nDouble = 2; - a3.nInt16 = 2; - a3.nuInt16 = 2; - a3.nInt64 = 2; - a3.nInt32 = 2; - a3.nuInt64 = 2; - a3.nuInt32 = 2; - a3.eType = TypeClass_STRUCT; - a3.wChar = L'g'; - a3.td.nInt16 = 2; - a3.td.dDouble = 2; - a3.bBool = sal_True; - uno_type_constructData( &a3, getCppuType( (Test3*)0).getTypeLibType() ); - OSL_ASSERT( a3.nInt8 == 0 && a3.nFloat == (float)0 - && a3.nDouble == 0 && a3.nInt16 == 0 && a3.aString == OUString() - && a3.nuInt16 == 0 && a3.nInt64 == 0 && a3.nInt32 == 0 - && a3.nuInt64 == 0 && a3.nuInt32 == 0 && a3.eType == TypeClass_VOID - && a3.wChar == L'\0' && a3.td.nInt16 == 0 && a3.td.dDouble == 0 - && a3.bBool == sal_False ); - OSL_ASSERT( a3.aAny.getValueType() == getCppuVoidType() ); - delete[] reinterpret_cast< char * >(pa3); - } - - { - // test the destructor - long a1[ sizeof( Test1 ) / sizeof(long) +1 ]; - uno_type_constructData( &a1, getCppuType( (Test1*)0).getTypeLibType() ); - uno_type_destructData( &a1, getCppuType( (Test1*)0).getTypeLibType(), reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - long a2[ sizeof( Test2 ) / sizeof(long) +1 ]; - uno_type_constructData( &a2, getCppuType( (Test2*)0).getTypeLibType() ); - uno_type_destructData( &a2, getCppuType( (Test2*)0).getTypeLibType(), reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - long a3[ sizeof( Test3 ) / sizeof(long) +1 ]; - uno_type_constructData( &a3, getCppuType( (Test3*)0).getTypeLibType() ); - OUString aTestString( RTL_CONSTASCII_USTRINGPARAM("test") ); - ((Test3*)a3)->aString = aTestString; - uno_type_destructData( &a3, getCppuType( (Test3*)0).getTypeLibType(), reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - OSL_ASSERT( aTestString.pData->refCount == 1 ); - } - - { - // test the copy constructor - Test1 a1; - a1.nInt16 = 4; - a1.dDouble = 3.6; - a1.bBool = sal_True; - char sz1[sizeof( Test1 )]; - uno_type_copyData( sz1, &a1, getCppuType( (Test1*)0).getTypeLibType(), reinterpret_cast<uno_AcquireFunc>(cpp_acquire) ); - OSL_ASSERT( ((Test1*)sz1)->nInt16 == 4 && ((Test1*)sz1)->dDouble == 3.6 && ((Test1*)sz1)->bBool == sal_True); - - Test2 a2; - a2.nInt16 = 2; - a2.aTest1.nInt16 = 4; - a2.aTest1.dDouble = 3.6; - a2.aTest1.bBool = sal_True; - char sz2[sizeof( Test2 )]; - uno_type_copyData( sz2, &a2, getCppuType( (Test2*)0).getTypeLibType(), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire) ); - OSL_ASSERT( ((Test2*)sz2)->nInt16 == 2 ); - OSL_ASSERT(((Test2*)sz2)->aTest1.nInt16 == 4 ); - OSL_ASSERT( ((Test2*)sz2)->aTest1.dDouble == 3.6 ); - OSL_ASSERT(((Test2*)sz2)->aTest1.bBool == sal_True); - - Test3 a3; - a3.nInt8 = 2; - a3.nFloat = (float)2; - a3.nDouble = 2; - a3.nInt16 = 2; - a3.aString = OUString::createFromAscii("2"); - a3.nuInt16 = 2; - a3.nInt64 = 2; - a3.nInt32 = 2; - a3.nuInt64 = 2; - a3.nuInt32 = 2; - a3.eType = TypeClass_STRUCT; - a3.wChar = L'2'; - a3.td.nInt16 = 2; - a3.td.dDouble = 2; - a3.bBool = sal_True; - a3.aAny = makeAny( (sal_Int32)2 ); - char sz3[sizeof( Test3 )]; - uno_type_copyData( sz3, &a3, getCppuType( (Test3*)0).getTypeLibType(), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire) ); - OSL_ASSERT( ((Test3*)sz3)->nInt8 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nFloat == (float)2 ); - OSL_ASSERT( ((Test3*)sz3)->nDouble == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nInt16 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->aString == OUString::createFromAscii("2") ); - OSL_ASSERT( ((Test3*)sz3)->nuInt16 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nInt64 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nInt32 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nuInt64 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->nuInt32 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->eType == TypeClass_STRUCT ); - OSL_ASSERT( ((Test3*)sz3)->wChar == L'2' ); - OSL_ASSERT( ((Test3*)sz3)->td.nInt16 == 2 ); - OSL_ASSERT( ((Test3*)sz3)->td.dDouble == 2 ); - OSL_ASSERT( ((Test3*)sz3)->bBool == sal_True ); - OSL_ASSERT( ((Test3*)sz3)->aAny.getValueType() == getCppuType( (sal_Int32 *)0 ) ); - OSL_ASSERT( *(sal_Int32*)((Test3*)sz3)->aAny.getValue() == 2 ); - ((Test3 *)sz3)->~Test3(); - } - - { - sal_Bool bAssignable; - // test assignment - Test1 a1; - a1.nInt16 = 4; - a1.dDouble = 3.6; - a1.bBool = sal_True; - Test1 sz1; - bAssignable = uno_type_assignData( - &sz1, getCppuType( (Test1*)0).getTypeLibType(), - &a1, getCppuType( (Test1*)0).getTypeLibType(), - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - OSL_ASSERT( bAssignable ); - OSL_ASSERT( sz1.nInt16 == 4 && sz1.dDouble == 3.6 && sz1.bBool == sal_True); - - Test2 a2; - a2.nInt16 = 2; - a2.aTest1.nInt16 = 4; - a2.aTest1.dDouble = 3.6; - a2.aTest1.bBool = sal_True; - Test2 sz2; - bAssignable = uno_type_assignData( - &sz2, getCppuType( (Test2*)0).getTypeLibType(), - &a2, getCppuType( (Test2*)0).getTypeLibType(), - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - OSL_ASSERT( bAssignable ); - OSL_ASSERT( sz2.nInt16 == 2 && sz2.aTest1.nInt16 == 4 - && sz2.aTest1.dDouble == 3.6 && sz2.aTest1.bBool == sal_True); - - Test3 a3; - Test3 sz3; - a3.nInt8 = 2; - a3.nFloat = (float)2; - a3.nDouble = 2; - a3.nInt16 = 2; - a3.aString = OUString::createFromAscii("2"); - a3.nuInt16 = 2; - a3.nInt64 = 2; - a3.nInt32 = 2; - a3.nuInt64 = 2; - a3.nuInt32 = 2; - a3.eType = TypeClass_STRUCT; - a3.wChar = L'2'; - a3.td.nInt16 = 2; - a3.td.dDouble = 2; - a3.bBool = sal_True; - a3.aAny = makeAny( (sal_Int32)2 ); - OSL_ASSERT( a3.aAny.isExtractableTo( ::getCppuType( (sal_Int64 const *)0 ) ) ); - OSL_ASSERT( ::getCppuType( (sal_Int64 const *)0 ).isAssignableFrom( a3.aAny.getValueType() ) ); - bAssignable = uno_type_assignData( - &sz3, getCppuType( (Test3*)0).getTypeLibType(), - &a3, getCppuType( (Test3*)0).getTypeLibType(), - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - OSL_ASSERT( bAssignable ); - OSL_ASSERT( sz3.nInt8 == 2 ); - OSL_ASSERT( sz3.nFloat == (float)2 ); - OSL_ASSERT( sz3.nDouble == 2 ); - OSL_ASSERT( sz3.nInt16 == 2 ); - OSL_ASSERT( sz3.aString == OUString::createFromAscii("2") ); - OSL_ASSERT( sz3.nuInt16 == 2 ); - OSL_ASSERT( sz3.nInt64 == 2 ); - OSL_ASSERT( sz3.nInt32 == 2 ); - OSL_ASSERT( sz3.nuInt64 == 2 ); - OSL_ASSERT( sz3.nuInt32 == 2 ); - OSL_ASSERT( sz3.eType == TypeClass_STRUCT ); - OSL_ASSERT( sz3.wChar == L'2' ); - OSL_ASSERT( sz3.td.nInt16 == 2 ); - OSL_ASSERT( sz3.td.dDouble == 2 ); - OSL_ASSERT( sz3.bBool == sal_True ); - OSL_ASSERT( sz3.aAny.getValueType() == getCppuType( (sal_Int32 *)0 ) ); - OSL_ASSERT( *(sal_Int32*)sz3.aAny.getValue() == 2 ); - - // test not assigneable values - bAssignable = uno_type_assignData( - &a1, getCppuType( (Test1*)0).getTypeLibType(), - &a2, getCppuType( (Test2*)0).getTypeLibType(), - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - OSL_ASSERT( !bAssignable ); - } - - { - // test any - Any tb; - tb <<= true; - OSL_ASSERT( tb.getValueType() == ::getCppuBooleanType() ); - OSL_ASSERT( tb == makeAny( true ) ); - Any aAny = makeAny( (sal_Int8)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int8 *)0 ) ); - OSL_ASSERT( *(sal_Int8*)aAny.getValue() == 2 ); - aAny = makeAny( (float)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (float *)0 ) ); - OSL_ASSERT( *(float*)aAny.getValue() == (float)2 ); - aAny = makeAny( (sal_Int8)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int8 *)0 ) ); - OSL_ASSERT( *(sal_Int8*)aAny.getValue() == 2 ); - aAny = makeAny( (double)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (double *)0 ) ); - OSL_ASSERT( *(double*)aAny.getValue() == (double)2 ); - aAny = makeAny( (sal_Int16)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int16 *)0 ) ); - OSL_ASSERT( *(sal_Int16*)aAny.getValue() == 2 ); - aAny = makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM("test") ) ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (OUString *)0 ) ); - OSL_ASSERT( *(OUString*)aAny.getValue() == OUString::createFromAscii("test") ); - aAny = makeAny( (sal_uInt16)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt16 *)0 ) ); - OSL_ASSERT( *(sal_Int16*)aAny.getValue() == 2 ); - sal_Int64 aInt64 = SAL_CONST_INT64(0x200000000); - aAny = makeAny( aInt64 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int64 *)0 ) ); - OSL_ASSERT( *(sal_Int64*)aAny.getValue() == SAL_CONST_INT64(0x200000000) ); - aAny = makeAny( (sal_Int32)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int32 *)0 ) ); - OSL_ASSERT( *(sal_Int32*)aAny.getValue() == 2 ); - sal_uInt64 auInt64 = SAL_CONST_UINT64(0x200000000); - aAny = makeAny( auInt64 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt64 *)0 ) ); - OSL_ASSERT( *(sal_uInt64*)aAny.getValue() == SAL_CONST_UINT64(0x200000000) ); - aAny = makeAny( (sal_uInt32)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt32 *)0 ) ); - OSL_ASSERT( *(sal_uInt32*)aAny.getValue() == 2 ); - aAny = makeAny( TypeClass_STRUCT ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (TypeClass *)0 ) ); - OSL_ASSERT( *(TypeClass*)aAny.getValue() == TypeClass_STRUCT ); - sal_Unicode c = L'2'; - aAny.setValue( &c, getCppuCharType() ); - OSL_ASSERT( aAny.getValueType() == getCppuCharType() ); - OSL_ASSERT( *(sal_Unicode*)aAny.getValue() == L'2' ); - sal_Bool b2 = sal_True; - aAny.setValue( &b2, getCppuBooleanType() ); - OSL_ASSERT( aAny.getValueType() == getCppuBooleanType() ); - OSL_ASSERT( *(sal_Bool*)aAny.getValue() == sal_True ); - } - - { - // test: operator <<=( any, value ) - Any aAny; - aAny <<= (sal_Int8)2; - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int8 *)0 ) ); - OSL_ASSERT( *(sal_Int8*)aAny.getValue() == 2 ); - aAny <<=( (float)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (float *)0 ) ); - OSL_ASSERT( *(float*)aAny.getValue() == (float)2 ); -// aAny <<=( (sal_uInt8)2 ); -// OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt8 *)0 ) ); -// OSL_ASSERT( *(sal_uInt8*)aAny.getValue() == 2 ); - aAny <<=( (double)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (double *)0 ) ); - OSL_ASSERT( *(double*)aAny.getValue() == (double)2 ); - aAny <<=( (sal_Int16)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int16 *)0 ) ); - OSL_ASSERT( *(sal_Int16*)aAny.getValue() == 2 ); - aAny <<=( OUString( RTL_CONSTASCII_USTRINGPARAM("test") ) ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (OUString *)0 ) ); - OSL_ASSERT( *(OUString*)aAny.getValue() == OUString::createFromAscii("test") ); - aAny <<=( (sal_uInt16)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt16 *)0 ) ); - OSL_ASSERT( *(sal_Int16*)aAny.getValue() == 2 ); - sal_Int64 aInt64 = SAL_CONST_INT64(0x200000000); - aAny <<=( aInt64 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int64 *)0 ) ); - OSL_ASSERT( *(sal_Int64*)aAny.getValue() == SAL_CONST_UINT64(0x200000000) ); - aAny <<=( (sal_Int32)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_Int32 *)0 ) ); - OSL_ASSERT( *(sal_Int32*)aAny.getValue() == 2 ); - sal_uInt64 auInt64 = SAL_CONST_UINT64(0x200000000); - aAny <<=( auInt64 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt64 *)0 ) ); - OSL_ASSERT( *(sal_uInt64*)aAny.getValue() == SAL_CONST_UINT64(0x200000000) ); - aAny <<=( (sal_uInt32)2 ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (sal_uInt32 *)0 ) ); - OSL_ASSERT( *(sal_uInt32*)aAny.getValue() == 2 ); - aAny <<=( TypeClass_STRUCT ); - OSL_ASSERT( aAny.getValueType() == getCppuType( (TypeClass *)0 ) ); - OSL_ASSERT( *(TypeClass*)aAny.getValue() == TypeClass_STRUCT ); - } - - { - // test seq< any > - Sequence< Any > seqAny( 1 ); - seqAny[ 0 ] <<= sal_Int32(5); - seqAny.realloc( 200000 ); // hopefully different memory - seqAny[ 1 ] <<= sal_Int32(6); - - uno_Any * pAnys = (uno_Any *)seqAny.getConstArray(); - OSL_ASSERT( pAnys[ 1 ].pData == &pAnys[ 1 ].pReserved ); - OSL_ASSERT( *(sal_Int32 *)pAnys[ 1 ].pData == sal_Int32(6) ); - OSL_ASSERT( pAnys[ 0 ].pData == &pAnys[ 0 ].pReserved ); - OSL_ASSERT( *(sal_Int32 *)pAnys[ 0 ].pData == sal_Int32(5) ); - } - - { - // test: operator >>=( any, value ) - Test3 a3; - makeAny( (sal_Int8)2) >>= a3.nInt8; - OSL_ASSERT( (makeAny( (sal_Int8)2) >>= a3.nInt8) && a3.nInt8 == 2 ); - OSL_ASSERT( (makeAny( (float)2) >>= a3.nFloat) && a3.nFloat ==(float)2 ); - OSL_ASSERT( (makeAny( (double)2) >>= a3.nDouble) && a3.nDouble == 2 ); - OSL_ASSERT( (makeAny( (sal_Int16)2) >>= a3.nInt16) && a3.nInt16 == 2 ); - OSL_ASSERT( (makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM("2") )) >>= a3.aString) && - a3.aString == OUString::createFromAscii("2") ); - OSL_ASSERT( (makeAny( (sal_uInt16)2) >>= a3.nuInt16) && a3.nuInt16 == 2 ); - sal_Int64 aInt64 = SAL_CONST_INT64(0x200000000); - OSL_ASSERT( makeAny( aInt64 ) >>= a3.nInt64 ); - OSL_ASSERT( a3.nInt64 == SAL_CONST_INT64(0x200000000) ); - OSL_ASSERT( (makeAny( (sal_Int32)2) >>= a3.nInt32) && a3.nInt32 == 2 ); - sal_uInt64 auInt64 = SAL_CONST_UINT64(0x200000000); - OSL_ASSERT( makeAny( auInt64 ) >>= a3.nuInt64 ); - OSL_ASSERT( a3.nuInt64 == SAL_CONST_UINT64(0x200000000) ); - OSL_ASSERT( (makeAny( (sal_uInt32)2) >>= a3.nuInt32) && a3.nuInt32 == 2 ); - OSL_ASSERT( (makeAny( TypeClass_STRUCT) >>= a3.eType) && a3.eType == TypeClass_STRUCT ); - //OSL_ASSERT( (makeAny( L'2' ) >>= a3.wChar) && a3.nInt8 ==L'2'; - OSL_ASSERT( (makeAny( (sal_Int16)2) >>= a3.td.nInt16) && a3.nInt16 == 2 ); - OSL_ASSERT( (makeAny( (double)2) >>= a3.td.dDouble) && a3.nDouble == 2 ); - //OSL_ASSERT( (makeAny( (sal_True)2) >>= a3.bBool) && a3.nInt8 ==sal_True; - - // Only one negative test, the implementation has only one if to test this - OSL_ASSERT( (makeAny( (float)2) >>= a3.nFloat) && a3.nFloat ==(float)2 ); - } - - { - // test: Sequence - Sequence< Test1 > aTestSeq; - OSL_ASSERT( aTestSeq.getLength() == 0 ); - sal_Int32 szInt32[2] = { 1, 2 }; - Sequence< sal_Int32 > aInt32Seq( szInt32, 2 ); - OSL_ASSERT( aInt32Seq.getLength() == 2 ); - OSL_ASSERT( aInt32Seq[0] == 1 && aInt32Seq[1] == 2 ); - OSL_ASSERT( aInt32Seq.getArray()[0] == 1 && aInt32Seq.getArray()[1] == 2 ); - Sequence< sal_Int32 > aNextInt32Seq( aInt32Seq ); - OSL_ASSERT( aNextInt32Seq[0] == 1 && aNextInt32Seq[1] == 2 ); - aInt32Seq[0] = 45; - OSL_ASSERT( aInt32Seq[0] == 45 && aInt32Seq[1] == 2 ); - OSL_ASSERT( aNextInt32Seq[0] == 1 && aNextInt32Seq[1] == 2 ); - sal_Int32 * pArray = aNextInt32Seq.getArray(); - OSL_ASSERT( pArray[0] == 1 && pArray[1] == 2 ); - Sequence< double > aDoubleSeq( 5 ); - OSL_ASSERT( aDoubleSeq[4] == 0.0 ); - Sequence< OUString > aStringSeq( 5 ); - OSL_ASSERT( aStringSeq[4] == OUString() ); - } - sal_Int32 szInt32[2] = { 1, 2 }; - Sequence<sal_Int32 > aInt32Seq( szInt32, 2 ); - Sequence<sal_Int32 > aNextInt32Seq( aInt32Seq ); - aNextInt32Seq.realloc( 1 ); // split of sequence - const sal_Int32 * pArray = aNextInt32Seq.getConstArray(); - OSL_ASSERT( pArray[0] == 1 ); - aInt32Seq.realloc( 1 ); // reallocate mem - pArray = aInt32Seq.getConstArray(); - OSL_ASSERT( pArray[0] == 1 ); - - Sequence<sal_Int32 > aInt32Seq2( aInt32Seq ); - aInt32Seq.realloc( 0 ); - aInt32Seq.realloc( 1 ); - aInt32Seq.realloc( 0 ); -} - -class TestInterface : public XInterface -{ -public: - // XInterface - void SAL_CALL acquire() throw () - { osl_incrementInterlockedCount( &nRefCount ); } - void SAL_CALL release() throw () - { if( !osl_decrementInterlockedCount( &nRefCount ) ) delete this; } - Any SAL_CALL queryInterface( const Type & rType ) throw (RuntimeException) - { return cppu::queryInterface( rType, static_cast< XInterface* >( this ) ); } - - TestInterface() : nRefCount( 0 ) {} - - sal_Int32 nRefCount; -}; - -struct SimpleInterface : public TestInterface, public XSimpleInterface -{ - void SAL_CALL acquire() throw () - { TestInterface::acquire(); } - void SAL_CALL release() throw () - { TestInterface::release(); } - Any SAL_CALL queryInterface( const Type & rType ) throw (RuntimeException) - { - Any aRet( cppu::queryInterface( rType, static_cast< XSimpleInterface * >( this ) ) ); - return (aRet.hasValue() ? aRet : TestInterface::queryInterface( rType )); - } - virtual void SAL_CALL method() throw(::com::sun::star::uno::RuntimeException) - {} -}; - -static sal_Bool s_aAssignableFromTab[11][11] = -{ - /* from CH,BO,BY,SH,US,LO,UL,HY,UH,FL,DO */ -/* TypeClass_CHAR */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -/* TypeClass_BOOLEAN */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -/* TypeClass_BYTE */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, -/* TypeClass_SHORT */ { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, -/* TypeClass_UNSIGNED_SHORT */ { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, -/* TypeClass_LONG */ { 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, -/* TypeClass_UNSIGNED_LONG */ { 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, -/* TypeClass_HYPER */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, -/* TypeClass_UNSIGNED_HYPER */ { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, -/* TypeClass_FLOAT */ { 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0 }, -/* TypeClass_DOUBLE */ { 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1 } -}; -template < class T > -void test_assignSimple( const T & rVal, /*const*/ Any /*&*/ rAny ) -{ - typelib_TypeDescription * pTD = 0; - ::getCppuType( &rVal ).getDescription( &pTD ); - sal_Bool bTable = s_aAssignableFromTab[pTD->eTypeClass-1][rAny.getValueTypeClass()-1]; - OSL_ASSERT( - (bTable!=sal_False) == - (typelib_typedescriptionreference_isAssignableFrom( - pTD->pWeakRef, rAny.getValueTypeRef() )!=sal_False) ); - T t; - OSL_ASSERT( (bTable!=sal_False) == ((rAny >>= t)!=sal_False) ); - if (bTable) - OSL_ASSERT( t == rVal ); - typelib_typedescription_release( pTD ); -} -template < class T > -void test_simple_assignment( const T & rVal ) -{ - // bool - sal_Bool tr = sal_True; - typelib_TypeDescription * pBoolTD = 0; - ::getCppuBooleanType().getDescription( &pBoolTD ); - Any a( &tr, pBoolTD ); - test_assignSimple( rVal, a ); - OSL_ASSERT( typelib_typedescriptionreference_isAssignableFrom( pBoolTD->pWeakRef, a.getValueTypeRef() ) ); - typelib_typedescription_release( pBoolTD ); - OSL_ASSERT( *(sal_Bool *)a.getValue() ); - // char - sal_Unicode ch = 'a'; - typelib_TypeDescription * pCharTD = 0; - ::getCppuCharType().getDescription( &pCharTD ); - a.setValue( &ch, pCharTD ); - test_assignSimple( rVal, a ); - OSL_ASSERT( typelib_typedescriptionreference_isAssignableFrom( pCharTD->pWeakRef, a.getValueTypeRef() ) ); - typelib_typedescription_release( pCharTD ); - OSL_ASSERT( *(sal_Unicode *)a.getValue() == 'a' ); - - // rest by template - a <<= (sal_Int8)5; - test_assignSimple( rVal, a ); - a <<= (sal_Int16)5; - test_assignSimple( rVal, a ); - a <<= (sal_uInt16)5; - test_assignSimple( rVal, a ); - a <<= (sal_Int32)5; - test_assignSimple( rVal, a ); - a <<= (sal_uInt32)5; - test_assignSimple( rVal, a ); - a <<= (sal_Int64)5; - test_assignSimple( rVal, a ); - a <<= (sal_uInt64)5; - test_assignSimple( rVal, a ); - a <<= (float)5; - test_assignSimple( rVal, a ); - a <<= (double)5; - test_assignSimple( rVal, a ); -} -static void testAssignment() -{ - // simple types - test_simple_assignment( (sal_Int8)5 ); - test_simple_assignment( (sal_Int16)5 ); - test_simple_assignment( (sal_uInt16)5 ); - test_simple_assignment( (sal_Int32)5 ); - test_simple_assignment( (sal_uInt32)5 ); - test_simple_assignment( (sal_Int64)5 ); - test_simple_assignment( (sal_uInt64)5 ); - test_simple_assignment( (float)5 ); - test_simple_assignment( (double)5 ); - // some complex things - Any a; - TestSimple ts; - TestElement te; // derived from simple - a <<= ts; - OSL_ASSERT( !(a >>= te) ); - OSL_ASSERT( a >>= ts ); - a <<= te; - OSL_ASSERT( (a >>= te) && (a >>= ts) ); - // interface - Reference< XSimpleInterface > xOriginal( new SimpleInterface() ); - a <<= xOriginal; - Reference< XInterface > x; - OSL_ASSERT( (a >>= x) && (a == xOriginal) && (xOriginal == x) && (x == xOriginal) ); - // sequence - Sequence< TestElement > aSeq( 5 ); - Sequence< TestElement > aSeq2( 3 ); - aSeq[1].Byte = 17; - a <<= aSeq; - OSL_ASSERT( a >>= aSeq2 ); - OSL_ASSERT( aSeq2[1].Byte == 17 ); - aSeq2[1].Byte = 20; - OSL_ASSERT( aSeq != aSeq2 ); - OSL_ASSERT( a != aSeq2 ); - a <<= aSeq2; - OSL_ASSERT( a >>= aSeq ); - OSL_ASSERT( a == aSeq ); - OSL_ASSERT( !(a != aSeq) ); - OSL_ASSERT( aSeq == aSeq2 ); - OSL_ASSERT( aSeq[1].Byte == 20 ); - - // equals... - sal_uInt64 n = (sal_uInt64)(sal_Int64)-5; - a.setValue( &n, getCppuType( (sal_uInt64 *)0 ) ); - Any b; - sal_Int8 n2 = -5; - b.setValue( &n2, getCppuType( (sal_Int8 *)0 ) ); - OSL_ASSERT( a != b ); -} - -void test_interface() -{ - { - // test: Interface - Reference< XInterface > xIFace; - OSL_ASSERT( !xIFace.is() ); - xIFace.clear(); // do nothing - } -} - -void test_inheritance() -{ - OSL_ASSERT( sizeof( Base ) == getSize( getCppuType( (Base *)0).getTypeLibType() ) ); - OSL_ASSERT( sizeof( Base1 ) == getSize( getCppuType( (Base1 *)0).getTypeLibType() ) ); - OSL_ASSERT( sizeof( Base2 ) == getSize( getCppuType( (Base2 *)0).getTypeLibType() ) ); -} - -sal_Int32 nCallback_1; -sal_Int32 nCallback; -void SAL_CALL typedescription_Callback_1 -( - void * pContext, - typelib_TypeDescription ** ppRet, - rtl_uString * pTypeName -) -{ - OSL_ENSURE( pContext == (void *)1, "### unexpected context!" ); - if( *ppRet ) - { - typelib_typedescription_release( *ppRet ); - *ppRet = 0; - } - - OUString aTypeName( pTypeName ); - if( -1 != aTypeName.indexOf( OUString::createFromAscii("1_") ) ) - { - nCallback_1++; - OUString aName( RTL_CONSTASCII_USTRINGPARAM("unsigned short") ); - OUString empty; - typelib_CompoundMember_Init aMember = { typelib_TypeClass_UNSIGNED_SHORT, - aName.pData, - empty.pData }; - typelib_typedescription_new( - ppRet, - typelib_TypeClass_STRUCT, pTypeName, 0, - 1, - &aMember - ); - } -} - -void SAL_CALL typedescription_Callback -( - void * pContext, - typelib_TypeDescription ** ppRet, - rtl_uString * pTypeName -) -{ - OSL_ENSURE( pContext == (void *)0, "### unexpected context!" ); - if( *ppRet ) - { - typelib_typedescription_release( *ppRet ); - *ppRet = 0; - } - - OUString aTypeName( pTypeName ); - if( -1 != aTypeName.indexOf( OUString::createFromAscii("cachetest") ) ) - { - nCallback++; - aTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM("1_") ) + aTypeName; - OUString empty; - typelib_CompoundMember_Init aMember = { typelib_TypeClass_STRUCT, - aTypeName.pData, - empty.pData }; - typelib_typedescription_new( - ppRet, - typelib_TypeClass_STRUCT, pTypeName, 0, - 1, - &aMember - ); - } -} - -void test_cache() -{ - typelib_typedescription_registerCallback( - (void *)1, - reinterpret_cast<typelib_typedescription_Callback>(typedescription_Callback_1) ); - typelib_typedescription_registerCallback( - 0, - reinterpret_cast<typelib_typedescription_Callback>(typedescription_Callback) ); - - for( sal_Int32 i = 0; i < 300; i++ ) - { - typelib_TypeDescription * pTD = 0; - OUString aTypeName( RTL_CONSTASCII_USTRINGPARAM("cachetest") ); - aTypeName = aTypeName + OUString::valueOf( i ); - typelib_typedescription_getByName( &pTD, aTypeName.pData ); - typelib_typedescription_release( pTD ); - } - OSL_ASSERT( nCallback_1 == 300 ); - OSL_ASSERT( nCallback == 300 ); - // The cache size is 200 so the description "cachetest200" is in the cache - typelib_TypeDescription * pTD = 0; - OUString aName200( RTL_CONSTASCII_USTRINGPARAM("cachetest200") ); - typelib_typedescription_getByName( &pTD, aName200.pData ); - OSL_ASSERT( nCallback_1 == 300 ); - OSL_ASSERT( nCallback == 300 ); - // The cache size is 200 so the description "cachetest199" is not in the cache - // "1_cachetest199" is loaded too. - OUString aName199( RTL_CONSTASCII_USTRINGPARAM("cachetest199") ); - typelib_typedescription_getByName( &pTD, aName199.pData ); - typelib_typedescription_release( pTD ); - OSL_ASSERT( nCallback_1 == 301 ); - OSL_ASSERT( nCallback == 301 ); - - typelib_typedescription_revokeCallback( - (void *)1, - reinterpret_cast<typelib_typedescription_Callback>(typedescription_Callback_1) ); - typelib_typedescription_revokeCallback( - 0, - reinterpret_cast<typelib_typedescription_Callback>(typedescription_Callback) ); -} - -static OUString s_aAddPurpose; - -static void SAL_CALL getMappingCallback( - uno_Mapping ** /*ppMapping*/, - uno_Environment * /*pFrom*/, uno_Environment * /*pTo*/, rtl_uString * pAddPurpose ) -{ - s_aAddPurpose = pAddPurpose; -} -static void testMappingCallback() -{ - uno_registerMappingCallback( reinterpret_cast<uno_getMappingFunc>(getMappingCallback) ); - OSL_ASSERT( ! s_aAddPurpose.getLength() ); - Mapping aTest( - OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ), - OUString( RTL_CONSTASCII_USTRINGPARAM("test") ) ); - uno_revokeMappingCallback( reinterpret_cast<uno_getMappingFunc>(getMappingCallback) ); - OSL_ASSERT( s_aAddPurpose.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test") ) ); - s_aAddPurpose = OUString(); - Mapping aTest2( - OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ), - OUString( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ), - OUString( RTL_CONSTASCII_USTRINGPARAM("test") ) ); - OSL_ASSERT( ! s_aAddPurpose.getLength() ); -} - -static void testEnvironments(void) -{ - uno_Environment ** ppEnv; - sal_Int32 nLen; - OUString aTypeName; - - ::uno_getRegisteredEnvironments( - &ppEnv, &nLen, ::rtl_allocateMemory, aTypeName.pData ); - - if (nLen) - { - for ( sal_Int32 nPos = 0; nPos < nLen; ++nPos ) - { - uno_Environment * pEnv = ppEnv[ nPos ]; - - // dump out infos - ::uno_dumpEnvironment( stderr, pEnv, 0 ); - - // call some releases - void ** ppInterfaces = 0; - sal_Int32 nInterfaces; - - uno_ExtEnvironment * pExtEnv = pEnv->pExtEnv; - (*pExtEnv->getRegisteredInterfaces)( - pExtEnv, &ppInterfaces, &nInterfaces, ::rtl_allocateMemory ); - if (nInterfaces) - { - while (nInterfaces--) - { - void * p = ppInterfaces[ nInterfaces ]; - (*pExtEnv->releaseInterface)( pExtEnv, p ); - } - ::rtl_freeMemory( ppInterfaces ); - } - - (*pEnv->release)( pEnv ); - } - ::rtl_freeMemory( ppEnv ); - } -} - -inline const ::com::sun::star::uno::Type& SAL_CALL getCppuType( const Sequence< OUString[2][4] >* ) SAL_THROW( () ) -{ - return getCppuSequenceType< OUString[2][4] >( getCppuArrayType2( (const OUString (*)[2][4])0 ) ); -} - -//================================================================================================== -class Test_CContext - : public ::cppu::WeakImplHelper1< XCurrentContext > -{ - Reference< XCurrentContext > m_xDel; - sal_Int32 m_value; - OUString m_name; -public: - inline Test_CContext( sal_Int32 val, OUString const & rName, - Reference< XCurrentContext > const & xDel ) - SAL_THROW( () ) - : m_xDel( xDel ) - , m_value( val ) - , m_name( rName ) - {} - - virtual Any SAL_CALL getValueByName( OUString const & rName ) - throw (RuntimeException); -}; -//__________________________________________________________________________________________________ -Any Test_CContext::getValueByName( OUString const & rName ) - throw (RuntimeException) -{ - if (rName == m_name) - { - return makeAny( m_value ); - } - else if (m_xDel.is()) - { - return m_xDel->getValueByName( rName ); - } - return Any(); -} -//================================================================================================== -static void testCurrentContext() -{ - { - ContextLayer layer( new Test_CContext( - 5, OUString( RTL_CONSTASCII_USTRINGPARAM("Value1") ), - Reference< XCurrentContext >() ) ); - Reference< XCurrentContext > xCC( getCurrentContext() ); - OSL_ASSERT( - xCC.is() && - xCC->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM("Value1") ) ) == (sal_Int16)5 && - !xCC->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM("Value2") ) ).hasValue() ); - OSL_ASSERT( ! layer.getPreviousContext().is() ); - - { - ContextLayer layer2( new Test_CContext( - 7, OUString( RTL_CONSTASCII_USTRINGPARAM("Value2") ), - xCC ) ); - OSL_ASSERT( layer2.getPreviousContext() == xCC ); - xCC = getCurrentContext(); - OSL_ASSERT( - xCC.is() && - xCC->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM("Value1") ) ) == (sal_Int16)5 && - xCC->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM("Value2") ) ) == (sal_Int16)7 && - !xCC->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM("dummy") ) ).hasValue() ); - - uno_Interface * pContext = 0; - OUString aEnvName( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO) ); - OSL_VERIFY( ::uno_getCurrentContext( (void **)&pContext, aEnvName.pData, 0 ) ); - (*pContext->release)( pContext ); - } - OSL_ASSERT( ! layer.getPreviousContext().is() ); - } - OSL_ASSERT( ! getCurrentContext().is() ); -} - -void testArray(void) -{ - long a[5][6]; - getCppuArrayType2( &a ); - - getCppuArrayType1( (const long (*)[5])0 ); - getCppuArrayType2( (const long (*)[6][7])0 ); - getCppuArrayType3( (const long (*)[7][8][9])0 ); - getCppuArrayType4( (const long (*)[8][9][10][11])0 ); - getCppuArrayType5( (const long (*)[9][10][11][12][13])0 ); - getCppuArrayType6( (const long (*)[10][11][12][13][14][15])0 ); - - getCppuArrayType2( (const Reference< XInterface > (*)[6][7])0 ); - - getCppuArrayType1( (const Test1 (*)[5])0 ); - getCppuArrayType2( (const Test1 (*)[6][7])0 ); - getCppuArrayType3( (const Test1 (*)[7][8][9])0 ); - getCppuArrayType4( (const Test1 (*)[8][9][10][11])0 ); - getCppuArrayType5( (const Test1 (*)[9][10][11][12][13])0 ); - getCppuArrayType6( (const Test1 (*)[10][11][12][13][14][15])0 ); - - typelib_TypeDescription* pType = NULL; - typelib_TypeDescriptionReference* pTypeRef = NULL; - sal_Int32 pDim[] = { 2, 4 }; - Type rType = getCppuType((const sal_Int32*)0); - typelib_typedescription_newArray(&pType, rType.getTypeLibType(), 2, pDim); - OSL_ASSERT( pType ); - typelib_typedescriptionreference_new(&pTypeRef, typelib_TypeClass_ARRAY, pType->pTypeName); - OSL_ASSERT( pTypeRef ); - - sal_Int32 a1[2][4]; - sal_Int32 a2[2][4] = { {1,2,3,4}, {5,6,7,8} }; - uno_constructData( &a1, pType ); -// uno_type_constructData( &a1, pTypeRef ); - - sal_Bool bAssignable = uno_assignData(&a1, pType, a2, pType, - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - sal_Int32 i,j; - for ( i=0; i<2; i++ ) - for ( j=0; j<4; j++ ) - OSL_ASSERT( a1[i][j] == a2[i][j] ); - - uno_destructData( a1, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); -// uno_type_destructData( &a1, pTypeRef, cpp_release ); - uno_destructData( a2, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - typelib_typedescription_release(pType); - typelib_typedescriptionreference_release(pTypeRef); - pType = NULL; - pTypeRef = NULL; - - typelib_typedescription_newArray(&pType, getCppuType((const OUString*)0).getTypeLibType(), 2, pDim); - OSL_ASSERT( pType ); - typelib_typedescriptionreference_new(&pTypeRef, typelib_TypeClass_ARRAY, pType->pTypeName); - OSL_ASSERT( pTypeRef ); - - OUString s1(OUString::createFromAscii("Hallo")); - OUString s2(OUString::createFromAscii("jetzt")); - OUString s3(OUString::createFromAscii("teste")); - OUString s4(OUString::createFromAscii("ich")); - OUString s5(OUString::createFromAscii("ein")); - OUString s6(OUString::createFromAscii("Array")); - OUString s7(OUString::createFromAscii("mit")); - OUString s8(OUString::createFromAscii("strings")); - OUString st1,st2,st3,st4,st5,st6,st7,st8; - - void* p = rtl_allocateMemory(8 * sizeof(rtl_uString*)); - void* p2 = rtl_allocateMemory(8 * sizeof(rtl_uString*)); - rtl_uString** ppS = (rtl_uString**)p; - rtl_uString* sa1[2][4] = { {st1.pData,st2.pData,st3.pData,st4.pData}, - {st5.pData,st6.pData,st7.pData,st8.pData} }; - rtl_uString* sa2[2][4] = { {s1.pData,s2.pData,s3.pData,s4.pData}, - {s5.pData,s6.pData,s7.pData,s8.pData} }; - uno_constructData( p, pType ); - - bAssignable = uno_assignData(p, pType, sa2, pType, - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - bAssignable = uno_assignData(sa1, pType, p, pType, - reinterpret_cast<uno_QueryInterfaceFunc>(cpp_queryInterface), - reinterpret_cast<uno_AcquireFunc>(cpp_acquire), - reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - for ( i=0; i<2; i++ ) - for ( j=0; j<4; j++ ) - OSL_ASSERT( sa1[i][j] == sa2[i][j] ); - - OUString sA[2][4]; - sA[0][0] = s1; - sA[1][0] = s5; - sA[0][1] = s2; - sA[1][1] = s6; - sA[0][2] = s3; - sA[1][2] = s7; - sA[0][3] = s4; - sA[1][3] = s8; - - Any aa1, aa2; - Type arrayType; - OUString (*sB)[2][4]; - aa1.setValue(&sA, getCppuArrayType2( (const OUString (*)[2][4])0 )); - aa2 = aa1; - arrayType = aa2.getValueType(); - sB = (OUString(*)[2][4])aa2.getValue(); - for ( i=0; i<2; i++ ) - for ( j=0; j<4; j++ ) - OSL_ASSERT( sA[i][j] == (*sB)[i][j] ); - - // requires a specialized getCppuType function 'getCppuType( const Sequence< OUString[2][4] >* )' -// Sequence< OUString[2][4] > aSeq(2); -// OUString (*pSeq)[2][4] = aSeq.getArray(); -// uno_copyData(pSeq[0], sA, pType, cpp_acquire); -// uno_copyData(pSeq[1], sA, pType, cpp_acquire); - -// OSL_ASSERT( aSeq[0][0][0] == sA[0][0] ); -// OSL_ASSERT( aSeq[0][0][1] == sA[0][1] ); -// OSL_ASSERT( aSeq[0][0][2] == sA[0][2] ); -// OSL_ASSERT( aSeq[0][0][3] == sA[0][3] ); -// OSL_ASSERT( aSeq[0][1][0] == sA[1][0] ); -// OSL_ASSERT( aSeq[0][1][1] == sA[1][1] ); -// OSL_ASSERT( aSeq[0][1][2] == sA[1][2] ); -// OSL_ASSERT( aSeq[0][1][3] == sA[1][3] ); - -// OSL_ASSERT( aSeq[1][0][0] == sA[0][0] ); -// OSL_ASSERT( aSeq[1][0][1] == sA[0][1] ); -// OSL_ASSERT( aSeq[1][0][2] == sA[0][2] ); -// OSL_ASSERT( aSeq[1][0][3] == sA[0][3] ); -// OSL_ASSERT( aSeq[1][1][0] == sA[1][0] ); -// OSL_ASSERT( aSeq[1][1][1] == sA[1][1] ); -// OSL_ASSERT( aSeq[1][1][2] == sA[1][2] ); -// OSL_ASSERT( aSeq[1][1][3] == sA[1][3] ); - - uno_constructData( p2, pType ); - ppS = (rtl_uString**)p2; - uno_copyData(p2, sa1, pType, reinterpret_cast<uno_AcquireFunc>(cpp_acquire)); - uno_copyData(sa2, p2, pType, reinterpret_cast<uno_AcquireFunc>(cpp_acquire)); - - uno_destructData( p, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release)); - uno_destructData( p2, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - uno_destructData( sa1, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - uno_destructData( sa2, pType, reinterpret_cast<uno_ReleaseFunc>(cpp_release) ); - - rtl_freeMemory(p); - rtl_freeMemory(p2); - typelib_typedescription_release(pType); - typelib_typedescriptionreference_release(pTypeRef); - pType = NULL; - pTypeRef = NULL; -} - -/* - * main. - */ -SAL_IMPLEMENT_MAIN() -{ - rtl::OUString const cppName( - RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) ); - uno_Environment * pCppEnv = 0; - uno_getEnvironment( &pCppEnv, cppName.pData, 0 ); - uno_getEnvironment( &pCppEnv, cppName.pData, 0 ); - (*pCppEnv->release)( pCppEnv ); - - try { - typelib_setCacheSize( 200 ); - Reference< registry::XSimpleRegistry > xRegistry( - ::cppu::createSimpleRegistry() ); - xRegistry->open( OUString( RTL_CONSTASCII_USTRINGPARAM("testcppu.rdb") ), sal_True, sal_False ); - Reference< XComponentContext > xContext( - ::cppu::bootstrap_InitialComponentContext( xRegistry ) ); - testEnvironments(); - ::rtl_unloadUnusedModules( 0 ); - testMappingCallback(); - ::rtl_unloadUnusedModules( 0 ); - -// // security test -// void test_security( const Reference< XMultiServiceFactory > & ); -// test_security( xMgr ); - - // C++, C bridges test - void test_CppBridge(void); - test_CppBridge(); - ::rtl_unloadUnusedModules( 0 ); -// void test_CBridge(void); -// void test_CBridge2(void); -// test_CBridge(); -// test_CBridge2(); - - testCurrentContext(); - testAssignment(); - testCppu(); -// testArray(); -#if 0 // cache test not possible if types are loaded dynamically (cppumaker -L) - test_cache(); -#endif - test_interface(); - test_inheritance(); - - // shutdown - Reference< XComponent > xComp( xContext, UNO_QUERY_THROW ); - xComp.set( xContext, UNO_QUERY_THROW ); - Reference< XInterface > x( - xContext->getValueByName( - OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theTypeDescriptionManager") ) ), UNO_QUERY_THROW ); - xComp->dispose(); - } - catch (Exception & exc) { - fprintf( stderr, "error: %s\n", rtl::OUStringToOString( - exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - - typelib_setCacheSize( 0 ); - ::rtl_unloadUnusedModules( 0 ); - testEnvironments(); - ::rtl_unloadUnusedModules( 0 ); - - return 0; -} diff --git a/cppu/test/testthreadpool.cxx b/cppu/test/testthreadpool.cxx deleted file mode 100644 index ec404b89793c..000000000000 --- a/cppu/test/testthreadpool.cxx +++ /dev/null @@ -1,193 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_cppu.hxx" -#include <osl/diagnose.h> -#include <osl/time.h> - -#include <rtl/uuid.h> - -#include <uno/threadpool.h> - -#include <vos/thread.hxx> - -#define TEST_ENSURE OSL_ENSURE - -using namespace ::vos; - - -class OThread1 : public OThread -{ -public: - OThread1( sal_uInt8 *pCallerUuid ); - virtual void run(); - -public: - sal_uInt8 *m_pCallerUuid; - sal_Int8 *m_pThreadIdentifier; - sal_Int32 m_nThreadIdentifierLength; - - void *m_pThreadData; -}; - -OThread1::OThread1( sal_uInt8 *pCallerUuid ) : - m_pCallerUuid( pCallerUuid ), - m_pThreadData( (void*) 1 ), - m_pThreadIdentifier( 0 ), - m_nThreadIdentifierLength( 0 ) -{ - -} - -void OThread1::run() -{ - - uno_threadpool_Ticket *pTicket = uno_threadpool_createTicket( m_pCallerUuid ); - - uno_threadIdent_retrieve( &m_pThreadIdentifier , &m_nThreadIdentifierLength ); - - uno_threadpool_waitOnTicket( pTicket , &m_pThreadData ); - - uno_threadIdent_revoke(); -} - - -void SAL_CALL doIt( void *pThreadData ) -{ - *( sal_Int32 *) pThreadData = 2; -} - -void testthreadpool() -{ - printf( "Testing threadpool ..." ); - fflush( stdout ); - - sal_uInt8 pCallerUuid1[16]; - sal_uInt8 pCallerUuid2[16]; - rtl_createUuid( pCallerUuid1, 0 , sal_True ); - rtl_createUuid( pCallerUuid2, 0 , sal_True ); - - //------------ - // Test reply - //------------ - { - OThread1 thread1( pCallerUuid1 ); - - thread1.create(); - - // do a busy wait - while( ! thread1.m_pThreadIdentifier && ! thread1.m_nThreadIdentifierLength ); - - void *pThreadData = (void*)0xdeadbabe; - uno_threadpool_reply( thread1.m_pThreadIdentifier , - thread1.m_nThreadIdentifierLength, - pThreadData ); - - // do a busy wait - while( (void*)1 == thread1.m_pThreadData ); - - TEST_ENSURE( pThreadData == thread1.m_pThreadData, "uno_threadpool_reply error" ); - } - - //--------------- - // Test request - //--------------- - { - OThread1 thread1( pCallerUuid1 ); - - thread1.create(); - - // do a busy wait - while( ! thread1.m_pThreadIdentifier && ! thread1.m_nThreadIdentifierLength ); - - // do a request - sal_Int32 i = 1; - uno_threadpool_request( thread1.m_pThreadIdentifier , - thread1.m_nThreadIdentifierLength, - &i, - doIt, - sal_False); - - // do a busy wait - while( 1 == i ); - TEST_ENSURE( 2 == i, "uno_threadpool_request error" ); - - // get it out of the pool - void *pThreadData = (void*)0xdeadbabe; - uno_threadpool_reply( thread1.m_pThreadIdentifier , - thread1.m_nThreadIdentifierLength, - pThreadData ); - - // do a busy wait - while( pThreadData != thread1.m_pThreadData ); - - } - - //--------------- - // Test dispose threads - //--------------- - { - OThread1 thread1( pCallerUuid1 ); - OThread1 thread2( pCallerUuid2 ); - - thread1.create(); - thread2.create(); - - // do a busy wait - while( ! thread1.m_pThreadIdentifier && ! thread1.m_nThreadIdentifierLength && - ! thread2.m_pThreadIdentifier && ! thread2.m_nThreadIdentifierLength ); - - // dispose the first - uno_threadpool_disposeThreads( pCallerUuid1 ); - - while( (void*)1 == thread1.m_pThreadData ); - TEST_ENSURE( (void*)0 == thread1.m_pThreadData, "disposing threads failed" ); - - TimeValue value = {1,0}; - osl_waitThread( &value ); - TEST_ENSURE( (void*)1 == thread2.m_pThreadData, "wrong thread disposed !" ); - - // test, if new threads are directly disposed - OThread1 thread3( pCallerUuid1 ); - thread3.create(); - - while( (void*)1 == thread3.m_pThreadData ); - TEST_ENSURE( (void*)0 == thread3.m_pThreadData , - "new threads entering threadpool are not disposed" ); - - uno_threadpool_reply( thread2.m_pThreadIdentifier , - thread2.m_nThreadIdentifierLength, - (void*)0x2 ); - - while( (void*)1 == thread2.m_pThreadData ); - TEST_ENSURE( (void*)2 == thread2.m_pThreadData , "reply does not work correctly" ); - - uno_threadpool_stopDisposeThreads( pCallerUuid1 ); - } - printf( "Done\n" ); -} |