From 2fdcf22dfa02d644cae2f0a4342783b715e12f43 Mon Sep 17 00:00:00 2001
From: Caroline Chao <caroline.chao@digia.com>
Date: Wed, 20 Feb 2013 15:50:44 +0100
Subject: [PATCH] TestBench: Add possibility to stop timer on progress bar

Change-Id: I7aad12734a6bfe4e97ce5810366c7a5590ec1b11
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
---
 tests/manual/testbench/content/Components.qml |  4 +++-
 tests/manual/testbench/main.qml               | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tests/manual/testbench/content/Components.qml b/tests/manual/testbench/content/Components.qml
index ef80f0d71..73e154b7d 100644
--- a/tests/manual/testbench/content/Components.qml
+++ b/tests/manual/testbench/content/Components.qml
@@ -69,9 +69,10 @@ Item {
     }
 
     property Component progressbar: ProgressBar {
+        property bool ___isRunning: true
         Timer {
             id: timer
-            running: true
+            running: ___isRunning
             repeat: true
             interval: 25
             onTriggered: {
@@ -80,6 +81,7 @@ Item {
             }
         }
     }
+
     property var model: ListModel{
         id: testDataModel
         Component.onCompleted: {
diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml
index c6b1cdf08..ef8e69584 100644
--- a/tests/manual/testbench/main.qml
+++ b/tests/manual/testbench/main.qml
@@ -53,6 +53,7 @@ ApplicationWindow {
     toolBar: ToolBar {
         width: parent.width
         RowLayout {
+            id: alwaysVisible
             anchors.left: parent.left
             anchors.leftMargin: 8
             height: parent.height
@@ -72,6 +73,16 @@ ApplicationWindow {
                 onClicked: container.resetSize()
             }
         }
+
+        CheckBox {
+            id: startStopAnim
+            anchors.left: alwaysVisible.right
+            anchors.verticalCenter: parent.verticalCenter
+            text: "Stop Animation"
+            checked: true
+            visible: false
+            onCheckedChanged: if (visible) loader.item.___isRunning = checked
+        }
     }
     statusBar: StatusBar {
         Row {
@@ -133,12 +144,19 @@ ApplicationWindow {
                     PropertyLayouts{ id: layouts }
                     onStatusChanged: {
 
+                        startStopAnim.visible = false
+
                         if (status == Loader.Ready) {
                             propertyMap = []
                             var arr = new Array
 
                             for (var prop in item) {
 
+                                if (prop.toString() === "___isRunning") {
+                                    startStopAnim.visible = true
+                                    continue;
+                                }
+
                                 if (!prop.indexOf("on")) { // look only for properties
                                     if (prop.indexOf("Changed") !== (prop.length - 7))
                                         continue;
-- 
GitLab