1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: testidlclass.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_cppuhelper.hxx"
33 #if OSL_DEBUG_LEVEL == 0
39 #include <cppuhelper/stdidlclass.hxx>
41 #include <com/sun/star/reflection/XIdlClassProvider.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include "testhelper.hxx"
46 using namespace ::com::sun::star::uno
;
47 using namespace ::com::sun::star::lang
;
48 using namespace ::com::sun::star::reflection
;
49 using namespace ::rtl
;
54 void testidlclass( const Reference
< XMultiServiceFactory
> &rSMgr
)
56 const OUString
sImplName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.cpputest") ) );
58 // this reference is static to test behaviour during exiting application
59 Reference
< XIdlClass
> r
=
60 ::cppu::createStandardClass(
63 Reference
< XIdlClass
> () ,
64 (XMultiServiceFactory
* ) 0 ,
71 { // test the xidlclassprovider interface !
72 Reference
< XIdlClassProvider
> rProv( r
, UNO_QUERY
);
76 Sequence
< Reference
< XIdlClass
> > seq
= rProv
->getIdlClasses();
79 assert( seq
.getLength() == 1 );
81 // test the weak reference
82 rProv
->getIdlClasses();
86 rProv
->getIdlClasses();
92 assert( r
->getName() == sImplName
);
95 Reference
< XIdlClass
> r2
=
96 ::cppu::createStandardClass(
99 Reference
< XIdlClass
> () ,
100 (XMultiServiceFactory
* ) 0 ,
103 // test for implementation name
104 assert( r2
->equals( r
) );
106 Sequence
< Reference
< XIdlClass
> > seqIdlClass
= r
->getInterfaces();
109 // one idl class for one interface
110 // this test fails, if core reflection fails !
111 // assert( 1 == seqIdlClass.getLength() );
112 // Reference < XIdlClass > rIdlInterface = seqIdlClass.getArray()[0];
114 // check for IdlClass interface returned by Core Reflection
115 // assert( rIdlInterface.is() );
119 // Test all ten templates
120 Reference
< XIdlClass
> x
= ::cppu::createStandardClass(
123 Reference
< XIdlClass
> () ,
124 (XMultiServiceFactory
* ) 0 ,
125 (XServiceInfo
* ) 0 ,
129 // Test all ten templates
130 x
= ::cppu::createStandardClass(
133 Reference
< XIdlClass
> () ,
134 (XMultiServiceFactory
* ) 0 ,
135 (XServiceInfo
* ) 0 ,
136 (XServiceInfo
* ) 0 ,
141 // Test all ten templates
142 x
= ::cppu::createStandardClass(
145 Reference
< XIdlClass
> () ,
146 (XMultiServiceFactory
* ) 0 ,
147 (XServiceInfo
* ) 0 ,
148 (XServiceInfo
* ) 0 ,
149 (XServiceInfo
* ) 0 ,
155 // Test all ten templates
156 x
= ::cppu::createStandardClass(
159 Reference
< XIdlClass
> () ,
160 (XMultiServiceFactory
* ) 0 ,
161 (XServiceInfo
* ) 0 ,
162 (XServiceInfo
* ) 0 ,
163 (XServiceInfo
* ) 0 ,
164 (XServiceInfo
* ) 0 ,
170 // Test all ten templates
171 x
= ::cppu::createStandardClass(
174 Reference
< XIdlClass
> () ,
175 (XMultiServiceFactory
* ) 0 ,
176 (XServiceInfo
* ) 0 ,
177 (XServiceInfo
* ) 0 ,
178 (XServiceInfo
* ) 0 ,
179 (XServiceInfo
* ) 0 ,
180 (XServiceInfo
* ) 0 ,
185 // Test all ten templates
186 x
= ::cppu::createStandardClass(
189 Reference
< XIdlClass
> () ,
190 (XMultiServiceFactory
* ) 0 ,
191 (XServiceInfo
* ) 0 ,
192 (XServiceInfo
* ) 0 ,
193 (XServiceInfo
* ) 0 ,
194 (XServiceInfo
* ) 0 ,
195 (XServiceInfo
* ) 0 ,
196 (XServiceInfo
* ) 0 ,
203 // Test all ten templates
204 x
= ::cppu::createStandardClass(
207 Reference
< XIdlClass
> () ,
208 (XMultiServiceFactory
* ) 0 ,
209 (XServiceInfo
* ) 0 ,
210 (XServiceInfo
* ) 0 ,
211 (XServiceInfo
* ) 0 ,
212 (XServiceInfo
* ) 0 ,
213 (XServiceInfo
* ) 0 ,
214 (XServiceInfo
* ) 0 ,
215 (XServiceInfo
* ) 0 ,
219 // Test all ten templates
220 x
= ::cppu::createStandardClass(
223 Reference
< XIdlClass
> () ,
224 (XMultiServiceFactory
* ) 0 ,
225 (XServiceInfo
* ) 0 ,
226 (XServiceInfo
* ) 0 ,
227 (XServiceInfo
* ) 0 ,
228 (XServiceInfo
* ) 0 ,
229 (XServiceInfo
* ) 0 ,
230 (XServiceInfo
* ) 0 ,
231 (XServiceInfo
* ) 0 ,
232 (XServiceInfo
* ) 0 ,