@@ -2538,6 +2538,7 @@ Rectangle {
25382538 tap(maximizeButton);
25392539 }
25402540
2541+ waitUntilTransitionsEnd(appDelegate);
25412542 tryCompare(appDelegate, "state", "maximized");
25422543
25432544 if (data.mouse) {
@@ -2547,7 +2548,7 @@ Rectangle {
25472548 tryCompare(menuBarLoader.item, "visible", true);
25482549 mouseDrag(panel, panel.width/2, panel.height/2, 0, shell.height/3, Qt.LeftButton, Qt.NoModifier, 500);
25492550 } else {
2550− touchFlick(panel, panel.width/2, panel.height/2, panel.width/2, shell.height/3);
2551+ touchFlick(panel, panel.width/2, panel.panelHeight/2, panel.width/2, shell.height/3);
25512552 }
25522553
25532554 tryCompare(appDelegate, "state", "restored");
@@ -2864,7 +2865,7 @@ Rectangle {
28642865 loadShell(data.tag);
28652866
28662867 var panel = findChild(shell, "panel"); verify(panel);
2867− var panelTitle = findChild(panel.applicationMenus, "panelTitle"); verify(panelTitle);
2868+ var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
28682869 compare(panelTitle.visible, false, "Panel title should not be visible when greeter is shown");
28692870
28702871 swipeAwayGreeter();
@@ -2929,6 +2930,86 @@ Rectangle {
29292930 tryCompare(appDelegate, "state", "maximizedRight");
29302931 }
29312932
2933+
2934+ function test_closeAppsInSpreadWithQ() {
2935+ loadShell("desktop");
2936+ shell.usageScenario = "desktop";
2937+ waitForRendering(shell);
2938+ swipeAwayGreeter();
2939+
2940+ var appSurfaceId = topLevelSurfaceList.nextId;
2941+ var app = ApplicationManager.startApplication("dialer-app")
2942+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2943+
2944+ appSurfaceId = topLevelSurfaceList.nextId;
2945+ app = ApplicationManager.startApplication("calendar-app")
2946+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2947+
2948+ keyPress(Qt.Key_Alt);
2949+ keyClick(Qt.Key_Tab);
2950+
2951+ var stage = findChild(shell, "stage");
2952+ var spread = findChild(stage, "spreadItem");
2953+ var appRepeater = findChild(stage, "appRepeater");
2954+
2955+ tryCompare(stage, "state", "spread");
2956+
2957+ tryCompare(ApplicationManager, "count", 3);
2958+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "dialer-app"}, true);
2959+
2960+ // Close one app with Q while in spread
2961+ keyClick(Qt.Key_Q);
2962+
2963+ tryCompare(ApplicationManager, "count", 2);
2964+
2965+ // Now the dash should be highlighted
2966+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "unity8-dash"}, true);
2967+
2968+ keyClick(Qt.Key_Q);
2969+
2970+ // Dash is not closeable, should still be 2
2971+ tryCompare(ApplicationManager, "count", 2);
2972+
2973+ // Move to the next one, should be closable again
2974+ keyClick(Qt.Key_Tab);
2975+ tryCompareFunction(function() {return appRepeater.itemAt(spread.highlightedIndex).appId == "calendar-app"}, true);
2976+
2977+ // close it
2978+ keyClick(Qt.Key_Q);
2979+ tryCompare(ApplicationManager, "count", 1);
2980+
2981+ keyRelease(Qt.Key_Alt);
2982+
2983+ // Now start the apps again
2984+ appSurfaceId = topLevelSurfaceList.nextId;
2985+ app = ApplicationManager.startApplication("dialer-app");
2986+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2987+
2988+ appSurfaceId = topLevelSurfaceList.nextId;
2989+ app = ApplicationManager.startApplication("calendar-app");
2990+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2991+
2992+ // First focus the dash so it'll be the leftmost in the spread
2993+ ApplicationManager.requestFocusApplication("unity8-dash");
2994+
2995+ keyPress(Qt.Key_Alt);
2996+ keyClick(Qt.Key_Tab);
2997+ tryCompare(stage, "state", "spread");
2998+
2999+ // Move to the last one
3000+ keyClick(Qt.Key_Tab);
3001+
3002+ // Close the last one, make sure the highlight fixes itself to stick within the list
3003+ tryCompare(spread, "highlightedIndex", ApplicationManager.count - 1);
3004+ var oldHighlighted = spread.highlightedIndex;
3005+
3006+ keyClick(Qt.Key_Q);
3007+ tryCompare(spread, "highlightedIndex", oldHighlighted - 1);
3008+
3009+ keyRelease(Qt.Key_Alt);
3010+
3011+ }
3012+
29323013 function test_altTabToMinimizedApp() {
29333014 loadShell("desktop");
29343015 shell.usageScenario = "desktop";
@@ -2957,6 +3038,61 @@ Rectangle {
29573038 tryCompare(topLevelSurfaceList.applicationAt(0), "appId", "dialer-app");
29583039 }
29593040
3041+ function test_touchMenuPosition_data() {
3042+ return [
3043+ { tag: "launcher locked", lockLauncher: true },
3044+ { tag: "launcher not locked", lockLauncher: false }
3045+ ];
3046+ }
3047+
3048+ function test_touchMenuPosition(data) {
3049+ loadShell("desktop");
3050+ shell.usageScenario = "desktop";
3051+ waitForRendering(shell);
3052+ swipeAwayGreeter();
3053+
3054+ var panel = findChild(shell, "panel");
3055+ var launcher = testCase.findChild(shell, "launcher");
3056+ launcher.lockedVisible = data.lockLauncher;
3057+ if (data.lockLauncher) {
3058+ compare(panel.applicationMenus.x, launcher.panelWidth);
3059+ } else {
3060+ compare(panel.applicationMenus.x, 0);
3061+ }
3062+ }
3063+
3064+ function test_touchMenuHidesOnLauncherAppDrawer_data() {
3065+ return [
3066+ { tag: "launcher locked", lockLauncher: true },
3067+ { tag: "launcher not locked", lockLauncher: false }
3068+ ];
3069+ }
3070+
3071+ function test_touchMenuHidesOnLauncherAppDrawer(data) {
3072+ loadShell("desktop");
3073+ shell.usageScenario = "desktop";
3074+ waitForRendering(shell);
3075+ swipeAwayGreeter();
3076+
3077+ var panel = findChild(shell, "panel");
3078+ var launcher = testCase.findChild(shell, "launcher");
3079+ launcher.lockedVisible = data.lockLauncher;
3080+
3081+ waitForRendering(panel.applicationMenus);
3082+
3083+ if (data.lockLauncher) {
3084+ panel.applicationMenus.show();
3085+ tryCompare(panel.applicationMenus, "fullyOpened", true);
3086+ launcher.openDrawer();
3087+ } else {
3088+ tryCompare(launcher, "shown", false);
3089+ panel.applicationMenus.show();
3090+ tryCompare(panel.applicationMenus, "fullyOpened", true);
3091+ launcher.switchToNextState("visible");
3092+ }
3093+ tryCompare(panel.applicationMenus, "fullyClosed", true);
3094+ }
3095+
29603096 function test_doubleClickPanelRestoresWindow() {
29613097 loadShell("desktop");
29623098 shell.usageScenario = "desktop";