diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-11 20:08:02 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-11 22:48:57 (GMT) |
commit | 5624c360505a11b9380d2d1e47b2b3477ccc229c (patch) | |
tree | ce5a88b4f678a367cc3ca9aa89ef0e9da4bf6710 /tests | |
parent | c3996d0dc64b0815968a86d44866d9fe45de731b (diff) | |
download | Qt-5624c360505a11b9380d2d1e47b2b3477ccc229c.zip Qt-5624c360505a11b9380d2d1e47b2b3477ccc229c.tar.gz Qt-5624c360505a11b9380d2d1e47b2b3477ccc229c.tar.bz2 |
Animations are running by default when used as property source value
When you assign an animation to a property (used as source value),
the animation will automatically start running, which is the most
common behavior for this use case.
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/animations/data/valuesource.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/animations/data/valuesource2.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/animations/tst_animations.cpp | 30 |
3 files changed, 58 insertions, 0 deletions
diff --git a/tests/auto/declarative/animations/data/valuesource.qml b/tests/auto/declarative/animations/data/valuesource.qml new file mode 100644 index 0000000..c35063d --- /dev/null +++ b/tests/auto/declarative/animations/data/valuesource.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Rectangle { + width: 400 + height: 400 + Rectangle { + id: rect + objectName: "MyRect" + color: "red" + width: 50; height: 50 + x: 100; y: 100 + x: NumberAnimation { id: anim; objectName: "MyAnim"; to: 200 } + } +} diff --git a/tests/auto/declarative/animations/data/valuesource2.qml b/tests/auto/declarative/animations/data/valuesource2.qml new file mode 100644 index 0000000..1a60542 --- /dev/null +++ b/tests/auto/declarative/animations/data/valuesource2.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Rectangle { + width: 400 + height: 400 + Rectangle { + id: rect + objectName: "MyRect" + color: "red" + width: 50; height: 50 + x: 100; y: 100 + x: NumberAnimation { id: anim; objectName: "MyAnim"; running: false; to: 200 } + } +} diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp index 5026f6f..17085af 100644 --- a/tests/auto/declarative/animations/tst_animations.cpp +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -68,6 +68,7 @@ private slots: void easingStringConversion(); void invalidDuration(); void attached(); + void propertyValueSourceDefaultStart(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -576,6 +577,35 @@ void tst_animations::attached() QVERIFY(rect); } +void tst_animations::propertyValueSourceDefaultStart() +{ + { + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource.qml")); + + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); + QVERIFY(rect); + + QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim); + QVERIFY(myAnim->isRunning()); + } + + { + QmlEngine engine; + + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource2.qml")); + + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); + QVERIFY(rect); + + QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim); + QVERIFY(myAnim->isRunning() == false); + } +} + QTEST_MAIN(tst_animations) #include "tst_animations.moc" |