diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-31 09:08:23 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-31 09:11:37 (GMT) |
commit | 3216fe93a400980ec9d1a4eeafa1c700db56ded2 (patch) | |
tree | 6effa549f578d495d259d5b71ee1386fdcdde520 /tests/auto | |
parent | 734badac98a81b6a1937dc94ac52839c52eee8a9 (diff) | |
download | Qt-3216fe93a400980ec9d1a4eeafa1c700db56ded2.zip Qt-3216fe93a400980ec9d1a4eeafa1c700db56ded2.tar.gz Qt-3216fe93a400980ec9d1a4eeafa1c700db56ded2.tar.bz2 |
fix crash due to double deletion
Needed due to commit 3636e666528b72de79f8c7012690bb9e279f0863
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 1c09693..beba26a 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2243,9 +2243,31 @@ void tst_QScriptValue::getSetScriptClass() obj.setScriptClass(&testClass); QEXPECT_FAIL("", "With JSC back-end, the class of a plain object created in JS can't be changed", Continue); QCOMPARE(obj.scriptClass(), (QScriptClass*)&testClass); + QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setScriptClass() failed: cannot change class of non-QScriptObject"); obj.setScriptClass(0); QCOMPARE(obj.scriptClass(), (QScriptClass*)0); } + // object that already has a(n internal) class + { + QScriptValue obj = eng.newVariant(QUrl("http://example.com")); + QVERIFY(obj.isVariant()); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + obj.setScriptClass(&testClass); + QCOMPARE(obj.scriptClass(), &testClass); + QVERIFY(obj.isObject()); + QVERIFY(!obj.isVariant()); + QVERIFY(!obj.toVariant().isValid()); + } + { + QScriptValue obj = eng.newQObject(this); + QVERIFY(obj.isQObject()); + QCOMPARE(obj.scriptClass(), (QScriptClass*)0); + obj.setScriptClass(&testClass); + QCOMPARE(obj.scriptClass(), &testClass); + QVERIFY(obj.isObject()); + QVERIFY(!obj.isQObject()); + QVERIFY(obj.toQObject() == 0); + } } static QScriptValue getArg(QScriptContext *ctx, QScriptEngine *) |