@@ -322,8 +322,9 @@ Rectangle {
323 function loadDesktopShellWithApps() {
323 function loadDesktopShellWithApps() {
324 loadShell("desktop");
324 loadShell("desktop");
325+ waitForRendering(shell)
325 shell.usageScenario = "desktop"
326 shell.usageScenario = "desktop"
326− waitForRendering(root)
327+ waitForRendering(shell)
327 var app1 = ApplicationManager.startApplication("dialer-app")
328 var app1 = ApplicationManager.startApplication("dialer-app")
328 var app2 = ApplicationManager.startApplication("webbrowser-app")
329 var app2 = ApplicationManager.startApplication("webbrowser-app")
329 var app3 = ApplicationManager.startApplication("camera-app")
330 var app3 = ApplicationManager.startApplication("camera-app")
@@ -1407,17 +1408,18 @@ Rectangle {
1407 keyClick(Qt.Key_Tab, Qt.ControlModifier)
1408 keyClick(Qt.Key_Tab, Qt.ControlModifier)
1408 tryCompare(app2.session.surface, "activeFocus", true)
1409 tryCompare(app2.session.surface, "activeFocus", true)
1411+ var desktopSpread = findChild(shell, "spread")
1411− tryCompare(desktopStage, "state", "")
1413+ tryCompare(desktopSpread, "state", "")
1413 // Just press Alt, make sure the spread comes up
1415 // Just press Alt, make sure the spread comes up
1414 keyPress(Qt.Key_Control);
1416 keyPress(Qt.Key_Control);
1415 keyClick(Qt.Key_Tab);
1417 keyClick(Qt.Key_Tab);
1416− tryCompare(desktopStage, "state", "altTab")
1418+ tryCompare(desktopSpread, "state", "altTab")
1418 // Release control, check if spread disappears
1420 // Release control, check if spread disappears
1419 keyRelease(Qt.Key_Control)
1421 keyRelease(Qt.Key_Control)
1420− tryCompare(desktopStage, "state", "")
1422+ tryCompare(desktopSpread, "state", "")
1422 // Focus should have switched back now
1424 // Focus should have switched back now
1423 tryCompare(app3.session.surface, "activeFocus", true)
1425 tryCompare(app3.session.surface, "activeFocus", true)
@@ -1429,41 +1431,44 @@ Rectangle {
1429 var desktopStage = findChild(shell, "stage");
1431 var desktopStage = findChild(shell, "stage");
1430 verify(desktopStage !== null)
1432 verify(desktopStage !== null)
1432− var appContainer = findInvisibleChild(shell, "appContainer")
1434+ var desktopSpread = findChild(shell, "spread");
1433− verify(appContainer !== null)
1435+ verify(desktopSpread !== null)
1437+ var spreadContainer = findInvisibleChild(shell, "spreadContainer")
1438+ verify(spreadContainer !== null)
1435− var appRepeater = findInvisibleChild(shell, "appRepeater")
1440+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater")
1436− verify(appRepeater !== null)
1441+ verify(spreadRepeater !== null)
1438 // remember the focused appId
1443 // remember the focused appId
1439 var focused = ApplicationManager.get(ApplicationManager.findApplication(ApplicationManager.focusedApplicationId));
1444 var focused = ApplicationManager.get(ApplicationManager.findApplication(ApplicationManager.focusedApplicationId));
1441− tryCompare(desktopStage, "state", "")
1446+ tryCompare(desktopSpread, "state", "")
1443 // Just press Alt, make sure the spread comes up
1448 // Just press Alt, make sure the spread comes up
1444 keyPress(Qt.Key_Control);
1449 keyPress(Qt.Key_Control);
1445 keyClick(Qt.Key_Tab);
1450 keyClick(Qt.Key_Tab);
1446− tryCompare(desktopStage, "state", "altTab")
1451+ tryCompare(desktopSpread, "state", "altTab")
1447− tryCompare(appRepeater, "highlightedIndex", 1)
1452+ tryCompare(spreadRepeater, "highlightedIndex", 1)
1448 waitForRendering(shell)
1453 waitForRendering(shell)
1450 // Now press and hold Tab, make sure the highlight moves all the way but stops at the last one
1455 // Now press and hold Tab, make sure the highlight moves all the way but stops at the last one
1451 // We can't simulate a pressed key with keyPress() currently, so let's inject the events
1456 // We can't simulate a pressed key with keyPress() currently, so let's inject the events
1452 // at API level. Jump for 10 times, verify that it's still at the last one and didn't wrap around.
1457 // at API level. Jump for 10 times, verify that it's still at the last one and didn't wrap around.
1453 for (var i = 0; i < 10; i++) {
1458 for (var i = 0; i < 10; i++) {
1454− appContainer.selectNext(true); // true == isAutoRepeat
1459+ desktopSpread.selectNext(true); // true == isAutoRepeat
1455 wait(0); // Trigger the event loop to make sure all the things happen
1460 wait(0); // Trigger the event loop to make sure all the things happen
1457− tryCompare(appRepeater, "highlightedIndex", 6)
1462+ tryCompare(spreadRepeater, "highlightedIndex", 6)
1459 // Now release it once, and verify that it does wrap around with an additional Tab press
1464 // Now release it once, and verify that it does wrap around with an additional Tab press
1460 keyRelease(Qt.Key_Tab);
1465 keyRelease(Qt.Key_Tab);
1461 keyClick(Qt.Key_Tab);
1466 keyClick(Qt.Key_Tab);
1462− tryCompare(appRepeater, "highlightedIndex", 0)
1467+ tryCompare(spreadRepeater, "highlightedIndex", 0)
1464 // Release control, check if spread disappears
1469 // Release control, check if spread disappears
1465 keyRelease(Qt.Key_Control)
1470 keyRelease(Qt.Key_Control)
1466− tryCompare(desktopStage, "state", "")
1471+ tryCompare(desktopSpread, "state", "")
1468 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1473 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1469 tryCompare(focused.session.surface, "activeFocus", true)
1474 tryCompare(focused.session.surface, "activeFocus", true)
@@ -1472,30 +1477,30 @@ Rectangle {
1472 function test_altBackTabNavigation() {
1477 function test_altBackTabNavigation() {
1473 loadDesktopShellWithApps();
1478 loadDesktopShellWithApps();
1475− var appRepeater = findInvisibleChild(shell, "appRepeater");
1480+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1476− verify(appRepeater !== null);
1481+ verify(spreadRepeater !== null);
1478 keyPress(Qt.Key_Control)
1483 keyPress(Qt.Key_Control)
1479 keyClick(Qt.Key_Tab);
1484 keyClick(Qt.Key_Tab);
1480− tryCompare(appRepeater, "highlightedIndex", 1);
1485+ tryCompare(spreadRepeater, "highlightedIndex", 1);
1482 keyClick(Qt.Key_Tab);
1487 keyClick(Qt.Key_Tab);
1483− tryCompare(appRepeater, "highlightedIndex", 2);
1488+ tryCompare(spreadRepeater, "highlightedIndex", 2);
1485 keyClick(Qt.Key_Tab);
1490 keyClick(Qt.Key_Tab);
1486− tryCompare(appRepeater, "highlightedIndex", 3);
1491+ tryCompare(spreadRepeater, "highlightedIndex", 3);
1488 keyClick(Qt.Key_Tab);
1493 keyClick(Qt.Key_Tab);
1489− tryCompare(appRepeater, "highlightedIndex", 4);
1494+ tryCompare(spreadRepeater, "highlightedIndex", 4);
1491 keyClick(Qt.Key_Backtab);
1496 keyClick(Qt.Key_Backtab);
1492− tryCompare(appRepeater, "highlightedIndex", 3);
1497+ tryCompare(spreadRepeater, "highlightedIndex", 3);
1494 keyClick(Qt.Key_Backtab);
1499 keyClick(Qt.Key_Backtab);
1495− tryCompare(appRepeater, "highlightedIndex", 2);
1500+ tryCompare(spreadRepeater, "highlightedIndex", 2);
1497 keyClick(Qt.Key_Backtab);
1502 keyClick(Qt.Key_Backtab);
1498− tryCompare(appRepeater, "highlightedIndex", 1);
1503+ tryCompare(spreadRepeater, "highlightedIndex", 1);
1500 keyRelease(Qt.Key_Control);
1505 keyRelease(Qt.Key_Control);
@@ -1503,20 +1508,20 @@ Rectangle {
1503 function test_highlightFollowsMouse() {
1508 function test_highlightFollowsMouse() {
1504 loadDesktopShellWithApps()
1509 loadDesktopShellWithApps()
1506− var appRepeater = findInvisibleChild(shell, "appRepeater");
1511+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1507− verify(appRepeater !== null);
1512+ verify(spreadRepeater !== null);
1509 keyPress(Qt.Key_Control)
1514 keyPress(Qt.Key_Control)
1510 keyClick(Qt.Key_Tab);
1515 keyClick(Qt.Key_Tab);
1512− tryCompare(appRepeater, "highlightedIndex", 1);
1517+ tryCompare(spreadRepeater, "highlightedIndex", 1);
1514 var x = 0;
1519 var x = 0;
1515 var y = shell.height * .75;
1520 var y = shell.height * .75;
1516 mouseMove(shell, x, y)
1521 mouseMove(shell, x, y)
1518 for (var i = 0; i < 7; i++) {
1523 for (var i = 0; i < 7; i++) {
1519− while (appRepeater.highlightedIndex != i && x <= 4000) {
1524+ while (spreadRepeater.highlightedIndex != i && x <= 4000) {
1521 mouseMove(shell, x, y)
1526 mouseMove(shell, x, y)
1522 wait(0); // spin the loop so bindings get evaluated
1527 wait(0); // spin the loop so bindings get evaluated
@@ -1531,8 +1536,8 @@ Rectangle {
1531 function test_closeFromSpread() {
1536 function test_closeFromSpread() {
1532 loadDesktopShellWithApps()
1537 loadDesktopShellWithApps()
1534− var appRepeater = findInvisibleChild(shell, "appRepeater");
1539+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1535− verify(appRepeater !== null);
1540+ verify(spreadRepeater !== null);
1537 keyPress(Qt.Key_Control)
1542 keyPress(Qt.Key_Control)
1538 keyClick(Qt.Key_Tab);
1543 keyClick(Qt.Key_Tab);
@@ -1540,14 +1545,14 @@ Rectangle {
1540 appRemovedSpy.clear();
1545 appRemovedSpy.clear();
1542 var closedAppId = ApplicationManager.get(2).appId;
1547 var closedAppId = ApplicationManager.get(2).appId;
1543− var appDelegate2 = appRepeater.itemAt(2);
1548+ var spreadDelegate2 = spreadRepeater.itemAt(2);
1544− var closeMouseArea = findChild(appDelegate2, "closeMouseArea");
1549+ var closeMouseArea = findChild(spreadDelegate2, "closeMouseArea");
1546 // Move the mosue over tile 2 and verify the close button becomes visible
1551 // Move the mosue over tile 2 and verify the close button becomes visible
1547 var x = 0;
1552 var x = 0;
1548 var y = shell.height * .5;
1553 var y = shell.height * .5;
1549 mouseMove(shell, x, y)
1554 mouseMove(shell, x, y)
1550− while (appRepeater.highlightedIndex !== 2 && x <= 4000) {
1555+ while (spreadRepeater.highlightedIndex !== 2 && x <= 4000) {
1552 mouseMove(shell, x, y)
1557 mouseMove(shell, x, y)
1553 wait(0); // spin the loop so bindings get evaluated
1558 wait(0); // spin the loop so bindings get evaluated
@@ -1574,32 +1579,35 @@ Rectangle {
1574 function test_selectFromSpreadWithMouse(data) {
1579 function test_selectFromSpreadWithMouse(data) {
1575 loadDesktopShellWithApps()
1580 loadDesktopShellWithApps()
1582+ var stage = findChild(shell, "stage");
1583+ var spread = findChild(stage, "spread");
1584+ waitForRendering(spread)
1577− var appRepeater = findInvisibleChild(shell, "appRepeater");
1586+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1578− verify(appRepeater !== null);
1587+ verify(spreadRepeater !== null);
1580 keyPress(Qt.Key_Control)
1589 keyPress(Qt.Key_Control)
1581 keyClick(Qt.Key_Tab);
1590 keyClick(Qt.Key_Tab);
1583 var focusAppId = ApplicationManager.get(2).appId;
1592 var focusAppId = ApplicationManager.get(2).appId;
1584− var appDelegate2 = appRepeater.itemAt(2);
1593+ var spreadDelegate2 = spreadRepeater.itemAt(2);
1585− var decoratedWindow = findChild(appDelegate2, "decoratedWindow");
1594+ var clippedSpreadDelegate = findChild(spreadDelegate2, "clippedSpreadDelegate");
1586− var stage = findChild(shell, "stage");
1588− tryCompare(stage, "state", "altTab");
1596+ tryCompare(spread, "state", "altTab");
1590 // Move the mouse over tile 2 and verify the highlight becomes visible
1598 // Move the mouse over tile 2 and verify the highlight becomes visible
1591 var x = 0;
1599 var x = 0;
1592 var y = shell.height * (data.tileInfo ? .95 : 0.5)
1600 var y = shell.height * (data.tileInfo ? .95 : 0.5)
1593 mouseMove(shell, x, y)
1601 mouseMove(shell, x, y)
1594− while (appRepeater.highlightedIndex !== 2 && x <= 4000) {
1602+ while (spreadRepeater.highlightedIndex !== 2 && x <= 4000) {
1596 mouseMove(shell, x, y)
1604 mouseMove(shell, x, y)
1597 wait(0); // spin the loop so bindings get evaluated
1605 wait(0); // spin the loop so bindings get evaluated
1599− tryCompare(decoratedWindow, "highlightShown", true);
1607+ tryCompare(clippedSpreadDelegate, "highlightShown", true);
1601 // Click the tile
1609 // Click the tile
1602− mouseClick(decoratedWindow, decoratedWindow.width / 2, decoratedWindow.height / 2)
1610+ mouseClick(clippedSpreadDelegate, clippedSpreadDelegate.width / 2, clippedSpreadDelegate.height / 2)
1604 // Verify that we left the spread and app2 is the focused one now
1612 // Verify that we left the spread and app2 is the focused one now
1605 tryCompare(stage, "state", "");
1613 tryCompare(stage, "state", "");
@@ -1618,7 +1626,6 @@ Rectangle {
1618 keyClick(Qt.Key_Tab);
1626 keyClick(Qt.Key_Tab);
1620 var spreadFlickable = findChild(shell, "spreadFlickable")
1628 var spreadFlickable = findChild(shell, "spreadFlickable")
1621− print("have flickable", spreadFlickable, spreadFlickable.contentX)
1623 compare(spreadFlickable.contentX, 0);
1630 compare(spreadFlickable.contentX, 0);
@@ -1643,5 +1650,86 @@ Rectangle {
1644 keyRelease(Qt.Key_Control);
1651 keyRelease(Qt.Key_Control);
1654+ // This makes sure the hoverMouseArea is set to invisible AND disabled
1655+ // when not needed. Otherwise it'll eat mouse hover events for the rest of the shell/apps
1656+ function test_hoverMouseAreaDisabledAndInvisible() {
1657+ loadDesktopShellWithApps()
1659+ var hoverMouseArea = findChild(shell, "hoverMouseArea");
1660+ tryCompare(hoverMouseArea, "enabled", false)
1661+ tryCompare(hoverMouseArea, "visible", false)
1663+ keyPress(Qt.Key_Control)
1664+ keyClick(Qt.Key_Tab);
1666+ tryCompare(hoverMouseArea, "enabled", true)
1667+ tryCompare(hoverMouseArea, "visible", true)
1669+ keyRelease(Qt.Key_Control)
1671+ tryCompare(hoverMouseArea, "enabled", false)
1672+ tryCompare(hoverMouseArea, "visible", false)
1675+ function test_workspacePreviewsHighlightedApp() {
1676+ loadDesktopShellWithApps()
1678+ var targetZ = ApplicationManager.count + 1;
1680+ var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1681+ verify(spreadRepeater !== null);
1683+ var appRepeater = findInvisibleChild(shell, "appRepeater");
1684+ verify(appRepeater !== null);
1686+ keyPress(Qt.Key_Control)
1687+ keyClick(Qt.Key_Tab);
1689+ tryCompare(spreadRepeater, "highlightedIndex", 1);
1690+ tryCompare(appRepeater.itemAt(1), "z", targetZ)
1693+ var y = shell.height * .75;
1694+ mouseMove(shell, x, y)
1696+ for (var i = 0; i < 7; i++) {
1697+ while (spreadRepeater.highlightedIndex != i && x <= 4000) {
1698+ tryCompare(appRepeater.itemAt(spreadRepeater.highlightedIndex), "z", targetZ)
1700+ mouseMove(shell, x, y)
1701+ wait(0); // spin the loop so bindings get evaluated
1707+ keyRelease(Qt.Key_Control);
1710+ function test_focusAppFromLauncherExitsSpread() {
1711+ loadDesktopShellWithApps()
1713+ var desktopSpread = findChild(shell, "spread");
1714+ var launcher = findChild(shell, "launcher");
1715+ var bfb = findChild(launcher, "buttonShowDashHome");
1717+ keyPress(Qt.Key_Control)
1718+ keyClick(Qt.Key_Tab);
1721+ tryCompare(desktopSpread, "state", "altTab")
1723+ mouseMove(shell, 0, 0);
1724+ tryCompare(launcher, "state", "visibleTemporary")
1726+ mouseClick(bfb, bfb.width / 2, bfb.height / 2)
1727+ tryCompare(launcher, "state", "")
1728+ tryCompare(desktopSpread, "state", "")
1730+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1732+ keyRelease(Qt.Key_Control);