From: Rohan McGovern Date: Wed, 8 Feb 2012 06:56:38 +0000 (+1000) Subject: Fixed tst_qobject::property for clang X-Git-Tag: qt-v5.0.0-alpha1~1205 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=adfca27ac09cfd87121bb3611d74a75136ea6498;p=profile%2Fivi%2Fqtbase.git Fixed tst_qobject::property for clang The test was failing at: QCOMPARE(property.userType(), qMetaTypeId()); The CustomType* metatype was not registered before this part of the test. qMetaTypeId will register the metatype for T before returning it if it is not yet registered, while QMetaProperty::userType() returns 0 if the metatype is not yet registered. However, the order of evaluation of these two expressions in the above statement is technically undefined. Apparently, gcc evaluates the arguments in order from right to left, allowing the test to pass, while clang evaluates the arguments in order from left to right, causing the test to fail. Change-Id: I5059556e860cec29b57c31e4e26f46cf9e6055da Reviewed-by: Jędrzej Nowacki --- diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 4e7935b..91b93e4 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1703,6 +1703,7 @@ void tst_QObject::property() QVERIFY(property.isWritable()); QVERIFY(!property.isEnumType()); QCOMPARE(property.typeName(), "CustomType*"); + qRegisterMetaType(); QCOMPARE(property.type(), QVariant::UserType); QCOMPARE(property.userType(), qMetaTypeId());