aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/declarative/script
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/declarative/script')
-rw-r--r--tests/benchmarks/declarative/script/data/CustomObject.qml48
-rw-r--r--tests/benchmarks/declarative/script/data/block.qml75
-rw-r--r--tests/benchmarks/declarative/script/data/enums.qml51
-rw-r--r--tests/benchmarks/declarative/script/data/global.js54
-rw-r--r--tests/benchmarks/declarative/script/data/global_prop.qml53
-rw-r--r--tests/benchmarks/declarative/script/data/namespacedEnums.qml52
-rw-r--r--tests/benchmarks/declarative/script/data/script.js1
-rw-r--r--tests/benchmarks/declarative/script/data/script2.js2
-rw-r--r--tests/benchmarks/declarative/script/data/scriptCall.qml54
-rw-r--r--tests/benchmarks/declarative/script/data/signal_args.qml47
-rw-r--r--tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml51
-rw-r--r--tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml54
-rw-r--r--tests/benchmarks/declarative/script/data/signal_qml.qml47
-rw-r--r--tests/benchmarks/declarative/script/data/signal_unconnected.qml45
-rw-r--r--tests/benchmarks/declarative/script/data/signal_unusedArgs.qml47
-rw-r--r--tests/benchmarks/declarative/script/data/slot_complex.qml57
-rw-r--r--tests/benchmarks/declarative/script/data/slot_complex_js.js8
-rw-r--r--tests/benchmarks/declarative/script/data/slot_complex_js.qml49
-rw-r--r--tests/benchmarks/declarative/script/data/slot_simple.qml50
-rw-r--r--tests/benchmarks/declarative/script/data/slot_simple_js.js3
-rw-r--r--tests/benchmarks/declarative/script/data/slot_simple_js.qml48
-rw-r--r--tests/benchmarks/declarative/script/script.pro11
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp852
23 files changed, 0 insertions, 1759 deletions
diff --git a/tests/benchmarks/declarative/script/data/CustomObject.qml b/tests/benchmarks/declarative/script/data/CustomObject.qml
deleted file mode 100644
index 7c8c561114..0000000000
--- a/tests/benchmarks/declarative/script/data/CustomObject.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 QtQuick 2.0
-
-QtObject {
- property real prop1: 0
- property real prop2: 1
- property real prop3: 0
-}
diff --git a/tests/benchmarks/declarative/script/data/block.qml b/tests/benchmarks/declarative/script/data/block.qml
deleted file mode 100644
index 67ad5cbed2..0000000000
--- a/tests/benchmarks/declarative/script/data/block.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 QtQuick 2.0
-
-Rectangle {
- width: 200; height: 200
- CustomObject { id: theObject }
- function doSomethingDirect() {
- theObject.prop1 = 0;
-
- for (var i = 0; i < 1000; ++i)
- theObject.prop1 += theObject.prop2;
-
- theObject.prop3 = theObject.prop1;
- }
-
- function doSomethingLocalObj() {
- theObject.prop1 = 0;
-
- var incrementObj = theObject;
- for (var i = 0; i < 1000; ++i)
- incrementObj.prop1 += incrementObj.prop2;
-
- incrementObj.prop3 = incrementObj.prop1;
- }
-
- function doSomethingLocal() {
- theObject.prop1 = 0;
-
- var increment = theObject.prop2;
- for (var i = 0; i < 1000; ++i)
- theObject.prop1 += increment;
-
- theObject.prop3 = theObject.prop1;
- }
-}
diff --git a/tests/benchmarks/declarative/script/data/enums.qml b/tests/benchmarks/declarative/script/data/enums.qml
deleted file mode 100644
index 8450b15732..0000000000
--- a/tests/benchmarks/declarative/script/data/enums.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QtQuick 2.0
-
-Item {
- function runtest() {
- var a = 0;
- for (var ii = 0; ii < 100000; ++ii)
- a += Text.RichText;
- return a;
- }
-}
diff --git a/tests/benchmarks/declarative/script/data/global.js b/tests/benchmarks/declarative/script/data/global.js
deleted file mode 100644
index 4e3a4780f9..0000000000
--- a/tests/benchmarks/declarative/script/data/global.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite 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$
-**
-****************************************************************************/
-
-var incVar = 1;
-var total;
-
-function doSomething() {
- for (var i = 0; i < 10000; ++i)
- Math.sin(90);
-}
-
-function doIncrement() {
- total = 0;
- for (var i = 0; i < 100000; ++i)
- total += incVar;
-}
diff --git a/tests/benchmarks/declarative/script/data/global_prop.qml b/tests/benchmarks/declarative/script/data/global_prop.qml
deleted file mode 100644
index c77faaf9f4..0000000000
--- a/tests/benchmarks/declarative/script/data/global_prop.qml
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite 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 QtQuick 2.0
-import "global.js" as Program
-
-Rectangle {
- width: 200; height: 200
-
- signal triggered
- signal incrementTriggered
-
- onTriggered: Program.doSomething();
- onIncrementTriggered: Program.doIncrement();
-}
diff --git a/tests/benchmarks/declarative/script/data/namespacedEnums.qml b/tests/benchmarks/declarative/script/data/namespacedEnums.qml
deleted file mode 100644
index e49bf7e1ad..0000000000
--- a/tests/benchmarks/declarative/script/data/namespacedEnums.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QtQuick 2.0 as QtQuick
-
-QtQuick.Item {
- function runtest() {
- var a = 0;
- for (var ii = 0; ii < 100000; ++ii)
- a += QtQuick.Text.RichText;
- return a;
- }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/script.js b/tests/benchmarks/declarative/script/data/script.js
deleted file mode 100644
index 9f46570004..0000000000
--- a/tests/benchmarks/declarative/script/data/script.js
+++ /dev/null
@@ -1 +0,0 @@
-function func() { return 1; }
diff --git a/tests/benchmarks/declarative/script/data/script2.js b/tests/benchmarks/declarative/script/data/script2.js
deleted file mode 100644
index 102f081140..0000000000
--- a/tests/benchmarks/declarative/script/data/script2.js
+++ /dev/null
@@ -1,2 +0,0 @@
-function func() { return 2; }
-
diff --git a/tests/benchmarks/declarative/script/data/scriptCall.qml b/tests/benchmarks/declarative/script/data/scriptCall.qml
deleted file mode 100644
index 420f621dfc..0000000000
--- a/tests/benchmarks/declarative/script/data/scriptCall.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QtQuick 2.0
-import "script.js" as Script
-import "script2.js" as OtherScript
-
-Item {
- function runtest() {
- var a = 0;
- for (var ii = 0; ii < 1000000; ++ii)
- a += Script.func();
- return a;
- }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/signal_args.qml b/tests/benchmarks/declarative/script/data/signal_args.qml
deleted file mode 100644
index ed5c56a197..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_args.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 = n; return a; }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml b/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml
deleted file mode 100644
index a9675c333b..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_heavyArgsAccess.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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/declarative/script/data/signal_heavyIdAccess.qml b/tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml
deleted file mode 100644
index e426ee5116..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_heavyIdAccess.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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/declarative/script/data/signal_qml.qml b/tests/benchmarks/declarative/script/data/signal_qml.qml
deleted file mode 100644
index c5bda7d18e..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_qml.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 {
- onMySignal: { var a = 1; return a; }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/signal_unconnected.qml b/tests/benchmarks/declarative/script/data/signal_unconnected.qml
deleted file mode 100644
index 90fe2bc6f5..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_unconnected.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 {
-}
diff --git a/tests/benchmarks/declarative/script/data/signal_unusedArgs.qml b/tests/benchmarks/declarative/script/data/signal_unusedArgs.qml
deleted file mode 100644
index 6de5815939..0000000000
--- a/tests/benchmarks/declarative/script/data/signal_unusedArgs.qml
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 = 1; return a; }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/slot_complex.qml b/tests/benchmarks/declarative/script/data/slot_complex.qml
deleted file mode 100644
index 8e2cb30089..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_complex.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 {
- function myCustomFunction(b) {
- var n = b;
- var a = 1;
- while (n > 0) {
- a = a * n;
- n--;
- }
- return a;
- }
-
- onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(10); } }
-}
-
diff --git a/tests/benchmarks/declarative/script/data/slot_complex_js.js b/tests/benchmarks/declarative/script/data/slot_complex_js.js
deleted file mode 100644
index 64a1f65daa..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_complex_js.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function myCustomFunction(n) {
- var a = 1;
- while (n > 0) {
- a = a * n;
- n--;
- }
- return a;
-}
diff --git a/tests/benchmarks/declarative/script/data/slot_complex_js.qml b/tests/benchmarks/declarative/script/data/slot_complex_js.qml
deleted file mode 100644
index ca06046389..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_complex_js.qml
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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
-import "slot_complex_js.js" as Logic
-
-TestObject {
- onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(10); } }
-}
-
-
diff --git a/tests/benchmarks/declarative/script/data/slot_simple.qml b/tests/benchmarks/declarative/script/data/slot_simple.qml
deleted file mode 100644
index c93fbcc757..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_simple.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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 {
- function myCustomFunction() {
- return 0;
- }
-
- onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(); } }
-}
diff --git a/tests/benchmarks/declarative/script/data/slot_simple_js.js b/tests/benchmarks/declarative/script/data/slot_simple_js.js
deleted file mode 100644
index d6e60608da..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_simple_js.js
+++ /dev/null
@@ -1,3 +0,0 @@
-function myCustomFunction() {
- return 0;
-}
diff --git a/tests/benchmarks/declarative/script/data/slot_simple_js.qml b/tests/benchmarks/declarative/script/data/slot_simple_js.qml
deleted file mode 100644
index 07334ab4fa..0000000000
--- a/tests/benchmarks/declarative/script/data/slot_simple_js.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclarative 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
-import "slot_simple_js.js" as Logic
-
-TestObject {
- onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(); } }
-}
-
diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro
deleted file mode 100644
index 6b454beed5..0000000000
--- a/tests/benchmarks/declarative/script/script.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += testcase
-TEMPLATE = app
-TARGET = tst_script
-macx:CONFIG -= app_bundle
-CONFIG += release
-
-SOURCES += tst_script.cpp
-
-QT += core-private gui-private v8-private declarative-private quick-private testlib
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
deleted file mode 100644
index 77a0d36d3a..0000000000
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ /dev/null
@@ -1,852 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite 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$
-**
-****************************************************************************/
-
-#include <qtest.h>
-#include <QDeclarativeEngine>
-#include <QDeclarativeComponent>
-#include <private/qdeclarativeengine_p.h>
-#include <private/qquickrectangle_p.h>
-#include <QJSEngine>
-#include <QJSValue>
-
-class tst_script : public QObject
-{
- Q_OBJECT
-public:
- tst_script() {}
-
-private slots:
- void initTestCase();
-
- void property_js();
- void property_getter_js();
-#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();
-
- void setproperty_js();
- 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();
-
- void signal_unconnected();
- void signal_qml();
- void signal_args();
- void signal_unusedArgs();
- void signal_heavyArgsAccess();
- void signal_heavyIdAccess();
-
- void slot_simple();
- void slot_simple_js();
- void slot_complex();
- void slot_complex_js();
-
- void block_data();
- void block();
-
- void global_property_js();
- void global_property_qml();
- void global_property_qml_js();
-
- void scriptfile_property();
-
- void enums();
- void namespacedEnums();
- void scriptCall();
-};
-
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
-}
-
-class TestObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int x READ x WRITE setX)
-
-public:
- TestObject(QObject *parent = 0);
-
- int x();
- void setX(int x) { m_x = x; }
-
- void emitMySignal() { emit mySignal(); }
- void emitMySignalWithArgs(int n) { emit mySignalWithArgs(n); }
-
-signals:
- void mySignal();
- void mySignalWithArgs(int n);
-
-public slots:
- int method() {
- return x();
- }
-
- int methodArgs(int val) {
- return val + x();
- }
-
-private:
- int m_x;
-};
-QML_DECLARE_TYPE(TestObject);
-
-TestObject::TestObject(QObject *parent)
-: QObject(parent), m_x(0)
-{
-}
-
-int TestObject::x()
-{
- return m_x++;
-}
-
-void tst_script::initTestCase()
-{
- qmlRegisterType<TestObject>("Qt.test", 1, 0, "TestObject");
-}
-
-
-#define PROPERTY_PROGRAM \
- "(function(testObject) { return (function() { " \
- " var test = 0; " \
- " for (var ii = 0; ii < 10000; ++ii) { " \
- " test += testObject.x; " \
- " } " \
- " return test; " \
- "}); })"
-
-void tst_script::property_js()
-{
- QJSEngine engine;
-
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("x"), 10);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call().toNumber();
- }
-}
-
-#if 0
-static QJSValue property_getter_method(QScriptContext *, QJSEngine *engine)
-{
- static int x = 0;
- return QJSValue(engine,x++);
-}
-
-void tst_script::property_getter()
-{
- QJSEngine engine;
-
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_method),
- QJSValue::PropertyGetter);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-static TestObject *property_getter_qobject_object = 0;
-static QJSValue property_getter_qobject_method(QScriptContext *, QJSEngine *)
-{
- static int 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 QJSValue(value);
-}
-
-static QJSValue property_getter_qmetaproperty_method(QScriptContext *, QJSEngine *)
-{
- static int 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 QJSValue(value);
-}
-
-void tst_script::property_getter_qobject()
-{
- QJSEngine engine;
-
- TestObject to;
- property_getter_qobject_object = &to;
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qobject_method),
- QJSValue::PropertyGetter);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
- property_getter_qobject_object = 0;
-}
-
-void tst_script::property_getter_qmetaproperty()
-{
- QJSEngine engine;
-
- TestObject to;
- property_getter_qobject_object = &to;
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("x"), engine.newFunction(property_getter_qmetaproperty_method),
- QJSValue::PropertyGetter);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
- property_getter_qobject_object = 0;
-}
-#endif
-
-void tst_script::property_getter_js()
-{
- QJSEngine engine;
-
- QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.__defineGetter__(\"x\", function() { return this._x++; }); return o; })").call();
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::property_qobject()
-{
- QJSEngine engine;
-
- TestObject to;
- QJSValue v = engine.newQObject(&to);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::property_qmlobject()
-{
- QDeclarativeEngine qmlengine;
-
- TestObject to;
- QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine);
- v8::HandleScope handle_scope;
- v8::Context::Scope scope(engine->context());
- QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
-
- QJSValueList args;
- args << v;
- QJSValue prog = qmlengine.evaluate(PROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-#define SETPROPERTY_PROGRAM \
- "(function(testObject) { return (function() { " \
- " for (var ii = 0; ii < 10000; ++ii) { " \
- " testObject.x = ii; " \
- " } " \
- "}); })"
-
-void tst_script::setproperty_js()
-{
- QJSEngine engine;
-
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("x"), 0);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(SETPROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::setproperty_qmlobject()
-{
- QDeclarativeEngine qmlengine;
-
- TestObject to;
-
- QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine);
- v8::HandleScope handle_scope;
- v8::Context::Scope scope(engine->context());
- QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
-
- QJSValueList args;
- args << v;
- QJSValue prog = qmlengine.evaluate(SETPROPERTY_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-#define FUNCTION_PROGRAM \
- "(function(testObject) { return (function() { " \
- " var test = 0; " \
- " for (var ii = 0; ii < 10000; ++ii) { " \
- " test += testObject.method(); " \
- " } " \
- " return test; " \
- "}); })"
-
-void tst_script::function_js()
-{
- QJSEngine engine;
-
- QJSValue v = engine.evaluate("(function() { var o = new Object; o._x = 0; o.method = (function() { return this._x++; }); return o; })").call();
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-#if 0
-static QJSValue function_method(QScriptContext *, QJSEngine *)
-{
- static int x = 0;
- return QJSValue(x++);
-}
-
-void tst_script::function_cpp()
-{
- QJSEngine engine;
-
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("method"), engine.newFunction(function_method));
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-#endif
-
-void tst_script::function_qobject()
-{
- QJSEngine engine;
-
- TestObject to;
- QJSValue v = engine.newQObject(&to);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(FUNCTION_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::function_qmlobject()
-{
- QDeclarativeEngine qmlengine;
-
- TestObject to;
-
- QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine);
- v8::HandleScope handle_scope;
- v8::Context::Scope scope(engine->context());
- QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
-
- QJSValueList args;
- args << v;
- QJSValue prog = qmlengine.evaluate(FUNCTION_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-#define FUNCTION_ARGS_PROGRAM \
- "(function(testObject) { return (function() { " \
- " var test = 0; " \
- " for (var ii = 0; ii < 10000; ++ii) { " \
- " test += testObject.methodArgs(ii); " \
- " } " \
- " return test; " \
- "}); })"
-
-void tst_script::function_args_js()
-{
- QJSEngine engine;
-
- 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;
- QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-#if 0
-static QJSValue function_args_method(QScriptContext *ctxt, QJSEngine *)
-{
- static int x = 0;
- return QJSValue(ctxt->argument(0).toNumber() + x++);
-}
-
-void tst_script::function_args_cpp()
-{
- QJSEngine engine;
-
- QJSValue v = engine.newObject();
- v.setProperty(QLatin1String("methodArgs"), engine.newFunction(function_args_method));
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-#endif
-
-void tst_script::function_args_qobject()
-{
- QJSEngine engine;
-
- TestObject to;
- QJSValue v = engine.newQObject(&to);
-
- QJSValueList args;
- args << v;
- QJSValue prog = engine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::function_args_qmlobject()
-{
- QDeclarativeEngine qmlengine;
-
- TestObject to;
-
- QV8Engine *engine = QDeclarativeEnginePrivate::getV8Engine(&qmlengine);
- v8::HandleScope handle_scope;
- v8::Context::Scope scope(engine->context());
- QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to));
-
- QJSValueList args;
- args << v;
- QJSValue prog = qmlengine.evaluate(FUNCTION_ARGS_PROGRAM).call(args);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::signal_unconnected()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("signal_unconnected.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::signal_qml()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("signal_qml.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::signal_args()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("signal_args.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignalWithArgs(11);
- }
-
- delete object;
-}
-
-void tst_script::signal_unusedArgs()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("signal_unusedArgs.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignalWithArgs(11);
- }
-
- delete object;
-}
-
-void tst_script::signal_heavyArgsAccess()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent 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()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent 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()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("slot_simple.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::slot_simple_js()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("slot_simple_js.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::slot_complex()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("slot_complex.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::slot_complex_js()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("slot_complex_js.qml"));
- TestObject *object = qobject_cast<TestObject *>(component.create());
- QVERIFY(object != 0);
-
- QBENCHMARK {
- object->emitMySignal();
- }
-
- delete object;
-}
-
-void tst_script::block_data()
-{
- QTest::addColumn<QString>("methodName");
- QTest::newRow("direct") << "doSomethingDirect()";
- QTest::newRow("localObj") << "doSomethingLocalObj()";
- QTest::newRow("local") << "doSomethingLocal()";
-}
-
-void tst_script::block()
-{
- QFETCH(QString, methodName);
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("block.qml"));
- QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
- QVERIFY(rect != 0);
-
- int index = rect->metaObject()->indexOfMethod(methodName.toUtf8());
- QVERIFY(index != -1);
- QMetaMethod method = rect->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(rect, Qt::DirectConnection);
- }
-
- delete rect;
-}
-
-#define GLOBALPROPERTY_PROGRAM \
- "(function() { " \
- " for (var ii = 0; ii < 10000; ++ii) { " \
- " Math.sin(90); " \
- " } " \
- "})"
-
-void tst_script::global_property_js()
-{
- QJSEngine engine;
-
- QJSValue prog = engine.evaluate(GLOBALPROPERTY_PROGRAM);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::global_property_qml()
-{
- QDeclarativeEngine qmlengine;
-
- QJSValue prog = qmlengine.evaluate(GLOBALPROPERTY_PROGRAM);
- prog.call();
-
- QBENCHMARK {
- prog.call();
- }
-}
-
-void tst_script::global_property_qml_js()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("global_prop.qml"));
- QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
- QVERIFY(rect != 0);
-
- int index = rect->metaObject()->indexOfMethod("triggered()");
- QVERIFY(index != -1);
- QMetaMethod method = rect->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(rect, Qt::DirectConnection);
- }
-
- delete rect;
-}
-
-void tst_script::scriptfile_property()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("global_prop.qml"));
- QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(component.create());
- QVERIFY(rect != 0);
-
- int index = rect->metaObject()->indexOfMethod("incrementTriggered()");
- QVERIFY(index != -1);
- QMetaMethod method = rect->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(rect, Qt::DirectConnection);
- }
-
- delete rect;
-}
-
-void tst_script::enums()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("enums.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- int index = o->metaObject()->indexOfMethod("runtest()");
- QVERIFY(index != -1);
- QMetaMethod method = o->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(o, Qt::DirectConnection);
- }
-
- delete o;
-}
-
-void tst_script::namespacedEnums()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("namespacedEnums.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- int index = o->metaObject()->indexOfMethod("runtest()");
- QVERIFY(index != -1);
- QMetaMethod method = o->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(o, Qt::DirectConnection);
- }
-
- delete o;
-}
-
-void tst_script::scriptCall()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("scriptCall.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
-
- int index = o->metaObject()->indexOfMethod("runtest()");
- QVERIFY(index != -1);
- QMetaMethod method = o->metaObject()->method(index);
-
- QBENCHMARK {
- method.invoke(o, Qt::DirectConnection);
- }
-
- delete o;
-}
-
-QTEST_MAIN(tst_script)
-
-#include "tst_script.moc"