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("void"), t
.getTypeName());
91 t
= ::cppu::UnoType
< bool >::get();
92 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BOOLEAN
, +t
.getTypeClass());
94 ::rtl::OUString("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("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("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("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("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("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("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("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("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("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("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("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("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("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("[]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("[]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("[]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("[][]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("[][]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("[][]char"),
196 t
= ::cppu::UnoType
< css::uno::TypeClass
>::get();
197 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ENUM
, +t
.getTypeClass());
198 CPPUNIT_ASSERT_EQUAL(
199 ::rtl::OUString("com.sun.star.uno.TypeClass"),
201 t
= ::cppu::UnoType
< css::lang::EventObject
>::get();
202 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
203 CPPUNIT_ASSERT_EQUAL(
204 ::rtl::OUString("com.sun.star.lang.EventObject"),
206 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct1
>::get() == t
);
207 t
= ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get();
208 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
209 CPPUNIT_ASSERT_EQUAL(
211 "com.sun.star.beans.PropertyChangeEvent"),
213 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
214 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct2
>::get() == t
);
216 t
= ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get();
217 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
218 CPPUNIT_ASSERT_EQUAL(
219 ::rtl::OUString("com.sun.star.beans.Optional<byte>"),
221 t
= ::cppu::UnoType
< css::uno::Exception
>::get();
222 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
223 CPPUNIT_ASSERT_EQUAL(
224 ::rtl::OUString("com.sun.star.uno.Exception"),
226 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException1
>::get() == t
);
227 t
= ::cppu::UnoType
< css::uno::RuntimeException
>::get();
228 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
229 CPPUNIT_ASSERT_EQUAL(
230 ::rtl::OUString("com.sun.star.uno.RuntimeException"),
232 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
233 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException2
>::get() == t
);
235 t
= ::cppu::UnoType
< css::uno::XInterface
>::get();
236 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
237 CPPUNIT_ASSERT_EQUAL(
238 ::rtl::OUString("com.sun.star.uno.XInterface"),
241 ::cppu::UnoType
< css::uno::Reference
< css::uno::XInterface
> >::get() ==
243 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface1
>::get() == t
);
245 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface1
> >::get() ==
247 t
= ::cppu::UnoType
< css::uno::XComponentContext
>::get();
248 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
249 CPPUNIT_ASSERT_EQUAL(
250 ::rtl::OUString("com.sun.star.uno.XComponentContext"),
254 css::uno::Reference
< css::uno::XComponentContext
> >::get() == t
);
255 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
256 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface2
>::get() == t
);
258 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface2
> >::get() ==
263 void Test::testGetTypeFavourUnsigned() {
264 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
266 ::getCppuType(static_cast< ::sal_Unicode
* >(0)) ==
267 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
269 ::cppu::getTypeFavourUnsigned(
270 static_cast< ::cppu::UnoVoidType
* >(0)) ==
271 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
273 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
274 ::cppu::UnoType
< bool >::get());
276 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
277 ::getCppuType(static_cast< bool * >(0)));
279 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
280 ::cppu::UnoType
< bool >::get());
282 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
283 ::getCppuType(static_cast< ::sal_Bool
* >(0)));
285 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
286 ::cppu::UnoType
< ::sal_Int8
>::get());
288 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
289 ::getCppuType(static_cast< ::sal_Int8
* >(0)));
291 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
292 ::cppu::UnoType
< ::sal_Int16
>::get());
294 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
295 ::getCppuType(static_cast< ::sal_Int16
* >(0)));
297 ::cppu::getTypeFavourUnsigned(
298 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
299 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
301 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
302 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
304 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
305 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
307 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
308 ::cppu::UnoType
< ::sal_Int32
>::get());
310 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
311 ::getCppuType(static_cast< ::sal_Int32
* >(0)));
313 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
314 ::cppu::UnoType
< ::sal_uInt32
>::get());
316 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
317 ::getCppuType(static_cast< ::sal_uInt32
* >(0)));
319 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
320 ::cppu::UnoType
< ::sal_Int64
>::get());
322 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
323 ::getCppuType(static_cast< ::sal_Int64
* >(0)));
325 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
326 ::cppu::UnoType
< ::sal_uInt64
>::get());
328 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
329 ::getCppuType(static_cast< ::sal_uInt64
* >(0)));
331 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
332 ::cppu::UnoType
< float >::get());
334 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
335 ::getCppuType(static_cast< float * >(0)));
337 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
338 ::cppu::UnoType
< double >::get());
340 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
341 ::getCppuType(static_cast< double * >(0)));
343 ::cppu::getTypeFavourUnsigned(
344 static_cast< ::cppu::UnoCharType
* >(0)) ==
345 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
347 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
348 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
350 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
351 ::getCppuType(static_cast< ::sal_Unicode
* >(0)));
353 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
354 ::cppu::UnoType
< ::rtl::OUString
>::get());
356 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
357 ::getCppuType(static_cast< ::rtl::OUString
* >(0)));
359 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
360 ::cppu::UnoType
< css::uno::Type
>::get());
362 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
363 ::getCppuType(static_cast< css::uno::Type
* >(0)));
365 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
366 ::cppu::UnoType
< css::uno::Any
>::get());
368 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
369 ::getCppuType(static_cast< css::uno::Any
* >(0)));
371 ::cppu::getTypeFavourUnsigned(
373 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
375 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
377 ::cppu::getTypeFavourUnsigned(
378 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
380 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
382 ::cppu::getTypeFavourUnsigned(
383 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
384 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)));
386 ::cppu::getTypeFavourUnsigned(
387 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
388 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
389 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
390 ::cppu::UnoUnsignedShortType
> > >::get());
392 ::cppu::getTypeFavourUnsigned(
393 static_cast< css::uno::Sequence
< css::uno::Sequence
<
394 ::sal_uInt16
> > * >(0)) ==
395 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
396 ::cppu::UnoUnsignedShortType
> > >::get());
398 ::cppu::getTypeFavourUnsigned(
399 static_cast< css::uno::Sequence
< css::uno::Sequence
<
400 ::sal_uInt16
> > * >(0)) ==
402 static_cast< css::uno::Sequence
< css::uno::Sequence
<
403 ::sal_uInt16
> > * >(0)));
405 ::cppu::getTypeFavourUnsigned(
406 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
408 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
410 ::cppu::getTypeFavourUnsigned(
411 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
412 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)));
414 ::cppu::getTypeFavourUnsigned(
415 static_cast< css::uno::Sequence
< css::uno::Sequence
<
416 ::sal_Unicode
> > * >(0)) ==
417 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
418 ::cppu::UnoUnsignedShortType
> > >::get());
420 ::cppu::getTypeFavourUnsigned(
421 static_cast< css::uno::Sequence
< css::uno::Sequence
<
422 ::sal_Unicode
> > * >(0)) ==
424 static_cast< css::uno::Sequence
< css::uno::Sequence
<
425 ::sal_Unicode
> > * >(0)));
427 ::cppu::getTypeFavourUnsigned(
428 static_cast< css::uno::TypeClass
* >(0)) ==
429 ::cppu::UnoType
< css::uno::TypeClass
>::get());
431 ::cppu::getTypeFavourUnsigned(
432 static_cast< css::uno::TypeClass
* >(0)) ==
433 ::getCppuType(static_cast< css::uno::TypeClass
* >(0)));
435 ::cppu::getTypeFavourUnsigned(
436 static_cast< css::lang::EventObject
* >(0)) ==
437 ::cppu::UnoType
< css::lang::EventObject
>::get());
439 ::cppu::getTypeFavourUnsigned(
440 static_cast< css::lang::EventObject
* >(0)) ==
441 ::getCppuType(static_cast< css::lang::EventObject
* >(0)));
443 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
444 ::cppu::UnoType
< css::lang::EventObject
>::get());
446 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
447 ::getCppuType(static_cast< DerivedStruct1
* >(0)));
449 ::cppu::getTypeFavourUnsigned(
450 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
451 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
453 ::cppu::getTypeFavourUnsigned(
454 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
455 ::getCppuType(static_cast< css::beans::PropertyChangeEvent
* >(0)));
456 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
458 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
459 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
461 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
462 ::getCppuType(static_cast< DerivedStruct2
* >(0)));
465 ::cppu::getTypeFavourUnsigned(
466 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
467 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
469 ::cppu::getTypeFavourUnsigned(
470 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
471 ::getCppuType(static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)));
473 ::cppu::getTypeFavourUnsigned(
474 static_cast< css::uno::Exception
* >(0)) ==
475 ::cppu::UnoType
< css::uno::Exception
>::get());
477 ::cppu::getTypeFavourUnsigned(
478 static_cast< css::uno::Exception
* >(0)) ==
479 ::getCppuType(static_cast< css::uno::Exception
* >(0)));
481 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
482 ::cppu::UnoType
< css::uno::Exception
>::get());
484 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
485 ::getCppuType(static_cast< DerivedException1
* >(0)));
487 ::cppu::getTypeFavourUnsigned(
488 static_cast< css::uno::RuntimeException
* >(0)) ==
489 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
491 ::cppu::getTypeFavourUnsigned(
492 static_cast< css::uno::RuntimeException
* >(0)) ==
493 ::getCppuType(static_cast< css::uno::RuntimeException
* >(0)));
494 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
496 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
497 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
499 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
500 ::getCppuType(static_cast< DerivedException2
* >(0)));
503 ::cppu::getTypeFavourUnsigned(
504 static_cast< css::uno::XInterface
* >(0)) ==
505 ::cppu::UnoType
< css::uno::XInterface
>::get());
507 ::cppu::getTypeFavourUnsigned(
508 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
509 ::cppu::UnoType
< css::uno::XInterface
>::get());
511 ::cppu::getTypeFavourUnsigned(
512 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
514 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)));
516 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1
* >(0)) ==
517 ::cppu::UnoType
< css::uno::XInterface
>::get());
519 ::cppu::getTypeFavourUnsigned(
520 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
521 ::cppu::UnoType
< css::uno::XInterface
>::get());
523 ::cppu::getTypeFavourUnsigned(
524 static_cast< css::uno::XComponentContext
* >(0)) ==
525 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
527 ::cppu::getTypeFavourUnsigned(
529 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
530 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
532 ::cppu::getTypeFavourUnsigned(
534 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
537 css::uno::Reference
< css::uno::XComponentContext
> * >(0)));
538 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
540 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2
* >(0)) ==
541 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
543 ::cppu::getTypeFavourUnsigned(
544 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
545 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
549 void Test::testGetTypeFavourChar() {
550 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
552 ::getCppuType
< ::sal_Unicode
>() == ::getCppuType
< ::sal_uInt16
>());
554 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType
* >(0)) ==
555 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
557 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
558 ::cppu::UnoType
< bool >::get());
560 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
561 ::getCppuType
< bool >());
563 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
564 ::cppu::UnoType
< bool >::get());
566 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
567 ::getCppuType
< ::sal_Bool
>());
569 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
570 ::cppu::UnoType
< ::sal_Int8
>::get());
572 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
573 ::getCppuType
< ::sal_Int8
>());
575 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
576 ::cppu::UnoType
< ::sal_Int16
>::get());
578 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
579 ::getCppuType
< ::sal_Int16
>());
581 ::cppu::getTypeFavourChar(
582 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
583 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
585 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16
* >(0)) ==
586 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
588 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
589 ::cppu::UnoType
< ::sal_Int32
>::get());
591 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
592 ::getCppuType
< ::sal_Int32
>());
594 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
595 ::cppu::UnoType
< ::sal_uInt32
>::get());
597 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
598 ::getCppuType
< ::sal_uInt32
>());
600 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
601 ::cppu::UnoType
< ::sal_Int64
>::get());
603 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
604 ::getCppuType
< ::sal_Int64
>());
606 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
607 ::cppu::UnoType
< ::sal_uInt64
>::get());
609 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
610 ::getCppuType
< ::sal_uInt64
>());
612 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
613 ::cppu::UnoType
< float >::get());
615 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
616 ::getCppuType
< float >());
618 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
619 ::cppu::UnoType
< double >::get());
621 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
622 ::getCppuType
< double >());
624 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType
* >(0)) ==
625 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
627 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
628 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
630 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
631 ::getCppuType
< ::sal_Unicode
>());
633 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
634 ::cppu::UnoType
< ::rtl::OUString
>::get());
636 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
637 ::getCppuType
< ::rtl::OUString
>());
639 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
640 ::cppu::UnoType
< css::uno::Type
>::get());
642 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
643 ::getCppuType
< css::uno::Type
>());
645 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
646 ::cppu::UnoType
< css::uno::Any
>::get());
648 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
649 ::getCppuType
< css::uno::Any
>());
651 ::cppu::getTypeFavourChar(
653 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
655 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
657 ::cppu::getTypeFavourChar(
658 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
660 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
662 ::cppu::getTypeFavourChar(
663 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
664 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
665 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
666 ::cppu::UnoUnsignedShortType
> > >::get());
668 ::cppu::getTypeFavourChar(
669 static_cast< css::uno::Sequence
< css::uno::Sequence
<
670 ::sal_uInt16
> > * >(0)) ==
671 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
672 ::cppu::UnoCharType
> > >::get());
674 ::cppu::getTypeFavourChar(
675 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
677 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
679 ::cppu::getTypeFavourChar(
680 static_cast< css::uno::Sequence
< css::uno::Sequence
<
681 ::sal_Unicode
> > * >(0)) ==
682 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
683 ::cppu::UnoCharType
> > >::get());
685 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
686 ::cppu::UnoType
< css::uno::TypeClass
>::get());
688 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
689 ::getCppuType
< css::uno::TypeClass
>());
691 ::cppu::getTypeFavourChar(
692 static_cast< css::lang::EventObject
* >(0)) ==
693 ::cppu::UnoType
< css::lang::EventObject
>::get());
695 ::cppu::getTypeFavourChar(
696 static_cast< css::lang::EventObject
* >(0)) ==
697 ::getCppuType
< css::lang::EventObject
>());
699 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
700 ::cppu::UnoType
< css::lang::EventObject
>::get());
702 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
703 ::getCppuType
< DerivedStruct1
>());
705 ::cppu::getTypeFavourChar(
706 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
707 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
709 ::cppu::getTypeFavourChar(
710 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
711 ::getCppuType
< css::beans::PropertyChangeEvent
>());
712 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
714 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
715 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
717 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
718 ::getCppuType
< DerivedStruct2
>());
721 ::cppu::getTypeFavourChar(
722 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
723 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
725 ::cppu::getTypeFavourChar(
726 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
727 ::getCppuType
< css::beans::Optional
< ::sal_Int8
> >());
729 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
730 ::cppu::UnoType
< css::uno::Exception
>::get());
732 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
733 ::getCppuType
< css::uno::Exception
>());
735 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
736 ::cppu::UnoType
< css::uno::Exception
>::get());
738 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
739 ::getCppuType
< DerivedException1
>());
741 ::cppu::getTypeFavourChar(
742 static_cast< css::uno::RuntimeException
* >(0)) ==
743 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
745 ::cppu::getTypeFavourChar(
746 static_cast< css::uno::RuntimeException
* >(0)) ==
747 ::getCppuType
< css::uno::RuntimeException
>());
748 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
750 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
751 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
753 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
754 ::getCppuType
< DerivedException2
>());
757 ::cppu::getTypeFavourChar(
758 static_cast< css::uno::XInterface
* >(0)) ==
759 ::cppu::UnoType
< css::uno::XInterface
>::get());
761 ::cppu::getTypeFavourChar(
762 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
763 ::cppu::UnoType
< css::uno::XInterface
>::get());
765 ::cppu::getTypeFavourChar(
766 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
767 ::getCppuType
< css::uno::Reference
< css::uno::XInterface
> >());
769 ::cppu::getTypeFavourChar(static_cast< DerivedInterface1
* >(0)) ==
770 ::cppu::UnoType
< css::uno::XInterface
>::get());
772 ::cppu::getTypeFavourChar(
773 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
774 ::cppu::UnoType
< css::uno::XInterface
>::get());
776 ::cppu::getTypeFavourChar(
777 static_cast< css::uno::XComponentContext
* >(0)) ==
778 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
780 ::cppu::getTypeFavourChar(
782 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
783 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
785 ::cppu::getTypeFavourChar(
787 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
788 ::getCppuType
< css::uno::Reference
< css::uno::XComponentContext
> >());
789 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
791 ::cppu::getTypeFavourChar(static_cast< DerivedInterface2
* >(0)) ==
792 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
794 ::cppu::getTypeFavourChar(
795 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
796 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
800 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
804 CPPUNIT_PLUGIN_IMPLEMENT();
806 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */