diff options
author | mae <qt-info@nokia.com> | 2010-08-04 09:27:34 +0200 |
---|---|---|
committer | mae <qt-info@nokia.com> | 2010-08-04 09:30:40 +0200 |
commit | 33203efb786de9aebc6e05d1b4878d89e86ac456 (patch) | |
tree | 77cf3516c81e421c18b9600d94f7d31ae3fed673 /tests/auto/declarative | |
parent | ded11a8737bf1828c0c4e188ec26af06f590e990 (diff) | |
download | qt4-tools-33203efb786de9aebc6e05d1b4878d89e86ac456.tar.gz |
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')
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml | 29 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 14 |
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() |