@@ -957,6 +957,37 @@ Rectangle {
957957 compare(unlockAllModemsSpy.count, 1);
958958 }
959959
960+ function test_wizardEarlyExit() {
961+ Wizard.System.wizardEnabled = true;
962+ AccountsService.demoEdges = true;
963+ loadShell("phone");
964+
965+ var wizard = findChild(shell, "wizard");
966+ var tutorial = findChild(shell, "tutorial");
967+ tryCompare(wizard, "active", true);
968+ tryCompare(tutorial, "running", true);
969+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
970+
971+ // Make sure we stay running when nothing focused (can happen for
972+ // a moment when we restart the dash after switching language)
973+ ApplicationManager.stopApplication("unity8-dash");
974+ tryCompare(ApplicationManager, "focusedApplicationId", "");
975+ compare(wizard.shown, true);
976+ compare(tutorial.running, true);
977+
978+ // And make sure we stay running when dash focused again
979+ ApplicationManager.startApplication("unity8-dash");
980+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
981+ compare(wizard.shown, true);
982+ compare(tutorial.running, true);
983+
984+ // And make sure we stop when something else is focused
985+ ApplicationManager.startApplication("gallery-app");
986+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
987+ compare(wizard.shown, false);
988+ compare(tutorial.running, false);
989+ }
990+
960991 function test_tapOnRightEdgeReachesApplicationSurface() {
961992 loadShell("phone");
962993 swipeAwayGreeter();