diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-09 14:52:46 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2011-05-18 11:02:59 +1000 |
commit | e8bb0b083ae3329c6c7f638c0ad269576b301bf1 (patch) | |
tree | 94d796eaee783028cb084e8306629fe0c4464f0b /tests/auto/qscriptengine/tst_qscriptengine.cpp | |
parent | 1f8fba4de211299133d168d92d5d196900070e42 (diff) | |
download | qtscript-e8bb0b083ae3329c6c7f638c0ad269576b301bf1.tar.gz |
Remove Q_ASSERT from qscriptengine autotest
Rather than aborting in debug builds and failing silently in release
builds, output a meaningful warning message and return a null
QScriptValue which will cause the "isQObject" check in the testfunction
to fail.
Change-Id: I69fd9c15a69924d0abfde6710ea6ae4bf7e013fa
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 3b7f3757efb038fe523a00d474d1b92920f9abe8)
Diffstat (limited to 'tests/auto/qscriptengine/tst_qscriptengine.cpp')
-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 bc4091d..1a9db8f 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -5701,7 +5701,10 @@ void tst_QScriptEngine::collectGarbageAfterNativeArguments() static QScriptValue constructQObjectFromThisObject(QScriptContext *ctx, QScriptEngine *eng) { - Q_ASSERT(ctx->isCalledAsConstructor()); + if (!ctx->isCalledAsConstructor()) { + qWarning("%s: ctx->isCalledAsConstructor() returned false", Q_FUNC_INFO); + return QScriptValue(); + } return eng->newQObject(ctx->thisObject(), new QObject, QScriptEngine::ScriptOwnership); } |