comphelper/source/misc/threadpool.cxx | 2 cppuhelper/test/bootstrap/TestEnv.cxx | 118 - cppuhelper/test/bootstrap/TestEnv.def | 8 cppuhelper/test/bootstrap/bootstrap.test.cxx | 278 ---- cppuhelper/test/bootstrap/makefile.mk | 51 cppuhelper/test/cfg_data/instance/uno/components.xml | 92 - cppuhelper/test/cfg_data/template/uno/components.xml | 40 cppuhelper/test/cfg_test.cxx | 275 ---- cppuhelper/test/helpertest.idl | 78 - cppuhelper/test/loader/loader.test.cxx | 198 --- cppuhelper/test/loader/makefile.mk | 42 cppuhelper/test/makefile.mk | 159 -- cppuhelper/test/testcmp/TestComponent.cxx | 227 --- cppuhelper/test/testcmp/TestComponent.hxx | 45 cppuhelper/test/testcmp/TestComponent.uno.def | 11 cppuhelper/test/testcmp/makefile.mk | 40 cppuhelper/test/testcontainer.cxx | 145 -- cppuhelper/test/testdefaultbootstrapping.cxx | 70 - cppuhelper/test/testdefaultbootstrapping.pl | 268 ---- cppuhelper/test/testhelper.cxx | 99 - cppuhelper/test/testhelper.hxx | 31 cppuhelper/test/testimplhelper.cxx | 569 --------- cppuhelper/test/testlib/UNO.pm | 85 - cppuhelper/test/testlib/defbootstrap.map | 26 cppuhelper/test/testlib/defbootstrap_lib.cxx | 101 - cppuhelper/test/testlib/makefile.mk | 92 - cppuhelper/test/testpropshlp.cxx | 1162 ------------------- cppuhelper/test/testproptyphlp.cxx | 76 - remotebridges/examples/exports.dxp | 2 remotebridges/examples/makefile.mk | 52 remotebridges/examples/officeclient.cxx | 311 ----- 31 files changed, 1 insertion(+), 4752 deletions(-)
New commits: commit 21f6405cbef47feb871a5290cc57788589d932c4 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Dec 7 22:17:56 2016 +0100 This is presumably not meant to be exported Change-Id: Id11393c44ddd217d3def259ea5a8df9f8bb27711 diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index 6329143..eddf56e 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -27,7 +27,7 @@ static thread_local bool gbIsWorkerThread; #endif // used to group thread-tasks for waiting in waitTillDone() -class COMPHELPER_DLLPUBLIC ThreadTaskTag +class ThreadTaskTag { std::mutex maMutex; sal_Int32 mnTasksWorking; commit a7a9350a89d3c82641282d7e6273402c9fc54fc3 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Dec 7 22:17:35 2016 +0100 Remove dead example code Change-Id: I126446de2aa4314fb53bc6942b55b151a65f2b84 diff --git a/remotebridges/examples/exports.dxp b/remotebridges/examples/exports.dxp deleted file mode 100644 index 51703a0..0000000 --- a/remotebridges/examples/exports.dxp +++ /dev/null @@ -1,2 +0,0 @@ -component_writeInfo -component_getFactory diff --git a/remotebridges/examples/makefile.mk b/remotebridges/examples/makefile.mk deleted file mode 100644 index 67306d3..0000000 --- a/remotebridges/examples/makefile.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=.. - -PRJNAME=remotebridges -TARGET=officeclientsample -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = $(SLO)$/officeclient.obj - -SHL1TARGET= officeclientsample - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) -SHL1LIBS= $(SLB)$/$(SHL1TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/remotebridges/examples/officeclient.cxx b/remotebridges/examples/officeclient.cxx deleted file mode 100644 index 767d4fc..0000000 --- a/remotebridges/examples/officeclient.cxx +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <stdio.h> -#include <osl/mutex.hxx> -#include <cppuhelper/factory.hxx> - -#include <cppuhelper/servicefactory.hxx> - -#include <com/sun/star/uno/XNamingService.hpp> - -#include <com/sun/star/registry/ImplementationRegistration.hpp> - -#include <com/sun/star/connection/XConnector.hpp> - -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> - -#include <com/sun/star/lang/XMain.hpp> -#include <com/sun/star/lang/XComponent.hpp> - -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> - -#include <com/sun/star/text/XTextDocument.hpp> - -#include <cppuhelper/implbase1.hxx> - -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::connection; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::frame; - - -namespace remotebridges_officeclient { - -class OfficeClientMain : public WeakImplHelper1< XMain > -{ -public: - explicit OfficeClientMain( const Reference< XMultiServiceFactory > &r ) : - m_xSMgr( r ) - {} -public: // Methods - - - virtual sal_Int32 SAL_CALL run( const Sequence< OUString >& aArguments ) - throw(RuntimeException); - - -private: // helper methods - void testWriter( const Reference < XComponent > & rComponent ); - void registerServices(); - Reference< XMultiServiceFactory > m_xSMgr; -}; - -void OfficeClientMain::testWriter( const Reference< XComponent > & rComponent ) -{ - printf( "pasting some text into the writer document\n" ); - - Reference< XTextDocument > rTextDoc( rComponent , UNO_QUERY ); - Reference< XText > rText = rTextDoc->getText(); - Reference< XTextCursor > rCursor = rText->createTextCursor(); - Reference< XTextRange > rRange ( rCursor , UNO_QUERY ); - - rText->insertString( rRange, OUString("This text has been posted by the officeclient component"), sal_False ); -} - -/******************** - * does necessary service registration ( this could be done also by a setup tool ) - *********************/ -void OfficeClientMain::registerServices( ) -{ - // register services. - // Note : this needs to be done only once and is in general done by the setup - Reference < XImplementationRegistration > rImplementationRegistration( - ImplementationRegistration::create(m_xSMgr) ); - - if( ! rImplementationRegistration.is() ) - { - printf( "Couldn't create registration component\n" ); - exit(1); - } - - OUString aSharedLibrary[4]; - aSharedLibrary[0] = - OUString( "connector.uno" SAL_DLLEXTENSION ); - aSharedLibrary[1] = - OUString( "remotebridge.uno" SAL_DLLEXTENSION ); - aSharedLibrary[2] = - OUString( "bridgefac.uno" SAL_DLLEXTENSION ); - aSharedLibrary[3] = - OUString( "uuresolver.uno" SAL_DLLEXTENSION ); - - sal_Int32 i; - for( i = 0 ; i < 4 ; i ++ ) - { - - // build the system specific library name - OUString aDllName = aSharedLibrary[i]; - - try - { - // register the needed services in the servicemanager - rImplementationRegistration->registerImplementation( - OUString("com.sun.star.loader.SharedLibrary"), - aDllName, - Reference< XSimpleRegistry > () ); - } - catch( Exception & ) - { - printf( "couldn't register dll %s\n" , - OUStringToOString( aDllName, RTL_TEXTENCODING_ASCII_US ).getStr() ); - } - } -} - -sal_Int32 OfficeClientMain::run( const Sequence< OUString > & aArguments ) throw ( RuntimeException ) -{ - printf( "Connecting ....\n" ); - - if( aArguments.getLength() == 1 ) - { - try { - registerServices(); - Reference < XInterface > r = - m_xSMgr->createInstance("com.sun.star.bridge.UnoUrlResolver"); - Reference < XUnoUrlResolver > rResolver( r , UNO_QUERY ); - r = rResolver->resolve( aArguments.getConstArray()[0] ); - - Reference< XNamingService > rNamingService( r, UNO_QUERY ); - if( rNamingService.is() ) - { - printf( "got the remote NamingService\n" ); - - r = rNamingService->getRegisteredObject(OUString("StarOffice.ServiceManager")); - - Reference< XMultiServiceFactory > rRemoteSMgr( r , UNO_QUERY ); - - Reference < XDesktop2 > rLoader = Desktop::create( comphelper::getComponentContext(r) ); - - sal_Char *urls[] = { - "private:factory/swriter", - "private:factory/sdraw", - "private:factory/simpress", - "private:factory/scalc" - }; - - sal_Char *docu[]= { - "a new writer document ...\n", - "a new draw document ...\n", - "a new schedule document ...\n" , - "a new calc document ...\n" - }; - sal_Int32 i; - for( i = 0 ; i < 4 ; i ++ ) - { - printf( "press any key to open %s\n" , docu[i] ); - getchar(); - - Reference< XComponent > rComponent = - rLoader->loadComponentFromURL( - OUString::createFromAscii( urls[i] ) , - OUString( "_blank"), - 0 , - Sequence < css::beans::PropertyValue >() ); - - if( 0 == i ) - { - testWriter( rComponent ); - } - printf( "press any key to close the document\n" ); - getchar(); - rComponent->dispose(); - } - } - - } - catch( const ConnectionSetupException &e ) - { - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - printf( "%s\n", o.pData->buffer ); - printf( "couldn't access local resource ( possible security resons )\n" ); - } - catch( const NoConnectException &e ) - { - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - printf( "%s\n", o.pData->buffer ); - printf( "no server listening on the resource\n" ); - } - catch( const IllegalArgumentException &e ) - { - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - printf( "%s\n", o.pData->buffer ); - printf( "uno url invalid\n" ); - } - catch( const RuntimeException & e ) - { - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - printf( "%s\n", o.pData->buffer ); - printf( "a remote call was aborted\n" ); - } - } - else - { - printf( "usage: (uno officeclient-component --) uno-url\n" - "e.g.: uno:socket,host=localhost,port=2002;urp;StarOffice.NamingService\n" ); - return 1; - } - return 0; -} - -Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r) -{ - return Reference< XInterface > ( ( OWeakObject * ) new OfficeClientMain(r) ); -} - -Sequence< OUString > getSupportedServiceNames() -{ - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(2); - seqNames[0] = "com.sun.star.bridge.example.OfficeClientExample"; - pNames = &seqNames; - } - } - return *pNames; -} - -} - -using namespace remotebridges_officeclient; -#define IMPLEMENTATION_NAME "com.sun.star.comp.remotebridges.example.OfficeClientSample" - - -extern "C" -{ - -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_FAIL( "### InvalidRegistryException!" ); - } - } - return sal_False; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - void * pRet = 0; - - if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) - { - Reference< XSingleServiceFactory > xFactory( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - CreateInstance, getSupportedServiceNames() ) ); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 0816ec33c86fffd8a05994c3edfe8d1d3a285ef3 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Dec 7 22:17:24 2016 +0100 Remove dead test code Change-Id: Iea40cee7dab736ffd954b0eae2b1dca2d9f5463b diff --git a/cppuhelper/test/bootstrap/TestEnv.cxx b/cppuhelper/test/bootstrap/TestEnv.cxx deleted file mode 100644 index 2e239ad..0000000 --- a/cppuhelper/test/bootstrap/TestEnv.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#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 TestEnv : public cppu::Enterable -{ - int m_inCount; - - virtual ~TestEnv(); - -public: - explicit TestEnv(); - -protected: - virtual void v_enter(); - virtual void v_leave(); - - virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam); - virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam); - - virtual bool v_isValid (rtl::OUString * pReason); -}; - -TestEnv::TestEnv() - : m_inCount(0) -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::TestEnv(...)", this)); -} - -TestEnv::~TestEnv() -{ - LOG_LIFECYCLE_TestEnv_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestEnv::~TestEnv()", 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() -{ - ++ m_inCount; -} - -void TestEnv::v_leave() -{ - -- m_inCount; -} - -bool TestEnv::v_isValid(rtl::OUString * pReason) -{ - bool result = m_inCount & 1; - - if (result) - *pReason = rtl::OUString("OK"); - - else - *pReason = rtl::OUString("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); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/bootstrap/TestEnv.def b/cppuhelper/test/bootstrap/TestEnv.def deleted file mode 100644 index 1444d92..0000000 --- a/cppuhelper/test/bootstrap/TestEnv.def +++ /dev/null @@ -1,8 +0,0 @@ -HEAPSIZE 0 -EXPORTS - uno_initEnvironment - uno_ext_getMapping - - - - diff --git a/cppuhelper/test/bootstrap/bootstrap.test.cxx b/cppuhelper/test/bootstrap/bootstrap.test.cxx deleted file mode 100644 index 90c9fb3..0000000 --- a/cppuhelper/test/bootstrap/bootstrap.test.cxx +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <sal/main.h> -#include <osl/file.hxx> - -#include <typelib/typedescription.hxx> - -#include <cppuhelper/bootstrap.hxx> -#include <cppuhelper/shlib.hxx> - -#include <com/sun/star/lang/XComponent.hpp> - -#include <uno/environment.hxx> -#include <uno/lbnames.h> -#include <cppu/EnvDcp.hxx> -#include <cppu/EnvGuards.hxx> - -#include <iostream> - - -#ifndef SAL_DLLPREFIX -# define SAL_DLLPREFIX "" -#endif - - -using namespace com::sun::star; - - -static rtl::OUString s_comment; - -static bool s_check_object_is_in(void * pObject) -{ - uno::Environment currentEnv(uno::Environment::getCurrent()); - - rtl_uString * pOId = NULL; - currentEnv.get()->pExtEnv->getObjectIdentifier(currentEnv.get()->pExtEnv, &pOId, pObject); - - - uno::TypeDescription typeDescription(rtl::OUString("com.sun.star.uno.XInterface")); - - void * pRegisteredObject = NULL; - currentEnv.get()->pExtEnv->getRegisteredInterface(currentEnv.get()->pExtEnv, - &pRegisteredObject, - pOId, - (typelib_InterfaceTypeDescription *)typeDescription.get()); - - - if (pOId) rtl_uString_release(pOId); - - bool result = pRegisteredObject != NULL; - - if (result) - currentEnv.get()->pExtEnv->releaseInterface(currentEnv.get()->pExtEnv, pRegisteredObject); - - return result; -} - -static void s_test__loadSharedLibComponentFactory(rtl::OUString const & clientPurpose, - rtl::OUString const & servicePurpose) -{ - cppu::EnvGuard envGuard(uno::Environment(UNO_LB_UNO + clientPurpose, NULL)); - if (!clientPurpose.isEmpty() && !envGuard.is()) - { - s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n"; - return; - } - - rtl::OString os_clientPurpose(rtl::OUStringToOString(clientPurpose, RTL_TEXTENCODING_ASCII_US)); - - uno::Reference<uno::XInterface> xItf( - cppu::loadSharedLibComponentFactory( - rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION), -#ifdef _WIN32 - "", -#else - "file://../lib/", -#endif - "impl.test.TestComponent" + servicePurpose, - uno::Reference<lang::XMultiServiceFactory>(), - uno::Reference<registry::XRegistryKey>() - ) - ); - - if (!xItf.is()) - { - s_comment += rtl::OUString("\t\tgot no object - FAILURE\n"); - return; - } - - if (!clientPurpose.equals(servicePurpose) && !s_check_object_is_in(xItf.get())) - { - s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n"; - } - - if (!cppu::EnvDcp::getPurpose(uno::Environment::getCurrent().getTypeName()).equals(clientPurpose)) - { - s_comment += "\t\tdid not enter client purpose \"" + clientPurpose + "\" - FAILURE\n"; - } -} - -static void s_test__loadSharedLibComponentFactory__free_free() -{ - s_comment += "\ts_test__loadSharedLibComponentFactory__free_free\n"; - - s_test__loadSharedLibComponentFactory("", ""); -} - -static void s_test__loadSharedLibComponentFactory__free_purpose() -{ - s_comment += "\ts_test__loadSharedLibComponentFactory__free_purpose\n"; - - s_test__loadSharedLibComponentFactory("", ":testenv"); -} - -static void s_test__loadSharedLibComponentFactory__purpose_free() -{ - s_comment += "\ts_test__loadSharedLibComponentFactory__purpose_free\n"; - - s_test__loadSharedLibComponentFactory(":testenv", ""); -} - -static void s_test__loadSharedLibComponentFactory__purpose_purpose() -{ - s_comment += "\ts_test__loadSharedLibComponentFactory__purpose_purpose\n"; - - s_test__loadSharedLibComponentFactory(":testenv", ":testenv"); -} - -static rtl::OUString s_getSDrive() -{ - rtl::OUString path;//("file://"); - - // FIXME no more S drive - - osl::FileBase::getFileURLFromSystemPath(path, path); - - return path; -} - -static void s_test__createSimpleRegistry(rtl::OUString const & clientPurpose) -{ - cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(UNO_LB_UNO) - + clientPurpose, NULL)); - if (!clientPurpose.isEmpty() && !envGuard.is()) - { - s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n"; - return; - } - - uno::Reference<registry::XSimpleRegistry> registry(cppu::createSimpleRegistry( - s_getSDrive())); - - if (!registry.is()) - { - s_comment += "\t\tgot no object - FAILURE\n"; - return; - } - - if (!clientPurpose.isEmpty() && !s_check_object_is_in(registry.get())) - { - s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n"; - } -} - -static void s_test__createSimpleRegistry__free() -{ - s_comment += "\ts_test__createSimpleRegistry__free\n"; - - s_test__createSimpleRegistry(rtl::OUString()); -} - -static void s_test__createSimpleRegistry__purpose() -{ - s_comment += "\ts_test__createSimpleRegistry__purpose\n"; - - s_test__createSimpleRegistry(":testenv"); -} - - -static void s_test__bootstrap_InitialComponentContext(rtl::OUString const & clientPurpose) -{ - cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(UNO_LB_UNO) - + clientPurpose, NULL)); - if (!clientPurpose.isEmpty() && !envGuard.is()) - { - s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n"; - return; - } - - uno::Reference<uno::XComponentContext> xContext( - cppu::bootstrap_InitialComponentContext( - uno::Reference<registry::XSimpleRegistry>(), - s_getSDrive()) - ); - - if (!xContext.is()) - { - s_comment += "\t\tgot no object - FAILURE\n"; - return; - } - - if (!clientPurpose.isEmpty() && !s_check_object_is_in(xContext.get())) - { - s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n"; - } - - uno::Reference<lang::XComponent> xComponent(xContext, uno::UNO_QUERY_THROW); - xComponent->dispose(); -} - -static void s_test__bootstrap_InitialComponentContext__free() -{ - s_comment += "\ts_test__bootstrap_InitialComponentContext__free\n"; - - s_test__bootstrap_InitialComponentContext(rtl::OUString()); -} - -static void s_test__bootstrap_InitialComponentContext__purpose() -{ - s_comment += "\ts_test__bootstrap_InitialComponentContext__purpose\n"; - - s_test__bootstrap_InitialComponentContext(":testenv"); -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - s_test__createSimpleRegistry__free(); - s_test__createSimpleRegistry__purpose(); - - s_test__loadSharedLibComponentFactory__free_free(); - s_test__loadSharedLibComponentFactory__free_purpose(); - s_test__loadSharedLibComponentFactory__purpose_free(); - s_test__loadSharedLibComponentFactory__purpose_purpose(); - - s_test__bootstrap_InitialComponentContext__free(); - s_test__bootstrap_InitialComponentContext__purpose(); - - int ret; - if (s_comment.indexOf("FAILURE") == -1) - { - s_comment += "TESTS PASSED\n"; - ret = 0; - } - else - { - s_comment += "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; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/bootstrap/makefile.mk b/cppuhelper/test/bootstrap/makefile.mk deleted file mode 100644 index a2d1715..0000000 --- a/cppuhelper/test/bootstrap/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ := ..$/.. -PRJNAME := cppuhelper -TARGET := bootstrap.test - - -ENABLE_EXCEPTIONS := TRUE -USE_DEFFILE := TRUE - - -.INCLUDE : settings.mk - - -.IF "$(OS)"!="WNT" -PURPENVHELPERLIB := -luno_purpenvhelper$(COMID) - -.ELSE -PURPENVHELPERLIB := $(LIBPRE) ipurpenvhelper$(UDK_MAJOR)$(COMID).lib - -.ENDIF - - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/bootstrap.test.obj -APP1STDLIBS := $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) - -SHL1TARGET := testenv_uno_uno -SHL1IMPLIB := i$(SHL1TARGET) -SHL1OBJS := $(SLO)$/TestEnv.obj -SHL1STDLIBS := $(PURPENVHELPERLIB) $(SALHELPERLIB) $(SALLIB) -SHL1DEF := TestEnv.def - - -.INCLUDE : target.mk diff --git a/cppuhelper/test/cfg_data/instance/uno/components.xml b/cppuhelper/test/cfg_data/instance/uno/components.xml deleted file mode 100644 index 9670078..0000000 --- a/cppuhelper/test/cfg_data/instance/uno/components.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<components cfg:package="uno" - xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" - xmlns:cfg="http://openoffice.org/2000/registry/instance" - xmlns="http://openoffice.org/2000/uno/Components"> - - -<services cfg:type="set" cfg:element-type="service"> - - <service cfg:name="com.sun.star.script.Converter"> - <available-implementations cfg:type="string" cfg:derivedBy="list"> - com.sun.star.comp.stoc.TypeConverter - </available-implementations> - </service> - - <service cfg:name="com.sun.star.bootstrap.TestComponent0"> - <available-implementations cfg:type="string" cfg:derivedBy="list"> - com.sun.star.comp.bootstrap.TestComponent0 - </available-implementations> - <context-properties cfg:type="set" cfg:element-type="cfg:any"> - <cfg:any cfg:name="serviceprop0" cfg:type="int">13</cfg:any> - <cfg:any cfg:name="serviceprop1" cfg:type="string">value of serviceprop1</cfg:any> - </context-properties> - </service> - -</services> - - -<implementations cfg:type="set" cfg:element-type="implementation"> - - <implementation cfg:name="com.sun.star.comp.stoc.TypeConverter"> - <activator cfg:type="string">com.sun.star.loader.SharedLibrary</activator> - <url cfg:type="string">tcv.dll</url> - <supported-services cfg:type="string" cfg:derivedBy="list">com.sun.star.script.Converter</supported-services> - </implementation> - - <implementation cfg:name="com.sun.star.comp.bootstrap.TestComponent0"> - <activator cfg:type="string">com.sun.star.loader.SharedLibrary</activator> - <url cfg:type="string">cfg_test.dll</url> - <supported-services cfg:type="string" cfg:derivedBy="list">com.sun.star.bootstrap.TestComponent0</supported-services> - <context-properties cfg:type="set" cfg:element-type="cfg:any"> - <cfg:any cfg:name="implprop0" cfg:type="int">15</cfg:any> - <cfg:any cfg:name="implprop1" cfg:type="string">value of implprop1</cfg:any> - </context-properties> - </implementation> - -</implementations> - - -<singletons cfg:type="set" cfg:element-type="singleton"> - - <singleton cfg:name="com.sun.star.script.theConverter"> - <used-service cfg:type="string">com.sun.star.script.Converter</used-service> - </singleton> - - <singleton cfg:name="com.sun.star.bootstrap.theTestComponent0"> - <used-service cfg:type="string">com.sun.star.bootstrap.TestComponent0</used-service> - <initial-arguments cfg:type="set" cfg:element-type="cfg:any"> - <cfg:any cfg:name="0" cfg:type="string">first argument</cfg:any> - <cfg:any cfg:name="1" cfg:type="string">second argument</cfg:any> - <cfg:any cfg:name="2" cfg:type="string">third argument</cfg:any> - </initial-arguments> - </singleton> - -</singletons> - - -<global-context-properties cfg:type="set" cfg:element-type="cfg:any"> - - <cfg:any cfg:name="TestValue" cfg:type="int">5</cfg:any> - -</global-context-properties> - - -</components> diff --git a/cppuhelper/test/cfg_data/template/uno/components.xml b/cppuhelper/test/cfg_data/template/uno/components.xml deleted file mode 100644 index 511db5f..0000000 --- a/cppuhelper/test/cfg_data/template/uno/components.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<components cfg:package="uno" - xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" - xmlns:cfg="http://openoffice.org/2000/registry/instance"> - -<service> - <available-implementations cfg:type="string" cfg:derivedBy="list"/> - <context-properties cfg:type="set" cfg:element-type="cfg:any"/> -</service> - -<implementation> - <activator cfg:type="string"/> - <url cfg:type="string"/> - <supported-services cfg:type="string" cfg:derivedBy="list"/> - <context-properties cfg:type="set" cfg:element-type="cfg:any"/> -</implementation> - -<singleton> - <used-service cfg:type="string"/> - <initial-arguments cfg:type="set" cfg:element-type="cfg:any"/> -</singleton> - -</components> diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx deleted file mode 100644 index 1f17ab6..0000000 --- a/cppuhelper/test/cfg_test.cxx +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -// starting the executable: -// -env:UNO_CFG_URL=local;<absolute_path>..\\..\\test\\cfg_data;<absolute_path>\\cfg_update -// -env:UNO_TYPES=cpputest.rdb - -#include <sal/main.h> - -#include <stdio.h> - -#include <rtl/strbuf.hxx> - -#include <cppuhelper/implementationentry.hxx> -#include <cppuhelper/bootstrap.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/supportsservice.hxx> - -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XComponent.hpp> - -#include <com/sun/star/registry/XImplementationRegistration.hpp> - - -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -namespace cfg_test -{ - - -static Sequence< OUString > impl0_getSupportedServiceNames() -{ - OUString str("com.sun.star.bootstrap.TestComponent0"); - return Sequence< OUString >( &str, 1 ); -} - -static OUString impl0_getImplementationName() -{ - return OUString("com.sun.star.comp.bootstrap.TestComponent0"); -} - -static Sequence< OUString > impl1_getSupportedServiceNames() -{ - OUString str("com.sun.star.bootstrap.TestComponent1"); - return Sequence< OUString >( &str, 1 ); -} - -static OUString impl1_getImplementationName() -{ - return OUString("com.sun.star.comp.bootstrap.TestComponent1"); -} - - -class ServiceImpl0 - : public WeakImplHelper2< lang::XServiceInfo, lang::XInitialization > -{ - Reference< XComponentContext > m_xContext; - -public: - explicit ServiceImpl0( Reference< XComponentContext > const & xContext ); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& rArgs ) throw (Exception, RuntimeException); - - // XServiceInfo - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); - virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException); -}; - -ServiceImpl0::ServiceImpl0( Reference< XComponentContext > const & xContext ) - : m_xContext( xContext ) -{ - sal_Int32 n; - OUString val; - - // service properties - OSL_VERIFY( m_xContext->getValueByName( - "/services/com.sun.star.bootstrap.TestComponent0/context-properties/serviceprop0" ) >>= n ); - OSL_VERIFY( n == 13 ); - OSL_VERIFY( m_xContext->getValueByName( - "/services/com.sun.star.bootstrap.TestComponent0/context-properties/serviceprop1" ) >>= val ); - OSL_VERIFY( val == "value of serviceprop1" ); - // impl properties - OSL_VERIFY( m_xContext->getValueByName( - "/implementations/com.sun.star.comp.bootstrap.TestComponent0/context-properties/implprop0" ) >>= n ); - OSL_VERIFY( n == 15 ); - OSL_VERIFY( m_xContext->getValueByName( - "/implementations/com.sun.star.comp.bootstrap.TestComponent0/context-properties/implprop1" ) >>= val ); - OSL_VERIFY( val == "value of implprop1" ); -} -// XInitialization - -void ServiceImpl0::initialize( const Sequence< Any >& rArgs ) - throw (Exception, RuntimeException) -{ - // check args - OUString val; - OSL_VERIFY( rArgs.getLength() == 3 ); - OSL_VERIFY( rArgs[ 0 ] >>= val ); - OSL_VERIFY( val == "first argument" ); - OSL_VERIFY( rArgs[ 1 ] >>= val ); - OSL_VERIFY( val == "second argument" ); - OSL_VERIFY( rArgs[ 2 ] >>= val ); - OSL_VERIFY( val == "third argument" ); -} -// XServiceInfo - -OUString ServiceImpl0::getImplementationName() - throw(css::uno::RuntimeException) -{ - return impl0_getImplementationName(); -} - -Sequence< OUString > ServiceImpl0::getSupportedServiceNames() - throw(css::uno::RuntimeException) -{ - return impl0_getSupportedServiceNames(); -} - -sal_Bool ServiceImpl0::supportsService( const OUString & rServiceName ) - throw(css::uno::RuntimeException) -{ - return cppu::supportsService(this, rServiceName); -} - - -class ServiceImpl1 : public ServiceImpl0 -{ -public: - explicit ServiceImpl1( Reference< XComponentContext > const & xContext ) - : ServiceImpl0( xContext ) - { - } - - // XServiceInfo - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException); - virtual OUString SAL_CALL getImplementationName() throw (RuntimeException); -}; - -OUString ServiceImpl1::getImplementationName() - throw(css::uno::RuntimeException) -{ - return impl1_getImplementationName(); -} - -Sequence< OUString > ServiceImpl1::getSupportedServiceNames() - throw(css::uno::RuntimeException) -{ - return impl1_getSupportedServiceNames(); -} - - -static Reference< XInterface > SAL_CALL ServiceImpl0_create( - Reference< XComponentContext > const & xContext ) -{ - return (OWeakObject *)new ServiceImpl0( xContext ); -} - -static Reference< XInterface > SAL_CALL ServiceImpl1_create( - Reference< XComponentContext > const & xContext ) -{ - return (OWeakObject *)new ServiceImpl1( xContext ); -} - -} // namespace cfg_test - -static const struct ImplementationEntry g_entries[] = -{ - { - ::cfg_test::ServiceImpl0_create, ::cfg_test::impl0_getImplementationName, - ::cfg_test::impl0_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - { - ::cfg_test::ServiceImpl1_create, ::cfg_test::impl1_getImplementationName, - ::cfg_test::impl1_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 - }, - { 0, 0, 0, 0, 0, 0 } -}; - -// component exports -extern "C" -{ - -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries ); -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey , g_entries ); -} -} - - -SAL_IMPLEMENT_MAIN() -{ - try - { - Reference< XComponentContext > xContext( defaultBootstrap_InitialComponentContext() ); - Reference< lang::XMultiComponentFactory > xMgr( xContext->getServiceManager() ); - - // show what is in context - xContext->getValueByName( "dump_maps" ); - - sal_Int32 n(0); - OSL_VERIFY( xContext->getValueByName( "/global-context-properties/TestValue" ) >>= n ); - ::fprintf( stderr, "> n=%d\n", n ); - - Reference< XInterface > x; - OSL_VERIFY( !(xContext->getValueByName( "/singletons/my_converter" ) >>= x) ); - OSL_VERIFY( xContext->getValueByName( "/singletons/com.sun.star.script.theConverter" ) >>= x ); - OSL_VERIFY( xContext->getValueByName( "/singletons/com.sun.star.bootstrap.theTestComponent0" ) >>= x ); - - ::fprintf( stderr, "> registering service...\n"); -#if defined(SAL_W32) - OUString libName( "cfg_test.dll" ); -#elif defined(SAL_UNX) - OUString libName( "libcfg_test.so" ); -#endif - Reference< registry::XImplementationRegistration > xImplReg( xMgr->createInstanceWithContext( - "com.sun.star.registry.ImplementationRegistration", xContext ), UNO_QUERY ); - OSL_ENSURE( xImplReg.is(), "### no impl reg!" ); - xImplReg->registerImplementation( - "com.sun.star.loader.SharedLibrary", libName, - Reference< registry::XSimpleRegistry >() ); - - OSL_VERIFY( (x = xMgr->createInstanceWithContext( "com.sun.star.bootstrap.TestComponent0", xContext )).is() ); - OSL_VERIFY( (x = xMgr->createInstanceWithContext( "com.sun.star.bootstrap.TestComponent1", xContext )).is() ); - - 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; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/helpertest.idl b/cppuhelper/test/helpertest.idl deleted file mode 100644 index 80d55ca..0000000 --- a/cppuhelper/test/helpertest.idl +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _TEST_CPPUTEST_IDL_ -#define _TEST_CPPUTEST_IDL_ - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/uno/TypeClass.idl> - -module test -{ - -interface A : com::sun::star::uno::XInterface -{ - string a(); -}; - -interface BA : A -{ - string ba(); -}; - -interface CA : A -{ - string ca(); -}; - -interface DBA : BA -{ - string dba(); -}; - -interface E : com::sun::star::uno::XInterface -{ - string e(); -}; - -interface FE : E -{ - string fe(); -}; - -interface G : com::sun::star::uno::XInterface -{ - string g(); - string a(); -}; - -interface H : com::sun::star::uno::XInterface -{ - string h(); -}; -interface I : com::sun::star::uno::XInterface -{ - string i(); -}; - -}; //module test - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/loader/loader.test.cxx b/cppuhelper/test/loader/loader.test.cxx deleted file mode 100644 index a24a564..0000000 --- a/cppuhelper/test/loader/loader.test.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/main.h> -#include <cppuhelper/shlib.hxx> -#include <cppuhelper/implbase1.hxx> -#include <cppu/EnvDcp.hxx> - -#include "../testcmp/TestComponent.hxx" - -#include <iostream> -#include <cstring> - -#ifndef SAL_DLLPREFIX -# define SAL_DLLPREFIX "" -#endif - - -using namespace ::com::sun::star; - - -class MyKey : public cppu::WeakImplHelper1<registry::XRegistryKey> - -{ -public: - virtual rtl::OUString SAL_CALL getKeyName() throw (uno::RuntimeException) { return rtl::OUString(); }; - - // Methods - virtual sal_Bool SAL_CALL isReadOnly( ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return sal_False;}; - virtual sal_Bool SAL_CALL isValid( ) throw (uno::RuntimeException) {return sal_False;}; - virtual registry::RegistryKeyType SAL_CALL getKeyType( const rtl::OUString& /*rKeyName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return registry::RegistryKeyType_KEY;}; - virtual registry::RegistryValueType SAL_CALL getValueType( ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return registry::RegistryValueType_NOT_DEFINED;}; - virtual sal_Int32 SAL_CALL getLongValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return 0;}; - virtual void SAL_CALL setLongValue( sal_Int32 /*value*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) { return uno::Sequence<sal_Int32>(); }; - virtual void SAL_CALL setLongListValue( const uno::Sequence< sal_Int32 >& /*seqValue*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual rtl::OUString SAL_CALL getAsciiValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return rtl::OUString();}; - virtual void SAL_CALL setAsciiValue( const rtl::OUString& /*value*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return uno::Sequence<rtl::OUString>();}; - virtual void SAL_CALL setAsciiListValue( const uno::Sequence< rtl::OUString >& /*seqValue*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual rtl::OUString SAL_CALL getStringValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return rtl::OUString();}; - virtual void SAL_CALL setStringValue( const rtl::OUString& /*value*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Sequence< rtl::OUString > SAL_CALL getStringListValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return uno::Sequence<rtl::OUString>();}; - virtual void SAL_CALL setStringListValue( const uno::Sequence< rtl::OUString >& /*seqValue*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw (registry::InvalidRegistryException, registry::InvalidValueException, uno::RuntimeException) {return uno::Sequence<sal_Int8>();}; - virtual void SAL_CALL setBinaryValue( const uno::Sequence< sal_Int8 >& /*value*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Reference< registry::XRegistryKey > SAL_CALL openKey( const rtl::OUString& /*aKeyName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return uno::Reference<registry::XRegistryKey>();}; - virtual uno::Reference< registry::XRegistryKey > SAL_CALL createKey( const rtl::OUString& /*aKeyName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return uno::Reference<registry::XRegistryKey>();}; - virtual void SAL_CALL closeKey( ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual void SAL_CALL deleteKey( const rtl::OUString& /*rKeyName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual uno::Sequence< uno::Reference< registry::XRegistryKey > > SAL_CALL openKeys( ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return uno::Sequence<uno::Reference<registry::XRegistryKey> >();}; - virtual uno::Sequence< rtl::OUString > SAL_CALL getKeyNames( ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return uno::Sequence<rtl::OUString>();}; - virtual sal_Bool SAL_CALL createLink( const rtl::OUString& /*aLinkName*/, const rtl::OUString& /*aLinkTarget*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return sal_False;}; - virtual void SAL_CALL deleteLink( const rtl::OUString& /*rLinkName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {}; - virtual rtl::OUString SAL_CALL getLinkTarget( const rtl::OUString& /*rLinkName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return rtl::OUString();}; - virtual rtl::OUString SAL_CALL getResolvedName( const rtl::OUString& /*aKeyName*/ ) throw (registry::InvalidRegistryException, uno::RuntimeException) {return rtl::OUString();}; -}; - - -static rtl::OUString s_test__cppu_loadSharedLibComponentFactory(char const * pServicePurpose) -{ - rtl::OUString result; - - rtl::OUString servicePurpose = rtl::OUString(pServicePurpose, - rtl_str_getLength(pServicePurpose), - RTL_TEXTENCODING_ASCII_US); - - result += rtl::OUString("\ts_test__cppu_loadSharedLibComponentFactory "); - result += rtl::OUString("(\""); - result += servicePurpose; - result += rtl::OUString("\") - "); - - try { - uno::Reference<uno::XInterface> xObject( - cppu::loadSharedLibComponentFactory( - rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION), - rtl::OUString(), - rtl::OUString("impl.test.TestComponent") + servicePurpose, - uno::Reference<lang::XMultiServiceFactory>(), - uno::Reference<registry::XRegistryKey>()) - ); - - rtl::OUString envDcp_purpose(cppu::EnvDcp::getPurpose(g_envDcp)); - if (envDcp_purpose == servicePurpose) - result += rtl::OUString("passed\n"); - - else - { - result += rtl::OUString("FAILED - got: \""); - result += envDcp_purpose; - result += rtl::OUString("\"\n"); - } - } - catch(uno::Exception & exception) { - result += rtl::OUString("FAILED - got: \""); - result += exception.Message; - result += rtl::OUString("\"\n"); - } - - return result; -} - -static rtl::OUString s_test__cppu_writeSharedLibComponentInfo(char const * pServicePurpose) -{ - rtl::OUString result; - - rtl::OUString servicePurpose = rtl::OUString(pServicePurpose, - rtl_str_getLength(pServicePurpose), - RTL_TEXTENCODING_ASCII_US); - - result += rtl::OUString("\ts_test__cppu_writeSharedLibComponentInfo "); - result += rtl::OUString("(\""); - result += servicePurpose; - result += rtl::OUString("\") - "); - - char buff[256]; - strcpy(buff, "TestComponent.uno="); - strcat(buff, pServicePurpose); - - putenv(buff); - - try { - cppu::writeSharedLibComponentInfo( - rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION), - rtl::OUString(), - uno::Reference<lang::XMultiServiceFactory>(), - uno::Reference<registry::XRegistryKey>(new MyKey) - ); - - rtl::OUString envDcp_purpose(cppu::EnvDcp::getPurpose(g_envDcp)); - if (envDcp_purpose == servicePurpose) - result += rtl::OUString("passed\n"); - - else - { - result += rtl::OUString("FAILED - got: \""); - result += envDcp_purpose; - result += rtl::OUString("\"\n"); - } - } - catch(uno::Exception & exception) { - result += rtl::OUString("FAILED - got: \""); - result += exception.Message; - result += rtl::OUString("\"\n"); - } - - return result; -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv) -{ - int result = 0; - - rtl::OUString message; - - message += rtl::OUString(argv[0], rtl_str_getLength(argv[0]), RTL_TEXTENCODING_ASCII_US); - message += rtl::OUString("\n"); - - message += s_test__cppu_loadSharedLibComponentFactory(":unsafe"); - message += s_test__cppu_loadSharedLibComponentFactory(":affine"); - message += s_test__cppu_loadSharedLibComponentFactory(""); - - message += s_test__cppu_writeSharedLibComponentInfo(":unsafe"); - message += s_test__cppu_writeSharedLibComponentInfo(":affine"); - message += s_test__cppu_writeSharedLibComponentInfo(""); - - if (message.indexOf("FAILED") == -1) - message += rtl::OUString("TESTS PASSED\n"); - - else - { - message += rtl::OUString("TESTS _NOT_ PASSED\n"); - result = -1; - } - - std::cout << rtl::OUStringToOString(message, RTL_TEXTENCODING_ASCII_US).getStr(); - - return result; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/loader/makefile.mk b/cppuhelper/test/loader/makefile.mk deleted file mode 100644 index 73bf2ab..0000000 --- a/cppuhelper/test/loader/makefile.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ := ..$/.. -PRJNAME := cppuhelper -TARGET := loader.test - - -ENABLE_EXCEPTIONS := TRUE -USE_DEFFILE := TRUE - -.INCLUDE : settings.mk - -ENVINCPRE := -I$(OUT)$/inc$/$(TARGET) - -APP1TARGET := $(TARGET) -APP1OBJS := $(OBJ)$/loader.test.obj -.IF "$(OS)"=="WNT" -APP1STDLIBS := iTestComponent.uno.lib -.ELSE -APP1STDLIBS := -lTestComponent.uno - -.ENDIF - -APP1STDLIBS += $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) - -.INCLUDE : target.mk diff --git a/cppuhelper/test/makefile.mk b/cppuhelper/test/makefile.mk deleted file mode 100644 index 7ff0310..0000000 --- a/cppuhelper/test/makefile.mk +++ /dev/null @@ -1,159 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# -PRJ=.. - -PRJNAME=cppuhelper -TARGET=testhelper -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -UNOUCRDEP= $(SOLARBINDIR)$/udkapi.rdb -UNOUCRRDB= $(SOLARBINDIR)$/udkapi.rdb -UNOUCROUT= $(OUT)$/inc$/test -INCPRE+= $(OUT)$/inc$/test - -OBJFILES= \ - $(OBJ)$/testhelper.obj \ - $(OBJ)$/testpropshlp.obj \ - $(OBJ)$/testidlclass.obj \ - $(OBJ)$/testproptyphlp.obj \ - $(OBJ)$/testimplhelper.obj \ - $(OBJ)$/testcontainer.obj - -APP1TARGET=$(TARGET) -APP1OBJS=$(OBJFILES) - -APP1STDLIBS+= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -APP1DEF= $(MISC)$/$(APP1TARGET).def - -############################################# - -APP2OBJS = $(OBJ)$/testdefaultbootstrapping.obj -APP2STDLIBS += $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) -APP2TARGET = testdefaultbootstrapping - -############################################# - -SLOFILES= \ - $(SLO)$/cfg_test.obj -LIB1TARGET=$(SLB)$/cfg_test.lib -LIB1OBJFILES=$(SLOFILES) - - -APP3OBJS = $(OBJ)$/cfg_test.obj -APP3STDLIBS += $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) -APP3TARGET = test_cfg - -############################################# - -ALLIDLFILES:= helpertest.idl - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALL: $(BIN)$/cpputest.rdb \ - unoheader \ - $(BIN)$/testrc \ - $(BIN)$/testdefaultbootstrapping.pl \ - ALLTAR \ - $(BIN)$/$(APP2TARGET).bin \ - $(BIN)$/$(APP2TARGET).Bin \ - $(BIN)$/$(APP2TARGET).Exe - -.IF "$(OS)"!="WNT" -ALL: $(BIN)$/$(APP2TARGET).exe - -$(BIN)$/$(APP2TARGET).exe : $(APP2TARGETN) - cp $(APP2TARGETN) $@ - -.ENDIF - - -$(BIN)$/$(APP2TARGET).bin : $(APP2TARGETN) - cp $(APP2TARGETN) $@ - -$(BIN)$/$(APP2TARGET).Bin : $(APP2TARGETN) - cp $(APP2TARGETN) $@ - -$(BIN)$/$(APP2TARGET).Exe : $(APP2TARGETN) - cp $(APP2TARGETN) $@ - -.ELSE -ALL: ALLDEP -.ENDIF - -.INCLUDE : target.mk - -CPPUMAKERFLAGS = -.IF "$(COM)" == "MSC" -CPPUMAKERFLAGS = -L -.ENDIF - -TYPES:=test.A;test.BA;test.CA;test.DBA;test.E;test.FE;test.G;test.H;test.I -HELPERTYPES:=com.sun.star.uno.XReference;com.sun.star.uno.XAdapter;com.sun.star.uno.XAggregation;com.sun.star.uno.XWeak;com.sun.star.lang.XComponent;com.sun.star.lang.XTypeProvider;com.sun.star.lang.XEventListener;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.registry.XRegistryKey;com.sun.star.lang.XInitialization;com.sun.star.lang.XServiceInfo;com.sun.star.loader.XImplementationLoader;com.sun.star.lang.IllegalAccessException;com.sun.star.beans.XVetoableChangeListener;com.sun.star.beans.XPropertySet;com.sun.star.uno.XComponentContext -FACTORYTYPES:=com.sun.star.lang.XComponent;com.sun.star.registry.XSimpleRegistry;com.sun.star.lang.XInitialization;com.sun.star.lang.XMultiServiceFactory;com.sun.star.loader.XImplementationLoader;com.sun.star.registry.XImplementationRegistration;com.sun.star.container.XSet;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XSingleComponentFactory;com.sun.star.lang.XMultiComponentFactory - -.IF "$(OS)" == "WNT" -UNO_PATH := $(SOLARBINDIR) -UNO_OUT := $(OUT)$/bin -EXT_SO := .dll -.ELSE -UNO_PATH := $(SOLARLIBDIR) -UNO_OUT := $(OUT)$/lib -EXT_SO := .so -.ENDIF - -$(UNO_OUT)$/%$(EXT_SO): $(UNO_PATH)$/%$(EXT_SO) - $(COPY) $^ $@ - -$(BIN)$/cpputest.rdb: $(ALLIDLFILES) $(UNO_OUT)$/invocadapt.uno$(EXT_SO) $(UNO_OUT)$/bootstrap.uno$(EXT_SO) - $(IDLC) -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $(ALLIDLFILES) - $(REGMERGE) $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} - $(REGMERGE) $@ / $(UNOUCRRDB) - $(REGCOMP) -register -r $@ -c reflection.uno$(DLLPOST) - $(TOUCH) $@ - -unoheader: $(BIN)$/cpputest.rdb - $(CPPUMAKER) $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(TYPES);$(HELPERTYPES)" $(BIN)$/cpputest.rdb - $(CPPUMAKER) $(CPPUMAKERFLAGS) -BUCR -O$(UNOUCROUT) -T"$(FACTORYTYPES)" $(BIN)$/cpputest.rdb - - -$(BIN)$/testdefaultbootstrapping.pl: testdefaultbootstrapping.pl - cp testdefaultbootstrapping.pl $@ - -$(BIN)$/testrc: makefile.mk -.IF "$(OS)"=="WNT" - echo [Tests] > $@ - echo TestKey1=com.sun.star.uno.NamingService.rdb >> $@ -.ELSE - echo '[Tests]' > $@ - echo 'TestKey1=file:///'$(PWD)/$(BIN)'/com.sun.star.uno.NamingService.rdb' >> $@ -.ENDIF - - - diff --git a/cppuhelper/test/testcmp/TestComponent.cxx b/cppuhelper/test/testcmp/TestComponent.cxx deleted file mode 100644 index 1b4d785..0000000 --- a/cppuhelper/test/testcmp/TestComponent.cxx +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#define CPPUHELPER_TEST_COMPONENT_IMPL -#include "TestComponent.hxx" - - -#include <string.h> - -#include <osl/thread.h> - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implementationentry.hxx> -#include <cppuhelper/supportsservice.hxx> - -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> - -#include <com/sun/star/uno/XComponentContext.hpp> - - -#include <cppu/EnvDcp.hxx> - -#include <uno/environment.hxx> -#include <uno/lbnames.h> - -using namespace ::com::sun::star; - - -#define LOG_LIFECYCLE_TestComponent -#ifdef LOG_LIFECYCLE_TestComponent -# include <iostream> -# define LOG_LIFECYCLE_TestComponent_emit(x) x - -#else -# define LOG_LIFECYCLE_TestComponent_emit(x) - -#endif - - -class TestComponent: public cppu::WeakImplHelper1<lang::XServiceInfo> -{ - rtl::OUString m_implName; - -public: - static uno::Reference<uno::XInterface> create( - uno::Reference<uno::XComponentContext> const & xCtx - ); - - - static uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames_Static(); - - explicit TestComponent(uno::Reference<uno::XComponentContext> const & xCtx); - virtual ~TestComponent(); - - uno::Any SAL_CALL queryInterface(uno::Type const & rType ) throw (css::uno::RuntimeException); - void SAL_CALL release() throw (); - void SAL_CALL acquire() throw (); - - // lang::XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() throw (uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) - throw (uno::RuntimeException); - virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames() - throw (uno::RuntimeException); - -protected: - uno::Reference<uno::XComponentContext> m_xComponentContext; -}; - - -uno::Reference<uno::XInterface> SAL_CALL TestComponent::create( - uno::Reference<uno::XComponentContext> const & xCtx) -{ - try - { - return static_cast<cppu::OWeakObject *>(new TestComponent(xCtx)); - } - catch (std::bad_alloc &) - { - throw uno::RuntimeException("std::bad_alloc"); - } -} - -uno::Sequence<rtl::OUString> SAL_CALL TestComponent::getSupportedServiceNames_Static() -{ - uno::Sequence<OUString> serviceNames { rtl::OUString("com.sun.star.lang.ServiceInfo") }; - - return serviceNames; -} - - -TestComponent::TestComponent(uno::Reference<uno::XComponentContext> const & xCtx) - : m_xComponentContext(xCtx) -{ - LOG_LIFECYCLE_TestComponent_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestComponent::TestComponent()", this)); -} - -TestComponent::~TestComponent() -{ - LOG_LIFECYCLE_TestComponent_emit(fprintf(stderr, "LIFE: %s -> %p\n", "TestComponent::~TestComponent", this)); -} - -rtl::OUString SAL_CALL TestComponent::getImplementationName() - throw (uno::RuntimeException) -{ - return m_implName; -} - -void SAL_CALL TestComponent::acquire() throw () -{ - cppu::WeakImplHelper1<lang::XServiceInfo>::acquire(); -} - -void SAL_CALL TestComponent::release() throw () -{ - cppu::WeakImplHelper1<lang::XServiceInfo>::release(); -} - -uno::Any SAL_CALL TestComponent::queryInterface(uno::Type const & rType ) throw (css::uno::RuntimeException) -{ - return cppu::WeakImplHelper1<lang::XServiceInfo>::queryInterface(rType); -} - -sal_Bool SAL_CALL TestComponent::supportsService(rtl::OUString const & ServiceName) - throw (uno::RuntimeException) -{ - return cppu::supportsService(this, ServiceName); -} - -uno::Sequence<rtl::OUString> SAL_CALL TestComponent::getSupportedServiceNames() - throw (uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * /*serviceManager*/, - void * /*registryKey*/ -) -{ - g_envDcp = uno::Environment::getCurrent().getTypeName(); - - return true; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - char const * pImplName, - void * /*serviceManager*/, - void * /*registryKey*/ -) -{ - g_envDcp = uno::Environment::getCurrent().getTypeName(); - - uno::Reference< lang::XSingleComponentFactory > xFactory; - - rtl::OUString uTmp(pImplName, rtl_str_getLength(pImplName), RTL_TEXTENCODING_ASCII_US); - - rtl::OUString uImplName(cppu::EnvDcp::getTypeName(uTmp)); - rtl::OUString cmpName("impl.test.TestComponent"); - - if (uImplName.equals(cmpName)) - { - xFactory = cppu::createSingleComponentFactory( - TestComponent::create, - uImplName, - TestComponent::getSupportedServiceNames_Static()); - - xFactory->acquire(); - } - - return xFactory.get(); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironmentExt( - sal_Char const ** envTypeName, - uno_Environment ** /*ppEnv*/, - sal_Char const * pImplName, - uno_Environment * /*pSrcEnv*/ -) -{ - rtl::OString purpose; - - if (pImplName) // this is the purpose for a specified impl - { - rtl::OUString uImplName(pImplName, rtl_str_getLength(pImplName), RTL_TEXTENCODING_ASCII_US); - purpose = rtl::OUStringToOString(cppu::EnvDcp::getPurpose(uImplName), RTL_TEXTENCODING_ASCII_US); - } - - if (!purpose.getLength()) - { - char * pPurpose = getenv("TestComponent.uno"); - if (pPurpose) - purpose = rtl::OString(pPurpose); - } - - if (purpose.getLength() == 0) - *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - - else - { - char buff[256]; - strcpy(buff, CPPU_CURRENT_LANGUAGE_BINDING_NAME); - strcat(buff, purpose.getStr()); - - *envTypeName = strdup(buff); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testcmp/TestComponent.hxx b/cppuhelper/test/testcmp/TestComponent.hxx deleted file mode 100644 index 66979bf..0000000 --- a/cppuhelper/test/testcmp/TestComponent.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CPPUHELPER_TEST_TESTCMP_TESTCOMPONENT_HXX -#define INCLUDED_CPPUHELPER_TEST_TESTCMP_TESTCOMPONENT_HXX - -#include <sal/types.h> -#include <rtl/ustring.hxx> - -#ifdef CPPUHELPER_TEST_COMPONENT_IMPL -# define CPPUHELPER_TEST_COMPONENT_EXPORT SAL_DLLPUBLIC_EXPORT - -#elif defined(CPPUHELPER_TEST_COMPONENT_LIB) -# define CPPUHELPER_TEST_COMPONENT_EXPORT extern - -#elif defined(__GNUC__) -# define CPPUHELPER_TEST_COMPONENT_EXPORT extern __attribute__ ((weak)) - -#else -# define CPPUHELPER_TEST_COMPONENT_EXPORT SAL_DLLPUBLIC_IMPORT - -#endif - -CPPUHELPER_TEST_COMPONENT_EXPORT rtl::OUString g_envDcp; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testcmp/TestComponent.uno.def b/cppuhelper/test/testcmp/TestComponent.uno.def deleted file mode 100644 index 8c1906e..0000000 --- a/cppuhelper/test/testcmp/TestComponent.uno.def +++ /dev/null @@ -1,11 +0,0 @@ -HEAPSIZE 0 -EXPORTS - component_getImplementationEnvironmentExt; - component_getFactory; - component_writeInfo; - ?g_envDcp@@3VOUString@rtl@@A; - - - - - diff --git a/cppuhelper/test/testcmp/makefile.mk b/cppuhelper/test/testcmp/makefile.mk deleted file mode 100644 index a59657e..0000000 --- a/cppuhelper/test/testcmp/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ := ..$/.. -PRJNAME := cppuhelper -TARGET := TestComponent.uno -ENABLE_EXCEPTIONS := TRUE - - -.INCLUDE: settings.mk - - -SHL1TARGET := $(TARGET) -SHL1OBJS := $(SLO)$/TestComponent.obj -SHL1STDLIBS := $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) -SHL1IMPLIB := i$(SHL1TARGET) -.IF "$(OS)"=="WNT" -SHL1DEF := TestComponent.uno.def -.ELSE -DEF1NAME := $(SHL1TARGET) -.ENDIF - - -.INCLUDE: target.mk - diff --git a/cppuhelper/test/testcontainer.cxx b/cppuhelper/test/testcontainer.cxx deleted file mode 100644 index 7533695..0000000 --- a/cppuhelper/test/testcontainer.cxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <osl/mutex.hxx> - -#include <cppuhelper/interfacecontainer.hxx> -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/beans/XVetoableChangeListener.hpp> - -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; - - -class TestListener : public WeakImplHelper1< XVetoableChangeListener > -{ -public: - // Methods - virtual void SAL_CALL disposing( const css::lang::EventObject& /*Source*/ ) throw(css::uno::RuntimeException) - { - - } - - virtual void SAL_CALL vetoableChange( const css::beans::PropertyChangeEvent& /*aEvent*/ ) - throw(css::beans::PropertyVetoException, css::uno::RuntimeException) - { - - } -}; - -void test_interfacecontainer() -{ - Mutex mutex; - - { - OInterfaceContainerHelper helper( mutex ); - - Reference< XVetoableChangeListener > r1 = new TestListener(); - Reference< XVetoableChangeListener > r2 = new TestListener(); - Reference< XVetoableChangeListener > r3 = new TestListener(); - - helper.addInterface( r1 ); - helper.addInterface( r2 ); - helper.addInterface( r3 ); - - helper.disposeAndClear( EventObject() ); - } - - { - OInterfaceContainerHelper helper( mutex ); - - Reference< XVetoableChangeListener > r1 = new TestListener(); - Reference< XVetoableChangeListener > r2 = new TestListener(); - Reference< XVetoableChangeListener > r3 = new TestListener(); - - helper.addInterface( r1 ); - helper.addInterface( r2 ); - helper.addInterface( r3 ); - - OInterfaceIteratorHelper iterator( helper ); - - while( iterator.hasMoreElements() ) - ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); - - helper.disposeAndClear( EventObject() ); - } - - { - OInterfaceContainerHelper helper( mutex ); - - Reference< XVetoableChangeListener > r1 = new TestListener(); - Reference< XVetoableChangeListener > r2 = new TestListener(); - Reference< XVetoableChangeListener > r3 = new TestListener(); - - helper.addInterface( r1 ); - helper.addInterface( r2 ); - helper.addInterface( r3 ); - - OInterfaceIteratorHelper iterator( helper ); - - ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); - iterator.remove(); - ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); - iterator.remove(); - ((XVetoableChangeListener*)iterator.next())->vetoableChange( PropertyChangeEvent() ); - iterator.remove(); - - OSL_ASSERT( helper.getLength() == 0 ); - helper.disposeAndClear( EventObject() ); - } - - { - OInterfaceContainerHelper helper( mutex ); - - Reference< XVetoableChangeListener > r1 = new TestListener(); - Reference< XVetoableChangeListener > r2 = new TestListener(); - Reference< XVetoableChangeListener > r3 = new TestListener(); - - helper.addInterface( r1 ); - helper.addInterface( r2 ); - helper.addInterface( r3 ); - - { - OInterfaceIteratorHelper iterator( helper ); - while( iterator.hasMoreElements() ) - { - Reference< XVetoableChangeListener > r = ((XVetoableChangeListener*)iterator.next()); - if( r == r1 ) - iterator.remove(); - } - } - OSL_ASSERT( helper.getLength() == 2 ); - { - OInterfaceIteratorHelper iterator( helper ); - while( iterator.hasMoreElements() ) - { - Reference< XVetoableChangeListener > r = ((XVetoableChangeListener*)iterator.next()); - OSL_ASSERT( r != r1 && ( r == r2 || r == r3 ) ); - } - } - - helper.disposeAndClear( EventObject() ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testdefaultbootstrapping.cxx b/cppuhelper/test/testdefaultbootstrapping.cxx deleted file mode 100644 index 4e40d25..0000000 --- a/cppuhelper/test/testdefaultbootstrapping.cxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <sal/main.h> - - -#include <cstdio> - -#include <rtl/process.h> -#include <cppuhelper/bootstrap.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - - -SAL_IMPLEMENT_MAIN() -{ - sal_Bool result = sal_True; - - try { - Reference<XComponentContext> xComponentContext = defaultBootstrap_InitialComponentContext(); - - Reference<XMultiServiceFactory> smgr(xComponentContext->getServiceManager(), UNO_QUERY); - - for(sal_uInt32 i = 0; i < rtl_getAppCommandArgCount(); ++ i) { - OUString arg; - - rtl_getAppCommandArg(i, &arg.pData); - if (!arg.isEmpty()) - { - Reference<XInterface> xInterface = smgr->createInstance(arg); - SAL_INFO("cppuhelper", "got the " << arg << " service " << xInterface.get()); - - result = result && (xInterface.get() != 0); - } - } - } - catch(Exception & exception) { - OString message = OUStringToOString(exception.Message, RTL_TEXTENCODING_ASCII_US); - - fprintf(stderr, "an exception occurred: %s\n", message.getStr()); - } - - SAL_INFO("extensions", "---------------------------------- " << result); - - return result; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testdefaultbootstrapping.pl b/cppuhelper/test/testdefaultbootstrapping.pl deleted file mode 100644 index 278e759..0000000 --- a/cppuhelper/test/testdefaultbootstrapping.pl +++ /dev/null @@ -1,268 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -# -# deliver.pl - copy from module output tree to solver -# - -my $progname = "testdefaultbootstrapping"; -my $defExeExt; - -if ($ENV{OS} eq "WNT") { - %services = ( - 'com.sun.star.uno.NamingService' => 'namingservice.uno.dll', - 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.dll', - 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.dll', - ); - - $defExeExt = ".exe"; - -} -else { - %services = ( - 'com.sun.star.uno.NamingService' => 'namingservice.uno.so', - 'com.sun.star.reflection.CoreReflection' => 'reflection.uno.so', - 'com.sun.star.script.InvocationAdapterFactory' => 'invocadapt.uno.so' - ); - - $defExeExt = ""; -} - -sub extendProgName($) { - my $_extension = shift; - my $_result; - - if ($ENV{OS} eq "WNT") { - $_result = $progname . $_extension; - } - else { - $_result = $ENV{PWD} . "/" . $progname . $_extension; - } - - return $_result; -} - - -sub rmDefRDB() { - unlink $progname . "_services.rdb"; -} - - -sub unregisterService($){ - my $service_name = shift; - - my $rdb_name = $service_name . '.rdb'; - - unlink $rdb_name; - - return 1; -} - -sub testForServices($$$) { - my $_services = shift; - my $_pars = shift; - my $_testexe = shift; - - -# my $_rc = system 'echo', $_testexe, @{$_services}, $_pars; - my $_rc = system $_testexe, @{$_services}, $_pars; - - return $_rc >> 8; -} - - -sub registerService($$){ - my $service_lib = shift; - my $rdb_name = shift; - -# system 'echo', "regcomp -register -r " . $rdb_name . " -c $service_lib"; - my $rc = system "regcomp -register -r " . $rdb_name . " -c $service_lib"; - - - return ! ( $rc >> 8 ); -} - - - -my $state = 1; -my @allservices; -my $allservices_rdbs=""; -my $rc; -my $comment; -my $testexe; - - -sub registerServices() { - use Cwd; - - # ensure that services can not be instantiated - foreach $service ( keys %services ) { - # ensure that the current service is not reachable - unregisterService($service); - $rc = !testForServices([$service], "", $testexe); - if(!$rc) { - $comment = $comment . "\tcouldn't unregister service " . $service . "\n"; - $state = 0; - } - - - # register the service and ensure that it is reachable - $rc = registerService($services{$service}, $service . '.rdb'); - if(!$rc) { - $comment = $comment . "\tcouldn't register service " . $service . "\n"; - $state = 0; - } - - $rc = testForServices([$service], "-env:UNO_SERVICES=" . $service . ".rdb", $testexe); - if(!$rc) { - $comment = $comment . "\tcouldn't reach service " . $service . "\n"; - $state = 0; - } - - # memorize all services - if (length($allservices_rdbs)) { - $allservices_rdbs = $allservices_rdbs . " "; - } - $allservices_rdbs = $allservices_rdbs . "file://" . getcwd() . "/" . $service . ".rdb"; - push @allservices, $service; - } -} - -sub testIndirection() { - #test indirection - $rc = testForServices(['com.sun.star.uno.NamingService'], '-env:UNO_SERVICES=${testrc:Tests:TestKey1}', $testexe); - if (!$rc) { - $comment = $comment . "\tindirection test not passed\n"; - $state = 0; - } -} - - -sub testBeneathExe() { - my $service = 'com.sun.star.reflection.CoreReflection'; - my $_testexe; - - my @_exes = (extendProgName(".exe"), - extendProgName(".Exe"), - extendProgName(".bin"), - extendProgName(".Bin")); - - foreach $_testexe ( @_exes ) { - #test rdb found beneath executable - registerService($services{$service}, $progname . "_services.rdb"); - my $_rc = testForServices([$service], "", $_testexe); - if (!$_rc) { - $comment = $comment . "\tbeneath executable test not passed: " . $_testexe . "\n"; - $state = 0; - } - } -} - -sub testBeneathLib_rdb() { - my $_service = 'com.sun.star.uno.NamingService'; - - use UNO; - - my $_rdb_name; - - if ($ENV{OS} eq "WNT") { - $_rdb_name = "UNO" . "_services.rdb"; - } - else { - $_rdb_name = "../lib/UNO" . "_services.rdb"; - } - - registerService($services{$_service}, $_rdb_name); - my $_rc = UNO::tryService($_service); - if (!$_rc) { - $comment = $comment . "\tbeneath lib test not passed\n"; - $state = 0; - } - unlink $_rdb_name; -} - -sub testBeneathLib_rc() { - my $_service = 'com.sun.star.uno.NamingService'; - - use UNO; - - my $_rc_name; - - if ($ENV{OS} eq "WNT") { - $_rc_name = "UNO.ini"; - } - else { - $_rc_name = "../lib/UNOrc"; - } - - my $_rdb_name = "../lib/test.rdb"; - - my $_handle; - open $_handle, ">" . $_rc_name; - print $_handle "UNO_SERVICES=" . $_rdb_name . "\n"; - close $_handle; - - registerService($services{$_service}, $_rdb_name); - my $_rc = UNO::tryService($_service); - if (!$_rc) { - $comment = $comment . "\tbeneath lib rc test not passed\n"; - $state = 0; - } - unlink $_rdb_name; - unlink $_rc_name; -} - -sub testAllAvailable() { - # test that all services are reachable through different rdbs - # change the directory to ensure, that all paths become expanded - chdir ".."; - - $rc = testForServices(\@allservices, "-env:UNO_SERVICES=" . $allservices_rdbs, $testexe); - if (!$rc) { - $comment = $comment . "\tmulti rdb test not passed\n"; - $state = 0; - } -} - -$testexe = extendProgName($defExeExt); - -rmDefRDB(); -registerServices(); -#print "alls:", @allservices, $allservices_rdbs, "\n"; - -testIndirection(); -testBeneathExe(); -testBeneathLib_rc(); -testBeneathLib_rdb(); -testAllAvailable(); - -print "**************************\n"; -if($state) { - print "****** tests passed ******\n"; -} -else { - print "**** tests NOT passed ****\n"; - print "Commnent:\n", $comment, "\n"; -} -print "**************************\n"; - - - diff --git a/cppuhelper/test/testhelper.cxx b/cppuhelper/test/testhelper.cxx deleted file mode 100644 index 0fbd0ca..0000000 --- a/cppuhelper/test/testhelper.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 -# undef OSL_DEBUG_LEVEL -# define OSL_DEBUG_LEVEL 2 -#endif - - -#include <sal/main.h> - -#include <stdio.h> -#include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> - -#include <cppuhelper/component_context.hxx> -#include <cppuhelper/servicefactory.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/registry/XSimpleRegistry.hpp> -#include <com/sun/star/registry/XImplementationRegistration.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XComponent.hpp> - -#include "testhelper.hxx" - -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringToOString; - -SAL_IMPLEMENT_MAIN() -{ - try - { - Reference< XMultiComponentFactory > xMgr( createRegistryServiceFactory( - OUString("cpputest.rdb") ), UNO_QUERY ); - Reference< XComponentContext > xInitialContext; - OSL_VERIFY( Reference< beans::XPropertySet >( xMgr, UNO_QUERY )->getPropertyValue( - OUString("DefaultContext") ) >>= xInitialContext ); - - ContextEntry_Init aEntry; - aEntry.bLateInitService = false; - aEntry.name = "bla, bla"; - aEntry.value = makeAny( (sal_Int32)5 ); - Reference< XComponentContext > xContext( createComponentContext( &aEntry, 1, xInitialContext ) ); - OSL_ASSERT( xContext->getServiceManager() != xMgr ); // must be wrapped one - OSL_ASSERT( - Reference< beans::XPropertySet >( - xContext->getServiceManager(), UNO_QUERY )->getPropertyValue( - OUString("DefaultContext") ) != xInitialContext ); - - Reference< XMultiServiceFactory > x( xMgr, UNO_QUERY ); - test_ImplHelper( x ); - testPropertyTypeHelper(); - testidlclass( x ); - test_PropertySetHelper(); - test_interfacecontainer(); - - OSL_VERIFY( xContext->getValueByName( - OUString("bla, bla") ) == (sal_Int32)5 ); - OSL_VERIFY( ! xInitialContext->getValueByName( - OUString("bla, bla") ).hasValue() ); - Reference< XComponent >( xInitialContext, UNO_QUERY )->dispose(); - xMgr.clear(); - xContext.clear(); - xInitialContext.clear(); - } - catch (Exception & exc) - { - OString cstr_msg( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( ! "exception occurred: ", cstr_msg.getStr() ); - } - - printf( "Test finished\n" ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testhelper.hxx b/cppuhelper/test/testhelper.hxx deleted file mode 100644 index dfc4a6f..0000000 --- a/cppuhelper/test/testhelper.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CPPUHELPER_TEST_TESTHELPER_HXX -#define INCLUDED_CPPUHELPER_TEST_TESTHELPER_HXX - -void testidlclass( const css::uno::Reference < css::lang::XMultiServiceFactory > &r); -void testPropertyTypeHelper(); -void test_PropertySetHelper(); -void test_ImplHelper( const css::uno::Reference < css::lang::XMultiServiceFactory > & xSF ); -void test_interfacecontainer(); - -#endif // INCLUDED_CPPUHELPER_TEST_TESTHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/test/testimplhelper.cxx b/cppuhelper/test/testimplhelper.cxx deleted file mode 100644 index 3ff0ccd..0000000 --- a/cppuhelper/test/testimplhelper.cxx +++ /dev/null @@ -1,569 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0 -# undef OSL_DEBUG_LEVEL -# define OSL_DEBUG_LEVEL 2 -#endif - - -#include <stdio.h> - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/implbase4.hxx> -#include <cppuhelper/implbase5.hxx> -#include <cppuhelper/implbase6.hxx> -#include <cppuhelper/implbase7.hxx> -#include <cppuhelper/implbase8.hxx> -#include <cppuhelper/implbase9.hxx> -#include <cppuhelper/implbase10.hxx> -#include <cppuhelper/implbase11.hxx> -#include <cppuhelper/implbase12.hxx> - -#include <cppuhelper/compbase1.hxx> -#include <cppuhelper/compbase2.hxx> -#include <cppuhelper/compbase3.hxx> -#include <cppuhelper/compbase4.hxx> -#include <cppuhelper/compbase5.hxx> -#include <cppuhelper/compbase6.hxx> -#include <cppuhelper/compbase7.hxx> -#include <cppuhelper/compbase8.hxx> -#include <cppuhelper/compbase9.hxx> -#include <cppuhelper/compbase10.hxx> -#include <cppuhelper/compbase11.hxx> -#include <cppuhelper/compbase12.hxx> - -#include <osl/diagnose.h> -#include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/exc_hlp.hxx> - -#include <test/A.hpp> -#include <test/BA.hpp> -#include <test/CA.hpp> -#include <test/DBA.hpp> -#include <test/E.hpp> -#include <test/FE.hpp> -#include <test/G.hpp> -#include <test/H.hpp> -#include <test/I.hpp> - -#include <com/sun/star/lang/IllegalAccessException.hpp> - -using namespace test; -using namespace osl; -using namespace cppu; -using namespace com::sun::star; -using namespace com::sun::star::uno; - -using ::rtl::OUString; -using ::rtl::OUStringToOString; -using ::rtl::OString; - - -struct TestImpl : public ImplHelper4< CA, DBA, FE, G > -{ - sal_Int32 nRef; - - virtual ~TestImpl() - { OSL_TRACE( "> TestImpl dtor called... <\n" ); } - - virtual Any SAL_CALL queryInterface( const Type & rType ) throw(RuntimeException) - { return ImplHelper4< CA, DBA, FE, G >::queryInterface( rType ); } - virtual void SAL_CALL acquire( ) throw() - { ++nRef; } - virtual void SAL_CALL release( ) throw() - { if (! --nRef) delete this; } - - // A - virtual OUString SAL_CALL a() throw(RuntimeException) - { return OUString("a"); } - // BA - virtual OUString SAL_CALL ba() throw(RuntimeException) - { return OUString("ba"); } - // CA - virtual OUString SAL_CALL ca() throw(RuntimeException) - { return OUString("ca"); } - // DBA - virtual OUString SAL_CALL dba() throw(RuntimeException) - { return OUString("dba"); } - // E - virtual OUString SAL_CALL e() throw(RuntimeException) - { return OUString("e"); } - // FE - virtual OUString SAL_CALL fe() throw(RuntimeException) - { return OUString("fe"); } - // G - virtual OUString SAL_CALL g() throw(RuntimeException) - { return OUString("g"); } -}; - - -struct TestWeakAggImpl : public WeakAggImplHelper4< CA, DBA, FE, G > -{ - virtual ~TestWeakAggImpl() - { OSL_TRACE( "> TestWeakAggImpl dtor called... <\n" ); } - - // A - virtual OUString SAL_CALL a() throw(RuntimeException) - { return OUString("a"); } - // BA - virtual OUString SAL_CALL ba() throw(RuntimeException) - { return OUString("ba"); } - // CA - virtual OUString SAL_CALL ca() throw(RuntimeException) - { return OUString("ca"); } - // DBA - virtual OUString SAL_CALL dba() throw(RuntimeException) - { return OUString("dba"); } - // E - virtual OUString SAL_CALL e() throw(RuntimeException) - { return OUString("e"); } - // FE - virtual OUString SAL_CALL fe() throw(RuntimeException) - { return OUString("fe"); } - // G - virtual OUString SAL_CALL g() throw(RuntimeException) - { return OUString("g"); } -}; - - -struct TestWeakImpl : public WeakImplHelper4< CA, DBA, FE, G > -{ - TestWeakImpl() {} - - virtual ~TestWeakImpl() - { OSL_TRACE( "> TestWeakImpl dtor called... <\n" ); } - - // A - virtual OUString SAL_CALL a() throw(RuntimeException) - { return OUString("a"); } - // BA - virtual OUString SAL_CALL ba() throw(RuntimeException) - { return OUString("ba"); } - // CA - virtual OUString SAL_CALL ca() throw(RuntimeException) - { return OUString("ca"); } - // DBA - virtual OUString SAL_CALL dba() throw(RuntimeException) - { return OUString("dba"); } - // E - virtual OUString SAL_CALL e() throw(RuntimeException) - { return OUString("e"); } - // FE - virtual OUString SAL_CALL fe() throw(RuntimeException) - { return OUString("fe"); } - // G - virtual OUString SAL_CALL g() throw(RuntimeException) - { return OUString("g"); } - -protected: ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits