1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "sal/config.h"
30 #include "sal/precppunit.hxx"
33 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTest_qa_cppu_unotype
36 #include <cppunit/TestSuite.h>
37 #include <cppunit/TestFixture.h>
38 #include <cppunit/TestCase.h>
39 #include <cppunit/plugin/TestPlugIn.h>
40 #include <cppunit/extensions/HelperMacros.h>
44 #include "com/sun/star/beans/Optional.hpp"
45 #include "com/sun/star/beans/PropertyChangeEvent.hpp"
46 #include "com/sun/star/lang/EventObject.hpp"
47 #include "com/sun/star/uno/Exception.hpp"
48 #include "com/sun/star/uno/Reference.hxx"
49 #include "com/sun/star/uno/RuntimeException.hpp"
50 #include "com/sun/star/uno/Sequence.hxx"
51 #include "com/sun/star/uno/Type.hxx"
52 #include "com/sun/star/uno/TypeClass.hpp"
53 #include "com/sun/star/uno/XComponentContext.hpp"
54 #include "com/sun/star/uno/XInterface.hpp"
55 #include "cppu/unotype.hxx"
56 #include "rtl/oustringostreaminserter.hxx"
57 #include "rtl/ustring.h"
58 #include "rtl/ustring.hxx"
59 #include "sal/types.h"
61 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
67 namespace css
= com::sun::star
;
69 struct DerivedStruct1
: css::lang::EventObject
{};
71 struct DerivedStruct2
: css::beans::PropertyChangeEvent
{};
73 struct DerivedException1
: css::uno::Exception
{};
75 struct DerivedException2
: css::uno::RuntimeException
{};
77 struct DerivedInterface1
: css::uno::XInterface
{
79 ~DerivedInterface1() {}
80 // avoid warnings about virtual members and non-virtual dtor
83 struct DerivedInterface2
: css::uno::XComponentContext
{
85 ~DerivedInterface2() {}
86 // avoid warnings about virtual members and non-virtual dtor
89 class Test
: public ::CppUnit::TestFixture
{
93 void testGetTypeFavourUnsigned();
95 void testGetTypeFavourChar();
97 CPPUNIT_TEST_SUITE(Test
);
98 CPPUNIT_TEST(testUnoType
);
99 CPPUNIT_TEST(testGetTypeFavourUnsigned
);
100 CPPUNIT_TEST(testGetTypeFavourChar
);
101 CPPUNIT_TEST_SUITE_END();
104 void Test::testUnoType() {
106 t
= ::cppu::UnoType
< ::cppu::UnoVoidType
>::get();
107 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_VOID
, +t
.getTypeClass());
108 CPPUNIT_ASSERT_EQUAL(
109 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("void")), t
.getTypeName());
110 t
= ::cppu::UnoType
< bool >::get();
111 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BOOLEAN
, +t
.getTypeClass());
112 CPPUNIT_ASSERT_EQUAL(
113 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("boolean")),
115 CPPUNIT_ASSERT(::cppu::UnoType
< ::sal_Bool
>::get() == t
);
116 t
= ::cppu::UnoType
< ::sal_Int8
>::get();
117 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BYTE
, +t
.getTypeClass());
118 CPPUNIT_ASSERT_EQUAL(
119 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("byte")), t
.getTypeName());
120 t
= ::cppu::UnoType
< ::sal_Int16
>::get();
121 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SHORT
, +t
.getTypeClass());
122 CPPUNIT_ASSERT_EQUAL(
123 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("short")), t
.getTypeName());
124 t
= ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get();
125 CPPUNIT_ASSERT_EQUAL(
126 +css::uno::TypeClass_UNSIGNED_SHORT
, +t
.getTypeClass());
127 CPPUNIT_ASSERT_EQUAL(
128 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned short")),
130 t
= ::cppu::UnoType
< ::sal_Int32
>::get();
131 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_LONG
, +t
.getTypeClass());
132 CPPUNIT_ASSERT_EQUAL(
133 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("long")), t
.getTypeName());
134 t
= ::cppu::UnoType
< ::sal_uInt32
>::get();
135 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_UNSIGNED_LONG
, +t
.getTypeClass());
136 CPPUNIT_ASSERT_EQUAL(
137 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned long")),
139 t
= ::cppu::UnoType
< ::sal_Int64
>::get();
140 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_HYPER
, +t
.getTypeClass());
141 CPPUNIT_ASSERT_EQUAL(
142 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hyper")), t
.getTypeName());
143 t
= ::cppu::UnoType
< ::sal_uInt64
>::get();
144 CPPUNIT_ASSERT_EQUAL(
145 +css::uno::TypeClass_UNSIGNED_HYPER
, +t
.getTypeClass());
146 CPPUNIT_ASSERT_EQUAL(
147 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unsigned hyper")),
149 t
= ::cppu::UnoType
< float >::get();
150 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_FLOAT
, +t
.getTypeClass());
151 CPPUNIT_ASSERT_EQUAL(
152 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("float")), t
.getTypeName());
153 t
= ::cppu::UnoType
< double >::get();
154 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_DOUBLE
, +t
.getTypeClass());
155 CPPUNIT_ASSERT_EQUAL(
156 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("double")),
158 t
= ::cppu::UnoType
< ::cppu::UnoCharType
>::get();
159 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_CHAR
, +t
.getTypeClass());
160 CPPUNIT_ASSERT_EQUAL(
161 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("char")), t
.getTypeName());
162 t
= ::cppu::UnoType
< ::rtl::OUString
>::get();
163 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRING
, +t
.getTypeClass());
164 CPPUNIT_ASSERT_EQUAL(
165 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")),
167 t
= ::cppu::UnoType
< css::uno::Type
>::get();
168 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_TYPE
, +t
.getTypeClass());
169 CPPUNIT_ASSERT_EQUAL(
170 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("type")), t
.getTypeName());
171 t
= ::cppu::UnoType
< css::uno::Any
>::get();
172 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ANY
, +t
.getTypeClass());
173 CPPUNIT_ASSERT_EQUAL(
174 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), t
.getTypeName());
175 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::sal_Int8
> >::get();
176 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
177 CPPUNIT_ASSERT_EQUAL(
178 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]byte")),
181 ::cppu::UnoType
< css::uno::Sequence
< ::sal_Int8
> >::get() == t
);
183 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get();
184 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
185 CPPUNIT_ASSERT_EQUAL(
186 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]unsigned short")),
189 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get();
190 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
191 CPPUNIT_ASSERT_EQUAL(
192 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]char")),
194 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
195 ::sal_Int8
> > >::get();
196 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
197 CPPUNIT_ASSERT_EQUAL(
198 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]byte")),
202 css::uno::Sequence
< css::uno::Sequence
< ::sal_Int8
> > >::get() == t
);
203 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
204 ::cppu::UnoUnsignedShortType
> > >::get();
205 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
206 CPPUNIT_ASSERT_EQUAL(
207 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]unsigned short")),
209 t
= ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
210 ::cppu::UnoCharType
> > >::get();
211 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE
, +t
.getTypeClass());
212 CPPUNIT_ASSERT_EQUAL(
213 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[][]char")),
215 t
= ::cppu::UnoType
< css::uno::TypeClass
>::get();
216 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ENUM
, +t
.getTypeClass());
217 CPPUNIT_ASSERT_EQUAL(
219 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.TypeClass")),
221 t
= ::cppu::UnoType
< css::lang::EventObject
>::get();
222 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
223 CPPUNIT_ASSERT_EQUAL(
225 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.EventObject")),
227 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct1
>::get() == t
);
228 t
= ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get();
229 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
230 CPPUNIT_ASSERT_EQUAL(
232 RTL_CONSTASCII_USTRINGPARAM(
233 "com.sun.star.beans.PropertyChangeEvent")),
235 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
236 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedStruct2
>::get() == t
);
238 t
= ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get();
239 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT
, +t
.getTypeClass());
240 CPPUNIT_ASSERT_EQUAL(
242 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Optional<byte>")),
244 t
= ::cppu::UnoType
< css::uno::Exception
>::get();
245 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
246 CPPUNIT_ASSERT_EQUAL(
248 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.Exception")),
250 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException1
>::get() == t
);
251 t
= ::cppu::UnoType
< css::uno::RuntimeException
>::get();
252 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION
, +t
.getTypeClass());
253 CPPUNIT_ASSERT_EQUAL(
255 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException")),
257 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
258 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedException2
>::get() == t
);
260 t
= ::cppu::UnoType
< css::uno::XInterface
>::get();
261 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
262 CPPUNIT_ASSERT_EQUAL(
264 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")),
267 ::cppu::UnoType
< css::uno::Reference
< css::uno::XInterface
> >::get() ==
269 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface1
>::get() == t
);
271 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface1
> >::get() ==
273 t
= ::cppu::UnoType
< css::uno::XComponentContext
>::get();
274 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE
, +t
.getTypeClass());
275 CPPUNIT_ASSERT_EQUAL(
277 RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XComponentContext")),
281 css::uno::Reference
< css::uno::XComponentContext
> >::get() == t
);
282 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
283 CPPUNIT_ASSERT(::cppu::UnoType
< DerivedInterface2
>::get() == t
);
285 ::cppu::UnoType
< css::uno::Reference
< DerivedInterface2
> >::get() ==
290 void Test::testGetTypeFavourUnsigned() {
291 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
293 ::getCppuType(static_cast< ::sal_Unicode
* >(0)) ==
294 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
296 ::cppu::getTypeFavourUnsigned(
297 static_cast< ::cppu::UnoVoidType
* >(0)) ==
298 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
300 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
301 ::cppu::UnoType
< bool >::get());
303 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
304 ::getCppuType(static_cast< bool * >(0)));
306 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
307 ::cppu::UnoType
< bool >::get());
309 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Bool
* >(0)) ==
310 ::getCppuType(static_cast< ::sal_Bool
* >(0)));
312 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
313 ::cppu::UnoType
< ::sal_Int8
>::get());
315 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8
* >(0)) ==
316 ::getCppuType(static_cast< ::sal_Int8
* >(0)));
318 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
319 ::cppu::UnoType
< ::sal_Int16
>::get());
321 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16
* >(0)) ==
322 ::getCppuType(static_cast< ::sal_Int16
* >(0)));
324 ::cppu::getTypeFavourUnsigned(
325 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
326 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
328 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
329 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
331 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16
* >(0)) ==
332 ::getCppuType(static_cast< ::sal_uInt16
* >(0)));
334 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
335 ::cppu::UnoType
< ::sal_Int32
>::get());
337 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32
* >(0)) ==
338 ::getCppuType(static_cast< ::sal_Int32
* >(0)));
340 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
341 ::cppu::UnoType
< ::sal_uInt32
>::get());
343 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32
* >(0)) ==
344 ::getCppuType(static_cast< ::sal_uInt32
* >(0)));
346 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
347 ::cppu::UnoType
< ::sal_Int64
>::get());
349 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64
* >(0)) ==
350 ::getCppuType(static_cast< ::sal_Int64
* >(0)));
352 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
353 ::cppu::UnoType
< ::sal_uInt64
>::get());
355 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64
* >(0)) ==
356 ::getCppuType(static_cast< ::sal_uInt64
* >(0)));
358 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
359 ::cppu::UnoType
< float >::get());
361 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
362 ::getCppuType(static_cast< float * >(0)));
364 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
365 ::cppu::UnoType
< double >::get());
367 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
368 ::getCppuType(static_cast< double * >(0)));
370 ::cppu::getTypeFavourUnsigned(
371 static_cast< ::cppu::UnoCharType
* >(0)) ==
372 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
374 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
375 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
377 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode
* >(0)) ==
378 ::getCppuType(static_cast< ::sal_Unicode
* >(0)));
380 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
381 ::cppu::UnoType
< ::rtl::OUString
>::get());
383 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString
* >(0)) ==
384 ::getCppuType(static_cast< ::rtl::OUString
* >(0)));
386 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
387 ::cppu::UnoType
< css::uno::Type
>::get());
389 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type
* >(0)) ==
390 ::getCppuType(static_cast< css::uno::Type
* >(0)));
392 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
393 ::cppu::UnoType
< css::uno::Any
>::get());
395 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any
* >(0)) ==
396 ::getCppuType(static_cast< css::uno::Any
* >(0)));
398 ::cppu::getTypeFavourUnsigned(
400 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
402 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
404 ::cppu::getTypeFavourUnsigned(
405 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
407 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
409 ::cppu::getTypeFavourUnsigned(
410 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
411 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)));
413 ::cppu::getTypeFavourUnsigned(
414 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
415 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
416 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
417 ::cppu::UnoUnsignedShortType
> > >::get());
419 ::cppu::getTypeFavourUnsigned(
420 static_cast< css::uno::Sequence
< css::uno::Sequence
<
421 ::sal_uInt16
> > * >(0)) ==
422 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
423 ::cppu::UnoUnsignedShortType
> > >::get());
425 ::cppu::getTypeFavourUnsigned(
426 static_cast< css::uno::Sequence
< css::uno::Sequence
<
427 ::sal_uInt16
> > * >(0)) ==
429 static_cast< css::uno::Sequence
< css::uno::Sequence
<
430 ::sal_uInt16
> > * >(0)));
432 ::cppu::getTypeFavourUnsigned(
433 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
435 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
437 ::cppu::getTypeFavourUnsigned(
438 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
439 ::getCppuType(static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)));
441 ::cppu::getTypeFavourUnsigned(
442 static_cast< css::uno::Sequence
< css::uno::Sequence
<
443 ::sal_Unicode
> > * >(0)) ==
444 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
445 ::cppu::UnoUnsignedShortType
> > >::get());
447 ::cppu::getTypeFavourUnsigned(
448 static_cast< css::uno::Sequence
< css::uno::Sequence
<
449 ::sal_Unicode
> > * >(0)) ==
451 static_cast< css::uno::Sequence
< css::uno::Sequence
<
452 ::sal_Unicode
> > * >(0)));
454 ::cppu::getTypeFavourUnsigned(
455 static_cast< css::uno::TypeClass
* >(0)) ==
456 ::cppu::UnoType
< css::uno::TypeClass
>::get());
458 ::cppu::getTypeFavourUnsigned(
459 static_cast< css::uno::TypeClass
* >(0)) ==
460 ::getCppuType(static_cast< css::uno::TypeClass
* >(0)));
462 ::cppu::getTypeFavourUnsigned(
463 static_cast< css::lang::EventObject
* >(0)) ==
464 ::cppu::UnoType
< css::lang::EventObject
>::get());
466 ::cppu::getTypeFavourUnsigned(
467 static_cast< css::lang::EventObject
* >(0)) ==
468 ::getCppuType(static_cast< css::lang::EventObject
* >(0)));
470 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
471 ::cppu::UnoType
< css::lang::EventObject
>::get());
473 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1
* >(0)) ==
474 ::getCppuType(static_cast< DerivedStruct1
* >(0)));
476 ::cppu::getTypeFavourUnsigned(
477 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
478 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
480 ::cppu::getTypeFavourUnsigned(
481 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
482 ::getCppuType(static_cast< css::beans::PropertyChangeEvent
* >(0)));
483 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
485 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
486 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
488 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2
* >(0)) ==
489 ::getCppuType(static_cast< DerivedStruct2
* >(0)));
492 ::cppu::getTypeFavourUnsigned(
493 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
494 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
496 ::cppu::getTypeFavourUnsigned(
497 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
498 ::getCppuType(static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)));
500 ::cppu::getTypeFavourUnsigned(
501 static_cast< css::uno::Exception
* >(0)) ==
502 ::cppu::UnoType
< css::uno::Exception
>::get());
504 ::cppu::getTypeFavourUnsigned(
505 static_cast< css::uno::Exception
* >(0)) ==
506 ::getCppuType(static_cast< css::uno::Exception
* >(0)));
508 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
509 ::cppu::UnoType
< css::uno::Exception
>::get());
511 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1
* >(0)) ==
512 ::getCppuType(static_cast< DerivedException1
* >(0)));
514 ::cppu::getTypeFavourUnsigned(
515 static_cast< css::uno::RuntimeException
* >(0)) ==
516 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
518 ::cppu::getTypeFavourUnsigned(
519 static_cast< css::uno::RuntimeException
* >(0)) ==
520 ::getCppuType(static_cast< css::uno::RuntimeException
* >(0)));
521 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
523 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
524 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
526 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2
* >(0)) ==
527 ::getCppuType(static_cast< DerivedException2
* >(0)));
530 ::cppu::getTypeFavourUnsigned(
531 static_cast< css::uno::XInterface
* >(0)) ==
532 ::cppu::UnoType
< css::uno::XInterface
>::get());
534 ::cppu::getTypeFavourUnsigned(
535 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
536 ::cppu::UnoType
< css::uno::XInterface
>::get());
538 ::cppu::getTypeFavourUnsigned(
539 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
541 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)));
543 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1
* >(0)) ==
544 ::cppu::UnoType
< css::uno::XInterface
>::get());
546 ::cppu::getTypeFavourUnsigned(
547 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
548 ::cppu::UnoType
< css::uno::XInterface
>::get());
550 ::cppu::getTypeFavourUnsigned(
551 static_cast< css::uno::XComponentContext
* >(0)) ==
552 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
554 ::cppu::getTypeFavourUnsigned(
556 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
557 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
559 ::cppu::getTypeFavourUnsigned(
561 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
564 css::uno::Reference
< css::uno::XComponentContext
> * >(0)));
565 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
567 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2
* >(0)) ==
568 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
570 ::cppu::getTypeFavourUnsigned(
571 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
572 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
576 void Test::testGetTypeFavourChar() {
577 CPPUNIT_ASSERT(typeid(::sal_Unicode
) == typeid(::sal_uInt16
));
579 ::getCppuType
< ::sal_Unicode
>() == ::getCppuType
< ::sal_uInt16
>());
581 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType
* >(0)) ==
582 ::cppu::UnoType
< ::cppu::UnoVoidType
>::get());
584 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
585 ::cppu::UnoType
< bool >::get());
587 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
588 ::getCppuType
< bool >());
590 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
591 ::cppu::UnoType
< bool >::get());
593 ::cppu::getTypeFavourChar(static_cast< ::sal_Bool
* >(0)) ==
594 ::getCppuType
< ::sal_Bool
>());
596 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
597 ::cppu::UnoType
< ::sal_Int8
>::get());
599 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8
* >(0)) ==
600 ::getCppuType
< ::sal_Int8
>());
602 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
603 ::cppu::UnoType
< ::sal_Int16
>::get());
605 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16
* >(0)) ==
606 ::getCppuType
< ::sal_Int16
>());
608 ::cppu::getTypeFavourChar(
609 static_cast< ::cppu::UnoUnsignedShortType
* >(0)) ==
610 ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get());
612 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16
* >(0)) ==
613 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
615 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
616 ::cppu::UnoType
< ::sal_Int32
>::get());
618 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32
* >(0)) ==
619 ::getCppuType
< ::sal_Int32
>());
621 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
622 ::cppu::UnoType
< ::sal_uInt32
>::get());
624 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32
* >(0)) ==
625 ::getCppuType
< ::sal_uInt32
>());
627 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
628 ::cppu::UnoType
< ::sal_Int64
>::get());
630 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64
* >(0)) ==
631 ::getCppuType
< ::sal_Int64
>());
633 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
634 ::cppu::UnoType
< ::sal_uInt64
>::get());
636 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64
* >(0)) ==
637 ::getCppuType
< ::sal_uInt64
>());
639 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
640 ::cppu::UnoType
< float >::get());
642 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
643 ::getCppuType
< float >());
645 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
646 ::cppu::UnoType
< double >::get());
648 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
649 ::getCppuType
< double >());
651 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType
* >(0)) ==
652 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
654 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
655 ::cppu::UnoType
< ::cppu::UnoCharType
>::get());
657 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode
* >(0)) ==
658 ::getCppuType
< ::sal_Unicode
>());
660 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
661 ::cppu::UnoType
< ::rtl::OUString
>::get());
663 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString
* >(0)) ==
664 ::getCppuType
< ::rtl::OUString
>());
666 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
667 ::cppu::UnoType
< css::uno::Type
>::get());
669 ::cppu::getTypeFavourChar(static_cast< css::uno::Type
* >(0)) ==
670 ::getCppuType
< css::uno::Type
>());
672 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
673 ::cppu::UnoType
< css::uno::Any
>::get());
675 ::cppu::getTypeFavourChar(static_cast< css::uno::Any
* >(0)) ==
676 ::getCppuType
< css::uno::Any
>());
678 ::cppu::getTypeFavourChar(
680 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> * >(0)) ==
682 ::cppu::UnoSequenceType
< ::cppu::UnoUnsignedShortType
> >::get());
684 ::cppu::getTypeFavourChar(
685 static_cast< css::uno::Sequence
< ::sal_uInt16
> * >(0)) ==
687 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
689 ::cppu::getTypeFavourChar(
690 static_cast< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
691 ::cppu::UnoUnsignedShortType
> > * >(0)) ==
692 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
693 ::cppu::UnoUnsignedShortType
> > >::get());
695 ::cppu::getTypeFavourChar(
696 static_cast< css::uno::Sequence
< css::uno::Sequence
<
697 ::sal_uInt16
> > * >(0)) ==
698 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
699 ::cppu::UnoCharType
> > >::get());
701 ::cppu::getTypeFavourChar(
702 static_cast< css::uno::Sequence
< ::sal_Unicode
> * >(0)) ==
704 ::cppu::UnoSequenceType
< ::cppu::UnoCharType
> >::get());
706 ::cppu::getTypeFavourChar(
707 static_cast< css::uno::Sequence
< css::uno::Sequence
<
708 ::sal_Unicode
> > * >(0)) ==
709 ::cppu::UnoType
< ::cppu::UnoSequenceType
< ::cppu::UnoSequenceType
<
710 ::cppu::UnoCharType
> > >::get());
712 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
713 ::cppu::UnoType
< css::uno::TypeClass
>::get());
715 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass
* >(0)) ==
716 ::getCppuType
< css::uno::TypeClass
>());
718 ::cppu::getTypeFavourChar(
719 static_cast< css::lang::EventObject
* >(0)) ==
720 ::cppu::UnoType
< css::lang::EventObject
>::get());
722 ::cppu::getTypeFavourChar(
723 static_cast< css::lang::EventObject
* >(0)) ==
724 ::getCppuType
< css::lang::EventObject
>());
726 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
727 ::cppu::UnoType
< css::lang::EventObject
>::get());
729 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1
* >(0)) ==
730 ::getCppuType
< DerivedStruct1
>());
732 ::cppu::getTypeFavourChar(
733 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
734 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
736 ::cppu::getTypeFavourChar(
737 static_cast< css::beans::PropertyChangeEvent
* >(0)) ==
738 ::getCppuType
< css::beans::PropertyChangeEvent
>());
739 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
741 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
742 ::cppu::UnoType
< css::beans::PropertyChangeEvent
>::get());
744 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2
* >(0)) ==
745 ::getCppuType
< DerivedStruct2
>());
748 ::cppu::getTypeFavourChar(
749 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
750 ::cppu::UnoType
< css::beans::Optional
< ::sal_Int8
> >::get());
752 ::cppu::getTypeFavourChar(
753 static_cast< css::beans::Optional
< ::sal_Int8
> * >(0)) ==
754 ::getCppuType
< css::beans::Optional
< ::sal_Int8
> >());
756 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
757 ::cppu::UnoType
< css::uno::Exception
>::get());
759 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception
* >(0)) ==
760 ::getCppuType
< css::uno::Exception
>());
762 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
763 ::cppu::UnoType
< css::uno::Exception
>::get());
765 ::cppu::getTypeFavourChar(static_cast< DerivedException1
* >(0)) ==
766 ::getCppuType
< DerivedException1
>());
768 ::cppu::getTypeFavourChar(
769 static_cast< css::uno::RuntimeException
* >(0)) ==
770 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
772 ::cppu::getTypeFavourChar(
773 static_cast< css::uno::RuntimeException
* >(0)) ==
774 ::getCppuType
< css::uno::RuntimeException
>());
775 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
777 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
778 ::cppu::UnoType
< css::uno::RuntimeException
>::get());
780 ::cppu::getTypeFavourChar(static_cast< DerivedException2
* >(0)) ==
781 ::getCppuType
< DerivedException2
>());
784 ::cppu::getTypeFavourChar(
785 static_cast< css::uno::XInterface
* >(0)) ==
786 ::cppu::UnoType
< css::uno::XInterface
>::get());
788 ::cppu::getTypeFavourChar(
789 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
790 ::cppu::UnoType
< css::uno::XInterface
>::get());
792 ::cppu::getTypeFavourChar(
793 static_cast< css::uno::Reference
< css::uno::XInterface
> * >(0)) ==
794 ::getCppuType
< css::uno::Reference
< css::uno::XInterface
> >());
796 ::cppu::getTypeFavourChar(static_cast< DerivedInterface1
* >(0)) ==
797 ::cppu::UnoType
< css::uno::XInterface
>::get());
799 ::cppu::getTypeFavourChar(
800 static_cast< css::uno::Reference
< DerivedInterface1
> * >(0)) ==
801 ::cppu::UnoType
< css::uno::XInterface
>::get());
803 ::cppu::getTypeFavourChar(
804 static_cast< css::uno::XComponentContext
* >(0)) ==
805 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
807 ::cppu::getTypeFavourChar(
809 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
810 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
812 ::cppu::getTypeFavourChar(
814 css::uno::Reference
< css::uno::XComponentContext
> * >(0)) ==
815 ::getCppuType
< css::uno::Reference
< css::uno::XComponentContext
> >());
816 #if !(defined __SUNPRO_CC && __SUNPRO_CC <= 0x550) // erroneous ambiguity stated
818 ::cppu::getTypeFavourChar(static_cast< DerivedInterface2
* >(0)) ==
819 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
821 ::cppu::getTypeFavourChar(
822 static_cast< css::uno::Reference
< DerivedInterface2
> * >(0)) ==
823 ::cppu::UnoType
< css::uno::XComponentContext
>::get());
827 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
831 CPPUNIT_PLUGIN_IMPLEMENT();
833 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */