on xenial help sign in
Don't let the wizard sit indefinitely, waiting for a wizard page to finish preparing itself.

If a wizard page has a bug, we don't want to let it block the user. Fixes: #1425737 Approved by: Daniel d'Andrada

commitbb0b4a63449a1ee59717473fb0c987f0c5babee8 authorMichael Terry <michael.terry@canonical.com> dateWed 18 Mar 2015, 10:16 (12 years ago) parent2c64a0133b3eab
2 files changed+32−2
qml/Wizard/Pages.qml+14−1 tests/qmltests/Wizard/tst_Wizard.qml+18−1
qml/Wizard/Pages.qml+14−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013,2014,2015 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -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+18−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014,2015 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -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);