diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-27 15:16:34 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-27 15:20:40 (GMT) |
commit | a7d03f13fe84e704e243610af73f7b0a8ab5a340 (patch) | |
tree | f5a6ff26f446226af6afcbbf061eabc46ec40988 /tests/auto | |
parent | f41b7967b279609d9d4e1a872c92e753f9aefad3 (diff) | |
download | Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.zip Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.tar.gz Qt-a7d03f13fe84e704e243610af73f7b0a8ab5a340.tar.bz2 |
Fix tst_QScriptValue::call
We have to set the CallFrame correctly in QScriptEngine::evaluate() in
order to ger the 'arguments' object and all the local stuff working.
The code Assert if dynamicGlobalObject is not set, so set it to the
global object.
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index ce38575..126a7e0 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -163,7 +163,6 @@ void tst_QScriptEngine::currentContext() QVERIFY(globalCtx->thisObject().strictlyEquals(eng.globalObject())); QEXPECT_FAIL("", "", Continue); QVERIFY(globalCtx->activationObject().strictlyEquals(eng.globalObject())); - QEXPECT_FAIL("", "", Continue); QVERIFY(globalCtx->argumentsObject().isObject()); } @@ -1262,10 +1261,13 @@ void tst_QScriptEngine::evaluate() static QScriptValue eval_nested(QScriptContext *ctx, QScriptEngine *eng) { QScriptValue result = eng->newObject(); + eng->evaluate("var bar = 'local';"); result.setProperty("thisObjectIdBefore", ctx->thisObject().property("id")); QScriptValue evaluatedThisObject = eng->evaluate("this"); result.setProperty("thisObjectIdAfter", ctx->thisObject().property("id")); result.setProperty("evaluatedThisObjectId", evaluatedThisObject.property("id")); + result.setProperty("local_bar", eng->evaluate("bar")); + return result; } @@ -1274,6 +1276,7 @@ void tst_QScriptEngine::nestedEvaluate() QScriptEngine eng; eng.globalObject().setProperty("fun", eng.newFunction(eval_nested)); QScriptValue result = eng.evaluate("o = { id:'foo'}; o.fun = fun; o.fun()"); + QCOMPARE(result.property("local_bar").toString(), QString("local")); QCOMPARE(result.property("thisObjectIdBefore").toString(), QString("foo")); QCOMPARE(result.property("thisObjectIdAfter").toString(), QString("foo")); QCOMPARE(result.property("evaluatedThisObjectId").toString(), QString("foo")); |