diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-24 11:39:37 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-24 11:41:12 (GMT) |
commit | c354b3d4d27be3fdefc09b73c5b6965c8527e2cd (patch) | |
tree | 75bb202ca0386b6131e625052d7dd775f95a11e7 /tests | |
parent | 95567be17fd5a6e0be95bc3312b3e526c4130ebf (diff) | |
download | Qt-c354b3d4d27be3fdefc09b73c5b6965c8527e2cd.zip Qt-c354b3d4d27be3fdefc09b73c5b6965c8527e2cd.tar.gz Qt-c354b3d4d27be3fdefc09b73c5b6965c8527e2cd.tar.bz2 |
avoid calling QScriptValue::isFunction() inside call() and construct()
Avoid calling virtual function JSC::JSValue::get{Call,Construct}Data()
twice.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 16a9e87..3f231f2 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2504,6 +2504,13 @@ void tst_QScriptValue::call() QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); } + + // calling things that are not functions + QVERIFY(!QScriptValue(false).call().isValid()); + QVERIFY(!QScriptValue(123).call().isValid()); + QVERIFY(!QScriptValue(QString::fromLatin1("ciao")).call().isValid()); + QVERIFY(!QScriptValue(QScriptValue::UndefinedValue).call().isValid()); + QVERIFY(!QScriptValue(QScriptValue::NullValue).call().isValid()); } static QScriptValue ctorReturningUndefined(QScriptContext *ctx, QScriptEngine *) @@ -2629,6 +2636,13 @@ void tst_QScriptValue::construct() QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); } + + // construct on things that are not functions + QVERIFY(!QScriptValue(false).construct().isValid()); + QVERIFY(!QScriptValue(123).construct().isValid()); + QVERIFY(!QScriptValue(QString::fromLatin1("ciao")).construct().isValid()); + QVERIFY(!QScriptValue(QScriptValue::UndefinedValue).construct().isValid()); + QVERIFY(!QScriptValue(QScriptValue::NullValue).construct().isValid()); } void tst_QScriptValue::lessThan() |