tst_qqmlecmascript: Cast pointer to unsigned for printing
Otherwise QString::number() will apparently extend "negative" values to 64bits even if the actual type is only 32bits long. Change-Id: Ibdecff2fe707616d2254b7e34e08247f0ff52489 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
f19ec4561b
commit
e38ab72a7c
|
@ -2047,7 +2047,7 @@ void tst_qqmlecmascript::functionErrors()
|
||||||
|
|
||||||
QObject *resource = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
QObject *resource = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
||||||
warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
||||||
warning = warning.arg(QString::number((qintptr)resource, 16));
|
warning = warning.arg(QString::number(quintptr(resource), 16));
|
||||||
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
|
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed.
|
||||||
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
||||||
delete object;
|
delete object;
|
||||||
|
@ -4553,7 +4553,7 @@ void tst_qqmlecmascript::scarceResources_other()
|
||||||
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
||||||
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
|
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
|
||||||
expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
||||||
expectedWarning = expectedWarning.arg(QString::number((qintptr)eo, 16));
|
expectedWarning = expectedWarning.arg(QString::number(quintptr(eo), 16));
|
||||||
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
|
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
|
||||||
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
||||||
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
|
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
|
||||||
|
@ -4627,7 +4627,7 @@ void tst_qqmlecmascript::scarceResources_other()
|
||||||
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>());
|
||||||
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
|
QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage.
|
||||||
expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function");
|
||||||
expectedWarning = expectedWarning.arg(QString::number((qintptr)eo, 16));
|
expectedWarning = expectedWarning.arg(QString::number(quintptr(eo), 16));
|
||||||
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
|
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed.
|
||||||
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
QMetaObject::invokeMethod(object, "retrieveScarceResource");
|
||||||
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
|
QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred.
|
||||||
|
|
Loading…
Reference in New Issue