on xenial help sign in
Only unlock modems after we're done with the wizard
commit60faf713e75a22fb1ad598d17a058d49b4b84533 authorMichael Terry <michael.terry@canonical.com> dateWed 25 Feb 2015, 16:10 (12 years ago) parent23d9094
4 files changed+48−16
qml/Greeter/Greeter.qml−5 qml/Shell.qml+11 qml/Wizard/Wizard.qml+1−1 tests/qmltests/tst_Shell.qml+36−10
qml/Greeter/Greeter.qml−5
@@ -19,7 +19,6 @@ import AccountsService 0.1
1919import LightDM 0.1 as LightDM
2020import Ubuntu.Components 1.1
2121import Ubuntu.SystemImage 0.1
22−import Unity.Connectivity 0.1
2322import Unity.Launcher 0.1
2423import "../Components"
2524
@@ -179,10 +178,6 @@ Showable {
179178 }
180179 }
181180
182− Component.onCompleted: {
183− Connectivity.unlockAllModems();
184− }
185−
186181 Timer {
187182 id: forcedDelayTimer
188183 interval: 1000 * 60
qml/Shell.qml+11
@@ -23,6 +23,7 @@ import Ubuntu.Components 0.1
2323import Ubuntu.Components.Popups 1.0
2424import Ubuntu.Gestures 0.1
2525import Ubuntu.Telephony 0.1 as Telephony
26+import Unity.Connectivity 0.1
2627import Unity.Launcher 0.1
2728import Utils 0.1
2829import LightDM 0.1 as LightDM
@@ -535,8 +536,18 @@ Item {
535536
536537 Wizard {
537538 id: wizard
539+ objectName: "wizard"
538540 anchors.fill: parent
539541 background: shell.background
542+
543+ function unlockWhenDoneWithWizard() {
544+ if (!active) {
545+ Connectivity.unlockAllModems();
546+ }
547+ }
548+
549+ Component.onCompleted: unlockWhenDoneWithWizard()
550+ onActiveChanged: unlockWhenDoneWithWizard()
540551 }
541552
542553 Rectangle {
qml/Wizard/Wizard.qml+1−1
@@ -25,7 +25,7 @@ Showable {
2525 // The background wallpaper to use
2626 property string background
2727
28− readonly property alias active: loader.active
28+ readonly property bool active: loader.active
2929
3030 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
3131
tests/qmltests/tst_Shell.qml+36−10
@@ -31,6 +31,7 @@ import Unity.Indicators 0.1
3131import Unity.Notifications 1.0
3232import Unity.Test 0.1 as UT
3333import Powerd 0.1
34+import Wizard 0.1 as Wizard
3435
3536import "../../qml"
3637
@@ -202,10 +203,22 @@ Item {
202203 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
203204 launcherShowDashHomeSpy.target = null;
204205
205− shellLoader.itemDestroyed = false;
206+ stopShell();
206207
207− shellLoader.active = false;
208+ // kill all (fake) running apps
209+ killApps(ApplicationManager);
210+
211+ unlockAllModemsSpy.clear()
212+ LightDM.Greeter.authenticate(""); // reset greeter
213+ Wizard.System.wizardEnabled = false;
208214
215+ // reload our test subject to get it in a fresh state once again
216+ startShell();
217+ }
218+
219+ function stopShell() {
220+ shellLoader.itemDestroyed = false;
221+ shellLoader.active = false;
209222 tryCompare(shellLoader, "status", Loader.Null);
210223 tryCompare(shellLoader, "item", null);
211224 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
@@ -215,16 +228,10 @@ Item {
215228 // iteration to do its work. So to ensure the reload, we will wait until the
216229 // Shell instance gets destroyed.
217230 tryCompare(shellLoader, "itemDestroyed", true);
231+ }
218232
219− // kill all (fake) running apps
220− killApps(ApplicationManager);
221−
222− unlockAllModemsSpy.clear()
223− LightDM.Greeter.authenticate(""); // reset greeter
224−
225− // reload our test subject to get it in a fresh state once again
233+ function startShell() {
226234 shellLoader.active = true;
227−
228235 tryCompare(shellLoader, "status", Loader.Ready);
229236 removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
230237 }
@@ -725,6 +732,25 @@ Item {
725732 tryCompare(unlockAllModemsSpy, "count", 1)
726733 }
727734
735+ function test_unlockAllModemsAfterWizard() {
736+ // Stop and start shell to simulate wizard being enabled during
737+ // boot, instead of just being enabled after the fact.
738+ stopShell();
739+ Wizard.System.wizardEnabled = true;
740+ unlockAllModemsSpy.clear();
741+ startShell();
742+
743+ var wizard = findChild(shell, "wizard");
744+ compare(wizard.active, true);
745+ compare(Wizard.System.wizardEnabled, true);
746+ compare(unlockAllModemsSpy.count, 0);
747+
748+ wizard.hide();
749+ tryCompare(wizard, "active", false);
750+ compare(Wizard.System.wizardEnabled, false);
751+ compare(unlockAllModemsSpy.count, 1);
752+ }
753+
728754 function test_tapOnRightEdgeReachesApplicationSurface() {
729755 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
730756 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;