bump product version to 5.0.4.1
[LibreOffice.git] / cppu / qa / test_unotype.cxx
blob053b155628f1a9abdfec082b954f45469ee05c87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
28 #include <typeinfo>
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 {
45 class Any;
46 } } } }
48 namespace {
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 {
59 private:
60 ~DerivedInterface1() {}
61 // avoid warnings about virtual members and non-virtual dtor
63 public:
64 static void dummy(DerivedInterface1 * p) { p->~DerivedInterface1(); }
65 // ...and avoid warnings about unused ~DerivedInterface1 (see below)
68 struct DerivedInterface2: css::uno::XComponentContext {
69 private:
70 ~DerivedInterface2() {}
71 // avoid warnings about virtual members and non-virtual dtor
73 public:
74 static void dummy(DerivedInterface2 * p) { p->~DerivedInterface2(); }
75 // ...and avoid warnings about unused ~DerivedInterface2 (see below)
78 class Test: public ::CppUnit::TestFixture {
79 public:
80 void testUnoType();
82 void testGetTypeFavourUnsigned();
84 void testGetTypeFavourChar();
86 CPPUNIT_TEST_SUITE(Test);
87 CPPUNIT_TEST(testUnoType);
88 CPPUNIT_TEST(testGetTypeFavourUnsigned);
89 CPPUNIT_TEST(testGetTypeFavourChar);
90 CPPUNIT_TEST_SUITE_END();
93 void Test::testUnoType() {
94 // Avoid warnings about unused ~DerivedInterface1/2 (see above):
95 if (false) {
96 DerivedInterface1::dummy(0);
97 DerivedInterface2::dummy(0);
100 css::uno::Type t;
101 t = ::cppu::UnoType< ::cppu::UnoVoidType >::get();
102 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_VOID, +t.getTypeClass());
103 CPPUNIT_ASSERT_EQUAL(
104 ::rtl::OUString("void"), t.getTypeName());
105 CPPUNIT_ASSERT(cppu::UnoType<void>::get() == t);
106 t = ::cppu::UnoType< bool >::get();
107 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BOOLEAN, +t.getTypeClass());
108 CPPUNIT_ASSERT_EQUAL(
109 ::rtl::OUString("boolean"),
110 t.getTypeName());
111 CPPUNIT_ASSERT(::cppu::UnoType< sal_Bool >::get() == t);
112 t = ::cppu::UnoType< ::sal_Int8 >::get();
113 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_BYTE, +t.getTypeClass());
114 CPPUNIT_ASSERT_EQUAL(
115 ::rtl::OUString("byte"), t.getTypeName());
116 t = ::cppu::UnoType< ::sal_Int16 >::get();
117 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SHORT, +t.getTypeClass());
118 CPPUNIT_ASSERT_EQUAL(
119 ::rtl::OUString("short"), t.getTypeName());
120 t = ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
121 CPPUNIT_ASSERT_EQUAL(
122 +css::uno::TypeClass_UNSIGNED_SHORT, +t.getTypeClass());
123 CPPUNIT_ASSERT_EQUAL(
124 ::rtl::OUString("unsigned short"),
125 t.getTypeName());
126 t = ::cppu::UnoType< ::sal_Int32 >::get();
127 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_LONG, +t.getTypeClass());
128 CPPUNIT_ASSERT_EQUAL(
129 ::rtl::OUString("long"), t.getTypeName());
130 t = ::cppu::UnoType< ::sal_uInt32 >::get();
131 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_UNSIGNED_LONG, +t.getTypeClass());
132 CPPUNIT_ASSERT_EQUAL(
133 ::rtl::OUString("unsigned long"),
134 t.getTypeName());
135 t = ::cppu::UnoType< ::sal_Int64 >::get();
136 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_HYPER, +t.getTypeClass());
137 CPPUNIT_ASSERT_EQUAL(
138 ::rtl::OUString("hyper"), t.getTypeName());
139 t = ::cppu::UnoType< ::sal_uInt64 >::get();
140 CPPUNIT_ASSERT_EQUAL(
141 +css::uno::TypeClass_UNSIGNED_HYPER, +t.getTypeClass());
142 CPPUNIT_ASSERT_EQUAL(
143 ::rtl::OUString("unsigned hyper"),
144 t.getTypeName());
145 t = ::cppu::UnoType< float >::get();
146 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_FLOAT, +t.getTypeClass());
147 CPPUNIT_ASSERT_EQUAL(
148 ::rtl::OUString("float"), t.getTypeName());
149 t = ::cppu::UnoType< double >::get();
150 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_DOUBLE, +t.getTypeClass());
151 CPPUNIT_ASSERT_EQUAL(
152 ::rtl::OUString("double"),
153 t.getTypeName());
154 t = ::cppu::UnoType< ::cppu::UnoCharType >::get();
155 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_CHAR, +t.getTypeClass());
156 CPPUNIT_ASSERT_EQUAL(
157 ::rtl::OUString("char"), t.getTypeName());
158 t = ::cppu::UnoType< ::rtl::OUString >::get();
159 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRING, +t.getTypeClass());
160 CPPUNIT_ASSERT_EQUAL(
161 ::rtl::OUString("string"),
162 t.getTypeName());
163 t = ::cppu::UnoType< css::uno::Type >::get();
164 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_TYPE, +t.getTypeClass());
165 CPPUNIT_ASSERT_EQUAL(
166 ::rtl::OUString("type"), t.getTypeName());
167 t = ::cppu::UnoType< css::uno::Any >::get();
168 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ANY, +t.getTypeClass());
169 CPPUNIT_ASSERT_EQUAL(
170 ::rtl::OUString("any"), t.getTypeName());
171 t = ::cppu::UnoType< ::cppu::UnoSequenceType< ::sal_Int8 > >::get();
172 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
173 CPPUNIT_ASSERT_EQUAL(
174 ::rtl::OUString("[]byte"),
175 t.getTypeName());
176 CPPUNIT_ASSERT(
177 ::cppu::UnoType< css::uno::Sequence< ::sal_Int8 > >::get() == t);
178 t = ::cppu::UnoType<
179 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get();
180 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
181 CPPUNIT_ASSERT_EQUAL(
182 ::rtl::OUString("[]unsigned short"),
183 t.getTypeName());
184 t = ::cppu::UnoType<
185 ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get();
186 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
187 CPPUNIT_ASSERT_EQUAL(
188 ::rtl::OUString("[]char"),
189 t.getTypeName());
190 t = ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
191 ::sal_Int8 > > >::get();
192 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
193 CPPUNIT_ASSERT_EQUAL(
194 ::rtl::OUString("[][]byte"),
195 t.getTypeName());
196 CPPUNIT_ASSERT(
197 ::cppu::UnoType<
198 css::uno::Sequence< css::uno::Sequence< ::sal_Int8 > > >::get() == t);
199 t = ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
200 ::cppu::UnoUnsignedShortType > > >::get();
201 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
202 CPPUNIT_ASSERT_EQUAL(
203 ::rtl::OUString("[][]unsigned short"),
204 t.getTypeName());
205 t = ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
206 ::cppu::UnoCharType > > >::get();
207 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_SEQUENCE, +t.getTypeClass());
208 CPPUNIT_ASSERT_EQUAL(
209 ::rtl::OUString("[][]char"),
210 t.getTypeName());
211 t = ::cppu::UnoType< css::uno::TypeClass >::get();
212 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_ENUM, +t.getTypeClass());
213 CPPUNIT_ASSERT_EQUAL(
214 ::rtl::OUString("com.sun.star.uno.TypeClass"),
215 t.getTypeName());
216 t = ::cppu::UnoType< css::lang::EventObject >::get();
217 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass());
218 CPPUNIT_ASSERT_EQUAL(
219 ::rtl::OUString("com.sun.star.lang.EventObject"),
220 t.getTypeName());
221 CPPUNIT_ASSERT(::cppu::UnoType< DerivedStruct1 >::get() == t);
222 t = ::cppu::UnoType< css::beans::PropertyChangeEvent >::get();
223 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass());
224 CPPUNIT_ASSERT_EQUAL(
225 ::rtl::OUString(
226 "com.sun.star.beans.PropertyChangeEvent"),
227 t.getTypeName());
228 CPPUNIT_ASSERT(::cppu::UnoType< DerivedStruct2 >::get() == t);
229 t = ::cppu::UnoType< css::beans::Optional< ::sal_Int8 > >::get();
230 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_STRUCT, +t.getTypeClass());
231 CPPUNIT_ASSERT_EQUAL(
232 ::rtl::OUString("com.sun.star.beans.Optional<byte>"),
233 t.getTypeName());
234 t = ::cppu::UnoType< css::uno::Exception >::get();
235 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION, +t.getTypeClass());
236 CPPUNIT_ASSERT_EQUAL(
237 ::rtl::OUString("com.sun.star.uno.Exception"),
238 t.getTypeName());
239 CPPUNIT_ASSERT(::cppu::UnoType< DerivedException1 >::get() == t);
240 t = ::cppu::UnoType< css::uno::RuntimeException >::get();
241 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_EXCEPTION, +t.getTypeClass());
242 CPPUNIT_ASSERT_EQUAL(
243 ::rtl::OUString("com.sun.star.uno.RuntimeException"),
244 t.getTypeName());
245 CPPUNIT_ASSERT(::cppu::UnoType< DerivedException2 >::get() == t);
246 t = ::cppu::UnoType< css::uno::XInterface >::get();
247 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE, +t.getTypeClass());
248 CPPUNIT_ASSERT_EQUAL(
249 ::rtl::OUString("com.sun.star.uno.XInterface"),
250 t.getTypeName());
251 CPPUNIT_ASSERT(
252 ::cppu::UnoType< css::uno::Reference< css::uno::XInterface > >::get() ==
254 CPPUNIT_ASSERT(::cppu::UnoType< DerivedInterface1 >::get() == t);
255 CPPUNIT_ASSERT(
256 ::cppu::UnoType< css::uno::Reference< DerivedInterface1 > >::get() ==
258 t = ::cppu::UnoType< css::uno::XComponentContext >::get();
259 CPPUNIT_ASSERT_EQUAL(+css::uno::TypeClass_INTERFACE, +t.getTypeClass());
260 CPPUNIT_ASSERT_EQUAL(
261 ::rtl::OUString("com.sun.star.uno.XComponentContext"),
262 t.getTypeName());
263 CPPUNIT_ASSERT(
264 ::cppu::UnoType<
265 css::uno::Reference< css::uno::XComponentContext > >::get() == t);
266 CPPUNIT_ASSERT(::cppu::UnoType< DerivedInterface2 >::get() == t);
267 CPPUNIT_ASSERT(
268 ::cppu::UnoType< css::uno::Reference< DerivedInterface2 > >::get() ==
272 void Test::testGetTypeFavourUnsigned() {
273 CPPUNIT_ASSERT(typeid(::sal_Unicode) == typeid(::sal_uInt16));
274 // CPPUNIT_ASSERT(
275 // ::getCppuType(static_cast< ::sal_Unicode * >(0)) ==
276 // ::getCppuType(static_cast< ::sal_uInt16 * >(0)));
277 CPPUNIT_ASSERT(
278 ::cppu::getTypeFavourUnsigned(
279 static_cast< ::cppu::UnoVoidType * >(0)) ==
280 ::cppu::UnoType< ::cppu::UnoVoidType >::get());
281 CPPUNIT_ASSERT(
282 ::cppu::getTypeFavourUnsigned(static_cast< bool * >(0)) ==
283 ::cppu::UnoType< bool >::get());
284 CPPUNIT_ASSERT(
285 ::cppu::getTypeFavourUnsigned(static_cast< sal_Bool * >(0)) ==
286 ::cppu::UnoType< bool >::get());
287 CPPUNIT_ASSERT(
288 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int8 * >(0)) ==
289 ::cppu::UnoType< ::sal_Int8 >::get());
290 CPPUNIT_ASSERT(
291 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int16 * >(0)) ==
292 ::cppu::UnoType< ::sal_Int16 >::get());
293 CPPUNIT_ASSERT(
294 ::cppu::getTypeFavourUnsigned(
295 static_cast< ::cppu::UnoUnsignedShortType * >(0)) ==
296 ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get());
297 CPPUNIT_ASSERT(
298 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt16 * >(0)) ==
299 ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get());
300 CPPUNIT_ASSERT(
301 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int32 * >(0)) ==
302 ::cppu::UnoType< ::sal_Int32 >::get());
303 CPPUNIT_ASSERT(
304 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt32 * >(0)) ==
305 ::cppu::UnoType< ::sal_uInt32 >::get());
306 CPPUNIT_ASSERT(
307 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Int64 * >(0)) ==
308 ::cppu::UnoType< ::sal_Int64 >::get());
309 CPPUNIT_ASSERT(
310 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_uInt64 * >(0)) ==
311 ::cppu::UnoType< ::sal_uInt64 >::get());
312 CPPUNIT_ASSERT(
313 ::cppu::getTypeFavourUnsigned(static_cast< float * >(0)) ==
314 ::cppu::UnoType< float >::get());
315 CPPUNIT_ASSERT(
316 ::cppu::getTypeFavourUnsigned(static_cast< double * >(0)) ==
317 ::cppu::UnoType< double >::get());
318 CPPUNIT_ASSERT(
319 ::cppu::getTypeFavourUnsigned(
320 static_cast< ::cppu::UnoCharType * >(0)) ==
321 ::cppu::UnoType< ::cppu::UnoCharType >::get());
322 CPPUNIT_ASSERT(
323 ::cppu::getTypeFavourUnsigned(static_cast< ::sal_Unicode * >(0)) ==
324 ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get());
325 CPPUNIT_ASSERT(
326 ::cppu::getTypeFavourUnsigned(static_cast< ::rtl::OUString * >(0)) ==
327 ::cppu::UnoType< ::rtl::OUString >::get());
328 CPPUNIT_ASSERT(
329 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Type * >(0)) ==
330 ::cppu::UnoType< css::uno::Type >::get());
331 CPPUNIT_ASSERT(
332 ::cppu::getTypeFavourUnsigned(static_cast< css::uno::Any * >(0)) ==
333 ::cppu::UnoType< css::uno::Any >::get());
334 CPPUNIT_ASSERT(
335 ::cppu::getTypeFavourUnsigned(
336 static_cast<
337 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(0)) ==
338 ::cppu::UnoType<
339 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get());
340 CPPUNIT_ASSERT(
341 ::cppu::getTypeFavourUnsigned(
342 static_cast< css::uno::Sequence< ::sal_uInt16 > * >(0)) ==
343 ::cppu::UnoType<
344 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get());
345 CPPUNIT_ASSERT(
346 ::cppu::getTypeFavourUnsigned(
347 static_cast< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
348 ::cppu::UnoUnsignedShortType > > * >(0)) ==
349 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
350 ::cppu::UnoUnsignedShortType > > >::get());
351 CPPUNIT_ASSERT(
352 ::cppu::getTypeFavourUnsigned(
353 static_cast< css::uno::Sequence< css::uno::Sequence<
354 ::sal_uInt16 > > * >(0)) ==
355 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
356 ::cppu::UnoUnsignedShortType > > >::get());
357 CPPUNIT_ASSERT(
358 ::cppu::getTypeFavourUnsigned(
359 static_cast< css::uno::Sequence< ::sal_Unicode > * >(0)) ==
360 ::cppu::UnoType<
361 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get());
362 CPPUNIT_ASSERT(
363 ::cppu::getTypeFavourUnsigned(
364 static_cast< css::uno::Sequence< css::uno::Sequence<
365 ::sal_Unicode > > * >(0)) ==
366 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
367 ::cppu::UnoUnsignedShortType > > >::get());
368 CPPUNIT_ASSERT(
369 ::cppu::getTypeFavourUnsigned(
370 static_cast< css::uno::TypeClass * >(0)) ==
371 ::cppu::UnoType< css::uno::TypeClass >::get());
372 CPPUNIT_ASSERT(
373 ::cppu::getTypeFavourUnsigned(
374 static_cast< css::lang::EventObject * >(0)) ==
375 ::cppu::UnoType< css::lang::EventObject >::get());
376 CPPUNIT_ASSERT(
377 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct1 * >(0)) ==
378 ::cppu::UnoType< css::lang::EventObject >::get());
379 CPPUNIT_ASSERT(
380 ::cppu::getTypeFavourUnsigned(
381 static_cast< css::beans::PropertyChangeEvent * >(0)) ==
382 ::cppu::UnoType< css::beans::PropertyChangeEvent >::get());
383 CPPUNIT_ASSERT(
384 ::cppu::getTypeFavourUnsigned(static_cast< DerivedStruct2 * >(0)) ==
385 ::cppu::UnoType< css::beans::PropertyChangeEvent >::get());
386 CPPUNIT_ASSERT(
387 ::cppu::getTypeFavourUnsigned(
388 static_cast< css::beans::Optional< ::sal_Int8 > * >(0)) ==
389 ::cppu::UnoType< css::beans::Optional< ::sal_Int8 > >::get());
390 CPPUNIT_ASSERT(
391 ::cppu::getTypeFavourUnsigned(
392 static_cast< css::uno::Exception * >(0)) ==
393 ::cppu::UnoType< css::uno::Exception >::get());
394 CPPUNIT_ASSERT(
395 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException1 * >(0)) ==
396 ::cppu::UnoType< css::uno::Exception >::get());
397 CPPUNIT_ASSERT(
398 ::cppu::getTypeFavourUnsigned(
399 static_cast< css::uno::RuntimeException * >(0)) ==
400 ::cppu::UnoType< css::uno::RuntimeException >::get());
401 CPPUNIT_ASSERT(
402 ::cppu::getTypeFavourUnsigned(static_cast< DerivedException2 * >(0)) ==
403 ::cppu::UnoType< css::uno::RuntimeException >::get());
404 CPPUNIT_ASSERT(
405 ::cppu::getTypeFavourUnsigned(
406 static_cast< css::uno::XInterface * >(0)) ==
407 ::cppu::UnoType< css::uno::XInterface >::get());
408 CPPUNIT_ASSERT(
409 ::cppu::getTypeFavourUnsigned(
410 static_cast< css::uno::Reference< css::uno::XInterface > * >(0)) ==
411 ::cppu::UnoType< css::uno::XInterface >::get());
412 CPPUNIT_ASSERT(
413 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface1 * >(0)) ==
414 ::cppu::UnoType< css::uno::XInterface >::get());
415 CPPUNIT_ASSERT(
416 ::cppu::getTypeFavourUnsigned(
417 static_cast< css::uno::Reference< DerivedInterface1 > * >(0)) ==
418 ::cppu::UnoType< css::uno::XInterface >::get());
419 CPPUNIT_ASSERT(
420 ::cppu::getTypeFavourUnsigned(
421 static_cast< css::uno::XComponentContext * >(0)) ==
422 ::cppu::UnoType< css::uno::XComponentContext >::get());
423 CPPUNIT_ASSERT(
424 ::cppu::getTypeFavourUnsigned(
425 static_cast<
426 css::uno::Reference< css::uno::XComponentContext > * >(0)) ==
427 ::cppu::UnoType< css::uno::XComponentContext >::get());
428 CPPUNIT_ASSERT(
429 ::cppu::getTypeFavourUnsigned(static_cast< DerivedInterface2 * >(0)) ==
430 ::cppu::UnoType< css::uno::XComponentContext >::get());
431 CPPUNIT_ASSERT(
432 ::cppu::getTypeFavourUnsigned(
433 static_cast< css::uno::Reference< DerivedInterface2 > * >(0)) ==
434 ::cppu::UnoType< css::uno::XComponentContext >::get());
437 void Test::testGetTypeFavourChar() {
438 CPPUNIT_ASSERT(typeid(::sal_Unicode) == typeid(::sal_uInt16));
439 // CPPUNIT_ASSERT(
440 // ::getCppuType< ::sal_Unicode >() == ::getCppuType< ::sal_uInt16 >());
441 CPPUNIT_ASSERT(
442 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoVoidType * >(0)) ==
443 ::cppu::UnoType< ::cppu::UnoVoidType >::get());
444 CPPUNIT_ASSERT(
445 ::cppu::getTypeFavourChar(static_cast< bool * >(0)) ==
446 ::cppu::UnoType< bool >::get());
447 CPPUNIT_ASSERT(
448 ::cppu::getTypeFavourChar(static_cast< sal_Bool * >(0)) ==
449 ::cppu::UnoType< bool >::get());
450 CPPUNIT_ASSERT(
451 ::cppu::getTypeFavourChar(static_cast< ::sal_Int8 * >(0)) ==
452 ::cppu::UnoType< ::sal_Int8 >::get());
453 CPPUNIT_ASSERT(
454 ::cppu::getTypeFavourChar(static_cast< ::sal_Int16 * >(0)) ==
455 ::cppu::UnoType< ::sal_Int16 >::get());
456 CPPUNIT_ASSERT(
457 ::cppu::getTypeFavourChar(
458 static_cast< ::cppu::UnoUnsignedShortType * >(0)) ==
459 ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get());
460 CPPUNIT_ASSERT(
461 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt16 * >(0)) ==
462 ::cppu::UnoType< ::cppu::UnoCharType >::get());
463 CPPUNIT_ASSERT(
464 ::cppu::getTypeFavourChar(static_cast< ::sal_Int32 * >(0)) ==
465 ::cppu::UnoType< ::sal_Int32 >::get());
466 CPPUNIT_ASSERT(
467 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt32 * >(0)) ==
468 ::cppu::UnoType< ::sal_uInt32 >::get());
469 CPPUNIT_ASSERT(
470 ::cppu::getTypeFavourChar(static_cast< ::sal_Int64 * >(0)) ==
471 ::cppu::UnoType< ::sal_Int64 >::get());
472 CPPUNIT_ASSERT(
473 ::cppu::getTypeFavourChar(static_cast< ::sal_uInt64 * >(0)) ==
474 ::cppu::UnoType< ::sal_uInt64 >::get());
475 CPPUNIT_ASSERT(
476 ::cppu::getTypeFavourChar(static_cast< float * >(0)) ==
477 ::cppu::UnoType< float >::get());
478 CPPUNIT_ASSERT(
479 ::cppu::getTypeFavourChar(static_cast< double * >(0)) ==
480 ::cppu::UnoType< double >::get());
481 CPPUNIT_ASSERT(
482 ::cppu::getTypeFavourChar(static_cast< ::cppu::UnoCharType * >(0)) ==
483 ::cppu::UnoType< ::cppu::UnoCharType >::get());
484 CPPUNIT_ASSERT(
485 ::cppu::getTypeFavourChar(static_cast< ::sal_Unicode * >(0)) ==
486 ::cppu::UnoType< ::cppu::UnoCharType >::get());
487 CPPUNIT_ASSERT(
488 ::cppu::getTypeFavourChar(static_cast< ::rtl::OUString * >(0)) ==
489 ::cppu::UnoType< ::rtl::OUString >::get());
490 CPPUNIT_ASSERT(
491 ::cppu::getTypeFavourChar(static_cast< css::uno::Type * >(0)) ==
492 ::cppu::UnoType< css::uno::Type >::get());
493 CPPUNIT_ASSERT(
494 ::cppu::getTypeFavourChar(static_cast< css::uno::Any * >(0)) ==
495 ::cppu::UnoType< css::uno::Any >::get());
496 CPPUNIT_ASSERT(
497 ::cppu::getTypeFavourChar(
498 static_cast<
499 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > * >(0)) ==
500 ::cppu::UnoType<
501 ::cppu::UnoSequenceType< ::cppu::UnoUnsignedShortType > >::get());
502 CPPUNIT_ASSERT(
503 ::cppu::getTypeFavourChar(
504 static_cast< css::uno::Sequence< ::sal_uInt16 > * >(0)) ==
505 ::cppu::UnoType<
506 ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get());
507 CPPUNIT_ASSERT(
508 ::cppu::getTypeFavourChar(
509 static_cast< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
510 ::cppu::UnoUnsignedShortType > > * >(0)) ==
511 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
512 ::cppu::UnoUnsignedShortType > > >::get());
513 CPPUNIT_ASSERT(
514 ::cppu::getTypeFavourChar(
515 static_cast< css::uno::Sequence< css::uno::Sequence<
516 ::sal_uInt16 > > * >(0)) ==
517 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
518 ::cppu::UnoCharType > > >::get());
519 CPPUNIT_ASSERT(
520 ::cppu::getTypeFavourChar(
521 static_cast< css::uno::Sequence< ::sal_Unicode > * >(0)) ==
522 ::cppu::UnoType<
523 ::cppu::UnoSequenceType< ::cppu::UnoCharType > >::get());
524 CPPUNIT_ASSERT(
525 ::cppu::getTypeFavourChar(
526 static_cast< css::uno::Sequence< css::uno::Sequence<
527 ::sal_Unicode > > * >(0)) ==
528 ::cppu::UnoType< ::cppu::UnoSequenceType< ::cppu::UnoSequenceType<
529 ::cppu::UnoCharType > > >::get());
530 CPPUNIT_ASSERT(
531 ::cppu::getTypeFavourChar(static_cast< css::uno::TypeClass * >(0)) ==
532 ::cppu::UnoType< css::uno::TypeClass >::get());
533 CPPUNIT_ASSERT(
534 ::cppu::getTypeFavourChar(
535 static_cast< css::lang::EventObject * >(0)) ==
536 ::cppu::UnoType< css::lang::EventObject >::get());
537 CPPUNIT_ASSERT(
538 ::cppu::getTypeFavourChar(static_cast< DerivedStruct1 * >(0)) ==
539 ::cppu::UnoType< css::lang::EventObject >::get());
540 CPPUNIT_ASSERT(
541 ::cppu::getTypeFavourChar(
542 static_cast< css::beans::PropertyChangeEvent * >(0)) ==
543 ::cppu::UnoType< css::beans::PropertyChangeEvent >::get());
544 CPPUNIT_ASSERT(
545 ::cppu::getTypeFavourChar(static_cast< DerivedStruct2 * >(0)) ==
546 ::cppu::UnoType< css::beans::PropertyChangeEvent >::get());
547 CPPUNIT_ASSERT(
548 ::cppu::getTypeFavourChar(
549 static_cast< css::beans::Optional< ::sal_Int8 > * >(0)) ==
550 ::cppu::UnoType< css::beans::Optional< ::sal_Int8 > >::get());
551 CPPUNIT_ASSERT(
552 ::cppu::getTypeFavourChar(static_cast< css::uno::Exception * >(0)) ==
553 ::cppu::UnoType< css::uno::Exception >::get());
554 CPPUNIT_ASSERT(
555 ::cppu::getTypeFavourChar(static_cast< DerivedException1 * >(0)) ==
556 ::cppu::UnoType< css::uno::Exception >::get());
557 CPPUNIT_ASSERT(
558 ::cppu::getTypeFavourChar(
559 static_cast< css::uno::RuntimeException * >(0)) ==
560 ::cppu::UnoType< css::uno::RuntimeException >::get());
561 CPPUNIT_ASSERT(
562 ::cppu::getTypeFavourChar(static_cast< DerivedException2 * >(0)) ==
563 ::cppu::UnoType< css::uno::RuntimeException >::get());
564 CPPUNIT_ASSERT(
565 ::cppu::getTypeFavourChar(
566 static_cast< css::uno::XInterface * >(0)) ==
567 ::cppu::UnoType< css::uno::XInterface >::get());
568 CPPUNIT_ASSERT(
569 ::cppu::getTypeFavourChar(
570 static_cast< css::uno::Reference< css::uno::XInterface > * >(0)) ==
571 ::cppu::UnoType< css::uno::XInterface >::get());
572 CPPUNIT_ASSERT(
573 ::cppu::getTypeFavourChar(static_cast< DerivedInterface1 * >(0)) ==
574 ::cppu::UnoType< css::uno::XInterface >::get());
575 CPPUNIT_ASSERT(
576 ::cppu::getTypeFavourChar(
577 static_cast< css::uno::Reference< DerivedInterface1 > * >(0)) ==
578 ::cppu::UnoType< css::uno::XInterface >::get());
579 CPPUNIT_ASSERT(
580 ::cppu::getTypeFavourChar(
581 static_cast< css::uno::XComponentContext * >(0)) ==
582 ::cppu::UnoType< css::uno::XComponentContext >::get());
583 CPPUNIT_ASSERT(
584 ::cppu::getTypeFavourChar(
585 static_cast<
586 css::uno::Reference< css::uno::XComponentContext > * >(0)) ==
587 ::cppu::UnoType< css::uno::XComponentContext >::get());
588 CPPUNIT_ASSERT(
589 ::cppu::getTypeFavourChar(static_cast< DerivedInterface2 * >(0)) ==
590 ::cppu::UnoType< css::uno::XComponentContext >::get());
591 CPPUNIT_ASSERT(
592 ::cppu::getTypeFavourChar(
593 static_cast< css::uno::Reference< DerivedInterface2 > * >(0)) ==
594 ::cppu::UnoType< css::uno::XComponentContext >::get());
597 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
601 CPPUNIT_PLUGIN_IMPLEMENT();
603 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */