@@ -26,6 +26,7 @@ import Unity.Application 0.1
26import Unity.Connectivity 0.1
26import Unity.Connectivity 0.1
27import Unity.Indicators 0.1
27import Unity.Indicators 0.1
28import Unity.Notifications 1.0
28import Unity.Notifications 1.0
29+import Unity.Launcher 0.1
29import Unity.Test 0.1
30import Unity.Test 0.1
30import Powerd 0.1
31import Powerd 0.1
31import Wizard 0.1 as Wizard
32import Wizard 0.1 as Wizard
@@ -121,10 +122,6 @@ Rectangle {
121 Component.onDestruction: {
122 Component.onDestruction: {
122 shellLoader.itemDestroyed = true;
123 shellLoader.itemDestroyed = true;
124− Component.onCompleted: {
125− var keyMapper = testCase.findChild(__shell, "physicalKeysMapper");
126− keyMapper.controlInsteadOfAlt = true;
@@ -213,6 +210,31 @@ Rectangle {
213 checked: true
210 checked: true
214 color: "white"
211 color: "white"
213+ ListItem.ItemSelector {
215+ anchors { left: parent.left; right: parent.right }
216+ activeFocusOnPress: false
218+ model: ["Ctrl", "Alt", "Super"]
219+ onSelectedIndexChanged: {
220+ var keyMapper = testCase.findChild(shellContainer, "physicalKeysMapper");
221+ keyMapper.controlInsteadOfAlt = selectedIndex == 1;
222+ keyMapper.controlInsteadOfSuper = selectedIndex == 2;
227+ anchors { left: parent.left; right: parent.right }
229+ id: autohideLauncherCheckbox
231+ GSettingsController.setAutohideLauncher(checked)
235+ text: "Autohide launcher"
217 Label { text: "Applications"; font.bold: true }
239 Label { text: "Applications"; font.bold: true }
@@ -912,6 +934,7 @@ Rectangle {
912 function dragLauncherIntoView() {
934 function dragLauncherIntoView() {
913 var launcher = findChild(shell, "launcher");
935 var launcher = findChild(shell, "launcher");
914 var launcherPanel = findChild(launcher, "launcherPanel");
936 var launcherPanel = findChild(launcher, "launcherPanel");
937+ waitForRendering(launcher);
915 verify(launcherPanel.x = - launcherPanel.width);
938 verify(launcherPanel.x = - launcherPanel.width);
917 var touchStartX = 2;
940 var touchStartX = 2;
@@ -1441,7 +1464,7 @@ Rectangle {
1442 // Do a quick alt-tab and see if focus changes
1465 // Do a quick alt-tab and see if focus changes
1443 tryCompare(app3.session.lastSurface, "activeFocus", true)
1466 tryCompare(app3.session.lastSurface, "activeFocus", true)
1444− keyClick(Qt.Key_Tab, Qt.ControlModifier)
1467+ keyClick(Qt.Key_Tab, Qt.AltModifier)
1445 tryCompare(app2.session.lastSurface, "activeFocus", true)
1468 tryCompare(app2.session.lastSurface, "activeFocus", true)
1447 var desktopSpread = findChild(shell, "spread")
1470 var desktopSpread = findChild(shell, "spread")
@@ -1449,12 +1472,12 @@ Rectangle {
1449 tryCompare(desktopSpread, "state", "")
1472 tryCompare(desktopSpread, "state", "")
1451 // Just press Alt, make sure the spread comes up
1474 // Just press Alt, make sure the spread comes up
1452− keyPress(Qt.Key_Control);
1475+ keyPress(Qt.Key_Alt);
1453 keyClick(Qt.Key_Tab);
1476 keyClick(Qt.Key_Tab);
1454 tryCompare(desktopSpread, "state", "altTab")
1477 tryCompare(desktopSpread, "state", "altTab")
1456 // Release control, check if spread disappears
1479 // Release control, check if spread disappears
1457− keyRelease(Qt.Key_Control)
1480+ keyRelease(Qt.Key_Alt)
1458 tryCompare(desktopSpread, "state", "")
1481 tryCompare(desktopSpread, "state", "")
1460 // Focus should have switched back now
1483 // Focus should have switched back now
@@ -1482,7 +1505,7 @@ Rectangle {
1482 tryCompare(desktopSpread, "state", "")
1505 tryCompare(desktopSpread, "state", "")
1484 // Just press Alt, make sure the spread comes up
1507 // Just press Alt, make sure the spread comes up
1485− keyPress(Qt.Key_Control);
1508+ keyPress(Qt.Key_Alt);
1486 keyClick(Qt.Key_Tab);
1509 keyClick(Qt.Key_Tab);
1487 tryCompare(desktopSpread, "state", "altTab")
1510 tryCompare(desktopSpread, "state", "altTab")
1488 tryCompare(spreadRepeater, "highlightedIndex", 1)
1511 tryCompare(spreadRepeater, "highlightedIndex", 1)
@@ -1503,7 +1526,7 @@ Rectangle {
1503 tryCompare(spreadRepeater, "highlightedIndex", 0)
1526 tryCompare(spreadRepeater, "highlightedIndex", 0)
1505 // Release control, check if spread disappears
1528 // Release control, check if spread disappears
1506− keyRelease(Qt.Key_Control)
1529+ keyRelease(Qt.Key_Alt)
1507 tryCompare(desktopSpread, "state", "")
1530 tryCompare(desktopSpread, "state", "")
1509 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1532 // Make sure that after wrapping around once, we have the same one focused as at the beginning
@@ -1516,7 +1539,7 @@ Rectangle {
1516 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1539 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1517 verify(spreadRepeater !== null);
1540 verify(spreadRepeater !== null);
1519− keyPress(Qt.Key_Control)
1542+ keyPress(Qt.Key_Alt)
1520 keyClick(Qt.Key_Tab);
1543 keyClick(Qt.Key_Tab);
1521 tryCompare(spreadRepeater, "highlightedIndex", 1);
1544 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1538,7 +1561,7 @@ Rectangle {
1538 keyClick(Qt.Key_Backtab);
1561 keyClick(Qt.Key_Backtab);
1539 tryCompare(spreadRepeater, "highlightedIndex", 1);
1562 tryCompare(spreadRepeater, "highlightedIndex", 1);
1541− keyRelease(Qt.Key_Control);
1564+ keyRelease(Qt.Key_Alt);
1544 function test_highlightFollowsMouse() {
1567 function test_highlightFollowsMouse() {
@@ -1547,7 +1570,7 @@ Rectangle {
1547 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1570 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1548 verify(spreadRepeater !== null);
1571 verify(spreadRepeater !== null);
1550− keyPress(Qt.Key_Control)
1573+ keyPress(Qt.Key_Alt)
1551 keyClick(Qt.Key_Tab);
1574 keyClick(Qt.Key_Tab);
1553 tryCompare(spreadRepeater, "highlightedIndex", 1);
1576 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1566,7 +1589,7 @@ Rectangle {
1567 verify(y < 4000);
1590 verify(y < 4000);
1569− keyRelease(Qt.Key_Control);
1592+ keyRelease(Qt.Key_Alt);
1572 function test_closeFromSpread() {
1595 function test_closeFromSpread() {
@@ -1575,7 +1598,7 @@ Rectangle {
1575 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1598 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1576 verify(spreadRepeater !== null);
1599 verify(spreadRepeater !== null);
1578− keyPress(Qt.Key_Control)
1601+ keyPress(Qt.Key_Alt)
1579 keyClick(Qt.Key_Tab);
1602 keyClick(Qt.Key_Tab);
1581 appRemovedSpy.clear();
1604 appRemovedSpy.clear();
@@ -1602,7 +1625,7 @@ Rectangle {
1602 tryCompare(appRemovedSpy, "count", 1)
1625 tryCompare(appRemovedSpy, "count", 1)
1603 compare(appRemovedSpy.signalArguments[0][0], closedAppId);
1626 compare(appRemovedSpy.signalArguments[0][0], closedAppId);
1605− keyRelease(Qt.Key_Control);
1628+ keyRelease(Qt.Key_Alt);
1608 function test_selectFromSpreadWithMouse_data() {
1631 function test_selectFromSpreadWithMouse_data() {
@@ -1622,7 +1645,7 @@ Rectangle {
1622 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1645 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1623 verify(spreadRepeater !== null);
1646 verify(spreadRepeater !== null);
1625− keyPress(Qt.Key_Control)
1648+ keyPress(Qt.Key_Alt)
1626 keyClick(Qt.Key_Tab);
1649 keyClick(Qt.Key_Tab);
1628 var focusAppId = ApplicationManager.get(2).appId;
1651 var focusAppId = ApplicationManager.get(2).appId;
@@ -1649,7 +1672,7 @@ Rectangle {
1649 tryCompare(stage, "state", "");
1672 tryCompare(stage, "state", "");
1650 tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1673 tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1652− keyRelease(Qt.Key_Control);
1675+ keyRelease(Qt.Key_Alt);
1655 function test_progressiveAutoScrolling() {
1678 function test_progressiveAutoScrolling() {
@@ -1658,7 +1681,7 @@ Rectangle {
1658 var appRepeater = findInvisibleChild(shell, "appRepeater");
1681 var appRepeater = findInvisibleChild(shell, "appRepeater");
1659 verify(appRepeater !== null);
1682 verify(appRepeater !== null);
1661− keyPress(Qt.Key_Control)
1684+ keyPress(Qt.Key_Alt)
1662 keyClick(Qt.Key_Tab);
1685 keyClick(Qt.Key_Tab);
1664 var spreadFlickable = findChild(shell, "spreadFlickable")
1687 var spreadFlickable = findChild(shell, "spreadFlickable")
@@ -1669,7 +1692,7 @@ Rectangle {
1669 var x = 0;
1692 var x = 0;
1670 var y = shell.height * .5
1693 var y = shell.height * .5
1671 mouseMove(shell, x, y)
1694 mouseMove(shell, x, y)
1672− while (x <= spreadFlickable.width) {
1695+ while (x <= shell.width) {
1674 mouseMove(shell, x, y)
1697 mouseMove(shell, x, y)
1675 wait(0); // spin the loop so bindings get evaluated
1698 wait(0); // spin the loop so bindings get evaluated
@@ -1684,7 +1707,7 @@ Rectangle {
1685 tryCompare(spreadFlickable, "contentX", 0);
1708 tryCompare(spreadFlickable, "contentX", 0);
1687− keyRelease(Qt.Key_Control);
1710+ keyRelease(Qt.Key_Alt);
1690 // This makes sure the hoverMouseArea is set to invisible AND disabled
1713 // This makes sure the hoverMouseArea is set to invisible AND disabled
@@ -1696,13 +1719,13 @@ Rectangle {
1696 tryCompare(hoverMouseArea, "enabled", false)
1719 tryCompare(hoverMouseArea, "enabled", false)
1697 tryCompare(hoverMouseArea, "visible", false)
1720 tryCompare(hoverMouseArea, "visible", false)
1699− keyPress(Qt.Key_Control)
1722+ keyPress(Qt.Key_Alt)
1700 keyClick(Qt.Key_Tab);
1723 keyClick(Qt.Key_Tab);
1702 tryCompare(hoverMouseArea, "enabled", true)
1725 tryCompare(hoverMouseArea, "enabled", true)
1703 tryCompare(hoverMouseArea, "visible", true)
1726 tryCompare(hoverMouseArea, "visible", true)
1705− keyRelease(Qt.Key_Control)
1728+ keyRelease(Qt.Key_Alt)
1707 tryCompare(hoverMouseArea, "enabled", false)
1730 tryCompare(hoverMouseArea, "enabled", false)
1708 tryCompare(hoverMouseArea, "visible", false)
1731 tryCompare(hoverMouseArea, "visible", false)
@@ -1719,7 +1742,7 @@ Rectangle {
1719 var appRepeater = findInvisibleChild(shell, "appRepeater");
1742 var appRepeater = findInvisibleChild(shell, "appRepeater");
1720 verify(appRepeater !== null);
1743 verify(appRepeater !== null);
1722− keyPress(Qt.Key_Control)
1745+ keyPress(Qt.Key_Alt)
1723 keyClick(Qt.Key_Tab);
1746 keyClick(Qt.Key_Tab);
1725 tryCompare(spreadRepeater, "highlightedIndex", 1);
1748 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1740,33 +1763,46 @@ Rectangle {
1741 verify(y < 4000);
1764 verify(y < 4000);
1743− keyRelease(Qt.Key_Control);
1766+ keyRelease(Qt.Key_Alt);
1746− function test_focusAppFromLauncherExitsSpread() {
1769+ function test_focusAppFromLauncherExitsSpread_data() {
1747− loadDesktopShellWithApps()
1770+ return [
1771+ {tag: "autohide launcher", launcherLocked: false },
1772+ {tag: "locked launcher", launcherLocked: true }
1749− var desktopSpread = findChild(shell, "spread");
1776+ function test_focusAppFromLauncherExitsSpread(data) {
1777+ loadDesktopShellWithApps()
1750 var launcher = findChild(shell, "launcher");
1778 var launcher = findChild(shell, "launcher");
1779+ var desktopSpread = findChild(shell, "spread");
1751 var bfb = findChild(launcher, "buttonShowDashHome");
1780 var bfb = findChild(launcher, "buttonShowDashHome");
1782+ GSettingsController.setAutohideLauncher(!data.launcherLocked);
1783+ waitForRendering(shell);
1753− keyPress(Qt.Key_Control)
1785+ keyPress(Qt.Key_Alt)
1754 keyClick(Qt.Key_Tab);
1786 keyClick(Qt.Key_Tab);
1756 tryCompare(desktopSpread, "state", "altTab")
1788 tryCompare(desktopSpread, "state", "altTab")
1790+ if (!data.launcherLocked) {
1758− revealLauncherByEdgePushWithMouse();
1791+ revealLauncherByEdgePushWithMouse();
1759− tryCompare(launcher, "x", 0);
1792+ tryCompare(launcher, "x", 0);
1760− mouseMove(bfb, bfb.width / 2, bfb.height / 2)
1793+ mouseMove(bfb, bfb.width / 2, bfb.height / 2)
1761− waitForRendering(shell)
1794+ waitForRendering(shell)
1763 mouseClick(bfb, bfb.width / 2, bfb.height / 2)
1797 mouseClick(bfb, bfb.width / 2, bfb.height / 2)
1798+ if (!data.launcherLocked) {
1764− tryCompare(launcher, "state", "")
1799+ tryCompare(launcher, "state", "")
1765 tryCompare(desktopSpread, "state", "")
1801 tryCompare(desktopSpread, "state", "")
1767 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1803 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1769− keyRelease(Qt.Key_Control);
1805+ keyRelease(Qt.Key_Alt);
1772 // regression test for http://pad.lv/1443319
1808 // regression test for http://pad.lv/1443319
@@ -1989,6 +2025,138 @@ Rectangle {
2028+ function test_superTabToCycleLauncher_data() {
2030+ {tag: "autohide launcher", launcherLocked: false},
2031+ {tag: "locked launcher", launcherLocked: true}
2035+ function test_superTabToCycleLauncher(data) {
2036+ loadShell("desktop");
2037+ shell.usageScenario = "desktop";
2038+ GSettingsController.setAutohideLauncher(!data.launcherLocked);
2039+ waitForRendering(shell);
2041+ var launcher = findChild(shell, "launcher");
2042+ var launcherPanel = findChild(launcher, "launcherPanel");
2043+ var firstAppInLauncher = LauncherModel.get(0).appId;
2045+ compare(launcher.state, data.launcherLocked ? "visible": "");
2046+ compare(launcherPanel.highlightIndex, -2);
2047+ compare(ApplicationManager.focusedApplicationId, "unity8-dash");
2049+ // Use Super + Tab Tab to cycle to the first entry in the launcher
2050+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2051+ keyClick(Qt.Key_Tab);
2052+ tryCompare(launcher, "state", "visible");
2053+ tryCompare(launcherPanel, "highlightIndex", -1);
2054+ keyClick(Qt.Key_Tab);
2055+ tryCompare(launcherPanel, "highlightIndex", 0);
2056+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2057+ tryCompare(launcher, "state", data.launcherLocked ? "visible" : "");
2058+ tryCompare(launcherPanel, "highlightIndex", -2);
2059+ tryCompare(ApplicationManager, "focusedApplicationId", firstAppInLauncher);
2061+ // Now go back to the dash
2062+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2063+ keyClick(Qt.Key_Tab);
2064+ tryCompare(launcher, "state", "visible");
2065+ tryCompare(launcherPanel, "highlightIndex", -1);
2066+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2067+ tryCompare(launcher, "state", data.launcherLocked ? "visible" : "");
2068+ tryCompare(launcherPanel, "highlightIndex", -2);
2069+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
2072+ function test_longpressSuperOpensLauncher() {
2073+ loadShell("desktop");
2074+ var launcher = findChild(shell, "launcher");
2075+ var shortcutHint = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint")
2077+ compare(launcher.state, "");
2078+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2079+ tryCompare(launcher, "state", "visible");
2080+ tryCompare(shortcutHint, "visible", true);
2082+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2083+ tryCompare(launcher, "state", "");
2084+ tryCompare(shortcutHint, "visible", false);
2087+ function test_metaNumberLaunchesFromLauncher_data() {
2089+ {tag: "Meta+1", key: Qt.Key_1, index: 0},
2090+ {tag: "Meta+2", key: Qt.Key_2, index: 1},
2091+ {tag: "Meta+4", key: Qt.Key_5, index: 4},
2092+ {tag: "Meta+0", key: Qt.Key_0, index: 9},
2096+ function test_metaNumberLaunchesFromLauncher(data) {
2097+ loadShell("desktop");
2098+ var launcher = findChild(shell, "launcher");
2099+ var appId = LauncherModel.get(data.index).appId;
2100+ waitForRendering(shell);
2102+ keyClick(data.key, Qt.MetaModifier);
2103+ tryCompare(ApplicationManager, "focusedApplicationId", appId);
2106+ function test_altF1OpensLauncherForKeyboardNavigation() {
2107+ loadShell("desktop");
2108+ waitForRendering(shell);
2109+ var launcher = findChild(shell, "launcher");
2111+ keyClick(Qt.Key_F1, Qt.AltModifier);
2112+ tryCompare(launcher, "state", "visible");
2113+ tryCompare(launcher, "focus", true)
2116+ function test_lockedOutLauncherAddsMarginsToMaximized() {
2117+ loadShell("desktop");
2118+ shell.usageScenario = "desktop";
2119+ waitForRendering(shell);
2120+ var appContainer = findChild(shell, "appContainer");
2121+ var launcher = findChild(shell, "launcher");
2123+ var app = ApplicationManager.startApplication("music-app");
2124+ waitUntilAppWindowIsFullyLoaded(app);
2125+ var appDelegate = findChild(appContainer, "appDelegate_music-app");
2126+ appDelegate.maximize();
2127+ tryCompare(appDelegate, "visuallyMaximized", true);
2128+ waitForRendering(shell);
2130+ GSettingsController.setAutohideLauncher(true);
2131+ waitForRendering(shell)
2132+ var hiddenSize = appDelegate.width;
2134+ GSettingsController.setAutohideLauncher(false);
2135+ waitForRendering(shell)
2136+ var shownSize = appDelegate.width;
2138+ compare(shownSize + launcher.panelWidth, hiddenSize);
2141+ function test_fullscreenAppHidesLockedOutLauncher() {
2142+ loadShell("desktop");
2143+ shell.usageScenario = "desktop";
2145+ var launcher = findChild(shell, "launcher");
2146+ var launcherPanel = findChild(launcher, "launcherPanel");
2148+ GSettingsController.setAutohideLauncher(false);
2149+ waitForRendering(shell)
2151+ tryCompare(launcher, "lockedVisible", true);
2153+ var cameraApp = ApplicationManager.startApplication("camera-app");
2154+ waitUntilAppWindowIsFullyLoaded(cameraApp);
2156+ tryCompare(launcher, "lockedVisible", false);
1992 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
2160 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
1993 return [
2161 return [
1994 { tag: "phone", repeaterName: "spreadRepeater" },
2162 { tag: "phone", repeaterName: "spreadRepeater" },