Questions about getCppuType

sberg sbergman at redhat.com
Sun May 18 23:43:02 PDT 2014


On 05/17/2014 01:42 AM, julien2412 [via Document Foundation Mail 
Archive] wrote:
> I noticed that if I did this:
> diff --git a/cppu/qa/test_unotype.cxx b/cppu/qa/test_unotype.cxx
> index bbea200..f0d2b03 100644
> --- a/cppu/qa/test_unotype.cxx
> +++ b/cppu/qa/test_unotype.cxx
> @@ -271,8 +271,8 @@ void Test::testUnoType() {
>   void Test::testGetTypeFavourUnsigned() {
>       CPPUNIT_ASSERT(typeid(::sal_Unicode) == typeid(::sal_uInt16));
>       CPPUNIT_ASSERT(
> -        ::getCppuType(static_cast< ::sal_Unicode * >(0)) ==
> -        ::getCppuType(static_cast< ::sal_uInt16 * >(0)));
> +        cppu::UnoType<cppu::UnoCharType>::get() ==
> +        cppu::UnoType<cppu::UnoUnsignedShortType>::get() );
>
> make cppu gives this:
> /home/julien/compile-libreoffice/libreoffice/cppu/qa/test_unotype.cxx:275:(anonymous
> namespace)::Test::testGetTypeFavourUnsigned
> assertion failed
> - Expression: cppu::UnoType<cppu::UnoCharType>::get() ==
> cppu::UnoType<cppu::UnoUnsignedShortType>::get()
>
> test_unotype.cxx:275:Assertion
> Test name: (anonymous namespace)::Test::testGetTypeFavourUnsigned
> assertion failed
> - Expression: cppu::UnoType<cppu::UnoCharType>::get() ==
> cppu::UnoType<cppu::UnoUnsignedShortType>::get()
>
> Failures !!!
> Run: 3   Failure total: 1   Failures: 1   Errors: 0
>
> I don't understand why it's failing in this case.
> Any idea?

That code is a test that getCppuType (mis-)behaves as advertised, and 
conflates sal_Unicode/sal_uInt16.  Do not change code testing 
getCppuType/getTypeFavourUnsigned/getTypeFavourChar to use UnoType instead.

Stephan




--
View this message in context: http://nabble.documentfoundation.org/Questions-about-getCppuType-tp4106361p4109307.html
Sent from the Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140518/1e874ae5/attachment.html>


More information about the LibreOffice mailing list