diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-05 11:39:24 +1000 |
---|---|---|
committer | Matthew Vogt <matthew.vogt@nokia.com> | 2012-03-05 11:39:54 +1000 |
commit | 0284817d6cd7e17afa8da26ee6e9199100754446 (patch) | |
tree | c351d55d5a606c81c72e481f846b9b9e2603c883 /tests/benchmarks | |
parent | 377eb94eb19dafeca20d12bc6b624f1779fae514 (diff) | |
parent | 36bd7f616f37f5f60e59bce1f0d8970248d627de (diff) |
Merge master <-> api_changes
Change-Id: Iad2f07b989b25349fd2d4fff010e24dcd5a1688f
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qml/script/data/enums.qml | 2 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/data/namespacedEnums.qml | 2 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/data/scriptCall.qml | 2 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml | 51 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml | 54 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/script.pro | 3 | ||||
-rw-r--r-- | tests/benchmarks/qml/script/tst_script.cpp | 253 |
7 files changed, 261 insertions, 106 deletions
diff --git a/tests/benchmarks/qml/script/data/enums.qml b/tests/benchmarks/qml/script/data/enums.qml index 8450b15732..f2da9b068e 100644 --- a/tests/benchmarks/qml/script/data/enums.qml +++ b/tests/benchmarks/qml/script/data/enums.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the Declarative module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/tests/benchmarks/qml/script/data/namespacedEnums.qml b/tests/benchmarks/qml/script/data/namespacedEnums.qml index e49bf7e1ad..0f24112d7c 100644 --- a/tests/benchmarks/qml/script/data/namespacedEnums.qml +++ b/tests/benchmarks/qml/script/data/namespacedEnums.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the Declarative module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/tests/benchmarks/qml/script/data/scriptCall.qml b/tests/benchmarks/qml/script/data/scriptCall.qml index 420f621dfc..b4a49b1908 100644 --- a/tests/benchmarks/qml/script/data/scriptCall.qml +++ b/tests/benchmarks/qml/script/data/scriptCall.qml @@ -3,7 +3,7 @@ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/ ** -** This file is part of the Declarative module of the Qt Toolkit. +** This file is part of the QtQml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml b/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml new file mode 100644 index 0000000000..37ef64efef --- /dev/null +++ b/tests/benchmarks/qml/script/data/signal_heavyArgsAccess.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt.test 1.0 + +TestObject { + onMySignalWithArgs: { + var a = 0; + for (var i = 0; i < 10000; ++i) + a += n; + return a; + } +} diff --git a/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml b/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml new file mode 100644 index 0000000000..610fcd001a --- /dev/null +++ b/tests/benchmarks/qml/script/data/signal_heavyIdAccess.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt.test 1.0 + +TestObject { + id: obj + property real inc: 3 + + onMySignalWithArgs: { + var a = 0; + for (var i = 0; i < 10000; ++i) + a += obj.inc; + return a; + } +} diff --git a/tests/benchmarks/qml/script/script.pro b/tests/benchmarks/qml/script/script.pro index 88e8d9b33d..1f836a84f1 100644 --- a/tests/benchmarks/qml/script/script.pro +++ b/tests/benchmarks/qml/script/script.pro @@ -1,10 +1,11 @@ CONFIG += testcase TEMPLATE = app TARGET = tst_script -QT += qml qml-private testlib v8-private core-private macx:CONFIG -= app_bundle CONFIG += release SOURCES += tst_script.cpp +QT += core-private gui-private v8-private qml-private quick-private testlib + DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/benchmarks/qml/script/tst_script.cpp b/tests/benchmarks/qml/script/tst_script.cpp index 204fb945eb..e7418d5fc0 100644 --- a/tests/benchmarks/qml/script/tst_script.cpp +++ b/tests/benchmarks/qml/script/tst_script.cpp @@ -43,10 +43,9 @@ #include <QQmlEngine> #include <QQmlComponent> #include <private/qqmlengine_p.h> -#include <private/qdeclarativeobjectscriptclass_p.h> #include <private/qquickrectangle_p.h> -#include <QScriptEngine> -#include <QScriptValue> +#include <QJSEngine> +#include <QJSValue> class tst_script : public QObject { @@ -58,10 +57,13 @@ private slots: void initTestCase(); void property_js(); - void property_getter(); void property_getter_js(); - void property_getter_qobject(); - void property_getter_qmetaproperty(); +#if 0 + //no native functions for now + void property_getter(); + void property_getter_qobject(); + void property_getter_qmetaproperty(); +#endif void property_qobject(); void property_qmlobject(); @@ -69,12 +71,18 @@ private slots: void setproperty_qmlobject(); void function_js(); +#if 0 + //no native functions for now void function_cpp(); +#endif void function_qobject(); void function_qmlobject(); void function_args_js(); +#if 0 + //no native functions for now void function_args_cpp(); +#endif void function_args_qobject(); void function_args_qmlobject(); @@ -82,6 +90,8 @@ private slots: void signal_qml(); void signal_args(); void signal_unusedArgs(); + void signal_heavyArgsAccess(); + void signal_heavyIdAccess(); void slot_simple(); void slot_simple_js(); @@ -144,7 +154,7 @@ TestObject::TestObject(QObject *parent) { } -int TestObject::x() +int TestObject::x() { return m_x++; } @@ -166,14 +176,14 @@ void tst_script::initTestCase() void tst_script::property_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("x"), 10); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -181,23 +191,24 @@ void tst_script::property_js() } } -static QScriptValue property_getter_method(QScriptContext *, QScriptEngine *engine) +#if 0 +static QJSValue property_getter_method(QScriptContext *, QJSEngine *engine) { static int x = 0; - return QScriptValue(engine,x++); + return QJSValue(engine,x++); } void tst_script::property_getter() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -206,44 +217,44 @@ void tst_script::property_getter() } static TestObject *property_getter_qobject_object = 0; -static QScriptValue property_getter_qobject_method(QScriptContext *, QScriptEngine *) +static QJSValue property_getter_qobject_method(QScriptContext *, QJSEngine *) { static int idx = -1; - if (idx == -1) + if (idx == -1) idx = TestObject::staticMetaObject.indexOfProperty("x"); int value = 0; void *args[] = { &value, 0 }; QMetaObject::metacall(property_getter_qobject_object, QMetaObject::ReadProperty, idx, args); - return QScriptValue(value); + return QJSValue(value); } -static QScriptValue property_getter_qmetaproperty_method(QScriptContext *, QScriptEngine *) +static QJSValue property_getter_qmetaproperty_method(QScriptContext *, QJSEngine *) { static int idx = -1; - if (idx == -1) + if (idx == -1) idx = TestObject::staticMetaObject.indexOfProperty("x"); int value = 0; value = property_getter_qobject_object->metaObject()->property(idx).read(property_getter_qobject_object).toInt(); - return QScriptValue(value); + return QJSValue(value); } void tst_script::property_getter_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; property_getter_qobject_object = &to; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -254,17 +265,17 @@ void tst_script::property_getter_qobject() void tst_script::property_getter_qmetaproperty() { - QScriptEngine engine; + QJSEngine engine; TestObject to; property_getter_qobject_object = &to; - QScriptValue v = engine.newObject(); - v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method), - QScriptValue::PropertyGetter); + QJSValue v = engine.newObject(); + v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method), + QJSValue::PropertyGetter); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -272,17 +283,17 @@ void tst_script::property_getter_qmetaproperty() } property_getter_qobject_object = 0; } - +#endif void tst_script::property_getter_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call(); + QJSEngine engine; + + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call(); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -292,14 +303,14 @@ void tst_script::property_getter_js() void tst_script::property_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(PROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -311,14 +322,15 @@ void tst_script::property_qmlobject() { QQmlEngine qmlengine; - QScriptEngine *engine = QQmlEnginePrivate::getScriptEngine(&qmlengine); TestObject to; + QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValue v = QQmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); - - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(PROPERTY_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(PROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -335,14 +347,14 @@ void tst_script::property_qmlobject() void tst_script::setproperty_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("x"), 0); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -354,14 +366,16 @@ void tst_script::setproperty_qmlobject() { QQmlEngine qmlengine; - QScriptEngine *engine = QQmlEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QQmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(SETPROPERTY_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(SETPROPERTY_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -380,13 +394,13 @@ void tst_script::setproperty_qmlobject() void tst_script::function_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call(); + QJSEngine engine; + + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call(); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -394,39 +408,41 @@ void tst_script::function_js() } } -static QScriptValue function_method(QScriptContext *, QScriptEngine *) +#if 0 +static QJSValue function_method(QScriptContext *, QJSEngine *) { static int x = 0; - return QScriptValue(x++); + return QJSValue(x++); } void tst_script::function_cpp() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("method"), engine.newFunction(function_method)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { prog.call(); } } +#endif void tst_script::function_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -438,14 +454,16 @@ void tst_script::function_qmlobject() { QQmlEngine qmlengine; - QScriptEngine *engine = QQmlEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QQmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(FUNCTION_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(FUNCTION_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -464,13 +482,13 @@ void tst_script::function_qmlobject() void tst_script::function_args_js() { - QScriptEngine engine; - - QScriptValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.methodArgs = (function(a) { return a + this._x++; }); return o; })").call(); + QJSEngine engine; - QScriptValueList args; + QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.methodArgs = (function(a) { return a + this._x++; }); return o; })").call(); + + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -478,39 +496,41 @@ void tst_script::function_args_js() } } -static QScriptValue function_args_method(QScriptContext *ctxt, QScriptEngine *) +#if 0 +static QJSValue function_args_method(QScriptContext *ctxt, QJSEngine *) { static int x = 0; - return QScriptValue(ctxt->argument(0).toNumber() + x++); + return QJSValue(ctxt->argument(0).toNumber() + x++); } void tst_script::function_args_cpp() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue v = engine.newObject(); + QJSValue v = engine.newObject(); v.setProperty(QLatin1String("methodArgs"), engine.newFunction(function_args_method)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { prog.call(); } } +#endif void tst_script::function_args_qobject() { - QScriptEngine engine; + QJSEngine engine; TestObject to; - QScriptValue v = engine.newQObject(&to); + QJSValue v = engine.newQObject(&to); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(engine.globalObject(), args); + QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -522,14 +542,16 @@ void tst_script::function_args_qmlobject() { QQmlEngine qmlengine; - QScriptEngine *engine = QQmlEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QQmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); + v8::HandleScope handle_scope; + v8::Context::Scope scope(engine->context()); + QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - QScriptValueList args; + QJSValueList args; args << v; - QScriptValue prog = engine->evaluate(FUNCTION_ARGS_PROGRAM).call(engine->globalObject(), args); + QJSValue prog = qmlengine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); prog.call(); QBENCHMARK { @@ -593,6 +615,34 @@ void tst_script::signal_unusedArgs() delete object; } +void tst_script::signal_heavyArgsAccess() +{ + QQmlEngine engine; + QQmlComponent component(&engine, TEST_FILE("signal_heavyArgsAccess.qml")); + TestObject *object = qobject_cast<TestObject *>(component.create()); + QVERIFY(object != 0); + + QBENCHMARK { + object->emitMySignalWithArgs(11); + } + + delete object; +} + +void tst_script::signal_heavyIdAccess() +{ + QQmlEngine engine; + QQmlComponent component(&engine, TEST_FILE("signal_heavyIdAccess.qml")); + TestObject *object = qobject_cast<TestObject *>(component.create()); + QVERIFY(object != 0); + + QBENCHMARK { + object->emitMySignalWithArgs(11); + } + + delete object; +} + void tst_script::slot_simple() { QQmlEngine engine; @@ -685,9 +735,9 @@ void tst_script::block() void tst_script::global_property_js() { - QScriptEngine engine; + QJSEngine engine; - QScriptValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM); + QJSValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM); prog.call(); QBENCHMARK { @@ -699,8 +749,7 @@ void tst_script::global_property_qml() { QQmlEngine qmlengine; - QScriptEngine *engine = QQmlEnginePrivate::getScriptEngine(&qmlengine); - QScriptValue prog = engine->evaluate(GLOBALPROPERTY_PROGRAM); + QJSValue prog = qmlengine.evaluate(GLOBALPROPERTY_PROGRAM); prog.call(); QBENCHMARK { |