Fixed tst_qobject::property for clang

The test was failing at:

  QCOMPARE(property.userType(), qMetaTypeId<CustomType*>());

The CustomType* metatype was not registered before this part of the
test.

qMetaTypeId<T> 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 <jedrzej.nowacki@nokia.com>
This commit is contained in:
Rohan McGovern 2012-02-08 16:56:38 +10:00 committed by Qt by Nokia
parent 68cee5258b
commit adfca27ac0

View File

@ -1703,6 +1703,7 @@ void tst_QObject::property()
QVERIFY(property.isWritable());
QVERIFY(!property.isEnumType());
QCOMPARE(property.typeName(), "CustomType*");
qRegisterMetaType<CustomType*>();
QCOMPARE(property.type(), QVariant::UserType);
QCOMPARE(property.userType(), qMetaTypeId<CustomType*>());