@@ -332,9 +332,9 @@ Rectangle {
332332 var app2 = ApplicationManager.startApplication("webbrowser-app")
333333 var app3 = ApplicationManager.startApplication("camera-app")
334334 var app4 = ApplicationManager.startApplication("facebook-webapp")
335− var app5 = ApplicationManager.startApplication("calendar-app")
336− var app6 = ApplicationManager.startApplication("gallery-app")
337335 var app7 = ApplicationManager.startApplication("camera-app")
336+ var app6 = ApplicationManager.startApplication("gallery-app")
337+ var app5 = ApplicationManager.startApplication("calendar-app")
338338 waitUntilAppWindowIsFullyLoaded(app7);
339339 }
340340
@@ -1696,11 +1696,11 @@ Rectangle {
16961696 keyPress(Qt.Key_Control)
16971697 keyClick(Qt.Key_Tab);
16981698
1699−
17001699 tryCompare(desktopSpread, "state", "altTab")
17011700
1702− mouseMove(shell, 0, 0);
1701+ mouseMove(shell, 0, shell.height / 2);
17031702 tryCompare(launcher, "state", "visibleTemporary")
1703+ waitForRendering(shell)
17041704
17051705 mouseClick(bfb, bfb.width / 2, bfb.height / 2)
17061706 tryCompare(launcher, "state", "")
@@ -1780,5 +1780,36 @@ Rectangle {
17801780 waitForRendering(shell);
17811781 tryCompare(panelButtons, "visible", true);
17821782 }
1783+
1784+ function test_cantMoveWindowUnderPanel() {
1785+ loadDesktopShellWithApps();
1786+ var appRepeater = findChild(shell, "appRepeater")
1787+ var appDelegate = appRepeater.itemAt(0);
1788+
1789+ mousePress(appDelegate, appDelegate.width / 2, units.gu(1))
1790+ mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100))
1791+
1792+ compare(appDelegate.y >= PanelState.panelHeight, true);
1793+ }
1794+
1795+ function test_restoreWindowStateFixesIfUnderPanel() {
1796+ loadDesktopShellWithApps();
1797+ var appRepeater = findChild(shell, "appRepeater")
1798+ var appId = ApplicationManager.get(0).appId;
1799+ var appDelegate = appRepeater.itemAt(0);
1800+
1801+ // Move it under the panel programmatically (might happen later with an alt+drag)
1802+ appDelegate.y = -units.gu(10)
1803+
1804+ ApplicationManager.stopApplication(appId)
1805+ ApplicationManager.startApplication(appId)
1806+ waitForRendering(shell)
1807+
1808+ // Make sure the newly started one is at index 0 again
1809+ tryCompare(ApplicationManager.get(0), "appId", appId);
1810+
1811+ appDelegate = appRepeater.itemAt(0);
1812+ compare(appDelegate.y >= PanelState.panelHeight, true);
1813+ }
17831814 }
17841815}