@@ -2513,27 +2513,44 @@ Rectangle {
25132513 tryCompare(app2Surface, "keymap", "fr");
25142514 }
25152515
2516− function test_dragPanelToRestoreMaximizedWindow() {
2516+ function test_dragPanelToRestoreMaximizedWindow_data() {
2517+ return [
2518+ { tag: "with mouse", mouse: true },
2519+ { tag: "with touch", mouse: false }
2520+ ]
2521+ }
2522+
2523+ function test_dragPanelToRestoreMaximizedWindow(data) {
25172524 loadShell("desktop");
25182525 shell.usageScenario = "desktop";
25192526 waitForRendering(shell);
25202527 var panel = findChild(shell, "windowControlArea");
25212528 verify(panel);
25222529
2523− var appSurfaceId = topLevelSurfaceList.nextId;
2524− var app = ApplicationManager.startApplication("dialer-app")
2525− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2526−
25272530 // start dialer, maximize it
2528− var appContainer = findChild(shell, "appContainer");
2529− var appDelegate = findChild(appContainer, "appDelegate_" + appSurfaceId);
2531+ var appDelegate = startApplication("dialer-app");
25302532 verify(appDelegate);
2533+
25312534 var maximizeButton = findChild(appDelegate, "maximizeWindowButton");
2532− mouseClick(maximizeButton);
2535+ if (data.mouse) {
2536+ mouseClick(maximizeButton);
2537+ } else {
2538+ tap(maximizeButton);
2539+ }
25332540
2541+ waitUntilTransitionsEnd(appDelegate);
25342542 tryCompare(appDelegate, "state", "maximized");
25352543
2536− mouseDrag(panel, panel.width/2, panel.height/2, 0, shell.height/3, Qt.LeftButton, Qt.NoModifier, 500);
2544+ if (data.mouse) {
2545+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
2546+ var menuBarLoader = findInvisibleChild(panel, "menuBarLoader");
2547+ verify(menuBarLoader);
2548+ tryCompare(menuBarLoader.item, "visible", true);
2549+ mouseDrag(panel, panel.width/2, panel.height/2, 0, shell.height/3, Qt.LeftButton, Qt.NoModifier, 500);
2550+ } else {
2551+ touchFlick(panel, panel.width/2, panel.panelHeight/2, panel.width/2, shell.height/3);
2552+ }
2553+
25372554 tryCompare(appDelegate, "state", "restored");
25382555 }
25392556
@@ -3044,5 +3061,70 @@ Rectangle {
30443061 mouseDoubleClickSequence(panel, panel.width/2, PanelState.panelHeight/2, Qt.LeftButton, Qt.NoModifier, 300);
30453062 tryCompare(appDelegate, "state", "restored");
30463063 }
3064+
3065+ function test_noMenusWithActiveCall() {
3066+ loadShell("desktop");
3067+ shell.usageScenario = "desktop";
3068+ waitForRendering(shell);
3069+ swipeAwayGreeter();
3070+
3071+ // start music-app, maximize it
3072+ var appDelegate = startApplication("music-app")
3073+ verify(appDelegate);
3074+ appDelegate.requestMaximize();
3075+
3076+ // move the mouse over panel to reveal the menus
3077+ var panel = findChild(shell, "panel");
3078+ verify(panel);
3079+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
3080+ var menuBarLoader = findInvisibleChild(panel, "menuBarLoader");
3081+ verify(menuBarLoader);
3082+ tryCompare(menuBarLoader.item, "visible", true);
3083+
3084+ // place a phone call
3085+ callManager.foregroundCall = phoneCall;
3086+
3087+ // menu bar should be hidden
3088+ tryCompare(menuBarLoader, "active", false);
3089+ tryCompare(menuBarLoader, "item", null);
3090+
3091+ // remove call
3092+ callManager.foregroundCall = null;
3093+
3094+ // menu bar should be revealed
3095+ tryCompare(menuBarLoader, "active", true);
3096+ tryCompare(menuBarLoader.item, "visible", true);
3097+ }
3098+
3099+ function test_maximizedWindowAndMenuInPanel() {
3100+ loadShell("desktop");
3101+ shell.usageScenario = "desktop";
3102+ waitForRendering(shell);
3103+ swipeAwayGreeter();
3104+
3105+ // start music-app, maximize it
3106+ var appDelegate = startApplication("music-app")
3107+ verify(appDelegate);
3108+ appDelegate.requestMaximize();
3109+ tryCompare(appDelegate, "state", "maximized");
3110+
3111+ // move the mouse over panel to reveal the menus
3112+ var panel = findChild(shell, "panel");
3113+ verify(panel);
3114+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
3115+ var menuBar = findChild(panel, "menuBar");
3116+ verify(menuBar);
3117+ tryCompare(menuBar, "visible", true);
3118+
3119+ // check that the menu popup appears
3120+ var priv = findInvisibleChild(menuBar, "d");
3121+ var menuItem0 = findChild(menuBar, "menuBar-item0");
3122+ verify(menuItem0);
3123+ mouseMove(menuItem0, menuItem0.width/2, menuItem0.height/2, 200);
3124+ tryCompare(menuItem0, "visible", true);
3125+ mouseClick(menuItem0);
3126+ tryCompare(priv, "currentItem", menuItem0);
3127+ tryCompare(priv.currentItem, "popupVisible", true);
3128+ }
30473129 }
30483130}