on xenial help sign in
Time out wizard pages, so we don't leave user sitting there if bad code exists
commit242946d42b58e03bb37402b2213dc8a7238e7d90 authorMichael Terry <michael.terry@canonical.com> dateWed 25 Feb 2015, 18:32 (12 years ago) parent23d9094
2 files changed+30
qml/Wizard/Pages.qml+13 tests/qmltests/Wizard/tst_Wizard.qml+17
qml/Wizard/Pages.qml+13
@@ -110,6 +110,8 @@ Item {
110110 // this page, and either skip it or continue.
111111 push(path, {"opacity": 0, "enabled": false})
112112
113+ timeout.restart();
114+
113115 // Check for immediate skip or not. We may have to wait for
114116 // skipValid to be assigned (see Connections object below)
115117 checkSkip()
@@ -124,10 +126,21 @@ Item {
124126 } else {
125127 currentPage.opacity = 1
126128 currentPage.enabled = true
129+ timeout.stop();
127130 }
128131 }
129132 }
130133
134+ Timer {
135+ id: timeout
136+ objectName: "timeout"
137+ interval: 2000 // wizard pages shouldn't take long
138+ onTriggered: {
139+ pageStack.currentPage.skip = true;
140+ pageStack.currentPage.skipValid = true;
141+ }
142+ }
143+
131144 Connections {
132145 target: pageStack.currentPage
133146 onSkipValidChanged: pageStack.checkSkip()
tests/qmltests/Wizard/tst_Wizard.qml+17
@@ -285,6 +285,23 @@ Item {
285285 waitForPage("simPage");
286286 }
287287
288+ function test_simWaitTimeout() {
289+ MockQOfono.setModems(["a"], [false], [false]);
290+
291+ // Go to SIM page, which will be waiting for skip to be valid
292+ var page = goToPage("languagePage");
293+ tap(findChild(page, "forwardButton"));
294+ verifyPageIsBlocked("simPage");
295+
296+ var timeout = findInvisibleChild(wizard, "timeout");
297+ timeout.interval = 100; // reduce our delay
298+
299+ // Now just wait for timeout
300+ compare(timeout.running, true);
301+ waitForPage("passwdPage");
302+ compare(timeout.running, false);
303+ }
304+
288305 function enterPasscode(passcode) {
289306 for (var i = 0; i < passcode.length; ++i) {
290307 var character = passcode.charAt(i);