@@ -140,8 +140,6 @@ Item {
140140 stage = findChild(shell, "stage");
141141 topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
142142 verify(topLevelSurfaceList);
143−
144− startApplication("unity8-dash");
145143 }
146144
147145 function cleanup() {
@@ -288,7 +286,7 @@ Item {
288286 var greeter = findChild(shell, "greeter");
289287 var emergencyButton = findChild(greeter, "emergencyCallLabel");
290288 tap(emergencyButton)
291− tryCompare(topLevelSurfaceList, "count", 2);
289+ tryCompare(topLevelSurfaceList, "count", 1);
292290 waitUntilAppWindowIsFullyLoaded(dialerSurfaceId);
293291
294292 tryCompare(greeter, "shown", false);
@@ -416,6 +414,8 @@ Item {
416414 // - Should be back in normal dialer
417415 // (we've had a bug where we locked screen in this case)
418416
417+ startApplication("gallery-app");
418+
419419 var greeter = findChild(shell, "greeter");
420420 var panel = findChild(shell, "panel");
421421
@@ -427,8 +427,8 @@ Item {
427427 tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
428428 callManager.foregroundCall = phoneCall;
429429
430− ApplicationManager.requestFocusApplication("unity8-dash");
431− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
430+ ApplicationManager.requestFocusApplication("gallery-app");
431+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
432432 var callHint = findChild(panel, "callHint");
433433 tryCompare(callHint, "visible", true);
434434 wait(10000)
@@ -528,5 +528,31 @@ Item {
528528
529529 tryCompare(launcher, "state", "drawer");
530530 }
531+
532+ /* Regression test, https://github.com/ubports/ubuntu-touch/issues/1178
533+ When all apps closed while the Greeter was shown, the Launcher would
534+ appear over the Greeter. This was caused by logic that would normally
535+ cause the Launcher to be shown over the empty Background. */
536+ function test_launcherShowCulledWhenLocked() {
537+ var launcher = findChild(shell, "launcher");
538+
539+ // Ensure the Launcher is sane
540+ touchFlick(shell, units.gu(.5), shell.height / 2, units.gu(10), shell.height / 2);
541+ tryCompare(launcher, "state", "visible");
542+ tap(shell);
543+ tryCompare(launcher, "state", "");
544+
545+ console.log("I AM LOGGING NOW");
546+ console.log(ApplicationManager.count);
547+
548+ // Start and kill an app to cause the Launcher to be triggered (in error state)
549+ startApplication("gallery-app");
550+ tryCompare(ApplicationManager, "count", 1);
551+ ApplicationManager.stopApplication("gallery-app");
552+ tryCompare(ApplicationManager, "count", 0);
553+
554+ // Make sure that the error state didn't happen
555+ tryCompare(launcher, "state", "");
556+ }
531557 }
532558}