@@ -2913,6 +2913,86 @@ Rectangle {
2913 tryCompare(appDelegate, "state", "maximizedRight");
2913 tryCompare(appDelegate, "state", "maximizedRight");
2917+ function test_closeAppsInSpreadWithQ() {
2918+ loadShell("desktop");
2919+ shell.usageScenario = "desktop";
2920+ waitForRendering(shell);
2921+ swipeAwayGreeter();
2923+ var appSurfaceId = topLevelSurfaceList.nextId;
2924+ var app = ApplicationManager.startApplication("dialer-app")
2925+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2927+ appSurfaceId = topLevelSurfaceList.nextId;
2928+ app = ApplicationManager.startApplication("calendar-app")
2929+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2931+ keyPress(Qt.Key_Alt);
2932+ keyClick(Qt.Key_Tab);
2934+ var stage = findChild(shell, "stage");
2935+ var spread = findChild(stage, "spreadItem");
2936+ var appRepeater = findChild(stage, "appRepeater");
2938+ tryCompare(stage, "state", "spread");
2940+ tryCompare(ApplicationManager, "count", 3);
2941+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "dialer-app"}, true);
2943+ // Close one app with Q while in spread
2944+ keyClick(Qt.Key_Q);
2946+ tryCompare(ApplicationManager, "count", 2);
2948+ // Now the dash should be highlighted
2949+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
2951+ keyClick(Qt.Key_Q);
2953+ // Dash is not closeable, should still be 2
2954+ tryCompare(ApplicationManager, "count", 2);
2956+ // Move to the next one, should be closable again
2957+ keyClick(Qt.Key_Tab);
2958+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
2961+ keyClick(Qt.Key_Q);
2962+ tryCompare(ApplicationManager, "count", 1);
2964+ keyRelease(Qt.Key_Alt);
2966+ // Now start the apps again
2967+ appSurfaceId = topLevelSurfaceList.nextId;
2968+ app = ApplicationManager.startApplication("dialer-app");
2969+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2971+ appSurfaceId = topLevelSurfaceList.nextId;
2972+ app = ApplicationManager.startApplication("calendar-app");
2973+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2975+ // First focus the dash so it'll be the leftmost in the spread
2976+ ApplicationManager.requestFocusApplication("unity8-dash");
2978+ keyPress(Qt.Key_Alt);
2979+ keyClick(Qt.Key_Tab);
2980+ tryCompare(stage, "state", "spread");
2982+ // Move to the last one
2983+ keyClick(Qt.Key_Tab);
2985+ // Close the last one, make sure the highlight fixes itself to stick within the list
2986+ tryCompare(spread, "highlightedIndex", ApplicationManager.count - 1);
2987+ var oldHighlighted = spread.highlightedIndex;
2989+ keyClick(Qt.Key_Q);
2990+ tryCompare(spread, "highlightedIndex", oldHighlighted - 1);
2992+ keyRelease(Qt.Key_Alt);
2916 function test_altTabToMinimizedApp() {
2996 function test_altTabToMinimizedApp() {
2917 loadShell("desktop");
2997 loadShell("desktop");
2918 shell.usageScenario = "desktop";
2998 shell.usageScenario = "desktop";