diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-06 14:07:40 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-10-06 14:08:23 (GMT) |
commit | 56187037e3fe46800bfa670197a149121f00573e (patch) | |
tree | 6a6feddcc130324dd714aab5c9f1e65c617dec1a | |
parent | 8037c03174124bc136900c88254d118ab48b010f (diff) | |
download | Qt-56187037e3fe46800bfa670197a149121f00573e.zip Qt-56187037e3fe46800bfa670197a149121f00573e.tar.gz Qt-56187037e3fe46800bfa670197a149121f00573e.tar.bz2 |
add test for QT-2270
-rw-r--r-- | tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index b193d67..89f8a5cf 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -83,6 +83,7 @@ private slots: void argumentsObjectInNative(); void jsActivationObject(); void qobjectAsActivationObject(); + void parentContextCallee_QT2270(); }; tst_QScriptContext::tst_QScriptContext() @@ -1222,5 +1223,21 @@ void tst_QScriptContext::qobjectAsActivationObject() } } +static QScriptValue getParentContextCallee(QScriptContext *ctx, QScriptEngine *) +{ + return ctx->parentContext()->callee(); +} + +void tst_QScriptContext::parentContextCallee_QT2270() +{ + QScriptEngine engine; + engine.globalObject().setProperty("getParentContextCallee", engine.newFunction(getParentContextCallee)); + QScriptValue fun = engine.evaluate("(function() { return getParentContextCallee(); })"); + QVERIFY(fun.isFunction()); + QScriptValue callee = fun.call(); + QEXPECT_FAIL("", "QT-2270: Incorrect parentContext() returned for native call", Abort); + QVERIFY(callee.equals(fun)); +} + QTEST_MAIN(tst_QScriptContext) #include "tst_qscriptcontext.moc" |