Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / cppuhelper / test / testidlclass.cxx
blob590d3143c9df1d603ec8f94f51014dbbec9a4c3e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <cppuhelper/stdidlclass.hxx>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include "testhelper.hxx"
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::lang;
38 using namespace ::com::sun::star::reflection;
39 using namespace ::rtl;
44 void testidlclass( const Reference < XMultiServiceFactory > &rSMgr)
46 const OUString sImplName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.cpputest") ) );
48 // this reference is static to test behaviour during exiting application
49 Reference < XIdlClass > r =
50 ::cppu::createStandardClass(
51 rSMgr ,
52 sImplName,
53 Reference < XIdlClass > () ,
54 (XMultiServiceFactory * ) 0 ,
55 (XServiceInfo * ) 0
58 OSL_ASSERT( r.is() );
59 OSL_ASSERT( r->getName() == sImplName );
61 // test equals
62 Reference < XIdlClass > r2 =
63 ::cppu::createStandardClass(
64 rSMgr ,
65 sImplName,
66 Reference < XIdlClass > () ,
67 (XMultiServiceFactory * ) 0 ,
68 (XServiceInfo * ) 0
70 // test for implementation name
71 OSL_ASSERT( r2->equals( r ) );
73 Sequence < Reference < XIdlClass > > seqIdlClass = r->getInterfaces();
75 //TODO !
76 // one idl class for one interface
77 // this test fails, if core reflection fails !
78 // OSL_ASSERT( 1 == seqIdlClass.getLength() );
79 // Reference < XIdlClass > rIdlInterface = seqIdlClass.getArray()[0];
81 // check for IdlClass interface returned by Core Reflection
82 // OSL_ASSERT( rIdlInterface.is() );
86 // Test all ten templates
87 Reference< XIdlClass > x = ::cppu::createStandardClass(
88 rSMgr ,
89 sImplName,
90 Reference < XIdlClass > () ,
91 (XMultiServiceFactory * ) 0 ,
92 (XServiceInfo * ) 0 ,
93 (XServiceInfo * ) 0
96 // Test all ten templates
97 x = ::cppu::createStandardClass(
98 rSMgr ,
99 sImplName,
100 Reference < XIdlClass > () ,
101 (XMultiServiceFactory * ) 0 ,
102 (XServiceInfo * ) 0 ,
103 (XServiceInfo * ) 0 ,
104 (XServiceInfo * ) 0
108 // Test all ten templates
109 x = ::cppu::createStandardClass(
110 rSMgr ,
111 sImplName,
112 Reference < XIdlClass > () ,
113 (XMultiServiceFactory * ) 0 ,
114 (XServiceInfo * ) 0 ,
115 (XServiceInfo * ) 0 ,
116 (XServiceInfo * ) 0 ,
117 (XServiceInfo * ) 0
122 // Test all ten templates
123 x = ::cppu::createStandardClass(
124 rSMgr ,
125 sImplName,
126 Reference < XIdlClass > () ,
127 (XMultiServiceFactory * ) 0 ,
128 (XServiceInfo * ) 0 ,
129 (XServiceInfo * ) 0 ,
130 (XServiceInfo * ) 0 ,
131 (XServiceInfo * ) 0 ,
132 (XServiceInfo * ) 0
137 // Test all ten templates
138 x = ::cppu::createStandardClass(
139 rSMgr ,
140 sImplName,
141 Reference < XIdlClass > () ,
142 (XMultiServiceFactory * ) 0 ,
143 (XServiceInfo * ) 0 ,
144 (XServiceInfo * ) 0 ,
145 (XServiceInfo * ) 0 ,
146 (XServiceInfo * ) 0 ,
147 (XServiceInfo * ) 0 ,
148 (XServiceInfo * ) 0
152 // Test all ten templates
153 x = ::cppu::createStandardClass(
154 rSMgr ,
155 sImplName,
156 Reference < XIdlClass > () ,
157 (XMultiServiceFactory * ) 0 ,
158 (XServiceInfo * ) 0 ,
159 (XServiceInfo * ) 0 ,
160 (XServiceInfo * ) 0 ,
161 (XServiceInfo * ) 0 ,
162 (XServiceInfo * ) 0 ,
163 (XServiceInfo * ) 0 ,
164 (XServiceInfo * ) 0
170 // Test all ten templates
171 x = ::cppu::createStandardClass(
172 rSMgr ,
173 sImplName,
174 Reference < XIdlClass > () ,
175 (XMultiServiceFactory * ) 0 ,
176 (XServiceInfo * ) 0 ,
177 (XServiceInfo * ) 0 ,
178 (XServiceInfo * ) 0 ,
179 (XServiceInfo * ) 0 ,
180 (XServiceInfo * ) 0 ,
181 (XServiceInfo * ) 0 ,
182 (XServiceInfo * ) 0 ,
183 (XServiceInfo * ) 0
186 // Test all ten templates
187 x = ::cppu::createStandardClass(
188 rSMgr ,
189 sImplName,
190 Reference < XIdlClass > () ,
191 (XMultiServiceFactory * ) 0 ,
192 (XServiceInfo * ) 0 ,
193 (XServiceInfo * ) 0 ,
194 (XServiceInfo * ) 0 ,
195 (XServiceInfo * ) 0 ,
196 (XServiceInfo * ) 0 ,
197 (XServiceInfo * ) 0 ,
198 (XServiceInfo * ) 0 ,
199 (XServiceInfo * ) 0 ,
200 (XServiceInfo * ) 0
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */