summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeanimations
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-08-04 07:27:34 (GMT)
committermae <qt-info@nokia.com>2010-08-04 07:30:40 (GMT)
commit33203efb786de9aebc6e05d1b4878d89e86ac456 (patch)
tree77cf3516c81e421c18b9600d94f7d31ae3fed673 /tests/auto/declarative/qdeclarativeanimations
parentded11a8737bf1828c0c4e188ec26af06f590e990 (diff)
downloadQt-33203efb786de9aebc6e05d1b4878d89e86ac456.zip
Qt-33203efb786de9aebc6e05d1b4878d89e86ac456.tar.gz
Qt-33203efb786de9aebc6e05d1b4878d89e86ac456.tar.bz2
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
Diffstat (limited to 'tests/auto/declarative/qdeclarativeanimations')
-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 0000000..b47b5f2
--- /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 3e80c2c..ec867fe 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()