summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2001-08-31 08:12:21 +0000
committerDaniel Boelzle <dbo@openoffice.org>2001-08-31 08:12:21 +0000
commit17a3167736a2a27a469e15361e2fcc4012934361 (patch)
tree7277c78e5cccdeb00e19947e5588cf73b1e060f5
parent#91796# Deprecated. (diff)
downloadcore-17a3167736a2a27a469e15361e2fcc4012934361.tar.gz
core-17a3167736a2a27a469e15361e2fcc4012934361.zip
#90698# impl helper revision
-rw-r--r--cppuhelper/test/helpertest.idl13
-rw-r--r--cppuhelper/test/makefile.mk8
-rw-r--r--cppuhelper/test/testhelper.cxx6
-rw-r--r--cppuhelper/test/testimplhelper.cxx152
4 files changed, 128 insertions, 51 deletions
diff --git a/cppuhelper/test/helpertest.idl b/cppuhelper/test/helpertest.idl
index b6262f01278d..0f42b789b88c 100644
--- a/cppuhelper/test/helpertest.idl
+++ b/cppuhelper/test/helpertest.idl
@@ -2,9 +2,9 @@
*
* $RCSfile: helpertest.idl,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dbo $ $Date: 2001-03-21 13:51:25 $
+ * last change: $Author: dbo $ $Date: 2001-08-31 09:12:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,6 +104,15 @@ interface G : com::sun::star::uno::XInterface
string a();
};
+interface H : com::sun::star::uno::XInterface
+{
+ string h();
+};
+interface I : com::sun::star::uno::XInterface
+{
+ string i();
+};
+
}; //module test
#endif
diff --git a/cppuhelper/test/makefile.mk b/cppuhelper/test/makefile.mk
index 82eb0dad772e..8c304efda521 100644
--- a/cppuhelper/test/makefile.mk
+++ b/cppuhelper/test/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: kr $ $Date: 2001-07-25 09:20:13 $
+# last change: $Author: dbo $ $Date: 2001-08-31 09:12:21 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -62,7 +62,7 @@
PRJ=..
PRJNAME= cppuhelper
-TARGET= testhelper
+TARGET= testhelper
LIBTARGET= NO
TARGETTYPE= CUI
ENABLE_EXCEPTIONS=TRUE
@@ -146,7 +146,7 @@ CPPUMAKERFLAGS =
CPPUMAKERFLAGS = -L
.ENDIF
-TYPES:=test.A;test.BA;test.CA;test.DBA;test.E;test.FE;test.G
+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
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
diff --git a/cppuhelper/test/testhelper.cxx b/cppuhelper/test/testhelper.cxx
index ce8196a08cce..4dd17a25ecc3 100644
--- a/cppuhelper/test/testhelper.cxx
+++ b/cppuhelper/test/testhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testhelper.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dbo $ $Date: 2001-06-01 11:47:11 $
+ * last change: $Author: dbo $ $Date: 2001-08-31 09:12:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -131,10 +131,10 @@ int __cdecl main( int argc, char * argv[] )
Reference< XSimpleRegistry >() );
Reference< XMultiServiceFactory > x( xMgr, UNO_QUERY );
+ test_ImplHelper( x );
testPropertyTypeHelper();
testidlclass( x );
test_PropertySetHelper();
- test_ImplHelper( x );
test_interfacecontainer();
}
catch (Exception & rExc)
diff --git a/cppuhelper/test/testimplhelper.cxx b/cppuhelper/test/testimplhelper.cxx
index 4c5f9d51aef2..7a4f14d4d3e7 100644
--- a/cppuhelper/test/testimplhelper.cxx
+++ b/cppuhelper/test/testimplhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: testimplhelper.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dbo $ $Date: 2001-05-08 15:55:51 $
+ * last change: $Author: dbo $ $Date: 2001-08-31 09:12:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,32 @@
*
************************************************************************/
+#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/implbase4.hxx>
@@ -72,6 +98,8 @@
#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>
@@ -251,6 +279,47 @@ struct TestWeakAggComponentImpl : public WeakAggComponentImplHelper4< CA, DBA, F
};
//==================================================================================================
+struct TestImplInh : public ImplInheritanceHelper2< TestWeakImpl, H, I >
+{
+ virtual ~TestImplInh()
+ { OSL_TRACE( "> TestWeakImplInh dtor called... <\n" ); }
+
+ // H
+ virtual OUString SAL_CALL h() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("h") ); }
+ // I
+ virtual OUString SAL_CALL i() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("i") ); }
+};
+
+//==================================================================================================
+struct TestAggImplInh : public AggImplInheritanceHelper2< TestWeakAggImpl, H, I >
+{
+ virtual ~TestAggImplInh()
+ { OSL_TRACE( "> TestAggImplInh dtor called... <\n" ); }
+
+ // H
+ virtual OUString SAL_CALL h() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("h2") ); }
+ // I
+ virtual OUString SAL_CALL i() throw(RuntimeException)
+ { return OUString( RTL_CONSTASCII_USTRINGPARAM("i2") ); }
+};
+
+
+static bool isIn( Sequence< Type > const & rTypes, char const * name )
+{
+ OUString str( OUString::createFromAscii( name ) );
+ Type const * pTypes = rTypes.getConstArray();
+ for ( sal_Int32 nPos = rTypes.getLength(); nPos--; )
+ {
+ if (pTypes[ nPos ].getTypeName().equals( str ))
+ return true;
+ }
+ return false;
+}
+
+//==================================================================================================
static void dotest( const Reference< XInterface > & xOriginal )
{
Reference< A > xa( xOriginal, UNO_QUERY );
@@ -278,54 +347,40 @@ static void dotest( const Reference< XInterface > & xOriginal )
Sequence< Type > aTypes( xProv->getTypes() );
// CA, DBA, FE, G, XTypeProvider
- OSL_ASSERT( aTypes[0].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.CA") ) );
- OSL_ASSERT( aTypes[1].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.DBA") ) );
- OSL_ASSERT( aTypes[2].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.FE") ) );
- OSL_ASSERT( aTypes[3].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("test.G") ) );
- OSL_ASSERT( aTypes[4].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XTypeProvider") ) );
+ OSL_ASSERT( isIn( aTypes, "test.CA" ) );
+ OSL_ASSERT( isIn( aTypes, "test.DBA" ) );
+ OSL_ASSERT( isIn( aTypes, "test.FE") );
+ OSL_ASSERT( isIn( aTypes, "test.G") );
+ OSL_ASSERT( isIn( aTypes, "com.sun.star.lang.XTypeProvider") );
+ Reference< XWeak > xWeak( xg, UNO_QUERY );
+ if (xWeak.is())
+ {
+ OSL_ASSERT( isIn( aTypes, "com.sun.star.uno.XWeak") );
+ }
Reference< XComponent > xComp( xg, UNO_QUERY );
- Reference< XAggregation > xAgg( xg, UNO_QUERY );
if (xComp.is())
{
- if (xAgg.is())
- {
- OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
- OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XAggregation") ) );
- OSL_ASSERT( aTypes[7].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XComponent") ) );
- OSL_ASSERT( aTypes.getLength() == 8 );
- }
- else
- {
- OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
- OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.lang.XComponent") ) );
- OSL_ASSERT( aTypes.getLength() == 7 );
- }
+ OSL_ASSERT( isIn( aTypes, "com.sun.star.lang.XComponent") );
}
- else
+
+ Reference< XAggregation > xAgg( xg, UNO_QUERY );
+ if (xAgg.is())
{
- if (xAgg.is())
- {
- OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
- OSL_ASSERT( aTypes[6].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XAggregation") ) );
- OSL_ASSERT( aTypes.getLength() == 7 );
- }
- else
- {
- Reference< XWeak > xWeak( xg, UNO_QUERY );
- if (xWeak.is())
- {
- OSL_ASSERT( aTypes[5].getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XWeak") ) );
- OSL_ASSERT( aTypes.getLength() == 6 );
- }
- else
- {
- OSL_ASSERT( aTypes.getLength() == 5 );
- }
- }
+ OSL_ASSERT( isIn( aTypes, "com.sun.star.uno.XAggregation") );
+ }
+ Reference< H > xH( xg, UNO_QUERY );
+ if (xH.is())
+ {
+ OSL_ASSERT( isIn( aTypes, "test.H") );
+ }
+ Reference< I > xI( xg, UNO_QUERY );
+ if (xI.is())
+ {
+ OSL_ASSERT( isIn( aTypes, "test.I") );
}
- OSL_ENSURE( Reference< XInterface >::query( xg ) == xOriginal, "### root!" );
+ OSL_ENSURE( xg == xOriginal, "### root!" );
}
//==================================================================================================
@@ -342,6 +397,19 @@ void test_ImplHelper( const Reference< XMultiServiceFactory > & xSF )
dotest( xWeakComponentImpl );
dotest( xWeakAggComponentImpl );
//
+ xWeakImpl = (OWeakObject *)new TestImplInh();
+ dotest( xWeakImpl );
+ Reference< H > xH( xWeakImpl, UNO_QUERY );
+ Reference< I > xI( xH, UNO_QUERY );
+ OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h") ) );
+ OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i") ) );
+
+ xWeakAggImpl = (OWeakObject *)new TestAggImplInh();
+ dotest( xWeakAggImpl );
+ xH.set( xWeakAggImpl, UNO_QUERY );
+ xI.set( xH, UNO_QUERY );
+ OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h2") ) );
+ OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i2") ) );
// exception helper test
try