on xenial help sign in
Handle dash closing while the wizard is open
bb4710fMichael Terry
qml/Shell.qml+1−1
@@ -219,7 +219,7 @@ Item {
219 onFocusedApplicationIdChanged: {
219 onFocusedApplicationIdChanged: {
220 var appId = ApplicationManager.focusedApplicationId;
220 var appId = ApplicationManager.focusedApplicationId;
221
221
222− if (tutorial.running && appId != "unity8-dash") {
222+ if (tutorial.running && appId != "" && appId != "unity8-dash") {
223 // If this happens on first boot, we may be in edge
223 // If this happens on first boot, we may be in edge
224 // tutorial or wizard while receiving a call. But a call
224 // tutorial or wizard while receiving a call. But a call
225 // is more important than wizard so just bail out of those.
225 // is more important than wizard so just bail out of those.
tests/mocks/Unity/Application/ApplicationManager.cpp−4
@@ -256,10 +256,6 @@ ApplicationInfo* ApplicationManager::add(QString appId)
256
256
257bool ApplicationManager::stopApplication(const QString &appId)
257bool ApplicationManager::stopApplication(const QString &appId)
258{
258{
259− if (appId == "unity8-dash") {
260− return false;
261− }
262−
263 ApplicationInfo *application = findApplication(appId);
259 ApplicationInfo *application = findApplication(appId);
264 if (application == nullptr)
260 if (application == nullptr)
265 return false;
261 return false;
tests/qmltests/tst_Shell.qml+30
@@ -211,6 +211,7 @@ Item {
211 unlockAllModemsSpy.clear()
211 unlockAllModemsSpy.clear()
212 LightDM.Greeter.authenticate(""); // reset greeter
212 LightDM.Greeter.authenticate(""); // reset greeter
213 Wizard.System.wizardEnabled = false;
213 Wizard.System.wizardEnabled = false;
214+ AccountsService.demoEdges = false;
214
215
215 // reload our test subject to get it in a fresh state once again
216 // reload our test subject to get it in a fresh state once again
216 startShell();
217 startShell();
@@ -751,6 +752,35 @@ Item {
751 compare(unlockAllModemsSpy.count, 1);
752 compare(unlockAllModemsSpy.count, 1);
752 }
753 }
753
754
755+ function test_wizardEarlyExit() {
756+ Wizard.System.wizardEnabled = true;
757+ AccountsService.demoEdges = true;
758+ var wizard = findChild(shell, "wizard");
759+ var tutorial = findChild(shell, "tutorial");
760+ tryCompare(wizard, "active", true);
761+ tryCompare(tutorial, "running", true);
762+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
763+
764+ // Make sure we stay running when nothing focused (can happen for
765+ // a moment when we restart the dash after switching language)
766+ ApplicationManager.stopApplication("unity8-dash");
767+ tryCompare(ApplicationManager, "focusedApplicationId", "");
768+ compare(wizard.shown, true);
769+ compare(tutorial.running, true);
770+
771+ // And make sure we stay running when dash focused again
772+ ApplicationManager.startApplication("unity8-dash");
773+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
774+ compare(wizard.shown, true);
775+ compare(tutorial.running, true);
776+
777+ // And make sure we stop when something else is focused
778+ ApplicationManager.startApplication("gallery-app");
779+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
780+ compare(wizard.shown, false);
781+ compare(tutorial.running, false);
782+ }
783+
754 function test_tapOnRightEdgeReachesApplicationSurface() {
784 function test_tapOnRightEdgeReachesApplicationSurface() {
755 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
785 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
756 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
786 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;