1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/types.h>
22 #include <cppunit/TestSuite.h>
23 #include <cppunit/TestFixture.h>
24 #include <cppunit/TestCase.h>
25 #include <cppunit/plugin/TestPlugIn.h>
26 #include <cppunit/extensions/HelperMacros.h>
30 #include "com/sun/star/beans/Optional.hpp"
31 #include "com/sun/star/beans/PropertyChangeEvent.hpp"
32 #include "com/sun/star/lang/EventObject.hpp"
33 #include "com/sun/star/uno/Exception.hpp"
34 #include "com/sun/star/uno/Reference.hxx"
35 #include "com/sun/star/uno/RuntimeException.hpp"
36 #include "com/sun/star/uno/Sequence.hxx"
37 #include "com/sun/star/uno/Type.hxx"
38 #include "com/sun/star/uno/TypeClass.hpp"
39 #include "com/sun/star/uno/XComponentContext.hpp"
40 #include "com/sun/star/uno/XInterface.hpp"
41 #include "cppu/unotype.hxx"
42 #include "rtl/ustring.hxx"
44 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
50 struct DerivedStruct1
: css::lang::EventObject
{};
52 struct DerivedStruct2
: css::beans::PropertyChangeEvent
{};
54 struct DerivedException1
: css::uno::Exception
{};
56 struct DerivedException2
: css::uno::RuntimeException
{};
58 struct DerivedInterface1
: css::uno::XInterface
{
60 ~DerivedInterface1() {}
61 // avoid warnings about virtual members and non-virtual dtor
64 struct DerivedInterface2
: css::uno::XComponentContext
{
66 ~DerivedInterface2() {}
67 // avoid warnings about virtual members and non-virtual dtor
70 class Test
: public ::CppUnit::TestFixture
{
74 void testGetTypeFavourUnsigned();
76 void testGetTypeFavourChar();
78 CPPUNIT_TEST_SUITE(Test
);
79 CPPUNIT_TEST(testUnoType
);
80 CPPUNIT_TEST(testGetTypeFavourUnsigned
);
81 CPPUNIT_TEST(testGetTypeFavourChar
);
82 CPPUNIT_TEST_SUITE_END();
85 void Test::testUnoType() {
87 t
= ::cppu::UnoType
< ::cppu::UnoVoidType
>::get();
88 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_VOID
, +t
.getTypeClass());
90 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), t
.getTypeName());
91 t
= ::cppu::UnoType
< bool >::get();
92 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BOOLEAN
, +t
.getTypeClass());
94 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")),
96 CPPUNIT_ASSERT(::cppu::UnoType
< ::sal_Bool
>::get() == t
);
97 t
= ::cppu::UnoType
< ::sal_Int8
>::get();
98 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BYTE
, +t
.getTypeClass());
100 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("byte")), t
.getTypeName());
101 t
= ::cppu::UnoType
< ::sal_Int16
>::get();
102 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SHORT
, +t
.getTypeClass());
103 CPPUNIT_ASSERT_EQUAL(
104 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("short")), t
.getTypeName());
105 t
= ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get();
106 CPPUNIT_ASSERT_EQUAL(
107 +css::uno::TypeClass_UNSIGNED_SHORT
, +t
.getTypeClass());
108 CPPUNIT_ASSERT_EQUAL(
109 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned short")),
111 t
= ::cppu::UnoType
< ::sal_Int32
>::get();
112 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_LONG
, +t
.getTypeClass());
113 CPPUNIT_ASSERT_EQUAL(
114 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("long")), t
.getTypeName());
115 t
= ::cppu::UnoType
< ::sal_uInt32
>::get();
116 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_UNSIGNED_LONG
, +t
.getTypeClass());
117 CPPUNIT_ASSERT_EQUAL(
118 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned long")),
120 t
= ::cppu::UnoType
< ::sal_Int64
>::get();
121 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_HYPER
, +t
.getTypeClass());
122 CPPUNIT_ASSERT_EQUAL(
123 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hyper")), t
.getTypeName());
124 t
= ::cppu::UnoType
< ::sal_uInt64
>::get();
125 CPPUNIT_ASSERT_EQUAL(
126 +css::uno::TypeClass_UNSIGNED_HYPER
, +t
.getTypeClass());
127 CPPUNIT_ASSERT_EQUAL(
128 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned hyper")),
130 t
= ::cppu::UnoType
< float >::get();
131 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_FLOAT
, +t
.getTypeClass());
132 CPPUNIT_ASSERT_EQUAL(
133 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("float")), t
.getTypeName());
134 t
= ::cppu::UnoType
< double >::get();
135 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_DOUBLE
, +t
.getTypeClass());
136 CPPUNIT_ASSERT_EQUAL(
137 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("double")),
139 t
= ::cppu::UnoType
< ::cppu::UnoCharType
>::get();
140 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_CHAR
, +t
.getTypeClass());
141 CPPUNIT_ASSERT_EQUAL(
142 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("char")), t
.getTypeName());
143 t
= ::cppu::UnoType
< ::rtl::OUString
>::get();
144 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRING
, +t
.getTypeClass());
145 CPPUNIT_ASSERT_EQUAL(
146 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")),
148 t
= ::cppu::UnoType
< css::uno::Type
>::get();
149 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_TYPE
, +t
.getTypeClass());
150 CPPUNIT_ASSERT_EQUAL(
151 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("type")), t
.getTypeName());
152 t
= ::cppu::UnoType
< css::uno::Any
>::get();
153 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ANY
, +t
.getTypeClass());
154 CPPUNIT_ASSERT_EQUAL(
155 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), t
.getTypeName());
156 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::sal_Int8
> >::get();
157 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
158 CPPUNIT_ASSERT_EQUAL(
159 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]byte")),
162 ::cppu::UnoType
< css::uno::Sequence
< ::sal_Int8
> >::get() == t
);
164 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get();
165 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
166 CPPUNIT_ASSERT_EQUAL(
167 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]unsigned short")),
170 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get();
171 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
172 CPPUNIT_ASSERT_EQUAL(
173 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]char")),
175 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
176 ::sal_Int8
> > >::get();
177 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
178 CPPUNIT_ASSERT_EQUAL(
179 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]byte")),
183 css::uno::Sequence
< css::uno::Sequence
< ::sal_Int8
> > >::get() == t
);
184 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
185 ::cppu::UnoUnsignedShortType
> > >::get();
186 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
187 CPPUNIT_ASSERT_EQUAL(
188 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]unsigned short")),
190 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
191 ::cppu::UnoCharType
> > >::get();
192 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
193 CPPUNIT_ASSERT_EQUAL(
194 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]char")),
196 t
= ::cppu::UnoType
< css::uno::TypeClass
>::get();
197 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ENUM
, +t
.getTypeClass());
198 CPPUNIT_ASSERT_EQUAL(
200 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.TypeClass")),
202 t
= ::cppu::UnoType
< css::lang::EventObject
>::get();
203 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
204 CPPUNIT_ASSERT_EQUAL(
206 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.EventObject")),
208 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct1
>::get() == t
);
209 t
= ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get();
210 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
211 CPPUNIT_ASSERT_EQUAL(
213 RTL_CONSTASCII_USTRINGPARAM(
214 "com.sun.star.beans.PropertyChangeEvent")),
216 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
217 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct2
>::get() == t
);
219 t
= ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get();
220 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
221 CPPUNIT_ASSERT_EQUAL(
223 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Optional<byte>")),
225 t
= ::cppu::UnoType
< css::uno::Exception
>::get();
226 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
227 CPPUNIT_ASSERT_EQUAL(
229 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
231 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException1
>::get() == t
);
232 t
= ::cppu::UnoType
< css::uno::RuntimeException
>::get();
233 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
234 CPPUNIT_ASSERT_EQUAL(
236 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
238 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
239 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException2
>::get() == t
);
241 t
= ::cppu::UnoType
< css::uno::XInterface
>::get();
242 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
243 CPPUNIT_ASSERT_EQUAL(
245 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")),
248 ::cppu::UnoType
< css::uno::Reference
< css::uno::XInterface
> >::get() ==
250 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface1
>::get() == t
);
252 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface1
> >::get() ==
254 t
= ::cppu::UnoType
< css::uno::XComponentContext
>::get();
255 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
256 CPPUNIT_ASSERT_EQUAL(
258 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XComponentContext")),
262 css::uno::Reference
< css::uno::XComponentContext
> >::get() == t
);
263 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
264 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface2
>::get() == t
);
266 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface2
> >::get() ==
271 void Test::testGetTypeFavourUnsigned() {
272 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
274 ::getCppuType(static_cast< ::sal_Unicode
* >(0)) ==
275 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
277 ::cppu::getTypeFavourUnsigned(
278 static_cast< ::cppu::UnoVoidType
* >(0)) ==
279 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
281 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
282 ::cppu::UnoType
< bool >::get());
284 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
285 ::getCppuType(static_cast< bool * >(0)));
287 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
288 ::cppu::UnoType
< bool >::get());
290 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
291 ::getCppuType(static_cast< ::sal_Bool
* >(0)));
293 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
294 ::cppu::UnoType
< ::sal_Int8
>::get());
296 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
297 ::getCppuType(static_cast< ::sal_Int8
* >(0)));
299 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
300 ::cppu::UnoType
< ::sal_Int16
>::get());
302 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
303 ::getCppuType(static_cast< ::sal_Int16
* >(0)));
305 ::cppu::getTypeFavourUnsigned(
306 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
307 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
309 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
310 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
312 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
313 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
315 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
316 ::cppu::UnoType
< ::sal_Int32
>::get());
318 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
319 ::getCppuType(static_cast< ::sal_Int32
* >(0)));
321 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
322 ::cppu::UnoType
< ::sal_uInt32
>::get());
324 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
325 ::getCppuType(static_cast< ::sal_uInt32
* >(0)));
327 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
328 ::cppu::UnoType
< ::sal_Int64
>::get());
330 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
331 ::getCppuType(static_cast< ::sal_Int64
* >(0)));
333 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
334 ::cppu::UnoType
< ::sal_uInt64
>::get());
336 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
337 ::getCppuType(static_cast< ::sal_uInt64
* >(0)));
339 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
340 ::cppu::UnoType
< float >::get());
342 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
343 ::getCppuType(static_cast< float * >(0)));
345 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
346 ::cppu::UnoType
< double >::get());
348 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
349 ::getCppuType(static_cast< double * >(0)));
351 ::cppu::getTypeFavourUnsigned(
352 static_cast< ::cppu::UnoCharType
* >(0)) ==
353 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
355 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
356 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
358 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
359 ::getCppuType(static_cast< ::sal_Unicode
* >(0)));
361 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
362 ::cppu::UnoType
< ::rtl::OUString
>::get());
364 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
365 ::getCppuType(static_cast< ::rtl::OUString
* >(0)));
367 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
368 ::cppu::UnoType
< css::uno::Type
>::get());
370 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
371 ::getCppuType(static_cast< css::uno::Type
* >(0)));
373 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
374 ::cppu::UnoType
< css::uno::Any
>::get());
376 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
377 ::getCppuType(static_cast< css::uno::Any
* >(0)));
379 ::cppu::getTypeFavourUnsigned(
381 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
383 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
385 ::cppu::getTypeFavourUnsigned(
386 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
388 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
390 ::cppu::getTypeFavourUnsigned(
391 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
392 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)));
394 ::cppu::getTypeFavourUnsigned(
395 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
396 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
397 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
398 ::cppu::UnoUnsignedShortType
> > >::get());
400 ::cppu::getTypeFavourUnsigned(
401 static_cast< css::uno::Sequence
< css::uno::Sequence
<
402 ::sal_uInt16
> > * >(0)) ==
403 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
404 ::cppu::UnoUnsignedShortType
> > >::get());
406 ::cppu::getTypeFavourUnsigned(
407 static_cast< css::uno::Sequence
< css::uno::Sequence
<
408 ::sal_uInt16
> > * >(0)) ==
410 static_cast< css::uno::Sequence
< css::uno::Sequence
<
411 ::sal_uInt16
> > * >(0)));
413 ::cppu::getTypeFavourUnsigned(
414 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
416 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
418 ::cppu::getTypeFavourUnsigned(
419 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
420 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)));
422 ::cppu::getTypeFavourUnsigned(
423 static_cast< css::uno::Sequence
< css::uno::Sequence
<
424 ::sal_Unicode
> > * >(0)) ==
425 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
426 ::cppu::UnoUnsignedShortType
> > >::get());
428 ::cppu::getTypeFavourUnsigned(
429 static_cast< css::uno::Sequence
< css::uno::Sequence
<
430 ::sal_Unicode
> > * >(0)) ==
432 static_cast< css::uno::Sequence
< css::uno::Sequence
<
433 ::sal_Unicode
> > * >(0)));
435 ::cppu::getTypeFavourUnsigned(
436 static_cast< css::uno::TypeClass
* >(0)) ==
437 ::cppu::UnoType
< css::uno::TypeClass
>::get());
439 ::cppu::getTypeFavourUnsigned(
440 static_cast< css::uno::TypeClass
* >(0)) ==
441 ::getCppuType(static_cast< css::uno::TypeClass
* >(0)));
443 ::cppu::getTypeFavourUnsigned(
444 static_cast< css::lang::EventObject
* >(0)) ==
445 ::cppu::UnoType
< css::lang::EventObject
>::get());
447 ::cppu::getTypeFavourUnsigned(
448 static_cast< css::lang::EventObject
* >(0)) ==
449 ::getCppuType(static_cast< css::lang::EventObject
* >(0)));
451 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
452 ::cppu::UnoType
< css::lang::EventObject
>::get());
454 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
455 ::getCppuType(static_cast< DerivedStruct1
* >(0)));
457 ::cppu::getTypeFavourUnsigned(
458 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
459 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
461 ::cppu::getTypeFavourUnsigned(
462 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
463 ::getCppuType(static_cast< css::beans::PropertyChangeEvent
* >(0)));
464 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
466 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
467 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
469 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
470 ::getCppuType(static_cast< DerivedStruct2
* >(0)));
473 ::cppu::getTypeFavourUnsigned(
474 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
475 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
477 ::cppu::getTypeFavourUnsigned(
478 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
479 ::getCppuType(static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)));
481 ::cppu::getTypeFavourUnsigned(
482 static_cast< css::uno::Exception
* >(0)) ==
483 ::cppu::UnoType
< css::uno::Exception
>::get());
485 ::cppu::getTypeFavourUnsigned(
486 static_cast< css::uno::Exception
* >(0)) ==
487 ::getCppuType(static_cast< css::uno::Exception
* >(0)));
489 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
490 ::cppu::UnoType
< css::uno::Exception
>::get());
492 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
493 ::getCppuType(static_cast< DerivedException1
* >(0)));
495 ::cppu::getTypeFavourUnsigned(
496 static_cast< css::uno::RuntimeException
* >(0)) ==
497 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
499 ::cppu::getTypeFavourUnsigned(
500 static_cast< css::uno::RuntimeException
* >(0)) ==
501 ::getCppuType(static_cast< css::uno::RuntimeException
* >(0)));
502 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
504 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
505 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
507 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
508 ::getCppuType(static_cast< DerivedException2
* >(0)));
511 ::cppu::getTypeFavourUnsigned(
512 static_cast< css::uno::XInterface
* >(0)) ==
513 ::cppu::UnoType
< css::uno::XInterface
>::get());
515 ::cppu::getTypeFavourUnsigned(
516 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
517 ::cppu::UnoType
< css::uno::XInterface
>::get());
519 ::cppu::getTypeFavourUnsigned(
520 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
522 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)));
524 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1
* >(0)) ==
525 ::cppu::UnoType
< css::uno::XInterface
>::get());
527 ::cppu::getTypeFavourUnsigned(
528 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
529 ::cppu::UnoType
< css::uno::XInterface
>::get());
531 ::cppu::getTypeFavourUnsigned(
532 static_cast< css::uno::XComponentContext
* >(0)) ==
533 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
535 ::cppu::getTypeFavourUnsigned(
537 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
538 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
540 ::cppu::getTypeFavourUnsigned(
542 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
545 css::uno::Reference
< css::uno::XComponentContext
> * >(0)));
546 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
548 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2
* >(0)) ==
549 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
551 ::cppu::getTypeFavourUnsigned(
552 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
553 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
557 void Test::testGetTypeFavourChar() {
558 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
560 ::getCppuType
< ::sal_Unicode
>() == ::getCppuType
< ::sal_uInt16
>());
562 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType
* >(0)) ==
563 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
565 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
566 ::cppu::UnoType
< bool >::get());
568 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
569 ::getCppuType
< bool >());
571 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
572 ::cppu::UnoType
< bool >::get());
574 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
575 ::getCppuType
< ::sal_Bool
>());
577 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
578 ::cppu::UnoType
< ::sal_Int8
>::get());
580 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
581 ::getCppuType
< ::sal_Int8
>());
583 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
584 ::cppu::UnoType
< ::sal_Int16
>::get());
586 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
587 ::getCppuType
< ::sal_Int16
>());
589 ::cppu::getTypeFavourChar(
590 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
591 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
593 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16
* >(0)) ==
594 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
596 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
597 ::cppu::UnoType
< ::sal_Int32
>::get());
599 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
600 ::getCppuType
< ::sal_Int32
>());
602 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
603 ::cppu::UnoType
< ::sal_uInt32
>::get());
605 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
606 ::getCppuType
< ::sal_uInt32
>());
608 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
609 ::cppu::UnoType
< ::sal_Int64
>::get());
611 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
612 ::getCppuType
< ::sal_Int64
>());
614 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
615 ::cppu::UnoType
< ::sal_uInt64
>::get());
617 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
618 ::getCppuType
< ::sal_uInt64
>());
620 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
621 ::cppu::UnoType
< float >::get());
623 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
624 ::getCppuType
< float >());
626 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
627 ::cppu::UnoType
< double >::get());
629 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
630 ::getCppuType
< double >());
632 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType
* >(0)) ==
633 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
635 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
636 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
638 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
639 ::getCppuType
< ::sal_Unicode
>());
641 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
642 ::cppu::UnoType
< ::rtl::OUString
>::get());
644 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
645 ::getCppuType
< ::rtl::OUString
>());
647 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
648 ::cppu::UnoType
< css::uno::Type
>::get());
650 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
651 ::getCppuType
< css::uno::Type
>());
653 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
654 ::cppu::UnoType
< css::uno::Any
>::get());
656 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
657 ::getCppuType
< css::uno::Any
>());
659 ::cppu::getTypeFavourChar(
661 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
663 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
665 ::cppu::getTypeFavourChar(
666 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
668 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
670 ::cppu::getTypeFavourChar(
671 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
672 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
673 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
674 ::cppu::UnoUnsignedShortType
> > >::get());
676 ::cppu::getTypeFavourChar(
677 static_cast< css::uno::Sequence
< css::uno::Sequence
<
678 ::sal_uInt16
> > * >(0)) ==
679 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
680 ::cppu::UnoCharType
> > >::get());
682 ::cppu::getTypeFavourChar(
683 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
685 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
687 ::cppu::getTypeFavourChar(
688 static_cast< css::uno::Sequence
< css::uno::Sequence
<
689 ::sal_Unicode
> > * >(0)) ==
690 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
691 ::cppu::UnoCharType
> > >::get());
693 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
694 ::cppu::UnoType
< css::uno::TypeClass
>::get());
696 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
697 ::getCppuType
< css::uno::TypeClass
>());
699 ::cppu::getTypeFavourChar(
700 static_cast< css::lang::EventObject
* >(0)) ==
701 ::cppu::UnoType
< css::lang::EventObject
>::get());
703 ::cppu::getTypeFavourChar(
704 static_cast< css::lang::EventObject
* >(0)) ==
705 ::getCppuType
< css::lang::EventObject
>());
707 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
708 ::cppu::UnoType
< css::lang::EventObject
>::get());
710 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
711 ::getCppuType
< DerivedStruct1
>());
713 ::cppu::getTypeFavourChar(
714 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
715 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
717 ::cppu::getTypeFavourChar(
718 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
719 ::getCppuType
< css::beans::PropertyChangeEvent
>());
720 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
722 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
723 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
725 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
726 ::getCppuType
< DerivedStruct2
>());
729 ::cppu::getTypeFavourChar(
730 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
731 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
733 ::cppu::getTypeFavourChar(
734 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
735 ::getCppuType
< css::beans::Optional
< ::sal_Int8
> >());
737 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
738 ::cppu::UnoType
< css::uno::Exception
>::get());
740 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
741 ::getCppuType
< css::uno::Exception
>());
743 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
744 ::cppu::UnoType
< css::uno::Exception
>::get());
746 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
747 ::getCppuType
< DerivedException1
>());
749 ::cppu::getTypeFavourChar(
750 static_cast< css::uno::RuntimeException
* >(0)) ==
751 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
753 ::cppu::getTypeFavourChar(
754 static_cast< css::uno::RuntimeException
* >(0)) ==
755 ::getCppuType
< css::uno::RuntimeException
>());
756 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
758 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
759 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
761 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
762 ::getCppuType
< DerivedException2
>());
765 ::cppu::getTypeFavourChar(
766 static_cast< css::uno::XInterface
* >(0)) ==
767 ::cppu::UnoType
< css::uno::XInterface
>::get());
769 ::cppu::getTypeFavourChar(
770 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
771 ::cppu::UnoType
< css::uno::XInterface
>::get());
773 ::cppu::getTypeFavourChar(
774 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
775 ::getCppuType
< css::uno::Reference
< css::uno::XInterface
> >());
777 ::cppu::getTypeFavourChar(static_cast< DerivedInterface1
* >(0)) ==
778 ::cppu::UnoType
< css::uno::XInterface
>::get());
780 ::cppu::getTypeFavourChar(
781 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
782 ::cppu::UnoType
< css::uno::XInterface
>::get());
784 ::cppu::getTypeFavourChar(
785 static_cast< css::uno::XComponentContext
* >(0)) ==
786 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
788 ::cppu::getTypeFavourChar(
790 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
791 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
793 ::cppu::getTypeFavourChar(
795 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
796 ::getCppuType
< css::uno::Reference
< css::uno::XComponentContext
> >());
797 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
799 ::cppu::getTypeFavourChar(static_cast< DerivedInterface2
* >(0)) ==
800 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
802 ::cppu::getTypeFavourChar(
803 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
804 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
808 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
812 CPPUNIT_PLUGIN_IMPLEMENT();
814 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */