@@ -350,7 +350,9 @@ Rectangle {
350 target: fullscreenAppCheck
350 target: fullscreenAppCheck
351 when: topLevelSurfaceList && topLevelSurfaceList.focusedWindow
351 when: topLevelSurfaceList && topLevelSurfaceList.focusedWindow
352 property: "checked"
352 property: "checked"
353+ value: topLevelSurfaceList &&
354+ topLevelSurfaceList.focusedWindow &&
353− value: topLevelSurfaceList.focusedWindow.state == Mir.FullscreenState
355+ topLevelSurfaceList.focusedWindow.state == Mir.FullscreenState
@@ -378,7 +380,9 @@ Rectangle {
378 target: chromeAppCheck
380 target: chromeAppCheck
379 when: topLevelSurfaceList && topLevelSurfaceList.focusedWindow !== null && topLevelSurfaceList.focusedWindow.surface !== null
381 when: topLevelSurfaceList && topLevelSurfaceList.focusedWindow !== null && topLevelSurfaceList.focusedWindow.surface !== null
380 property: "checked"
382 property: "checked"
381− value: topLevelSurfaceList.focusedWindow.surface &&
383+ value: topLevelSurfaceList &&
384+ topLevelSurfaceList.focusedWindow &&
385+ topLevelSurfaceList.focusedWindow.surface &&
382 topLevelSurfaceList.focusedWindow.surface.shellChrome === Mir.LowChrome
386 topLevelSurfaceList.focusedWindow.surface.shellChrome === Mir.LowChrome
@@ -596,19 +600,26 @@ Rectangle {
596 stage = findChild(shell, "stage");
600 stage = findChild(shell, "stage");
599− function loadDesktopShellWithApps() {
603+ function loadDesktopShellWithApps(apps) {
605+ if (apps == undefined) {
600 loadShell("desktop");
609 loadShell("desktop");
601 waitForRendering(shell)
610 waitForRendering(shell)
602 shell.usageScenario = "desktop"
611 shell.usageScenario = "desktop"
603 waitForRendering(shell)
612 waitForRendering(shell)
604− var app0 = ApplicationManager.startApplication("unity8-dash")
613+ addApps(apps)
605− var app1 = ApplicationManager.startApplication("dialer-app")
614+ }
606− var app2 = ApplicationManager.startApplication("morph-browser")
615+
607− var app3 = ApplicationManager.startApplication("camera-app")
616+ function addApps(count) {
608− var app4 = ApplicationManager.startApplication("facebook-webapp")
617+ // Start apps up to count, but skip unity8-dash since it's the first
609− var app5 = ApplicationManager.startApplication("camera-app")
618+ // available application and it's treated specially
610− var app6 = ApplicationManager.startApplication("gallery-app")
619+ for (var i = 0; i < count; i++) {
620+ var startingAppId = ApplicationManager.availableApplications[ApplicationManager.count + 1];
611− var app7 = ApplicationManager.startApplication("calendar-app")
621+ var app = ApplicationManager.startApplication(startingAppId)
612 for (var i = 0; i < topLevelSurfaceList.count; ++i) {
623 for (var i = 0; i < topLevelSurfaceList.count; ++i) {
613 waitUntilAppWindowIsFullyLoaded(topLevelSurfaceList.idAt(i));
624 waitUntilAppWindowIsFullyLoaded(topLevelSurfaceList.idAt(i));
@@ -819,10 +830,6 @@ Rectangle {
822− function waitUntilDashIsFocused() {
823− tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
826 function swipeFromLeftEdge(swipeLength) {
833 function swipeFromLeftEdge(swipeLength) {
827 var touchStartX = 2;
834 var touchStartX = 2;
828 var touchStartY = shell.height / 2;
835 var touchStartY = shell.height / 2;
@@ -1291,9 +1298,7 @@ Rectangle {
1293 function test_customBackground() {
1300 function test_customBackground() {
1294− loadShell("desktop");
1301+ loadDesktopShellWithApps(0);
1295− shell.usageScenario = "desktop";
1296− waitForRendering(shell);
1298 var wallpaperResolver = findInvisibleChild(shell, "wallpaperResolver");
1303 var wallpaperResolver = findInvisibleChild(shell, "wallpaperResolver");
1299 var greeter = findChild(shell, "greeter");
1304 var greeter = findChild(shell, "greeter");
@@ -1306,9 +1311,7 @@ Rectangle {
1308 function test_cachedBackground() {
1313 function test_cachedBackground() {
1309− loadShell("desktop");
1314+ loadDesktopShellWithApps(0);
1310− shell.usageScenario = "desktop";
1311− waitForRendering(shell);
1313 var greeter = findChild(shell, "greeter");
1316 var greeter = findChild(shell, "greeter");
1314 verify(!greeter.hasCustomBackground);
1317 verify(!greeter.hasCustomBackground);
@@ -1475,10 +1478,7 @@ Rectangle {
1477 function test_terminalShortcut() {
1480 function test_terminalShortcut() {
1478− loadShell("desktop");
1481+ loadDesktopShellWithApps(0);
1479− shell.usageScenario = "desktop";
1480− waitForRendering(shell);
1481− swipeAwayGreeter();
1483 // not running, should start
1483 // not running, should start
1484 keyClick(Qt.Key_T, Qt.ControlModifier|Qt.AltModifier);
1484 keyClick(Qt.Key_T, Qt.ControlModifier|Qt.AltModifier);
@@ -1612,7 +1612,7 @@ Rectangle {
1614 function test_altTabWrapAround() {
1614 function test_altTabWrapAround() {
1615− loadDesktopShellWithApps();
1615+ loadDesktopShellWithApps(7);
1617 var stage = findChild(shell, "stage");
1617 var stage = findChild(shell, "stage");
1618 verify(stage !== null)
1618 verify(stage !== null)
@@ -1657,7 +1657,7 @@ Rectangle {
1659 function test_altBackTabNavigation() {
1659 function test_altBackTabNavigation() {
1660− loadDesktopShellWithApps();
1660+ loadDesktopShellWithApps(5);
1662 var spreadItem = findChild(shell, "spreadItem");
1662 var spreadItem = findChild(shell, "spreadItem");
1663 verify(spreadItem !== null);
1663 verify(spreadItem !== null);
@@ -1688,7 +1688,7 @@ Rectangle {
1690 function test_highlightFollowsMouse() {
1690 function test_highlightFollowsMouse() {
1691− loadDesktopShellWithApps()
1691+ loadDesktopShellWithApps(7)
1693 var spreadItem = findChild(shell, "spreadItem");
1693 var spreadItem = findChild(shell, "spreadItem");
1694 verify(spreadItem !== null);
1694 verify(spreadItem !== null);
@@ -1716,7 +1716,7 @@ Rectangle {
1718 function test_closeFromSpread() {
1718 function test_closeFromSpread() {
1719− loadDesktopShellWithApps()
1719+ loadDesktopShellWithApps(4)
1721 var appRepeater = findInvisibleChild(shell, "appRepeater");
1721 var appRepeater = findInvisibleChild(shell, "appRepeater");
1722 verify(appRepeater !== null);
1722 verify(appRepeater !== null);
@@ -1766,7 +1766,7 @@ Rectangle {
1768 function test_selectFromSpreadWithMouse(data) {
1768 function test_selectFromSpreadWithMouse(data) {
1769− loadDesktopShellWithApps()
1769+ loadDesktopShellWithApps(4)
1771 var stage = findChild(shell, "stage");
1771 var stage = findChild(shell, "stage");
1772 var spreadItem = findChild(stage, "spreadItem");
1772 var spreadItem = findChild(stage, "spreadItem");
@@ -1805,7 +1805,7 @@ Rectangle {
1807 function test_progressiveAutoScrolling() {
1807 function test_progressiveAutoScrolling() {
1808− loadDesktopShellWithApps()
1808+ loadDesktopShellWithApps(7)
1810 var appRepeater = findInvisibleChild(shell, "appRepeater");
1810 var appRepeater = findInvisibleChild(shell, "appRepeater");
1811 var launcherPanel = findChild(shell, "launcherPanel");
1811 var launcherPanel = findChild(shell, "launcherPanel");
@@ -1836,7 +1836,7 @@ Rectangle {
1836 // This makes sure the hoverMouseArea is set to invisible AND disabled
1836 // This makes sure the hoverMouseArea is set to invisible AND disabled
1837 // when not needed. Otherwise it'll eat mouse hover events for the rest of the shell/apps
1837 // when not needed. Otherwise it'll eat mouse hover events for the rest of the shell/apps
1838 function test_hoverMouseAreaDisabledAndInvisible() {
1838 function test_hoverMouseAreaDisabledAndInvisible() {
1839− loadDesktopShellWithApps()
1839+ loadDesktopShellWithApps(2)
1841 var hoverMouseArea = findChild(shell, "hoverMouseArea");
1841 var hoverMouseArea = findChild(shell, "hoverMouseArea");
1842 tryCompare(hoverMouseArea, "enabled", false)
1842 tryCompare(hoverMouseArea, "enabled", false)
@@ -1862,7 +1862,7 @@ Rectangle {
1864 function test_focusAppFromLauncherExitsSpread(data) {
1864 function test_focusAppFromLauncherExitsSpread(data) {
1865− loadDesktopShellWithApps()
1865+ loadDesktopShellWithApps(2)
1866 var launcher = findChild(shell, "launcher");
1866 var launcher = findChild(shell, "launcher");
1867 var stage = findChild(shell, "stage");
1867 var stage = findChild(shell, "stage");
1868 var app1 = findChild(launcher, "launcherDelegate0");
1868 var app1 = findChild(launcher, "launcherDelegate0");
@@ -1895,7 +1895,7 @@ Rectangle {
1896 // regression test for http://pad.lv/1443319
1896 // regression test for http://pad.lv/1443319
1897 function test_closeMaximizedAndRestart() {
1897 function test_closeMaximizedAndRestart() {
1898− loadDesktopShellWithApps();
1898+ loadDesktopShellWithApps(7);
1900 var appRepeater = findChild(shell, "appRepeater")
1900 var appRepeater = findChild(shell, "appRepeater")
1901 var application = topLevelSurfaceList.applicationAt(0);
1901 var application = topLevelSurfaceList.applicationAt(0);
@@ -1922,7 +1922,7 @@ Rectangle {
1924 function test_newAppHasValidGeometry() {
1924 function test_newAppHasValidGeometry() {
1925− loadDesktopShellWithApps();
1925+ loadDesktopShellWithApps(1);
1926 var appRepeater = findChild(shell, "appRepeater");
1926 var appRepeater = findChild(shell, "appRepeater");
1927 var appDelegate = appRepeater.itemAt(0);
1927 var appDelegate = appRepeater.itemAt(0);
@@ -1935,7 +1935,7 @@ Rectangle {
1936 // bug http://pad.lv/1431566
1936 // bug http://pad.lv/1431566
1937 function test_switchToStagedHidesPanelButtons() {
1937 function test_switchToStagedHidesPanelButtons() {
1938− loadDesktopShellWithApps();
1938+ loadDesktopShellWithApps(1);
1939 var appRepeater = findChild(shell, "appRepeater")
1939 var appRepeater = findChild(shell, "appRepeater")
1940 var appDelegate = appRepeater.itemAt(0);
1940 var appDelegate = appRepeater.itemAt(0);
1941 var panelButtons = findChild(shell, "panelWindowControlButtons")
1941 var panelButtons = findChild(shell, "panelWindowControlButtons")
@@ -1952,7 +1952,7 @@ Rectangle {
1954 function test_lockingGreeterHidesPanelButtons() {
1954 function test_lockingGreeterHidesPanelButtons() {
1955− loadDesktopShellWithApps();
1955+ loadDesktopShellWithApps(1);
1956 var appRepeater = findChild(shell, "appRepeater")
1956 var appRepeater = findChild(shell, "appRepeater")
1957 var appDelegate = appRepeater.itemAt(0);
1957 var appDelegate = appRepeater.itemAt(0);
1958 var panelButtons = findChild(shell, "panelWindowControlButtons")
1958 var panelButtons = findChild(shell, "panelWindowControlButtons")
@@ -1968,7 +1968,7 @@ Rectangle {
1970 function test_cantMoveWindowUnderPanel() {
1970 function test_cantMoveWindowUnderPanel() {
1971− loadDesktopShellWithApps();
1971+ loadDesktopShellWithApps(1);
1972 var appRepeater = findChild(shell, "appRepeater")
1972 var appRepeater = findChild(shell, "appRepeater")
1973 var appDelegate = appRepeater.itemAt(0);
1973 var appDelegate = appRepeater.itemAt(0);
@@ -1979,9 +1979,7 @@ Rectangle {
1981 function test_cantResizeWindowUnderPanel() {
1981 function test_cantResizeWindowUnderPanel() {
1982− loadShell("desktop");
1982+ loadDesktopShellWithApps(0);
1983− shell.usageScenario = "desktop";
1984− waitForRendering(shell);
1986 var appSurfaceId = topLevelSurfaceList.nextId;
1984 var appSurfaceId = topLevelSurfaceList.nextId;
1987 var app = ApplicationManager.startApplication("dialer-app")
1985 var app = ApplicationManager.startApplication("dialer-app")
@@ -2007,7 +2005,7 @@ Rectangle {
2009 function test_restoreWindowStateFixesIfUnderPanel() {
2007 function test_restoreWindowStateFixesIfUnderPanel() {
2010− loadDesktopShellWithApps();
2008+ loadDesktopShellWithApps(2);
2011 var appRepeater = findChild(shell, "appRepeater")
2009 var appRepeater = findChild(shell, "appRepeater")
2012 var application = topLevelSurfaceList.applicationAt(0);
2010 var application = topLevelSurfaceList.applicationAt(0);
2013 var appDelegate = appRepeater.itemAt(0);
2011 var appDelegate = appRepeater.itemAt(0);
@@ -2185,9 +2183,7 @@ Rectangle {
2187 function test_superTabToCycleLauncher(data) {
2185 function test_superTabToCycleLauncher(data) {
2188− loadShell("desktop");
2186+ loadDesktopShellWithApps(1);
2189− shell.usageScenario = "desktop";
2190− waitForRendering(shell);
2191 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2187 GSettingsController.setAutohideLauncher(!data.launcherLocked);
2192 waitForRendering(shell);
2188 waitForRendering(shell);
@@ -2273,9 +2269,7 @@ Rectangle {
2275 function test_lockedOutLauncherAddsMarginsToMaximized() {
2271 function test_lockedOutLauncherAddsMarginsToMaximized() {
2276− loadShell("desktop");
2272+ loadDesktopShellWithApps(1);
2277− shell.usageScenario = "desktop";
2278− waitForRendering(shell);
2279 var appContainer = findChild(shell, "appContainer");
2273 var appContainer = findChild(shell, "appContainer");
2280 var launcher = findChild(shell, "launcher");
2274 var launcher = findChild(shell, "launcher");
2281 var launcherPanel = findChild(launcher, "launcherPanel");
2275 var launcherPanel = findChild(launcher, "launcherPanel");
@@ -2563,9 +2557,7 @@ Rectangle {
2565 function test_dragPanelToRestoreMaximizedWindow(data) {
2559 function test_dragPanelToRestoreMaximizedWindow(data) {
2566− loadShell("desktop");
2560+ loadDesktopShellWithApps(0);
2567− shell.usageScenario = "desktop";
2568− waitForRendering(shell);
2569 var panel = findChild(shell, "windowControlArea");
2561 var panel = findChild(shell, "windowControlArea");
2570 verify(panel);
2562 verify(panel);
@@ -2644,10 +2636,7 @@ Rectangle {
2646 function test_rightEdgePushWithOpenIndicators() {
2638 function test_rightEdgePushWithOpenIndicators() {
2647− loadShell("desktop");
2639+ loadDesktopShellWithApps(1);
2648− shell.usageScenario = "desktop";
2649− waitForRendering(shell);
2650− swipeAwayGreeter();
2652 var stage = findChild(shell, "stage");
2641 var stage = findChild(shell, "stage");
2653 var cursor = findChild(shell, "cursor");
2642 var cursor = findChild(shell, "cursor");
@@ -2695,10 +2684,7 @@ Rectangle {
2697 function test_oskDisplacesWindow(data) {
2686 function test_oskDisplacesWindow(data) {
2698− loadShell("desktop");
2687+ loadDesktopShellWithApps(0);
2699− shell.usageScenario = "desktop";
2700− waitForRendering(shell);
2701− swipeAwayGreeter();
2702 ensureInputMethodSurface();
2688 ensureInputMethodSurface();
2703 shell.oskEnabled = data.oskEnabled;
2689 shell.oskEnabled = data.oskEnabled;
@@ -2905,10 +2891,7 @@ Rectangle {
2907 function test_fourFingerTapOpensDrawer(data) {
2893 function test_fourFingerTapOpensDrawer(data) {
2908− loadShell("desktop");
2894+ loadDesktopShellWithApps(1);
2909− shell.usageScenario = "desktop";
2910− waitForRendering(shell);
2911− swipeAwayGreeter();
2913 var stage = findChild(shell, "stage");
2896 var stage = findChild(shell, "stage");
2914 var drawer = findChild(shell, "drawer")
2897 var drawer = findChild(shell, "drawer")
@@ -2924,10 +2907,7 @@ Rectangle {
2926 function test_restoreFromFullscreen() {
2909 function test_restoreFromFullscreen() {
2927− loadShell("desktop");
2910+ loadDesktopShellWithApps(0);
2928− shell.usageScenario = "desktop";
2929− waitForRendering(shell);
2930− swipeAwayGreeter();
2932 var appSurfaceId = topLevelSurfaceList.nextId;
2912 var appSurfaceId = topLevelSurfaceList.nextId;
2933 var app = ApplicationManager.startApplication("dialer-app")
2913 var app = ApplicationManager.startApplication("dialer-app")
@@ -2954,10 +2934,7 @@ Rectangle {
2956 function test_closeAppsInSpreadWithQ() {
2936 function test_closeAppsInSpreadWithQ() {
2957− loadShell("desktop");
2937+ loadDesktopShellWithApps(0);
2958− shell.usageScenario = "desktop";
2959− waitForRendering(shell);
2960− swipeAwayGreeter();
2962 var appSurfaceId = topLevelSurfaceList.nextId;
2939 var appSurfaceId = topLevelSurfaceList.nextId;
2963 var app = ApplicationManager.startApplication("unity8-dash")
2940 var app = ApplicationManager.startApplication("unity8-dash")
@@ -3031,10 +3008,7 @@ Rectangle {
3033 function test_altTabToMinimizedApp() {
3010 function test_altTabToMinimizedApp() {
3034− loadShell("desktop");
3011+ loadDesktopShellWithApps(0);
3035− shell.usageScenario = "desktop";
3036− waitForRendering(shell);
3037− swipeAwayGreeter();
3039 var appSurfaceId = topLevelSurfaceList.nextId;
3013 var appSurfaceId = topLevelSurfaceList.nextId;
3040 var app = ApplicationManager.startApplication("dialer-app")
3014 var app = ApplicationManager.startApplication("dialer-app")
@@ -3066,10 +3040,7 @@ Rectangle {
3068 function test_touchMenuPosition(data) {
3042 function test_touchMenuPosition(data) {
3069− loadShell("desktop");
3043+ loadDesktopShellWithApps(0);
3070− shell.usageScenario = "desktop";
3071− waitForRendering(shell);
3072− swipeAwayGreeter();
3074 var panel = findChild(shell, "panel");
3045 var panel = findChild(shell, "panel");
3075 var launcher = testCase.findChild(shell, "launcher");
3046 var launcher = testCase.findChild(shell, "launcher");
@@ -3089,10 +3060,7 @@ Rectangle {
3091 function test_touchMenuHidesOnLauncherAppDrawer(data) {
3062 function test_touchMenuHidesOnLauncherAppDrawer(data) {
3092− loadShell("desktop");
3063+ loadDesktopShellWithApps(1);
3093− shell.usageScenario = "desktop";
3094− waitForRendering(shell);
3095− swipeAwayGreeter();
3097 var panel = findChild(shell, "panel");
3065 var panel = findChild(shell, "panel");
3098 var launcher = testCase.findChild(shell, "launcher");
3066 var launcher = testCase.findChild(shell, "launcher");
@@ -3114,10 +3082,7 @@ Rectangle {
3116 function test_doubleClickPanelRestoresWindow() {
3084 function test_doubleClickPanelRestoresWindow() {
3117− loadShell("desktop");
3085+ loadDesktopShellWithApps(0);
3118− shell.usageScenario = "desktop";
3119− waitForRendering(shell);
3120− swipeAwayGreeter();
3122 // start dialer
3087 // start dialer
3123 var appDelegate = startApplication("dialer-app")
3088 var appDelegate = startApplication("dialer-app")
@@ -3138,10 +3103,7 @@ Rectangle {
3140 function test_noMenusWithActiveCall() {
3105 function test_noMenusWithActiveCall() {
3141− loadShell("desktop");
3106+ loadDesktopShellWithApps(0);
3142− shell.usageScenario = "desktop";
3143− waitForRendering(shell);
3144− swipeAwayGreeter();
3146 // start music-app, maximize it
3108 // start music-app, maximize it
3147 var appDelegate = startApplication("music-app")
3109 var appDelegate = startApplication("music-app")
@@ -3172,10 +3134,7 @@ Rectangle {
3174 function test_enforceFocusOnStageOnAltTab() {
3136 function test_enforceFocusOnStageOnAltTab() {
3175− loadShell("desktop");
3137+ loadDesktopShellWithApps(0);
3176− shell.usageScenario = "desktop";
3177− waitForRendering(shell);
3178− swipeAwayGreeter();
3180 var appSurfaceId = topLevelSurfaceList.nextId;
3139 var appSurfaceId = topLevelSurfaceList.nextId;
3181 var app = ApplicationManager.startApplication("unity8-dash")
3140 var app = ApplicationManager.startApplication("unity8-dash")
@@ -3215,10 +3174,7 @@ Rectangle {
3217 function test_maximizedWindowMenuThenAltTab(data) {
3176 function test_maximizedWindowMenuThenAltTab(data) {
3218− loadShell("desktop");
3177+ loadDesktopShellWithApps(0);
3219− shell.usageScenario = "desktop";
3220− waitForRendering(shell);
3221− swipeAwayGreeter();
3223 var appDelegate = startApplication("gmail-webapp");
3179 var appDelegate = startApplication("gmail-webapp");
3224 var appDelegate2 = startApplication("dialer-app");
3180 var appDelegate2 = startApplication("dialer-app");
@@ -3262,10 +3218,7 @@ Rectangle {
3264 function test_launchFromDrawerPutsFocusOnStage() {
3220 function test_launchFromDrawerPutsFocusOnStage() {
3265− loadShell("desktop");
3221+ loadDesktopShellWithApps(1);
3266− shell.usageScenario = "desktop";
3267− waitForRendering(shell);
3268− swipeAwayGreeter();
3270 keyClick(Qt.Key_A, Qt.MetaModifier);
3223 keyClick(Qt.Key_A, Qt.MetaModifier);
3271 typeString("browser");
3224 typeString("browser");
@@ -3276,10 +3229,7 @@ Rectangle {
3278 function test_maximizedWindowAndMenuInPanel() {
3231 function test_maximizedWindowAndMenuInPanel() {
3279− loadShell("desktop");
3232+ loadDesktopShellWithApps(0);
3280− shell.usageScenario = "desktop";
3281− waitForRendering(shell);
3282− swipeAwayGreeter();
3284 // start music-app, maximize it
3234 // start music-app, maximize it
3285 var appDelegate = startApplication("music-app")
3235 var appDelegate = startApplication("music-app")