@@ -2513,27 +2513,43 @@ Rectangle {
2513 tryCompare(app2Surface, "keymap", "fr");
2513 tryCompare(app2Surface, "keymap", "fr");
2516+ function test_dragPanelToRestoreMaximizedWindow_data() {
2518+ { tag: "with mouse", mouse: true },
2519+ { tag: "with touch", mouse: false }
2516− function test_dragPanelToRestoreMaximizedWindow() {
2523+ function test_dragPanelToRestoreMaximizedWindow(data) {
2517 loadShell("desktop");
2524 loadShell("desktop");
2518 shell.usageScenario = "desktop";
2525 shell.usageScenario = "desktop";
2519 waitForRendering(shell);
2526 waitForRendering(shell);
2520 var panel = findChild(shell, "windowControlArea");
2527 var panel = findChild(shell, "windowControlArea");
2521 verify(panel);
2528 verify(panel);
2523− var appSurfaceId = topLevelSurfaceList.nextId;
2524− var app = ApplicationManager.startApplication("dialer-app")
2525− waitUntilAppWindowIsFullyLoaded(appSurfaceId);
2527 // start dialer, maximize it
2530 // start dialer, maximize it
2528− var appContainer = findChild(shell, "appContainer");
2531+ var appDelegate = startApplication("dialer-app");
2529− var appDelegate = findChild(appContainer, "appDelegate_" + appSurfaceId);
2530 verify(appDelegate);
2532 verify(appDelegate);
2531 var maximizeButton = findChild(appDelegate, "maximizeWindowButton");
2534 var maximizeButton = findChild(appDelegate, "maximizeWindowButton");
2532− mouseClick(maximizeButton);
2536+ mouseClick(maximizeButton);
2538+ tap(maximizeButton);
2534 tryCompare(appDelegate, "state", "maximized");
2541 tryCompare(appDelegate, "state", "maximized");
2544+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
2545+ var menuBarLoader = findInvisibleChild(panel, "menuBarLoader");
2546+ verify(menuBarLoader);
2547+ tryCompare(menuBarLoader.item, "visible", true);
2536− mouseDrag(panel, panel.width/2, panel.height/2, 0, shell.height/3, Qt.LeftButton, Qt.NoModifier, 500);
2548+ mouseDrag(panel, panel.width/2, panel.height/2, 0, shell.height/3, Qt.LeftButton, Qt.NoModifier, 500);
2550+ touchFlick(panel, panel.width/2, panel.height/2, panel.width/2, shell.height/3);
2537 tryCompare(appDelegate, "state", "restored");
2553 tryCompare(appDelegate, "state", "restored");
@@ -2964,5 +2980,70 @@ Rectangle {
2964 mouseDoubleClickSequence(panel, panel.width/2, PanelState.panelHeight/2, Qt.LeftButton, Qt.NoModifier, 300);
2980 mouseDoubleClickSequence(panel, panel.width/2, PanelState.panelHeight/2, Qt.LeftButton, Qt.NoModifier, 300);
2965 tryCompare(appDelegate, "state", "restored");
2981 tryCompare(appDelegate, "state", "restored");
2984+ function test_noMenusWithActiveCall() {
2985+ loadShell("desktop");
2986+ shell.usageScenario = "desktop";
2987+ waitForRendering(shell);
2988+ swipeAwayGreeter();
2990+ // start music-app, maximize it
2991+ var appDelegate = startApplication("music-app")
2992+ verify(appDelegate);
2993+ appDelegate.requestMaximize();
2995+ // move the mouse over panel to reveal the menus
2996+ var panel = findChild(shell, "panel");
2998+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
2999+ var menuBarLoader = findInvisibleChild(panel, "menuBarLoader");
3000+ verify(menuBarLoader);
3001+ tryCompare(menuBarLoader.item, "visible", true);
3003+ // place a phone call
3004+ callManager.foregroundCall = phoneCall;
3006+ // menu bar should be hidden
3007+ tryCompare(menuBarLoader, "active", false);
3008+ tryCompare(menuBarLoader, "item", null);
3011+ callManager.foregroundCall = null;
3013+ // menu bar should be revealed
3014+ tryCompare(menuBarLoader, "active", true);
3015+ tryCompare(menuBarLoader.item, "visible", true);
3018+ function test_maximizedWindowAndMenuInPanel() {
3019+ loadShell("desktop");
3020+ shell.usageScenario = "desktop";
3021+ waitForRendering(shell);
3022+ swipeAwayGreeter();
3024+ // start music-app, maximize it
3025+ var appDelegate = startApplication("music-app")
3026+ verify(appDelegate);
3027+ appDelegate.requestMaximize();
3028+ tryCompare(appDelegate, "state", "maximized");
3030+ // move the mouse over panel to reveal the menus
3031+ var panel = findChild(shell, "panel");
3033+ mouseMove(panel, panel.width/2, panel.panelHeight/2); // to reveal the menus
3034+ var menuBar = findChild(panel, "menuBar");
3036+ tryCompare(menuBar, "visible", true);
3038+ // check that the menu popup appears
3039+ var priv = findInvisibleChild(menuBar, "d");
3040+ var menuItem0 = findChild(menuBar, "menuBar-item0");
3042+ mouseMove(menuItem0, menuItem0.width/2, menuItem0.height/2, 200);
3043+ tryCompare(menuItem0, "visible", true);
3044+ mouseClick(menuItem0);
3045+ tryCompare(priv, "currentItem", menuItem0);
3046+ tryCompare(priv.currentItem, "popupVisible", true);