summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscriptvalue
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-19 13:26:24 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-19 13:26:24 (GMT)
commitb3796a7b72a8a9aa617c8fd2a64202f3a81fd57f (patch)
treecdbf83a0a2e52c9cea9865a9004bb36de1cb34b5 /tests/auto/qscriptvalue
parent20c82fb4323c29082c2c59c5d35b942581ea02d8 (diff)
downloadQt-b3796a7b72a8a9aa617c8fd2a64202f3a81fd57f.zip
Qt-b3796a7b72a8a9aa617c8fd2a64202f3a81fd57f.tar.gz
Qt-b3796a7b72a8a9aa617c8fd2a64202f3a81fd57f.tar.bz2
add test to make sure a JavaScript object's ID persists
Even if the QScriptValue is destroyed, the underlying ID should not change; e.g. if a new QScriptValue is created and wraps the same object, the ID should be the same as before.
Diffstat (limited to 'tests/auto/qscriptvalue')
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 87aa896..4b8dadd 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -3304,6 +3304,16 @@ void tst_QScriptValue::objectId()
QVERIFY(eng.objectById(o1.objectId()).strictlyEquals(o1));
QVERIFY(eng.objectById(o2.objectId()).strictlyEquals(o2));
+
+ qint64 globalObjectId = -1;
+ {
+ QScriptValue global = eng.globalObject();
+ globalObjectId = global.objectId();
+ QVERIFY(globalObjectId != -1);
+ QVERIFY(eng.objectById(globalObjectId).strictlyEquals(global));
+ }
+ QEXPECT_FAIL("", "In JSC back-end, the Global Object's ID does not persist", Continue);
+ QVERIFY(eng.objectById(globalObjectId).strictlyEquals(eng.globalObject()));
}
QTEST_MAIN(tst_QScriptValue)