summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptextqobject
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-01-18 13:56:22 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-01-18 14:06:47 (GMT)
commit2f6459ff25a59e913b5695dcd8919ead8d58947c (patch)
tree0706b81b7ab9a5de17cf932001fe3bd031faf3dd /tests/auto/qscriptextqobject
parent5346edef00dd8f541f16217e0960fd6bb4ea0981 (diff)
downloadQt-2f6459ff25a59e913b5695dcd8919ead8d58947c.zip
Qt-2f6459ff25a59e913b5695dcd8919ead8d58947c.tar.gz
Qt-2f6459ff25a59e913b5695dcd8919ead8d58947c.tar.bz2
don't assert when calling QtScript-wrapped method of deleted QObject
Make it behave the same as the old (4.5) back-end. Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'tests/auto/qscriptextqobject')
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 3415163..de9d37e 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -2913,7 +2913,8 @@ void tst_QScriptExtQObject::objectDeleted()
v.setProperty("intProperty", QScriptValue(&eng, 123));
QCOMPARE(qobj->intProperty(), 123);
qobj->resetQtFunctionInvoked();
- v.property("myInvokable").call(v);
+ QScriptValue invokable = v.property("myInvokable");
+ invokable.call(v);
QCOMPARE(qobj->qtFunctionInvoked(), 0);
// now delete the object
@@ -2951,6 +2952,14 @@ void tst_QScriptExtQObject::objectDeleted()
QCOMPARE(ret.toString(), QLatin1String("Error: cannot access member `myInvokableWithIntArg' of deleted QObject"));
}
+ // Meta-method wrappers are still valid, but throw error when called
+ QVERIFY(invokable.isFunction());
+ {
+ QScriptValue ret = invokable.call(v);
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("Error: cannot call function of deleted QObject"));
+ }
+
// access from script
eng.globalObject().setProperty("o", v);
{