aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimationcontroller
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-05-17 14:43:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-23 05:28:00 +0200
commit14ac380da38388829738910e96dcc5dbb35a448c (patch)
tree7c8bb30f240d3b35e98356899a98418022a3c4e0 /tests/auto/quick/qquickanimationcontroller
parent3765c84723738f736dc48a1e3aaf13991198818a (diff)
Add completeToBeginning()/completeToEnd() to animation controller
Change-Id: I1abac96754cc82c8e0e00c58a27c09b68c5075c1 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickanimationcontroller')
-rwxr-xr-xtests/auto/quick/qquickanimationcontroller/data/tst_completion.qml43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml
new file mode 100755
index 0000000000..92e252fc4c
--- /dev/null
+++ b/tests/auto/quick/qquickanimationcontroller/data/tst_completion.qml
@@ -0,0 +1,43 @@
+import QtQuick 2.0
+import QtTest 1.0
+
+Rectangle {
+ id:container
+ width:110
+ height:40
+
+ Rectangle {id:rect; x:0; y:0; color:"red"; width:10; height:10}
+ AnimationController {
+ id:ctrl
+ progress:0
+ animation: NumberAnimation {id:anim; target: rect; property:"x"; to:100; from:0; duration: 500}
+ }
+
+ TestCase {
+ name:"AnimationController"
+ when:windowShown
+ function test_complete() {
+ ctrl.progress = 0;
+ compare(rect.x, 0);
+ ctrl.progress = 0.5;
+ compare(rect.x, 50);
+
+ ctrl.completeToBeginning();
+ wait(200);
+ verify(ctrl.progress < 0.5 && ctrl.progress > 0);
+ wait(600);
+ compare(ctrl.progress, 0);
+ compare(rect.x, 0);
+
+ ctrl.progress = 0.5;
+ compare(rect.x, 50);
+
+ ctrl.completeToEnd();
+ wait(200);
+ verify(ctrl.progress > 0.5 && ctrl.progress < 1);
+ wait(600);
+ compare(ctrl.progress, 1);
+ compare(rect.x, 100);
+ }
+ }
+} \ No newline at end of file