diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-12 20:43:45 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-06-13 08:53:06 +0200 |
commit | 67f9d4785fbdc6a7e63e9a4cced7298666d56a11 (patch) | |
tree | 0bb30d0c9ccbd49cf16b7a72bb4fafe1bdf4faf6 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | ebc31ca3c4a6a49c274f82af52a2e1b6cace30b7 (diff) |
Fix toString lookups on QObject bindings (And thus qqmlecmascript::toObjectString)
Change-Id: I20e5788e8810d9354ca51245ee05181c9f4648ae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index cfbd987f94..a9a63d5855 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1795,7 +1795,9 @@ void tst_qqmlecmascript::functionErrors() object = componentTwo.create(); QVERIFY(object != 0); - warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] is not a function"); + 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 = warning.arg(QString::number((qintptr)resource, 16)); QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); delete object; @@ -4112,7 +4114,8 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - expectedWarning = varComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] 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)); QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. @@ -4184,7 +4187,8 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - expectedWarning = variantComponentTwelve.url().toString() + QLatin1String(":16: TypeError: Property 'scarceResource' of object [object Object] 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)); QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); // we expect a meaningful warning to be printed. QMetaObject::invokeMethod(object, "retrieveScarceResource"); QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. |