@@ -1485,5 +1485,52 @@ Rectangle {
14851485
14861486 keyRelease(Qt.Key_Control);
14871487 }
1488+
1489+ function test_selectFromSpreadWithMouse_data() {
1490+ return [
1491+ {tag: "click on tileInfo", tileInfo: true },
1492+ {tag: "click on surface", tileInfo: false },
1493+ ]
1494+ }
1495+
1496+ function test_selectFromSpreadWithMouse(data) {
1497+ loadDesktopShellWithApps()
1498+
1499+ var appRepeater = findInvisibleChild(shell, "appRepeater");
1500+ verify(appRepeater !== null);
1501+
1502+ keyPress(Qt.Key_Control)
1503+ keyClick(Qt.Key_Tab);
1504+
1505+ appRemovedSpy.clear();
1506+
1507+ var focusAppId = ApplicationManager.get(2).appId;
1508+ var appDelegate2 = appRepeater.itemAt(2);
1509+ var decoratedWindow = findChild(appDelegate2, "decoratedWindow");
1510+ var stage = findChild(shell, "stage");
1511+
1512+ tryCompare(stage, "state", "altTab");
1513+
1514+ // Move the mouse over tile 2 and verify the highlight becomes visible
1515+ var x = 0;
1516+ var y = shell.height * (data.tileInfo ? .5 : 0.95)
1517+ mouseMove(shell, x, y)
1518+ while (appRepeater.highlightedIndex !== 2 && x <= 4000) {
1519+ print("y is", y)
1520+ x+=10;
1521+ mouseMove(shell, x, y)
1522+ waitForRendering(shell)
1523+ }
1524+ tryCompare(decoratedWindow, "highlightShown", true);
1525+
1526+ // Click the tile
1527+ mouseClick(decoratedWindow, decoratedWindow.width / 2, decoratedWindow.height / 2)
1528+
1529+ // Verify that we left the spread and app2 is the focused one now
1530+ tryCompare(stage, "state", "");
1531+ tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1532+
1533+ keyRelease(Qt.Key_Control);
1534+ }
14881535 }
14891536}