summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-24 05:15:05 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-06-24 05:15:05 (GMT)
commit1b4d6818865548b752008242ddbea6a4e5206684 (patch)
tree6fadb7ba12c9a40da35343bffec29e61db3d0ae8 /tests
parent29a406e3622ba44ccf35c6913fbb4ad098674092 (diff)
parentf2fc1355306219eaec9042462d3be4aceed1b829 (diff)
downloadQt-1b4d6818865548b752008242ddbea6a4e5206684.zip
Qt-1b4d6818865548b752008242ddbea6a4e5206684.tar.gz
Qt-1b4d6818865548b752008242ddbea6a4e5206684.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/runningTrueBug.qml30
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp15
-rw-r--r--tests/benchmarks/declarative/script/data/global.js9
-rw-r--r--tests/benchmarks/declarative/script/data/global_prop.qml7
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp19
5 files changed, 76 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/runningTrueBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/runningTrueBug.qml
new file mode 100644
index 0000000..2c5207e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/runningTrueBug.qml
@@ -0,0 +1,30 @@
+import Qt 4.7
+Rectangle {
+ color: "skyblue"
+ width: 500
+ height: 200
+ Rectangle {
+ objectName: "cloud"
+ color: "white"
+ y: 50
+ width: 100
+ height: 100
+
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ id: firstAnimation
+ from: 0
+ to: 500
+ duration: 5000
+ }
+ NumberAnimation {
+ id: secondAnimation
+ from: -100
+ to: 0
+ duration: 1000
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 5cf4c23..a965ef3 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -81,6 +81,7 @@ private slots:
void dontStart();
void easingProperties();
void rotation();
+ void runningTrueBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -733,6 +734,20 @@ void tst_qdeclarativeanimations::rotation()
QTIMED_COMPARE(rr->rotation() + rr2->rotation() + rr3->rotation() + rr4->rotation(), qreal(370*4));
}
+void tst_qdeclarativeanimations::runningTrueBug()
+{
+ //ensure we start correctly when "running: true" is explicitly set
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrueBug.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *cloud = rect->findChild<QDeclarativeRectangle*>("cloud");
+ QVERIFY(cloud);
+ QTest::qWait(1000);
+ QVERIFY(cloud->x() > qreal(0));
+}
+
QTEST_MAIN(tst_qdeclarativeanimations)
#include "tst_qdeclarativeanimations.moc"
diff --git a/tests/benchmarks/declarative/script/data/global.js b/tests/benchmarks/declarative/script/data/global.js
index 02472d2..5b86b4d 100644
--- a/tests/benchmarks/declarative/script/data/global.js
+++ b/tests/benchmarks/declarative/script/data/global.js
@@ -39,7 +39,16 @@
**
****************************************************************************/
+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
index 908cecf..4fb7ee7 100644
--- a/tests/benchmarks/declarative/script/data/global_prop.qml
+++ b/tests/benchmarks/declarative/script/data/global_prop.qml
@@ -46,9 +46,8 @@ Rectangle {
width: 200; height: 200
signal triggered
- onTriggered: Program.doSomething();
+ signal incrementTriggered
- function doSomething() {
- Program.doSomething();
- }
+ onTriggered: Program.doSomething();
+ onIncrementTriggered: Program.doIncrement();
}
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index 16052fa..5a7e151 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -96,6 +96,8 @@ private slots:
void global_property_js();
void global_property_qml();
void global_property_qml_js();
+
+ void scriptfile_property();
};
inline QUrl TEST_FILE(const QString &filename)
@@ -678,6 +680,23 @@ void tst_script::global_property_qml_js()
delete rect;
}
+void tst_script::scriptfile_property()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, TEST_FILE("global_prop.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle *>(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;
+}
QTEST_MAIN(tst_script)