LCOV - code coverage report
Current view: top level - cppu/qa - test_unotype.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 323 323 100.0 %
Date: 2015-06-13 12:38:46 Functions: 15 16 93.8 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11