diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-01-08 06:44:43 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-01-08 06:44:43 (GMT) |
commit | 17cdfc4b612d0f03bdcc42d4cc00ad8b27202e12 (patch) | |
tree | ecf84c3a7ff26248654611d63ebdd982fd007e13 /tests/benchmarks | |
parent | 73c106a235f655876313197dbf8dc35ee0e41c4e (diff) | |
parent | b30af554ba34bddc4f2487f037113c810597cda0 (diff) | |
download | Qt-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')
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" |