summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-08-04 09:27:34 +0200
committerToby Tomkins <toby.tomkins@nokia.com>2010-08-06 13:32:45 +1000
commite628b0808d874eb798e463f23387d00191d7068e (patch)
tree18093be70902d9a6a8aaa6f279aefde8cf819473 /tests
parent828604016ae257281c2e6ee2e4693e6833b478e3 (diff)
Make SpringAnimation usable inside a transition
SpringFollow was turned into SpringAnimation so it could be used inside a Behavior. This patch completes the work and makes it usable inside a transition. This is the documented behavior of SpringAnimation, the patch is essential to make SpringAnimation work consistently. Reviewed-by: Michael Brasser Task-number: QTBUG-12141 (cherry picked from commit 33203efb786de9aebc6e05d1b4878d89e86ac456)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml29
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp14
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml
new file mode 100644
index 0000000000..b47b5f26e7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml
@@ -0,0 +1,29 @@
+import Qt 4.7
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: theRect
+ objectName: "TheRect"
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+
+ states: State {
+ name: "moved"
+ PropertyChanges {
+ target: theRect
+ x: 200
+ }
+ }
+ transitions: Transition {
+ SpringAnimation { targets: theRect; properties: "x"; velocity: 10000 }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.state = "moved"
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 3e80c2c50d..ec867fefdb 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -551,6 +551,20 @@ void tst_qdeclarativeanimations::propertiesTransition()
QTest::qWait(waitDuration);
QTIMED_COMPARE(myRect->x(),qreal(100));
}*/
+
+ {
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition7.qml"));
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeItemPrivate::get(rect)->setState("moved");
+ QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect");
+ QVERIFY(myRect);
+ QTest::qWait(waitDuration);
+ QTIMED_COMPARE(myRect->x(),qreal(200));
+ }
+
}
void tst_qdeclarativeanimations::invalidDuration()