From 56187037e3fe46800bfa670197a149121f00573e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 6 Oct 2009 16:07:40 +0200 Subject: add test for QT-2270 --- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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" -- cgit v0.12