diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-06 14:07:40 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-07 03:01:54 (GMT) |
commit | 1c466daff4560bb287b9ae688f21d933f34a902c (patch) | |
tree | c907e473146b1465d7d2422c70ba6fa19b9a5fb0 /tests | |
parent | 955b581c8aca60d16837a994de5fa43e0f178d5f (diff) | |
download | Qt-1c466daff4560bb287b9ae688f21d933f34a902c.zip Qt-1c466daff4560bb287b9ae688f21d933f34a902c.tar.gz Qt-1c466daff4560bb287b9ae688f21d933f34a902c.tar.bz2 |
add test for QT-2270
(cherry picked from commit 56187037e3fe46800bfa670197a149121f00573e)
Diffstat (limited to 'tests')
-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" |