From b3796a7b72a8a9aa617c8fd2a64202f3a81fd57f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 19 Aug 2009 15:26:24 +0200 Subject: 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. --- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) -- cgit v0.12