summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeanimations
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-06-24 04:46:55 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-06-24 05:11:02 (GMT)
commitf2fc1355306219eaec9042462d3be4aceed1b829 (patch)
tree177b12595819a378faa933454cf04e4bbd1171a4 /tests/auto/declarative/qdeclarativeanimations
parentae422458fdbd9a2cdbc48024b31f7e5528baebb4 (diff)
downloadQt-f2fc1355306219eaec9042462d3be4aceed1b829.zip
Qt-f2fc1355306219eaec9042462d3be4aceed1b829.tar.gz
Qt-f2fc1355306219eaec9042462d3be4aceed1b829.tar.bz2
Prevent value source animations from being registered to start twice.
If the animation had an explicit "running: true", the animation would be registered with the engine twice, which prevented a proper start.
Diffstat (limited to 'tests/auto/declarative/qdeclarativeanimations')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/runningTrueBug.qml30
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp15
2 files changed, 45 insertions, 0 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"