From 789813aa8dcc19f8d576ca651ad8365d4ee6d703 Mon Sep 17 00:00:00 2001 From: Gábor Stefanik Date: Thu, 3 May 2012 22:26:44 +0200 Subject: fdo#48391: Remove TEST_ENSHURE Change-Id: Id9fc99aab1515a710374b3364f6136587f95f582 --- stoc/test/excomp/excomp.cxx | 16 ++-- stoc/test/testcorefl.cxx | 183 +++++++++++++++++++++----------------------- stoc/test/testintrosp.cxx | 38 ++++----- stoc/test/testloader.cxx | 20 ++--- stoc/test/testregistry.cxx | 171 ++++++++++++++++++++--------------------- stoc/test/testsmgr.cxx | 10 +-- stoc/test/testsmgr_cpnt.cxx | 37 ++++----- 7 files changed, 215 insertions(+), 260 deletions(-) (limited to 'stoc') diff --git a/stoc/test/excomp/excomp.cxx b/stoc/test/excomp/excomp.cxx index d896b6890dbd..fb831c14ce74 100644 --- a/stoc/test/excomp/excomp.cxx +++ b/stoc/test/excomp/excomp.cxx @@ -53,12 +53,6 @@ using namespace cppu; using ::rtl::OUString; using ::rtl::OUStringToOString; -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - OUString getExePath() { OUString exe; @@ -89,7 +83,7 @@ SAL_IMPLEMENT_MAIN() excompRdb += OUString(RTL_CONSTASCII_USTRINGPARAM("excomp.rdb")); Reference< XMultiServiceFactory > xSMgr = ::cppu::createRegistryServiceFactory( excompRdb ); - TEST_ENSHURE( xSMgr.is(), "excomp error 0" ); + OSL_ENSURE( xSMgr.is(), "excomp error 0" ); typelib_TypeDescription* pTypeDesc = NULL; OUString sType(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.XTextDocument")); @@ -98,7 +92,7 @@ SAL_IMPLEMENT_MAIN() Reference< XInterface > xIFace = xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))); Reference< XImplementationRegistration > xImpReg( xIFace, UNO_QUERY); - TEST_ENSHURE( xImpReg.is(), "excomp error 1" ); + OSL_ENSURE( xImpReg.is(), "excomp error 1" ); try { xImpReg->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), @@ -110,15 +104,15 @@ SAL_IMPLEMENT_MAIN() } catch(const CannotRegisterImplementationException& e) { - TEST_ENSHURE( e.Message.getLength(), OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); + OSL_ENSURE( e.Message.getLength(), OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); } Reference< XTest > xTest1( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("example.ExampleComponent1"))), UNO_QUERY); - TEST_ENSHURE( xTest1.is(), "excomp error 2" ); + OSL_ENSURE( xTest1.is(), "excomp error 2" ); Reference< XTest > xTest2( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("example.ExampleComponent2"))), UNO_QUERY); - TEST_ENSHURE( xTest2.is(), "excomp error 3" ); + OSL_ENSURE( xTest2.is(), "excomp error 3" ); OUString m1 = xTest1->getMessage(); OUString m2 = xTest2->getMessage(); diff --git a/stoc/test/testcorefl.cxx b/stoc/test/testcorefl.cxx index 416929364989..4a40bd2a54a6 100644 --- a/stoc/test/testcorefl.cxx +++ b/stoc/test/testcorefl.cxx @@ -30,12 +30,6 @@ #include #include -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - #include #include #include @@ -105,31 +99,31 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) { Reference< XIdlClass > xClass; Reference< XHierarchicalNameAccess > xHNameAccess( xRefl, UNO_QUERY ); - TEST_ENSHURE(xHNameAccess.is(), "### cannot get XHierarchicalNameAccess!" ); + OSL_ENSURE(xHNameAccess.is(), "### cannot get XHierarchicalNameAccess!" ); - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 2b"); - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")))->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 2c"); - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA"))).is(), "test_RegCoreReflection(): error 2e"); + OSL_ENSURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 2b"); + OSL_ENSURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")))->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 2c"); + OSL_ENSURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA"))).is(), "test_RegCoreReflection(): error 2e"); // const - TEST_ENSHURE(*(const sal_Bool *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstBoolean"))).getValue() == aConstBoolean, "test_RegCoreReflection(): error 4c"); - TEST_ENSHURE(*(const sal_Int8 *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstByte"))).getValue() == aConstByte, "test_RegCoreReflection(): error 4e"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstShort"))) == aConstShort, "test_RegCoreReflection(): error 4g"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstUShort"))) == aConstUShort, "test_RegCoreReflection(): error 4i"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstLong"))) == aConstLong, "test_RegCoreReflection(): error 4k"); - TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstULong"))) == aConstULong, "test_RegCoreReflection(): error 4m"); -// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstFloat"))) == aConstFloat, "test_RegCoreReflection(): error 4o"); -// TEST_ENSHURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstDouble"))) == aConstDouble, "test_RegCoreReflection(): error 4q"); + OSL_ENSURE(*(const sal_Bool *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstBoolean"))).getValue() == aConstBoolean, "test_RegCoreReflection(): error 4c"); + OSL_ENSURE(*(const sal_Int8 *)xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstByte"))).getValue() == aConstByte, "test_RegCoreReflection(): error 4e"); + OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstShort"))) == aConstShort, "test_RegCoreReflection(): error 4g"); + OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstUShort"))) == aConstUShort, "test_RegCoreReflection(): error 4i"); + OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstLong"))) == aConstLong, "test_RegCoreReflection(): error 4k"); + OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstULong"))) == aConstULong, "test_RegCoreReflection(): error 4m"); +// OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstFloat"))) == aConstFloat, "test_RegCoreReflection(): error 4o"); +// OSL_ENSURE(xHNameAccess->getByHierarchicalName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.aConstDouble"))) == aConstDouble, "test_RegCoreReflection(): error 4q"); // Enums xClass = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA"))); - TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 5"); + OSL_ENSURE(xClass.is(), "test_RegCoreReflection(): error 5"); Sequence > fields = xClass->getFields(); - TEST_ENSHURE( + OSL_ENSURE( (fields.getLength() == 3) && (fields.getArray()[0]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("VAL_1") )) && (*(EnumA*)fields.getArray()[0]->get(Any()).getValue() == EnumA_VAL_1) && @@ -146,74 +140,74 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) xClass = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceB"))); - TEST_ENSHURE(xClass == xA, "test_RegCoreReflection(): error 7"); - TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 7a"); + OSL_ENSURE(xClass == xA, "test_RegCoreReflection(): error 7"); + OSL_ENSURE(xClass.is(), "test_RegCoreReflection(): error 7a"); typelib_TypeDescription * pTD = 0; OUString aModuleName( RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceB") ); typelib_typedescription_getByName( &pTD, aModuleName.pData ); - TEST_ENSHURE( pTD, "### cannot get typedescription for ModuleC.XInterfaceB!" ); + OSL_ENSURE( pTD, "### cannot get typedescription for ModuleC.XInterfaceB!" ); - TEST_ENSHURE( uik_equals( *(Uik *)&((typelib_InterfaceTypeDescription *)pTD)->aUik, + OSL_ENSURE( uik_equals( *(Uik *)&((typelib_InterfaceTypeDescription *)pTD)->aUik, xClass->getUik() ), "test_RegCoreReflection(): error 8" ); typelib_typedescription_release( pTD ); - TEST_ENSHURE(xClass->getSuperclasses().getLength() == 1, "test_RegCoreReflection(): error 9"); - TEST_ENSHURE(xClass->getSuperclasses().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 10"); - TEST_ENSHURE(xClass->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11"); - TEST_ENSHURE(xA->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11a"); - TEST_ENSHURE(xClass->getMethods().getArray()[3]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodA")), "test_RegCoreReflection(): 12"); - TEST_ENSHURE(xClass->getMethods().getArray()[3]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 13"); - TEST_ENSHURE(xClass->getMethods().getArray()[3]->getParameterTypes().getLength() == 0, "test_RegCoreReflection(): error 14"); - TEST_ENSHURE(xClass->getMethods().getArray()[3]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 15"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("methodB") ), "test_RegCoreReflection(): error 16"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getMode() == MethodMode_ONEWAY, "test_RegCoreReflection(): error 16a"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 16"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 17"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_SHORT, "test_RegCoreReflection(): error 18"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aName == OUString( RTL_CONSTASCII_USTRINGPARAM("aShort") ), "test_RegCoreReflection(): error 18a"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aType == xRefl->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("short") ) ), "test_RegCoreReflection(): error 18b"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aMode == ParamMode_IN, "test_RegCoreReflection(): error 18c"); - TEST_ENSHURE(xClass->getMethods().getArray()[4]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 19"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")), "test_RegCoreReflection(): error 20"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getMode() == MethodMode_TWOWAY, "test_RegCoreReflection(): error 20a"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 21"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 22"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")), "test_RegCoreReflection(): error 23"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getLength() == 2, "test_RegCoreReflection(): error 24"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 25"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 26"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 27"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 28"); - TEST_ENSHURE(xClass->getMethods().getArray()[5]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 29"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodD")), "test_RegCoreReflection(): error 30"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 31"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getReturnType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 32"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 33"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_ENUM, "test_RegCoreReflection(): error 34"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA")), "test_RegCoreReflection(): error 35"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getLength() == 3, "test_RegCoreReflection(): error 36"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 37"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionA")), "test_RegCoreReflection(): error 38"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 38"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")), "test_RegCoreReflection(): error 39"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 40"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionC")), "test_RegCoreReflection(): error 41"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getLength() == 3, "test_RegCoreReflection(): error 42"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getTypeClass() == TypeClass_BOOLEAN, "test_RegCoreReflection(): error 43"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")), "test_RegCoreReflection(): error 43a"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 44"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 45"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 46"); - TEST_ENSHURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.XInterface1")), "test_RegCoreReflection(): error 47"); + OSL_ENSURE(xClass->getSuperclasses().getLength() == 1, "test_RegCoreReflection(): error 9"); + OSL_ENSURE(xClass->getSuperclasses().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 10"); + OSL_ENSURE(xClass->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11"); + OSL_ENSURE(xA->getMethods().getLength() == 7, "test_RegCoreReflection(): error 11a"); + OSL_ENSURE(xClass->getMethods().getArray()[3]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodA")), "test_RegCoreReflection(): 12"); + OSL_ENSURE(xClass->getMethods().getArray()[3]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 13"); + OSL_ENSURE(xClass->getMethods().getArray()[3]->getParameterTypes().getLength() == 0, "test_RegCoreReflection(): error 14"); + OSL_ENSURE(xClass->getMethods().getArray()[3]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 15"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getName() == OUString( RTL_CONSTASCII_USTRINGPARAM("methodB") ), "test_RegCoreReflection(): error 16"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getMode() == MethodMode_ONEWAY, "test_RegCoreReflection(): error 16a"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getReturnType()->getTypeClass() == TypeClass_VOID, "test_RegCoreReflection(): error 16"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 17"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_SHORT, "test_RegCoreReflection(): error 18"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aName == OUString( RTL_CONSTASCII_USTRINGPARAM("aShort") ), "test_RegCoreReflection(): error 18a"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aType == xRefl->forName( OUString( RTL_CONSTASCII_USTRINGPARAM("short") ) ), "test_RegCoreReflection(): error 18b"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getParameterInfos().getArray()[0].aMode == ParamMode_IN, "test_RegCoreReflection(): error 18c"); + OSL_ENSURE(xClass->getMethods().getArray()[4]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 19"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")), "test_RegCoreReflection(): error 20"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getMode() == MethodMode_TWOWAY, "test_RegCoreReflection(): error 20a"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 21"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 22"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")), "test_RegCoreReflection(): error 23"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getParameterTypes().getLength() == 2, "test_RegCoreReflection(): error 24"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 25"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 26"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 27"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getParameterTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 28"); + OSL_ENSURE(xClass->getMethods().getArray()[5]->getExceptionTypes().getLength() == 0, "test_RegCoreReflection(): error 29"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("methodD")), "test_RegCoreReflection(): error 30"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getReturnType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 31"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getReturnType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")), "test_RegCoreReflection(): error 32"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getParameterTypes().getLength() == 1, "test_RegCoreReflection(): error 33"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getTypeClass() == TypeClass_ENUM, "test_RegCoreReflection(): error 34"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getParameterTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ModuleB.EnumA")), "test_RegCoreReflection(): error 35"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getLength() == 3, "test_RegCoreReflection(): error 36"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 37"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[0]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionA")), "test_RegCoreReflection(): error 38"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 38"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[1]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionB")), "test_RegCoreReflection(): error 39"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getTypeClass() == TypeClass_EXCEPTION, "test_RegCoreReflection(): error 40"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.ExceptionC")), "test_RegCoreReflection(): error 41"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getLength() == 3, "test_RegCoreReflection(): error 42"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getTypeClass() == TypeClass_BOOLEAN, "test_RegCoreReflection(): error 43"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[0]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")), "test_RegCoreReflection(): error 43a"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getTypeClass() == TypeClass_STRUCT, "test_RegCoreReflection(): error 44"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[1]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")), "test_RegCoreReflection(): error 45"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getTypeClass() == TypeClass_INTERFACE, "test_RegCoreReflection(): error 46"); + OSL_ENSURE(xClass->getMethods().getArray()[6]->getExceptionTypes().getArray()[2]->getFields().getArray()[2]->getType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.XInterface1")), "test_RegCoreReflection(): error 47"); // SequenceReflections - TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 48"); - TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getComponentType().is(), "test_RegCoreReflection(): error 49"); - TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[][]ModuleA.StructA")) )->getComponentType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 50"); - TEST_ENSHURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]com.sun.star.uno.XInterface")) ) == xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aInterfaceSeq")))->getType(), "test_RegCoreReflection(): error 51"); + OSL_ENSURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 48"); + OSL_ENSURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->getComponentType().is(), "test_RegCoreReflection(): error 49"); + OSL_ENSURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[][]ModuleA.StructA")) )->getComponentType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")), "test_RegCoreReflection(): error 50"); + OSL_ENSURE(xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]com.sun.star.uno.XInterface")) ) == xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aInterfaceSeq")))->getType(), "test_RegCoreReflection(): error 51"); StructC aStructC; aStructC.aLong = aConstLong; @@ -226,43 +220,43 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aInterfaceSeq")))->getType()->createObject(aAny); - TEST_ENSHURE(aAny.getValueType() == ::getCppuType( (const Sequence > *)0 ), "test_RegCoreReflection(): error 51a"); + OSL_ENSURE(aAny.getValueType() == ::getCppuType( (const Sequence > *)0 ), "test_RegCoreReflection(): error 51a"); Any aStructAny(&aStructC, ::getCppuType( (const StructC *) 0 )); sal_Int32 nLong = aConstLong * 2; aAny.setValue( &nLong, ::getCppuType( (const sal_Int32 *)0 ) ); - TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get( + OSL_ENSURE(*(sal_Int32*)xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get( Any(&aStructC, ::getCppuType( (const StructC *)0 ))).getValue() == aConstLong, "test_RegCoreReflection(): error 52"); - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->getAccessMode() == FieldAccessMode_READWRITE, "test_RegCoreReflection(): error 52a"); + OSL_ENSURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructA")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->getAccessMode() == FieldAccessMode_READWRITE, "test_RegCoreReflection(): error 52a"); Reference< XIdlField2 > rField ( xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC") ))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") )) , UNO_QUERY ); rField->set(aStructAny, aAny); - TEST_ENSHURE(*(sal_Int32*)xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(aStructAny).getValue() == *(sal_Int32*)aAny.getValue(), "test_RegCoreReflection(): error 53"); + OSL_ENSURE(*(sal_Int32*)xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructB")))->getField(OUString( RTL_CONSTASCII_USTRINGPARAM("aLong") ))->get(aStructAny).getValue() == *(sal_Int32*)aAny.getValue(), "test_RegCoreReflection(): error 53"); xRefl->forName( OUString(RTL_CONSTASCII_USTRINGPARAM("[]ModuleA.StructA")) )->createObject(aAny); - TEST_ENSHURE( aAny.getValueTypeName() == "[]ModuleA.StructA", "test_RegCoreReflection(): error 54" ); + OSL_ENSURE( aAny.getValueTypeName() == "[]ModuleA.StructA", "test_RegCoreReflection(): error 54" ); xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("[][]ModuleA.StructA")))->createObject(aAny); - TEST_ENSHURE( aAny.getValueTypeName() == "[][]ModuleA.StructA", "test_RegCoreReflection(): error 56" ); + OSL_ENSURE( aAny.getValueTypeName() == "[][]ModuleA.StructA", "test_RegCoreReflection(): error 56" ); // xClass = xRefl->forName(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.XIntroTest") )); -// TEST_ENSHURE(xClass.is(), "test_RegCoreReflection(): error 58"); -// TEST_ENSHURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 59"); -// TEST_ENSHURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("string")), "test_RegCoreReflection(): error 60"); +// OSL_ENSURE(xClass.is(), "test_RegCoreReflection(): error 58"); +// OSL_ENSURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getTypeClass() == TypeClass_SEQUENCE, "test_RegCoreReflection(): error 59"); +// OSL_ENSURE(xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->getComponentType()->getName() == OUString(RTL_CONSTASCII_USTRINGPARAM("string")), "test_RegCoreReflection(): error 60"); // xClass->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("getStrings")))->getReturnType()->createObject(aAny); -// TEST_ENSHURE( aAny.getValueTypeName() == "[]string", "test_RegCoreReflection(): error 61" ); +// OSL_ENSURE( aAny.getValueTypeName() == "[]string", "test_RegCoreReflection(): error 61" ); - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("[][][]unsigned long")))->getComponentType()->getComponentType()->getComponentType()->getTypeClass() == TypeClass_UNSIGNED_LONG, "test_RegCoreReflection(): error 62"); + OSL_ENSURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("[][][]unsigned long")))->getComponentType()->getComponentType()->getComponentType()->getTypeClass() == TypeClass_UNSIGNED_LONG, "test_RegCoreReflection(): error 62"); try { fprintf( stderr, "%1\n" ); Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->get(Any()); - TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 63"); + OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 63"); return sal_False; } catch (IllegalArgumentException &) @@ -278,7 +272,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) rField = Reference< XIdlField2 > ( xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString"))) , UNO_QUERY); rField->set( blup, gulp); // xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->set(blup, gulp); - TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 64"); + OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 64"); return sal_False; } catch (IllegalArgumentException &) @@ -295,7 +289,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) rField = Reference< XIdlField2 > ( xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString"))) , UNO_QUERY); xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleA.StructC")))->getField(OUString(RTL_CONSTASCII_USTRINGPARAM("aString")))->set(blup, gulp); - TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 65"); + OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 65"); return sal_False; } catch (IllegalArgumentException &) @@ -318,7 +312,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params); - TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 66"); + OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 66"); return sal_False; } catch (IllegalArgumentException &) @@ -347,7 +341,7 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; Any bla = xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params); - TEST_ENSHURE(sal_False, "test_RegCoreReflection(): error 67"); + OSL_ENSURE(sal_False, "test_RegCoreReflection(): error 67"); return sal_False; } catch (IllegalArgumentException &) @@ -361,8 +355,9 @@ static sal_Bool test_corefl( const Reference< XIdlReflection > & xRefl ) Any a; a <<= xAI; - TEST_ENSHURE(xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params).getValueType() - == ::getCppuType( (const Sequence *)0 ), "test_RegCoreReflection(): error 68"); + bool result = (xRefl->forName(OUString(RTL_CONSTASCII_USTRINGPARAM("ModuleC.XInterfaceA")))->getMethod(OUString(RTL_CONSTASCII_USTRINGPARAM("methodC")))->invoke(a, params).getValueType() + == ::getCppuType( (const Sequence *)0 )); (void)result; + OSL_ENSURE(result, "test_RegCoreReflection(): error 68"); return sal_True; } diff --git a/stoc/test/testintrosp.cxx b/stoc/test/testintrosp.cxx index ac9b1b03df57..9f3b11dd91ad 100644 --- a/stoc/test/testintrosp.cxx +++ b/stoc/test/testintrosp.cxx @@ -74,12 +74,6 @@ typedef WeakImplHelper1< XPropertySetInfo > ImplPropertySetInfoHelper; #define DEFAULT_INDEX_ACCESS_COUNT 10 #define DEFAULT_NAME_ACCESS_COUNT 5 -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - //************************************************************** //*** Hilfs-Funktion, um vom Type eine XIdlClass zu bekommen *** //************************************************************** @@ -886,7 +880,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny ); xAccess = xIntrospection->inspect( aObjAny ); xAccess = xIntrospection->inspect( aObjAny ); - TEST_ENSHURE( xAccess.is(), "introspection failed, no XIntrospectionAccess returned" ); + OSL_ENSURE( xAccess.is(), "introspection failed, no XIntrospectionAccess returned" ); if( !xAccess.is() ) return sal_False; @@ -897,11 +891,11 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aType ); Reference< XPropertySet > xPropSet( xPropSetIface, UNO_QUERY ); - TEST_ENSHURE( xPropSet.is(), "Could not get XPropertySet by queryAdapter()" ); + OSL_ENSURE( xPropSet.is(), "Could not get XPropertySet by queryAdapter()" ); // XExactName Reference< XExactName > xExactName( xAccess, UNO_QUERY ); - TEST_ENSHURE( xExactName.is(), "Introspection unterstuetzt kein ExactName" ); + OSL_ENSURE( xExactName.is(), "Introspection unterstuetzt kein ExactName" ); // Schleife ueber alle Kombinationen von Concepts for( sal_Int32 nConcepts = 0 ; nConcepts < 16 ; nConcepts++ ) @@ -927,7 +921,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += OString::valueOf( nDemandedPropCount ); aErrorStr += " properties but found "; aErrorStr += OString::valueOf( nLen ); - TEST_ENSHURE( nLen == nDemandedPropCount, aErrorStr.getStr() ); + OSL_ENSURE( nLen == nDemandedPropCount, aErrorStr.getStr() ); const Property* pProps = aRetSeq.getConstArray(); Any aPropVal; @@ -956,7 +950,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\", found \""; aErrorStr += aNameStr; aErrorStr += "\""; - TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() ); + OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); Type aPropType = aProp.Type; OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) ); @@ -968,7 +962,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "< found type >"; aErrorStr += aTypeNameStr; aErrorStr += "<"; - TEST_ENSHURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() ); + OSL_ENSURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() ); // Wert des Property lesen und ausgeben aPropVal = xPropSet->getPropertyValue( aPropName ); @@ -982,7 +976,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "< found val >"; aErrorStr += aValStr; aErrorStr += "<"; - TEST_ENSHURE( aValStr == aDemandedValStr, aErrorStr.getStr() ); + OSL_ENSURE( aValStr == aDemandedValStr, aErrorStr.getStr() ); // Wert pruefen und typgerecht modifizieren TypeClass eType = aPropVal.getValueType().getTypeClass(); @@ -1038,7 +1032,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\", not found as \""; aErrorStr += OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US ); aErrorStr += "\" using XExactName"; - TEST_ENSHURE( sal_False, aErrorStr.getStr() ); + OSL_ENSURE( sal_False, aErrorStr.getStr() ); } } else @@ -1070,7 +1064,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "< found val >"; aErrorStr += aModifiedValStr; aErrorStr += "<"; - TEST_ENSHURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() ); + OSL_ENSURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() ); } // Checken, ob alle Properties auch einzeln gefunden werden @@ -1079,7 +1073,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\" not found with hasProperty()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts ); - TEST_ENSHURE( bProperty, aErrorStr.getStr() ); + OSL_ENSURE( bProperty, aErrorStr.getStr() ); aErrorStr = "property \""; aErrorStr += aDemandedName; @@ -1093,7 +1087,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr = "property \""; aErrorStr += aDemandedName; aErrorStr += "\", exception was thrown when trying getProperty()"; - TEST_ENSHURE( sal_False, aErrorStr.getStr() ); + OSL_ENSURE( sal_False, aErrorStr.getStr() ); } } @@ -1126,7 +1120,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += OString::valueOf( nDemandedMethCount ); aErrorStr += " methods but found "; aErrorStr += OString::valueOf( nLen ); - TEST_ENSHURE( nLen == nDemandedMethCount, aErrorStr.getStr() ); + OSL_ENSURE( nLen == nDemandedMethCount, aErrorStr.getStr() ); const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); sal_Int32 i; @@ -1156,7 +1150,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\", found \""; aErrorStr += aNameStr; aErrorStr += "\""; - TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() ); + OSL_ENSURE( aNameStr == aDemandedName, aErrorStr.getStr() ); // Checken, ob alle Methoden auch einzeln gefunden werden aErrorStr = "method \""; @@ -1164,7 +1158,7 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, aErrorStr += "\" not found with hasMethod()"; OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US ); sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts ); - TEST_ENSHURE( bMethod, aErrorStr.getStr() ); + OSL_ENSURE( bMethod, aErrorStr.getStr() ); aErrorStr = "method \""; aErrorStr += aDemandedName; @@ -1172,14 +1166,14 @@ static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr, try { Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts ); - TEST_ENSHURE( xGetMethod == rxMethod , aErrorStr.getStr() ); + OSL_ENSURE( xGetMethod == rxMethod , aErrorStr.getStr() ); } catch (const RuntimeException &) { aErrorStr = "method \""; aErrorStr += aDemandedName; aErrorStr += "\", exception was thrown when trying getMethod()"; - TEST_ENSHURE( sal_False, aErrorStr.getStr() ); + OSL_ENSURE( sal_False, aErrorStr.getStr() ); } } } diff --git a/stoc/test/testloader.cxx b/stoc/test/testloader.cxx index 490ac5b906c8..dad125fe669e 100644 --- a/stoc/test/testloader.cxx +++ b/stoc/test/testloader.cxx @@ -54,12 +54,6 @@ using namespace cppu; using ::rtl::OUString; -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - class EmptyComponentContext : public WeakImplHelper1< XComponentContext > { public: @@ -104,23 +98,23 @@ SAL_IMPLEMENT_MAIN() } } - TEST_ENSHURE( xIFace.is(), "testloader error1"); + OSL_ENSURE( xIFace.is(), "testloader error1"); Reference xFactory( Reference::query(xIFace) ); - TEST_ENSHURE( xFactory.is(), "testloader error2"); + OSL_ENSURE( xFactory.is(), "testloader error2"); Reference xLoader = xFactory->createInstanceWithContext( new EmptyComponentContext ); - TEST_ENSHURE( xLoader.is(), "testloader error3"); + OSL_ENSURE( xLoader.is(), "testloader error3"); Reference xServInfo( Reference::query(xLoader) ); - TEST_ENSHURE( xServInfo.is(), "testloader error4"); + OSL_ENSURE( xServInfo.is(), "testloader error4"); - TEST_ENSHURE( xServInfo->getImplementationName() == "com.sun.star.comp.stoc.DLLComponentLoader", "testloader error5"); - TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")) ), "testloader error6"); - TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "testloader error7"); + OSL_ENSURE( xServInfo->getImplementationName() == "com.sun.star.comp.stoc.DLLComponentLoader", "testloader error5"); + OSL_ENSURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")) ), "testloader error6"); + OSL_ENSURE( xServInfo->getSupportedServiceNames().getLength() == 1, "testloader error7"); xIFace.clear(); xFactory.clear(); diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx index df0cc7dec556..1c314e6c53f5 100644 --- a/stoc/test/testregistry.cxx +++ b/stoc/test/testregistry.cxx @@ -64,12 +64,6 @@ using ::rtl::OUString; using ::rtl::OUStringToOString; using ::rtl::OString; -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - namespace stoc_impreg { void SAL_CALL mergeKeys( @@ -129,10 +123,10 @@ OUString userReg = getExePath(); userReg += OUString(RTL_CONSTASCII_USTRINGPARAM("user.rdb")); if(myRegistry->open(userReg, REG_READWRITE)) { -TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1"); +OSL_VERIFY(!myRegistry->create(userReg)); } -TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9"); +OSL_VERIFY(!myRegistry->close()); delete myRegistry; userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US); @@ -148,13 +142,13 @@ void setLinkInDefaultRegistry(const OUString& linkName, const OUString& linkTarg OUString appReg = getExePath(); appReg += OUString(RTL_CONSTASCII_USTRINGPARAM("stoctest.rdb")); - TEST_ENSHURE(!myRegistry->open(appReg, REG_READWRITE), "setLinkInDefaultRegistry error 1"); - TEST_ENSHURE(!myRegistry->openRootKey(rootKey), "setLinkInDefaultRegistry error 2"); + OSL_VERIFY(!myRegistry->open(appReg, REG_READWRITE)); + OSL_VERIFY(!myRegistry->openRootKey(rootKey)); - TEST_ENSHURE(!rootKey.createLink(linkName, linkTarget), "setLinkInDefaultRegistry error 3"); + OSL_VERIFY(!rootKey.createLink(linkName, linkTarget)); - TEST_ENSHURE(!rootKey.closeKey(), "setLinkInDefaultRegistry error 4"); - TEST_ENSHURE(!myRegistry->close(), "setLinkInDefaultRegistry error 5"); + OSL_VERIFY(!rootKey.closeKey()); + OSL_VERIFY(!myRegistry->close()); delete myRegistry; } @@ -190,41 +184,41 @@ void test_SimpleRegistry( } } - TEST_ENSHURE( xIFace.is(), "test_SimpleRegistry error1"); + OSL_ENSURE( xIFace.is(), "test_SimpleRegistry error1"); Reference xFactory( Reference::query(xIFace) ); xIFace.clear(); - TEST_ENSHURE( xFactory.is(), "testloader error11"); + OSL_ENSURE( xFactory.is(), "testloader error11"); Reference xIFace2 = xFactory->createInstance(); xFactory.clear(); - TEST_ENSHURE( xIFace2.is(), "testloader error12"); + OSL_ENSURE( xIFace2.is(), "testloader error12"); Reference xServInfo( Reference::query(xIFace2) ); - TEST_ENSHURE( xServInfo.is(), "test_SimpleRegistry error2"); + OSL_ENSURE( xServInfo.is(), "test_SimpleRegistry error2"); - TEST_ENSHURE( xServInfo->getImplementationName() == "com.sun.star.comp.stoc.SimpleRegistry", "test_SimpleRegistry error3"); - TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"))), "test_SimpleRegistry error4"); - TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_SimpleRegistry error5"); + OSL_ENSURE( xServInfo->getImplementationName() == "com.sun.star.comp.stoc.SimpleRegistry", "test_SimpleRegistry error3"); + OSL_ENSURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"))), "test_SimpleRegistry error4"); + OSL_ENSURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_SimpleRegistry error5"); xServInfo.clear(); Reference xReg( Reference::query(xIFace2) ); xIFace2.clear(); - TEST_ENSHURE( xReg.is(), "test_SimpleRegistry error6"); + OSL_ENSURE( xReg.is(), "test_SimpleRegistry error6"); try { xReg->open(testreg, sal_False, sal_True); - TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 7" ); - TEST_ENSHURE( xReg->isReadOnly() == sal_False, "test_SimpleRegistry error 8" ); + OSL_ENSURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 7" ); + OSL_ENSURE( xReg->isReadOnly() == sal_False, "test_SimpleRegistry error 8" ); Reference xRootKey(xReg->getRootKey()); - TEST_ENSHURE( xRootKey->isValid(), "test_SimpleRegistry error 9" ); + OSL_ENSURE( xRootKey->isValid(), "test_SimpleRegistry error 9" ); Reference xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstKey") )); @@ -252,23 +246,23 @@ void test_SimpleRegistry( if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/FirstSubKey") )) { - TEST_ENSHURE( xSubKey->getLongValue() == 123456789, + OSL_ENSURE( xSubKey->getLongValue() == 123456789, "test_SimpleRegistry error 10" ); } else if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/SecondSubKey") )) { - TEST_ENSHURE( xSubKey->getAsciiValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein acsii value") ), + OSL_ENSURE( xSubKey->getAsciiValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein acsii value") ), "test_SimpleRegistry error 11" ); } else if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/ThirdSubKey") )) { - TEST_ENSHURE( xSubKey->getStringValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein unicode value") ), + OSL_ENSURE( xSubKey->getStringValue() == OUString( RTL_CONSTASCII_USTRINGPARAM("ich bin ein unicode value") ), "test_SimpleRegistry error 12" ); } else if (name == OUString( RTL_CONSTASCII_USTRINGPARAM("/FirstKey/FourthSubKey") )) { Sequence seqByte = xSubKey->getBinaryValue(); - TEST_ENSHURE(!strcmp(((const char*)seqByte.getArray()), "ich bin ein binary value"), + OSL_ENSURE(!strcmp(((const char*)seqByte.getArray()), "ich bin ein binary value"), "test_SimpleRegistry error 13" ); } @@ -287,10 +281,10 @@ void test_SimpleRegistry( Sequence seqLongs2; seqLongs2 = xKey->getLongListValue(); - TEST_ENSHURE( seqLongs.getLength() == 3, "test_SimpleRegistry error 14" ); - TEST_ENSHURE( seqLongs.getArray()[0] == 123, "test_SimpleRegistry error 15" ); - TEST_ENSHURE( seqLongs.getArray()[1] == 456, "test_SimpleRegistry error 16" ); - TEST_ENSHURE( seqLongs.getArray()[2] == 789, "test_SimpleRegistry error 17" ); + OSL_ENSURE( seqLongs.getLength() == 3, "test_SimpleRegistry error 14" ); + OSL_ENSURE( seqLongs.getArray()[0] == 123, "test_SimpleRegistry error 15" ); + OSL_ENSURE( seqLongs.getArray()[1] == 456, "test_SimpleRegistry error 16" ); + OSL_ENSURE( seqLongs.getArray()[2] == 789, "test_SimpleRegistry error 17" ); xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("ThirdKey") )); @@ -304,10 +298,10 @@ void test_SimpleRegistry( Sequence seqAscii2; seqAscii2 = xKey->getAsciiListValue(); - TEST_ENSHURE( seqAscii2.getLength() == 3, "test_SimpleRegistry error 18" ); - TEST_ENSHURE( seqAscii2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 19"); - TEST_ENSHURE( seqAscii2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 20"); - TEST_ENSHURE( seqAscii2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ), "test_SimpleRegistry error 21"); + OSL_ENSURE( seqAscii2.getLength() == 3, "test_SimpleRegistry error 18" ); + OSL_ENSURE( seqAscii2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 19"); + OSL_ENSURE( seqAscii2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 20"); + OSL_ENSURE( seqAscii2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ), "test_SimpleRegistry error 21"); xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FourthKey") )); OUString pUnicode[3]; @@ -320,27 +314,26 @@ void test_SimpleRegistry( Sequence seqUnicode2; seqUnicode2 = xKey->getStringListValue(); - TEST_ENSHURE( seqUnicode2.getLength() == 3, "test_SimpleRegistry error 22" ); - TEST_ENSHURE( seqUnicode2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 23"); - TEST_ENSHURE( seqUnicode2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 24"); - TEST_ENSHURE( seqUnicode2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich als unicode") ), "test_SimpleRegistry error 25"); + OSL_ENSURE( seqUnicode2.getLength() == 3, "test_SimpleRegistry error 22" ); + OSL_ENSURE( seqUnicode2.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_SimpleRegistry error 23"); + OSL_ENSURE( seqUnicode2.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_SimpleRegistry error 24"); + OSL_ENSURE( seqUnicode2.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich als unicode") ), "test_SimpleRegistry error 25"); xReg->open(testreg2, sal_False, sal_True); - TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 25" ); + OSL_ENSURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 25" ); xRootKey = xReg->getRootKey(); xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("ThirdKey/FirstSubKey/WithSubSubKey") )); xKey->closeKey(); - TEST_ENSHURE( + OSL_VERIFY( xRootKey->createLink( OUString( RTL_CONSTASCII_USTRINGPARAM("LinkTest") ), - OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") )), - "test_SimpleRegistry error 1212" ); + OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") )) ); xRootKey->closeKey(); xReg->close(); xReg->open(testreg, sal_False, sal_False); - TEST_ENSHURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 26" ); + OSL_ENSURE( xReg->isValid() != sal_False, "test_SimpleRegistry error 26" ); if (bMergeDifferently) { @@ -356,15 +349,15 @@ void test_SimpleRegistry( xRootKey = xReg->getRootKey(); xKey = xRootKey->openKey( OUString( RTL_CONSTASCII_USTRINGPARAM("LinkTest") ) ); - TEST_ENSHURE( xKey.is() && xKey->isValid() && xKey->getKeyName() == "/ThirdKey/FirstSubKey/WithSubSubKey", "test_SimpleRegistry error 1213" ); + OSL_ENSURE( xKey.is() && xKey->isValid() && xKey->getKeyName() == "/ThirdKey/FirstSubKey/WithSubSubKey", "test_SimpleRegistry error 1213" ); xKey->closeKey(); - TEST_ENSHURE( + OSL_ENSURE( xRootKey->getKeyType( OUString( RTL_CONSTASCII_USTRINGPARAM("LinkTest") ) ) == registry::RegistryKeyType_LINK, "test_SimpleRegistry error 1214" ); xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FirstKey/SecondSubKey") )); - TEST_ENSHURE( !xKey.is(), "test_SimpleRegistry error 27" ); + OSL_ENSURE( !xKey.is(), "test_SimpleRegistry error 27" ); // Test Links xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("FifthKey") )); @@ -372,18 +365,18 @@ void test_SimpleRegistry( OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey") )); xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink") )); - TEST_ENSHURE( xKey->isValid(), "test_SimpleRegistry error 27" ); - TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey") ), "test_SimpleRegistry error 28" ); + OSL_ENSURE( xKey->isValid(), "test_SimpleRegistry error 27" ); + OSL_ENSURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey") ), "test_SimpleRegistry error 28" ); xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ), OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") )); - TEST_ENSHURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") )) + OSL_ENSURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ), "test_SimpleRegistry error 29" ); try { - TEST_ENSHURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") )) + OSL_ENSURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink/BlaBlaBla") ), "test_SimpleRegistry error 30" ); } catch(InvalidRegistryException&) @@ -406,7 +399,7 @@ void test_SimpleRegistry( { } - TEST_ENSHURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") )) + OSL_ENSURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") ), "test_SimpleRegistry error 31" ); xRootKey->deleteLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") )); @@ -418,14 +411,14 @@ void test_SimpleRegistry( seqNames = xKey->getKeyNames(); seqKeys = xKey->openKeys(); - TEST_ENSHURE( seqNames.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ), + OSL_ENSURE( seqNames.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ), "test_SimpleRegistry error 32" ); - TEST_ENSHURE( seqNames.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/MyThirdLink") ), + OSL_ENSURE( seqNames.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/MyThirdLink") ), "test_SimpleRegistry error 33" ); - TEST_ENSHURE( seqKeys.getArray()[0]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ), + OSL_ENSURE( seqKeys.getArray()[0]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/SixthKey/SixthSubKey") ), "test_SimpleRegistry error 34" ); - TEST_ENSHURE( seqKeys.getArray()[1]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") ), + OSL_ENSURE( seqKeys.getArray()[1]->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/ThirdKey/FirstSubKey/WithSubSubKey") ), "test_SimpleRegistry error 35" ); xRootKey->deleteLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/FourthKey/MySecondLink") )); @@ -433,11 +426,11 @@ void test_SimpleRegistry( } catch(InvalidRegistryException&) { - TEST_ENSHURE(0, "exception InvalidRegistryExcption raised while doing test_SimpleRegistry"); + OSL_ENSURE(0, "exception InvalidRegistryExcption raised while doing test_SimpleRegistry"); } catch(InvalidValueException&) { - TEST_ENSHURE(0, "exception InvalidValueExcption raised while doing test_SimpleRegistry()"); + OSL_ENSURE(0, "exception InvalidValueExcption raised while doing test_SimpleRegistry()"); } xReg.clear(); @@ -463,25 +456,25 @@ void test_DefaultRegistry( //OUString(RTL_CONSTASCII_USTRINGPARAM("//./e:/src596/stoc/wntmsci3/bin")) ); Reference< XPropertySet > xPropSet( rSMgr, UNO_QUERY); - TEST_ENSHURE( xPropSet.is(), "test_DefaultRegistry error0"); + OSL_ENSURE( xPropSet.is(), "test_DefaultRegistry error0"); Any aPropertyAny( xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Registry")) ) ); - TEST_ENSHURE( aPropertyAny.hasValue(), "test_DefaultRegistry error1"); + OSL_ENSURE( aPropertyAny.hasValue(), "test_DefaultRegistry error1"); Reference xReg; aPropertyAny >>= xReg; - TEST_ENSHURE( xReg.is(), "test_DefaultRegistry error1a"); + OSL_ENSURE( xReg.is(), "test_DefaultRegistry error1a"); Reference xServInfo( Reference::query(xReg) ); - TEST_ENSHURE( xServInfo.is(), "test_DefaultRegistry error2"); + OSL_ENSURE( xServInfo.is(), "test_DefaultRegistry error2"); - TEST_ENSHURE( xServInfo->getImplementationName() == OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.NestedRegistry") ), "test_DefualtRegistry error3"); - TEST_ENSHURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.NestedRegistry") )), "test_DefaultRegistry error4"); - TEST_ENSHURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_DefaultRegistry error5"); + OSL_ENSURE( xServInfo->getImplementationName() == OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.NestedRegistry") ), "test_DefualtRegistry error3"); + OSL_ENSURE( xServInfo->supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.NestedRegistry") )), "test_DefaultRegistry error4"); + OSL_ENSURE( xServInfo->getSupportedServiceNames().getLength() == 1, "test_DefaultRegistry error5"); xServInfo.clear(); - TEST_ENSHURE( xReg.is(), "test_DefaultRegistry error6"); + OSL_ENSURE( xReg.is(), "test_DefaultRegistry error6"); try { @@ -489,7 +482,7 @@ void test_DefaultRegistry( Reference xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR/com/sun/star/registry/XSimpleRegistry") )); - TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR/com/sun/star/registry/XSimpleRegistry") ), + OSL_ENSURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR/com/sun/star/registry/XSimpleRegistry") ), "test_DefaultRegistry error 7" ); if (bMergeDifferently) @@ -515,23 +508,23 @@ void test_DefaultRegistry( Sequence seqNames = xKey->getKeyNames(); - TEST_ENSHURE( seqNames.getLength() == 2, "test_DefaultRegistry error 8" ); + OSL_ENSURE( seqNames.getLength() == 2, "test_DefaultRegistry error 8" ); } xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey") )); if (xKey.is()) { RegistryValueType valueType = xKey->getValueType(); - TEST_ENSHURE( valueType == RegistryValueType_ASCIILIST, "test_DefaultRegistry error 9" ); + OSL_ENSURE( valueType == RegistryValueType_ASCIILIST, "test_DefaultRegistry error 9" ); Sequence seqValue = xKey->getAsciiListValue(); - TEST_ENSHURE( seqValue.getLength() == 3, "test_DefaultRegistry error 10" ); - TEST_ENSHURE( seqValue.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), + OSL_ENSURE( seqValue.getLength() == 3, "test_DefaultRegistry error 10" ); + OSL_ENSURE( seqValue.getArray()[0] == OUString( RTL_CONSTASCII_USTRINGPARAM("Hallo") ), "test_DefaultRegistry error 11" ); - TEST_ENSHURE( seqValue.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), + OSL_ENSURE( seqValue.getArray()[1] == OUString( RTL_CONSTASCII_USTRINGPARAM("jetzt komm") ), "test_DefaultRegistry error 12" ); - TEST_ENSHURE( seqValue.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ), + OSL_ENSURE( seqValue.getArray()[2] == OUString( RTL_CONSTASCII_USTRINGPARAM("ich") ), "test_DefaultRegistry error 13" ); Sequence seqLong(3); @@ -543,10 +536,10 @@ void test_DefaultRegistry( Sequence seqLongValue = xKey->getLongListValue(); - TEST_ENSHURE( seqLongValue.getLength() == 3, "test_DefaultRegistry error 14" ); - TEST_ENSHURE( seqLongValue.getArray()[0] == 1234, "test_DefaultRegistry error 15" ); - TEST_ENSHURE( seqLongValue.getArray()[1] == 4567, "test_DefaultRegistry error 16" ); - TEST_ENSHURE( seqLongValue.getArray()[2] == 7890, "test_DefaultRegistry error 17" ); + OSL_ENSURE( seqLongValue.getLength() == 3, "test_DefaultRegistry error 14" ); + OSL_ENSURE( seqLongValue.getArray()[0] == 1234, "test_DefaultRegistry error 15" ); + OSL_ENSURE( seqLongValue.getArray()[1] == 4567, "test_DefaultRegistry error 16" ); + OSL_ENSURE( seqLongValue.getArray()[2] == 7890, "test_DefaultRegistry error 17" ); } // Test Links @@ -555,20 +548,20 @@ void test_DefaultRegistry( OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey") )); xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink") )); - TEST_ENSHURE( xKey->isValid(), "test_DefaultRegistry error 18" ); - TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey") ), + OSL_ENSURE( xKey->isValid(), "test_DefaultRegistry error 18" ); + OSL_ENSURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey") ), "test_DefaultRegistry error 19" ); xKey->createLink(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") ), OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") )); - TEST_ENSHURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") )) + OSL_ENSURE( xKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ), "test_DefaultRegistry error 20" ); try { - TEST_ENSHURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") )) + OSL_ENSURE( xKey->getResolvedName(OUString( RTL_CONSTASCII_USTRINGPARAM("/WithSubSubKey/MyFourthLink/BlaBlaBla") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink/BlaBlaBla") ), "test_DefaultRegistry error 21" ); } @@ -591,7 +584,7 @@ void test_DefaultRegistry( printf("test InvalidRegistryExcption OK!\n"); } - TEST_ENSHURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") )) + OSL_ENSURE( xRootKey->getLinkTarget(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FifthKey/MyFirstLink/WithSubSubKey/MyFourthLink") )) == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/FourthKey/MySecondLink") ), "test_DefaultRegistry error 22" ); @@ -600,17 +593,17 @@ void test_DefaultRegistry( xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/DefaultLink/SecondSubSubKey") )); if (xKey.is()) { - TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/SecondSubSubKey") ), "test_DefaultRegistry error 23" ); + OSL_ENSURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/SecondSubSubKey") ), "test_DefaultRegistry error 23" ); } xKey = xRootKey->createKey(OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/DefaultLink/ThirdSubSubKey") )); if (xKey.is()) { - TEST_ENSHURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/ThirdSubSubKey") ), + OSL_ENSURE( xKey->getKeyName() == OUString( RTL_CONSTASCII_USTRINGPARAM("/Test/ThirdKey/FirstSubKey/ThirdSubSubKey") ), "test_DefaultRegistry error 24" ); } xKey = xRootKey->openKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test") )); - TEST_ENSHURE( xKey->isValid(), "test_DefaultRegistry error 25" ); + OSL_ENSURE( xKey->isValid(), "test_DefaultRegistry error 25" ); xRootKey->deleteKey(OUString( RTL_CONSTASCII_USTRINGPARAM("Test") )); @@ -636,11 +629,11 @@ void test_DefaultRegistry( } catch(InvalidRegistryException&) { - TEST_ENSHURE(0, "exception InvalidRegistryExcption raised while doing test_DefaultRegistry"); + OSL_ENSURE(0, "exception InvalidRegistryExcption raised while doing test_DefaultRegistry"); } catch(InvalidValueException&) { - TEST_ENSHURE(0, "exception InvalidValueExcption raised while doing test_DefaultRegistry()"); + OSL_ENSURE(0, "exception InvalidValueExcption raised while doing test_DefaultRegistry()"); } try { @@ -649,7 +642,7 @@ void test_DefaultRegistry( catch(const InvalidRegistryException& e) { (void)e; - TEST_ENSHURE(0, OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr()); + OSL_ENSURE(0, OUStringToOString(e.Message,RTL_TEXTENCODING_ASCII_US).getStr()); } diff --git a/stoc/test/testsmgr.cxx b/stoc/test/testsmgr.cxx index 7687a52cc576..424b16d4c3c3 100644 --- a/stoc/test/testsmgr.cxx +++ b/stoc/test/testsmgr.cxx @@ -47,12 +47,6 @@ extern "C" void SAL_CALL test_ServiceManager(); #define TRUE 1 #endif -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - using namespace ::rtl; OString userRegEnv("STAR_USER_REGISTRY="); @@ -81,10 +75,10 @@ void setStarUserRegistry() userReg += OUString(RTL_CONSTASCII_USTRINGPARAM("user.rdb")); if(myRegistry->open(userReg, REG_READWRITE)) { - TEST_ENSHURE(!myRegistry->create(userReg), "setStarUserRegistry error 1"); + OSL_VERIFY(!myRegistry->create(userReg)); } - TEST_ENSHURE(!myRegistry->close(), "setStarUserRegistry error 9"); + OSL_VERIFY(!myRegistry->close()); delete myRegistry; userRegEnv += OUStringToOString(userReg, RTL_TEXTENCODING_ASCII_US); diff --git a/stoc/test/testsmgr_cpnt.cxx b/stoc/test/testsmgr_cpnt.cxx index 7e9296a75938..6672ef374f36 100644 --- a/stoc/test/testsmgr_cpnt.cxx +++ b/stoc/test/testsmgr_cpnt.cxx @@ -56,14 +56,6 @@ #endif - -#if OSL_DEBUG_LEVEL > 0 -#define TEST_ENSHURE(c, m) OSL_ENSURE(c, m) -#else -#define TEST_ENSHURE(c, m) OSL_VERIFY(c) -#endif - - #define IMPLEMENTATION_NAME "com.sun.star.DummyService.V10" #define SERVICE_NAME "com.sun.star.ts.TestManagerImpl" @@ -215,24 +207,24 @@ extern "C" void SAL_CALL test_ServiceManager() // get the process servicemanager Reference xSMgr = getProcessServiceManager(); - TEST_ENSHURE( xSMgr.is() , "query on XServiceManager failed" ); + OSL_ENSURE( xSMgr.is() , "query on XServiceManager failed" ); Reference xContEnum(xSMgr, UNO_QUERY); - TEST_ENSHURE( xContEnum.is() , "query on XContentEnumerationAccess failed" ); + OSL_ENSURE( xContEnum.is() , "query on XContentEnumerationAccess failed" ); Reference xEnum(xContEnum->createContentEnumeration(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry")))); - TEST_ENSHURE( xEnum.is() , "createContentEnumeration failed" ); + OSL_ENSURE( xEnum.is() , "createContentEnumeration failed" ); sal_Int32 nLen = 0; while( xEnum->hasMoreElements() ) { nLen++; xEnum->nextElement(); } - TEST_ENSHURE( nLen == 1, "more than one implementation for SimpleRegistry" ); + OSL_ENSURE( nLen == 1, "more than one implementation for SimpleRegistry" ); Reference xImplEnum(xSMgr, UNO_QUERY); - TEST_ENSHURE( xImplEnum.is() , "query on XEnumeration failed" ); + OSL_ENSURE( xImplEnum.is() , "query on XEnumeration failed" ); xEnum = Reference(xImplEnum->createEnumeration()); - TEST_ENSHURE( xEnum.is() , "createEnumeration failed" ); + OSL_ENSURE( xEnum.is() , "createEnumeration failed" ); nLen = 0; while( xEnum->hasMoreElements() ) { @@ -241,10 +233,10 @@ extern "C" void SAL_CALL test_ServiceManager() OString str( OUStringToOString( sf->getImplementationName(), RTL_TEXTENCODING_ASCII_US ) ); ::fprintf( stderr, "> implementation name: %s\n", str.getStr() ); } - TEST_ENSHURE( nLen == 8, "more than 6 factories" ); + OSL_ENSURE( nLen == 8, "more than 6 factories" ); // try to get an instance for a unknown service - TEST_ENSHURE( !xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("bla.blup.Q"))).is(), "unknown service provider found" ); + OSL_VERIFY( !xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("bla.blup.Q"))).is() ); // // First test : register service via the internal function of the component itself @@ -252,30 +244,29 @@ extern "C" void SAL_CALL test_ServiceManager() { Reference< XImplementationRegistration > xInst( xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))), UNO_QUERY ); - TEST_ENSHURE( xInst.is(), "no ImplementationRegistration" ); + OSL_ENSURE( xInst.is(), "no ImplementationRegistration" ); try { // register the services via writeComponentRegInfo (see at end of this file) xInst->registerImplementation(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), atUModule2, Reference< XSimpleRegistry >() ); } catch(const CannotRegisterImplementationException &) { - TEST_ENSHURE( 0, "register implementation failed" ); + OSL_ENSURE( 0, "register implementation failed" ); } // getImplementations() check Sequence seqImpl = xInst->getImplementations(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), atUModule2); - TEST_ENSHURE( seqImpl.getLength() == 1, "count of implementantions is wrong" ); - TEST_ENSHURE( seqImpl.getConstArray()[0] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.DummyService.V10")), "implementation name is not equal" ); + OSL_ENSURE( seqImpl.getLength() == 1, "count of implementantions is wrong" ); + OSL_ENSURE( seqImpl.getConstArray()[0] == OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.DummyService.V10")), "implementation name is not equal" ); // tests, if a service provider can be instantiated. Reference< XInterface > xIFace(xSMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ts.TestManagerImpl")))); - TEST_ENSHURE( xIFace.is(), "loadable service not found" ); + OSL_ENSURE( xIFace.is(), "loadable service not found" ); // remove the service - TEST_ENSHURE( xInst->revokeImplementation(atUModule2, Reference< XSimpleRegistry > ()), - "revoke implementation failed" ); + OSL_VERIFY( xInst->revokeImplementation(atUModule2, Reference< XSimpleRegistry > ()) ); } Reference xComp(xSMgr, UNO_QUERY); -- cgit