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: test_unotype.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_cppu.hxx"
34 #include "sal/config.h"
38 #include "com/sun/star/beans/Optional.hpp"
39 #include "com/sun/star/beans/PropertyChangeEvent.hpp"
40 #include "com/sun/star/lang/EventObject.hpp"
41 #include "com/sun/star/uno/Exception.hpp"
42 #include "com/sun/star/uno/Reference.hxx"
43 #include "com/sun/star/uno/RuntimeException.hpp"
44 #include "com/sun/star/uno/Sequence.hxx"
45 #include "com/sun/star/uno/Type.hxx"
46 #include "com/sun/star/uno/TypeClass.hpp"
47 #include "com/sun/star/uno/XComponentContext.hpp"
48 #include "com/sun/star/uno/XInterface.hpp"
49 #include "cppu/unotype.hxx"
50 #include "cppunit/simpleheader.hxx"
51 #include "rtl/ustring.h"
52 #include "rtl/ustring.hxx"
53 #include "sal/types.h"
55 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
61 namespace css
= com::sun::star
;
63 struct DerivedStruct1
: css::lang::EventObject
{};
65 struct DerivedStruct2
: css::beans::PropertyChangeEvent
{};
67 struct DerivedException1
: css::uno::Exception
{};
69 struct DerivedException2
: css::uno::RuntimeException
{};
71 struct DerivedInterface1
: css::uno::XInterface
{};
73 struct DerivedInterface2
: css::uno::XComponentContext
{};
75 class Test
: public ::CppUnit::TestFixture
{
79 void testGetTypeFavourUnsigned();
81 void testGetTypeFavourChar();
83 CPPUNIT_TEST_SUITE(Test
);
84 CPPUNIT_TEST(testUnoType
);
85 CPPUNIT_TEST(testGetTypeFavourUnsigned
);
86 CPPUNIT_TEST(testGetTypeFavourChar
);
87 CPPUNIT_TEST_SUITE_END();
90 void Test::testUnoType() {
92 t
= ::cppu::UnoType
< ::cppu::UnoVoidType
>::get();
93 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_VOID
, t
.getTypeClass());
95 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), t
.getTypeName());
96 t
= ::cppu::UnoType
< bool >::get();
97 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BOOLEAN
, t
.getTypeClass());
99 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")),
101 CPPUNIT_ASSERT(::cppu::UnoType
< ::sal_Bool
>::get() == t
);
102 t
= ::cppu::UnoType
< ::sal_Int8
>::get();
103 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_BYTE
, t
.getTypeClass());
104 CPPUNIT_ASSERT_EQUAL(
105 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("byte")), t
.getTypeName());
106 t
= ::cppu::UnoType
< ::sal_Int16
>::get();
107 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SHORT
, t
.getTypeClass());
108 CPPUNIT_ASSERT_EQUAL(
109 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("short")), t
.getTypeName());
110 t
= ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get();
111 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_UNSIGNED_SHORT
, t
.getTypeClass());
112 CPPUNIT_ASSERT_EQUAL(
113 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned short")),
115 t
= ::cppu::UnoType
< ::sal_Int32
>::get();
116 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_LONG
, t
.getTypeClass());
117 CPPUNIT_ASSERT_EQUAL(
118 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("long")), t
.getTypeName());
119 t
= ::cppu::UnoType
< ::sal_uInt32
>::get();
120 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_UNSIGNED_LONG
, t
.getTypeClass());
121 CPPUNIT_ASSERT_EQUAL(
122 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned long")),
124 t
= ::cppu::UnoType
< ::sal_Int64
>::get();
125 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_HYPER
, t
.getTypeClass());
126 CPPUNIT_ASSERT_EQUAL(
127 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hyper")), t
.getTypeName());
128 t
= ::cppu::UnoType
< ::sal_uInt64
>::get();
129 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_UNSIGNED_HYPER
, t
.getTypeClass());
130 CPPUNIT_ASSERT_EQUAL(
131 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned hyper")),
133 t
= ::cppu::UnoType
< float >::get();
134 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_FLOAT
, t
.getTypeClass());
135 CPPUNIT_ASSERT_EQUAL(
136 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("float")), t
.getTypeName());
137 t
= ::cppu::UnoType
< double >::get();
138 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_DOUBLE
, t
.getTypeClass());
139 CPPUNIT_ASSERT_EQUAL(
140 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("double")),
142 t
= ::cppu::UnoType
< ::cppu::UnoCharType
>::get();
143 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_CHAR
, t
.getTypeClass());
144 CPPUNIT_ASSERT_EQUAL(
145 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("char")), t
.getTypeName());
146 t
= ::cppu::UnoType
< ::rtl::OUString
>::get();
147 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRING
, t
.getTypeClass());
148 CPPUNIT_ASSERT_EQUAL(
149 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")),
151 t
= ::cppu::UnoType
< css::uno::Type
>::get();
152 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_TYPE
, t
.getTypeClass());
153 CPPUNIT_ASSERT_EQUAL(
154 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("type")), t
.getTypeName());
155 t
= ::cppu::UnoType
< css::uno::Any
>::get();
156 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ANY
, t
.getTypeClass());
157 CPPUNIT_ASSERT_EQUAL(
158 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), t
.getTypeName());
159 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::sal_Int8
> >::get();
160 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
161 CPPUNIT_ASSERT_EQUAL(
162 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]byte")),
165 ::cppu::UnoType
< css::uno::Sequence
< ::sal_Int8
> >::get() == t
);
167 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get();
168 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
169 CPPUNIT_ASSERT_EQUAL(
170 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]unsigned short")),
173 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get();
174 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
175 CPPUNIT_ASSERT_EQUAL(
176 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]char")),
178 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
179 ::sal_Int8
> > >::get();
180 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
181 CPPUNIT_ASSERT_EQUAL(
182 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]byte")),
186 css::uno::Sequence
< css::uno::Sequence
< ::sal_Int8
> > >::get() == t
);
187 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
188 ::cppu::UnoUnsignedShortType
> > >::get();
189 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
190 CPPUNIT_ASSERT_EQUAL(
191 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]unsigned short")),
193 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
194 ::cppu::UnoCharType
> > >::get();
195 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_SEQUENCE
, t
.getTypeClass());
196 CPPUNIT_ASSERT_EQUAL(
197 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]char")),
199 t
= ::cppu::UnoType
< css::uno::TypeClass
>::get();
200 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_ENUM
, t
.getTypeClass());
201 CPPUNIT_ASSERT_EQUAL(
203 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.TypeClass")),
205 t
= ::cppu::UnoType
< css::lang::EventObject
>::get();
206 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT
, t
.getTypeClass());
207 CPPUNIT_ASSERT_EQUAL(
209 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.EventObject")),
211 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct1
>::get() == t
);
212 t
= ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get();
213 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT
, t
.getTypeClass());
214 CPPUNIT_ASSERT_EQUAL(
216 RTL_CONSTASCII_USTRINGPARAM(
217 "com.sun.star.beans.PropertyChangeEvent")),
219 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
220 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct2
>::get() == t
);
222 t
= ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get();
223 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_STRUCT
, t
.getTypeClass());
224 CPPUNIT_ASSERT_EQUAL(
226 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Optional<byte>")),
228 t
= ::cppu::UnoType
< css::uno::Exception
>::get();
229 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION
, t
.getTypeClass());
230 CPPUNIT_ASSERT_EQUAL(
232 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
234 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException1
>::get() == t
);
235 t
= ::cppu::UnoType
< css::uno::RuntimeException
>::get();
236 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_EXCEPTION
, t
.getTypeClass());
237 CPPUNIT_ASSERT_EQUAL(
239 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
241 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
242 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException2
>::get() == t
);
244 t
= ::cppu::UnoType
< css::uno::XInterface
>::get();
245 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE
, t
.getTypeClass());
246 CPPUNIT_ASSERT_EQUAL(
248 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")),
251 ::cppu::UnoType
< css::uno::Reference
< css::uno::XInterface
> >::get() ==
253 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface1
>::get() == t
);
255 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface1
> >::get() ==
257 t
= ::cppu::UnoType
< css::uno::XComponentContext
>::get();
258 CPPUNIT_ASSERT_EQUAL(css::uno::TypeClass_INTERFACE
, t
.getTypeClass());
259 CPPUNIT_ASSERT_EQUAL(
261 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XComponentContext")),
265 css::uno::Reference
< css::uno::XComponentContext
> >::get() == t
);
266 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
267 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface2
>::get() == t
);
269 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface2
> >::get() ==
274 void Test::testGetTypeFavourUnsigned() {
275 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
277 ::getCppuType(static_cast< ::sal_Unicode
* >(0)) ==
278 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
280 ::cppu::getTypeFavourUnsigned(
281 static_cast< ::cppu::UnoVoidType
* >(0)) ==
282 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
284 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
285 ::cppu::UnoType
< bool >::get());
287 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
288 ::getCppuType(static_cast< bool * >(0)));
290 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
291 ::cppu::UnoType
< bool >::get());
293 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
294 ::getCppuType(static_cast< ::sal_Bool
* >(0)));
296 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
297 ::cppu::UnoType
< ::sal_Int8
>::get());
299 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
300 ::getCppuType(static_cast< ::sal_Int8
* >(0)));
302 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
303 ::cppu::UnoType
< ::sal_Int16
>::get());
305 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
306 ::getCppuType(static_cast< ::sal_Int16
* >(0)));
308 ::cppu::getTypeFavourUnsigned(
309 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
310 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
312 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
313 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
315 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
316 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
318 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
319 ::cppu::UnoType
< ::sal_Int32
>::get());
321 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
322 ::getCppuType(static_cast< ::sal_Int32
* >(0)));
324 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
325 ::cppu::UnoType
< ::sal_uInt32
>::get());
327 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
328 ::getCppuType(static_cast< ::sal_uInt32
* >(0)));
330 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
331 ::cppu::UnoType
< ::sal_Int64
>::get());
333 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
334 ::getCppuType(static_cast< ::sal_Int64
* >(0)));
336 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
337 ::cppu::UnoType
< ::sal_uInt64
>::get());
339 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
340 ::getCppuType(static_cast< ::sal_uInt64
* >(0)));
342 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
343 ::cppu::UnoType
< float >::get());
345 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
346 ::getCppuType(static_cast< float * >(0)));
348 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
349 ::cppu::UnoType
< double >::get());
351 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
352 ::getCppuType(static_cast< double * >(0)));
354 ::cppu::getTypeFavourUnsigned(
355 static_cast< ::cppu::UnoCharType
* >(0)) ==
356 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
358 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
359 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
361 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
362 ::getCppuType(static_cast< ::sal_Unicode
* >(0)));
364 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
365 ::cppu::UnoType
< ::rtl::OUString
>::get());
367 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
368 ::getCppuType(static_cast< ::rtl::OUString
* >(0)));
370 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
371 ::cppu::UnoType
< css::uno::Type
>::get());
373 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
374 ::getCppuType(static_cast< css::uno::Type
* >(0)));
376 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
377 ::cppu::UnoType
< css::uno::Any
>::get());
379 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
380 ::getCppuType(static_cast< css::uno::Any
* >(0)));
382 ::cppu::getTypeFavourUnsigned(
384 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
386 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
388 ::cppu::getTypeFavourUnsigned(
389 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
391 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
393 ::cppu::getTypeFavourUnsigned(
394 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
395 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)));
397 ::cppu::getTypeFavourUnsigned(
398 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
399 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
400 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
401 ::cppu::UnoUnsignedShortType
> > >::get());
403 ::cppu::getTypeFavourUnsigned(
404 static_cast< css::uno::Sequence
< css::uno::Sequence
<
405 ::sal_uInt16
> > * >(0)) ==
406 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
407 ::cppu::UnoUnsignedShortType
> > >::get());
409 ::cppu::getTypeFavourUnsigned(
410 static_cast< css::uno::Sequence
< css::uno::Sequence
<
411 ::sal_uInt16
> > * >(0)) ==
413 static_cast< css::uno::Sequence
< css::uno::Sequence
<
414 ::sal_uInt16
> > * >(0)));
416 ::cppu::getTypeFavourUnsigned(
417 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
419 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
421 ::cppu::getTypeFavourUnsigned(
422 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
423 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)));
425 ::cppu::getTypeFavourUnsigned(
426 static_cast< css::uno::Sequence
< css::uno::Sequence
<
427 ::sal_Unicode
> > * >(0)) ==
428 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
429 ::cppu::UnoUnsignedShortType
> > >::get());
431 ::cppu::getTypeFavourUnsigned(
432 static_cast< css::uno::Sequence
< css::uno::Sequence
<
433 ::sal_Unicode
> > * >(0)) ==
435 static_cast< css::uno::Sequence
< css::uno::Sequence
<
436 ::sal_Unicode
> > * >(0)));
438 ::cppu::getTypeFavourUnsigned(
439 static_cast< css::uno::TypeClass
* >(0)) ==
440 ::cppu::UnoType
< css::uno::TypeClass
>::get());
442 ::cppu::getTypeFavourUnsigned(
443 static_cast< css::uno::TypeClass
* >(0)) ==
444 ::getCppuType(static_cast< css::uno::TypeClass
* >(0)));
446 ::cppu::getTypeFavourUnsigned(
447 static_cast< css::lang::EventObject
* >(0)) ==
448 ::cppu::UnoType
< css::lang::EventObject
>::get());
450 ::cppu::getTypeFavourUnsigned(
451 static_cast< css::lang::EventObject
* >(0)) ==
452 ::getCppuType(static_cast< css::lang::EventObject
* >(0)));
454 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
455 ::cppu::UnoType
< css::lang::EventObject
>::get());
457 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
458 ::getCppuType(static_cast< DerivedStruct1
* >(0)));
460 ::cppu::getTypeFavourUnsigned(
461 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
462 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
464 ::cppu::getTypeFavourUnsigned(
465 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
466 ::getCppuType(static_cast< css::beans::PropertyChangeEvent
* >(0)));
467 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
469 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
470 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
472 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
473 ::getCppuType(static_cast< DerivedStruct2
* >(0)));
476 ::cppu::getTypeFavourUnsigned(
477 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
478 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
480 ::cppu::getTypeFavourUnsigned(
481 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
482 ::getCppuType(static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)));
484 ::cppu::getTypeFavourUnsigned(
485 static_cast< css::uno::Exception
* >(0)) ==
486 ::cppu::UnoType
< css::uno::Exception
>::get());
488 ::cppu::getTypeFavourUnsigned(
489 static_cast< css::uno::Exception
* >(0)) ==
490 ::getCppuType(static_cast< css::uno::Exception
* >(0)));
492 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
493 ::cppu::UnoType
< css::uno::Exception
>::get());
495 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
496 ::getCppuType(static_cast< DerivedException1
* >(0)));
498 ::cppu::getTypeFavourUnsigned(
499 static_cast< css::uno::RuntimeException
* >(0)) ==
500 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
502 ::cppu::getTypeFavourUnsigned(
503 static_cast< css::uno::RuntimeException
* >(0)) ==
504 ::getCppuType(static_cast< css::uno::RuntimeException
* >(0)));
505 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
507 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
508 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
510 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
511 ::getCppuType(static_cast< DerivedException2
* >(0)));
514 ::cppu::getTypeFavourUnsigned(
515 static_cast< css::uno::XInterface
* >(0)) ==
516 ::cppu::UnoType
< css::uno::XInterface
>::get());
518 ::cppu::getTypeFavourUnsigned(
519 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
520 ::cppu::UnoType
< css::uno::XInterface
>::get());
522 ::cppu::getTypeFavourUnsigned(
523 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
525 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)));
527 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1
* >(0)) ==
528 ::cppu::UnoType
< css::uno::XInterface
>::get());
530 ::cppu::getTypeFavourUnsigned(
531 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
532 ::cppu::UnoType
< css::uno::XInterface
>::get());
534 ::cppu::getTypeFavourUnsigned(
535 static_cast< css::uno::XComponentContext
* >(0)) ==
536 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
538 ::cppu::getTypeFavourUnsigned(
540 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
541 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
543 ::cppu::getTypeFavourUnsigned(
545 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
548 css::uno::Reference
< css::uno::XComponentContext
> * >(0)));
549 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
551 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2
* >(0)) ==
552 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
554 ::cppu::getTypeFavourUnsigned(
555 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
556 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
560 void Test::testGetTypeFavourChar() {
561 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
563 ::getCppuType
< ::sal_Unicode
>() == ::getCppuType
< ::sal_uInt16
>());
565 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType
* >(0)) ==
566 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
568 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
569 ::cppu::UnoType
< bool >::get());
571 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
572 ::getCppuType
< bool >());
574 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
575 ::cppu::UnoType
< bool >::get());
577 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
578 ::getCppuType
< ::sal_Bool
>());
580 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
581 ::cppu::UnoType
< ::sal_Int8
>::get());
583 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
584 ::getCppuType
< ::sal_Int8
>());
586 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
587 ::cppu::UnoType
< ::sal_Int16
>::get());
589 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
590 ::getCppuType
< ::sal_Int16
>());
592 ::cppu::getTypeFavourChar(
593 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
594 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
596 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16
* >(0)) ==
597 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
599 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
600 ::cppu::UnoType
< ::sal_Int32
>::get());
602 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
603 ::getCppuType
< ::sal_Int32
>());
605 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
606 ::cppu::UnoType
< ::sal_uInt32
>::get());
608 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
609 ::getCppuType
< ::sal_uInt32
>());
611 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
612 ::cppu::UnoType
< ::sal_Int64
>::get());
614 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
615 ::getCppuType
< ::sal_Int64
>());
617 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
618 ::cppu::UnoType
< ::sal_uInt64
>::get());
620 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
621 ::getCppuType
< ::sal_uInt64
>());
623 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
624 ::cppu::UnoType
< float >::get());
626 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
627 ::getCppuType
< float >());
629 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
630 ::cppu::UnoType
< double >::get());
632 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
633 ::getCppuType
< double >());
635 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType
* >(0)) ==
636 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
638 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
639 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
641 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
642 ::getCppuType
< ::sal_Unicode
>());
644 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
645 ::cppu::UnoType
< ::rtl::OUString
>::get());
647 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
648 ::getCppuType
< ::rtl::OUString
>());
650 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
651 ::cppu::UnoType
< css::uno::Type
>::get());
653 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
654 ::getCppuType
< css::uno::Type
>());
656 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
657 ::cppu::UnoType
< css::uno::Any
>::get());
659 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
660 ::getCppuType
< css::uno::Any
>());
662 ::cppu::getTypeFavourChar(
664 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
666 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
668 ::cppu::getTypeFavourChar(
669 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
671 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
673 ::cppu::getTypeFavourChar(
674 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
675 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
676 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
677 ::cppu::UnoUnsignedShortType
> > >::get());
679 ::cppu::getTypeFavourChar(
680 static_cast< css::uno::Sequence
< css::uno::Sequence
<
681 ::sal_uInt16
> > * >(0)) ==
682 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
683 ::cppu::UnoCharType
> > >::get());
685 ::cppu::getTypeFavourChar(
686 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
688 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
690 ::cppu::getTypeFavourChar(
691 static_cast< css::uno::Sequence
< css::uno::Sequence
<
692 ::sal_Unicode
> > * >(0)) ==
693 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
694 ::cppu::UnoCharType
> > >::get());
696 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
697 ::cppu::UnoType
< css::uno::TypeClass
>::get());
699 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
700 ::getCppuType
< css::uno::TypeClass
>());
702 ::cppu::getTypeFavourChar(
703 static_cast< css::lang::EventObject
* >(0)) ==
704 ::cppu::UnoType
< css::lang::EventObject
>::get());
706 ::cppu::getTypeFavourChar(
707 static_cast< css::lang::EventObject
* >(0)) ==
708 ::getCppuType
< css::lang::EventObject
>());
710 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
711 ::cppu::UnoType
< css::lang::EventObject
>::get());
713 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
714 ::getCppuType
< DerivedStruct1
>());
716 ::cppu::getTypeFavourChar(
717 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
718 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
720 ::cppu::getTypeFavourChar(
721 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
722 ::getCppuType
< css::beans::PropertyChangeEvent
>());
723 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
725 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
726 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
728 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
729 ::getCppuType
< DerivedStruct2
>());
732 ::cppu::getTypeFavourChar(
733 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
734 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
736 ::cppu::getTypeFavourChar(
737 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
738 ::getCppuType
< css::beans::Optional
< ::sal_Int8
> >());
740 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
741 ::cppu::UnoType
< css::uno::Exception
>::get());
743 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
744 ::getCppuType
< css::uno::Exception
>());
746 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
747 ::cppu::UnoType
< css::uno::Exception
>::get());
749 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
750 ::getCppuType
< DerivedException1
>());
752 ::cppu::getTypeFavourChar(
753 static_cast< css::uno::RuntimeException
* >(0)) ==
754 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
756 ::cppu::getTypeFavourChar(
757 static_cast< css::uno::RuntimeException
* >(0)) ==
758 ::getCppuType
< css::uno::RuntimeException
>());
759 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
761 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
762 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
764 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
765 ::getCppuType
< DerivedException2
>());
768 ::cppu::getTypeFavourChar(
769 static_cast< css::uno::XInterface
* >(0)) ==
770 ::cppu::UnoType
< css::uno::XInterface
>::get());
772 ::cppu::getTypeFavourChar(
773 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
774 ::cppu::UnoType
< css::uno::XInterface
>::get());
776 ::cppu::getTypeFavourChar(
777 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
778 ::getCppuType
< css::uno::Reference
< css::uno::XInterface
> >());
780 ::cppu::getTypeFavourChar(static_cast< DerivedInterface1
* >(0)) ==
781 ::cppu::UnoType
< css::uno::XInterface
>::get());
783 ::cppu::getTypeFavourChar(
784 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
785 ::cppu::UnoType
< css::uno::XInterface
>::get());
787 ::cppu::getTypeFavourChar(
788 static_cast< css::uno::XComponentContext
* >(0)) ==
789 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
791 ::cppu::getTypeFavourChar(
793 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
794 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
796 ::cppu::getTypeFavourChar(
798 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
799 ::getCppuType
< css::uno::Reference
< css::uno::XComponentContext
> >());
800 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
802 ::cppu::getTypeFavourChar(static_cast< DerivedInterface2
* >(0)) ==
803 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
805 ::cppu::getTypeFavourChar(
806 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
807 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
811 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test
, "alltests");