summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-01-08 06:44:43 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-01-08 06:44:43 (GMT)
commit17cdfc4b612d0f03bdcc42d4cc00ad8b27202e12 (patch)
treeecf84c3a7ff26248654611d63ebdd982fd007e13 /tests/benchmarks
parent73c106a235f655876313197dbf8dc35ee0e41c4e (diff)
parentb30af554ba34bddc4f2487f037113c810597cda0 (diff)
downloadQt-17cdfc4b612d0f03bdcc42d4cc00ad8b27202e12.zip
Qt-17cdfc4b612d0f03bdcc42d4cc00ad8b27202e12.tar.gz
Qt-17cdfc4b612d0f03bdcc42d4cc00ad8b27202e12.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/declarative/script/data/slot_complex.qml16
-rw-r--r--tests/benchmarks/declarative/script/data/slot_complex_js.qml18
-rw-r--r--tests/benchmarks/declarative/script/data/slot_simple.qml9
-rw-r--r--tests/benchmarks/declarative/script/data/slot_simple_js.qml13
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp61
5 files changed, 117 insertions, 0 deletions
diff --git a/tests/benchmarks/declarative/script/data/slot_complex.qml b/tests/benchmarks/declarative/script/data/slot_complex.qml
new file mode 100644
index 0000000..d71120d
--- /dev/null
+++ b/tests/benchmarks/declarative/script/data/slot_complex.qml
@@ -0,0 +1,16 @@
+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.qml b/tests/benchmarks/declarative/script/data/slot_complex_js.qml
new file mode 100644
index 0000000..ed4f78b
--- /dev/null
+++ b/tests/benchmarks/declarative/script/data/slot_complex_js.qml
@@ -0,0 +1,18 @@
+import Qt.test 1.0
+
+TestObject {
+ Script {
+ function myCustomFunction(n) {
+ 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_simple.qml b/tests/benchmarks/declarative/script/data/slot_simple.qml
new file mode 100644
index 0000000..4ba98d7
--- /dev/null
+++ b/tests/benchmarks/declarative/script/data/slot_simple.qml
@@ -0,0 +1,9 @@
+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.qml b/tests/benchmarks/declarative/script/data/slot_simple_js.qml
new file mode 100644
index 0000000..a88265c
--- /dev/null
+++ b/tests/benchmarks/declarative/script/data/slot_simple_js.qml
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+
+TestObject {
+
+ Script {
+ function myCustomFunction() {
+ return 0;
+ }
+ }
+
+ onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(); } }
+}
+
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index 9da795d..3c0805a 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -76,6 +76,11 @@ private slots:
void signal_qml();
void signal_args();
void signal_unusedArgs();
+
+ void slot_simple();
+ void slot_simple_js();
+ void slot_complex();
+ void slot_complex_js();
private:
};
@@ -521,6 +526,62 @@ void tst_script::signal_unusedArgs()
delete object;
}
+void tst_script::slot_simple()
+{
+ QmlEngine engine;
+ QmlComponent 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()
+{
+ QmlEngine engine;
+ QmlComponent 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()
+{
+ QmlEngine engine;
+ QmlComponent 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()
+{
+ QmlEngine engine;
+ QmlComponent component(&engine, TEST_FILE("slot_complex_js.qml"));
+ TestObject *object = qobject_cast<TestObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QBENCHMARK {
+ object->emitMySignal();
+ }
+
+ delete object;
+}
+
QTEST_MAIN(tst_script)
#include "tst_script.moc"