on xenial help sign in
Handle dash closing while the wizard is open
commitbb4710f87474753734eed8caae030c07a786eb04 authorMichael Terry <michael.terry@canonical.com> dateThu 26 Feb 2015, 11:25 (12 years ago) parent60faf71
3 files changed+31−5
qml/Shell.qml+1−1 tests/mocks/Unity/Application/ApplicationManager.cpp−4 tests/qmltests/tst_Shell.qml+30
qml/Shell.qml+1−1
@@ -219,7 +219,7 @@ Item {
219219 onFocusedApplicationIdChanged: {
220220 var appId = ApplicationManager.focusedApplicationId;
221221
222− if (tutorial.running && appId != "unity8-dash") {
222+ if (tutorial.running && appId != "" && appId != "unity8-dash") {
223223 // If this happens on first boot, we may be in edge
224224 // tutorial or wizard while receiving a call. But a call
225225 // 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)
256256
257257bool ApplicationManager::stopApplication(const QString &appId)
258258{
259− if (appId == "unity8-dash") {
260− return false;
261− }
262−
263259 ApplicationInfo *application = findApplication(appId);
264260 if (application == nullptr)
265261 return false;
tests/qmltests/tst_Shell.qml+30
@@ -211,6 +211,7 @@ Item {
211211 unlockAllModemsSpy.clear()
212212 LightDM.Greeter.authenticate(""); // reset greeter
213213 Wizard.System.wizardEnabled = false;
214+ AccountsService.demoEdges = false;
214215
215216 // reload our test subject to get it in a fresh state once again
216217 startShell();
@@ -751,6 +752,35 @@ Item {
751752 compare(unlockAllModemsSpy.count, 1);
752753 }
753754
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+
754784 function test_tapOnRightEdgeReachesApplicationSurface() {
755785 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
756786 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;