@@ -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,18 @@ 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;
217 Label { text: "Applications"; font.bold: true }
226 Label { text: "Applications"; font.bold: true }
@@ -1441,7 +1450,7 @@ Rectangle {
1442 // Do a quick alt-tab and see if focus changes
1451 // Do a quick alt-tab and see if focus changes
1443 tryCompare(app3.session.lastSurface, "activeFocus", true)
1452 tryCompare(app3.session.lastSurface, "activeFocus", true)
1444− keyClick(Qt.Key_Tab, Qt.ControlModifier)
1453+ keyClick(Qt.Key_Tab, Qt.AltModifier)
1445 tryCompare(app2.session.lastSurface, "activeFocus", true)
1454 tryCompare(app2.session.lastSurface, "activeFocus", true)
1447 var desktopSpread = findChild(shell, "spread")
1456 var desktopSpread = findChild(shell, "spread")
@@ -1449,12 +1458,12 @@ Rectangle {
1449 tryCompare(desktopSpread, "state", "")
1458 tryCompare(desktopSpread, "state", "")
1451 // Just press Alt, make sure the spread comes up
1460 // Just press Alt, make sure the spread comes up
1452− keyPress(Qt.Key_Control);
1461+ keyPress(Qt.Key_Alt);
1453 keyClick(Qt.Key_Tab);
1462 keyClick(Qt.Key_Tab);
1454 tryCompare(desktopSpread, "state", "altTab")
1463 tryCompare(desktopSpread, "state", "altTab")
1456 // Release control, check if spread disappears
1465 // Release control, check if spread disappears
1457− keyRelease(Qt.Key_Control)
1466+ keyRelease(Qt.Key_Alt)
1458 tryCompare(desktopSpread, "state", "")
1467 tryCompare(desktopSpread, "state", "")
1460 // Focus should have switched back now
1469 // Focus should have switched back now
@@ -1482,7 +1491,7 @@ Rectangle {
1482 tryCompare(desktopSpread, "state", "")
1491 tryCompare(desktopSpread, "state", "")
1484 // Just press Alt, make sure the spread comes up
1493 // Just press Alt, make sure the spread comes up
1485− keyPress(Qt.Key_Control);
1494+ keyPress(Qt.Key_Alt);
1486 keyClick(Qt.Key_Tab);
1495 keyClick(Qt.Key_Tab);
1487 tryCompare(desktopSpread, "state", "altTab")
1496 tryCompare(desktopSpread, "state", "altTab")
1488 tryCompare(spreadRepeater, "highlightedIndex", 1)
1497 tryCompare(spreadRepeater, "highlightedIndex", 1)
@@ -1503,7 +1512,7 @@ Rectangle {
1503 tryCompare(spreadRepeater, "highlightedIndex", 0)
1512 tryCompare(spreadRepeater, "highlightedIndex", 0)
1505 // Release control, check if spread disappears
1514 // Release control, check if spread disappears
1506− keyRelease(Qt.Key_Control)
1515+ keyRelease(Qt.Key_Alt)
1507 tryCompare(desktopSpread, "state", "")
1516 tryCompare(desktopSpread, "state", "")
1509 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1518 // Make sure that after wrapping around once, we have the same one focused as at the beginning
@@ -1516,7 +1525,7 @@ Rectangle {
1516 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1525 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1517 verify(spreadRepeater !== null);
1526 verify(spreadRepeater !== null);
1519− keyPress(Qt.Key_Control)
1528+ keyPress(Qt.Key_Alt)
1520 keyClick(Qt.Key_Tab);
1529 keyClick(Qt.Key_Tab);
1521 tryCompare(spreadRepeater, "highlightedIndex", 1);
1530 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1538,7 +1547,7 @@ Rectangle {
1538 keyClick(Qt.Key_Backtab);
1547 keyClick(Qt.Key_Backtab);
1539 tryCompare(spreadRepeater, "highlightedIndex", 1);
1548 tryCompare(spreadRepeater, "highlightedIndex", 1);
1541− keyRelease(Qt.Key_Control);
1550+ keyRelease(Qt.Key_Alt);
1544 function test_highlightFollowsMouse() {
1553 function test_highlightFollowsMouse() {
@@ -1547,7 +1556,7 @@ Rectangle {
1547 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1556 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1548 verify(spreadRepeater !== null);
1557 verify(spreadRepeater !== null);
1550− keyPress(Qt.Key_Control)
1559+ keyPress(Qt.Key_Alt)
1551 keyClick(Qt.Key_Tab);
1560 keyClick(Qt.Key_Tab);
1553 tryCompare(spreadRepeater, "highlightedIndex", 1);
1562 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1566,7 +1575,7 @@ Rectangle {
1567 verify(y < 4000);
1576 verify(y < 4000);
1569− keyRelease(Qt.Key_Control);
1578+ keyRelease(Qt.Key_Alt);
1572 function test_closeFromSpread() {
1581 function test_closeFromSpread() {
@@ -1575,7 +1584,7 @@ Rectangle {
1575 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1584 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1576 verify(spreadRepeater !== null);
1585 verify(spreadRepeater !== null);
1578− keyPress(Qt.Key_Control)
1587+ keyPress(Qt.Key_Alt)
1579 keyClick(Qt.Key_Tab);
1588 keyClick(Qt.Key_Tab);
1581 appRemovedSpy.clear();
1590 appRemovedSpy.clear();
@@ -1602,7 +1611,7 @@ Rectangle {
1602 tryCompare(appRemovedSpy, "count", 1)
1611 tryCompare(appRemovedSpy, "count", 1)
1603 compare(appRemovedSpy.signalArguments[0][0], closedAppId);
1612 compare(appRemovedSpy.signalArguments[0][0], closedAppId);
1605− keyRelease(Qt.Key_Control);
1614+ keyRelease(Qt.Key_Alt);
1608 function test_selectFromSpreadWithMouse_data() {
1617 function test_selectFromSpreadWithMouse_data() {
@@ -1622,7 +1631,7 @@ Rectangle {
1622 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1631 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1623 verify(spreadRepeater !== null);
1632 verify(spreadRepeater !== null);
1625− keyPress(Qt.Key_Control)
1634+ keyPress(Qt.Key_Alt)
1626 keyClick(Qt.Key_Tab);
1635 keyClick(Qt.Key_Tab);
1628 var focusAppId = ApplicationManager.get(2).appId;
1637 var focusAppId = ApplicationManager.get(2).appId;
@@ -1649,7 +1658,7 @@ Rectangle {
1649 tryCompare(stage, "state", "");
1658 tryCompare(stage, "state", "");
1650 tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1659 tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
1652− keyRelease(Qt.Key_Control);
1661+ keyRelease(Qt.Key_Alt);
1655 function test_progressiveAutoScrolling() {
1664 function test_progressiveAutoScrolling() {
@@ -1658,7 +1667,7 @@ Rectangle {
1658 var appRepeater = findInvisibleChild(shell, "appRepeater");
1667 var appRepeater = findInvisibleChild(shell, "appRepeater");
1659 verify(appRepeater !== null);
1668 verify(appRepeater !== null);
1661− keyPress(Qt.Key_Control)
1670+ keyPress(Qt.Key_Alt)
1662 keyClick(Qt.Key_Tab);
1671 keyClick(Qt.Key_Tab);
1664 var spreadFlickable = findChild(shell, "spreadFlickable")
1673 var spreadFlickable = findChild(shell, "spreadFlickable")
@@ -1684,7 +1693,7 @@ Rectangle {
1685 tryCompare(spreadFlickable, "contentX", 0);
1694 tryCompare(spreadFlickable, "contentX", 0);
1687− keyRelease(Qt.Key_Control);
1696+ keyRelease(Qt.Key_Alt);
1690 // This makes sure the hoverMouseArea is set to invisible AND disabled
1699 // This makes sure the hoverMouseArea is set to invisible AND disabled
@@ -1696,13 +1705,13 @@ Rectangle {
1696 tryCompare(hoverMouseArea, "enabled", false)
1705 tryCompare(hoverMouseArea, "enabled", false)
1697 tryCompare(hoverMouseArea, "visible", false)
1706 tryCompare(hoverMouseArea, "visible", false)
1699− keyPress(Qt.Key_Control)
1708+ keyPress(Qt.Key_Alt)
1700 keyClick(Qt.Key_Tab);
1709 keyClick(Qt.Key_Tab);
1702 tryCompare(hoverMouseArea, "enabled", true)
1711 tryCompare(hoverMouseArea, "enabled", true)
1703 tryCompare(hoverMouseArea, "visible", true)
1712 tryCompare(hoverMouseArea, "visible", true)
1705− keyRelease(Qt.Key_Control)
1714+ keyRelease(Qt.Key_Alt)
1707 tryCompare(hoverMouseArea, "enabled", false)
1716 tryCompare(hoverMouseArea, "enabled", false)
1708 tryCompare(hoverMouseArea, "visible", false)
1717 tryCompare(hoverMouseArea, "visible", false)
@@ -1719,7 +1728,7 @@ Rectangle {
1719 var appRepeater = findInvisibleChild(shell, "appRepeater");
1728 var appRepeater = findInvisibleChild(shell, "appRepeater");
1720 verify(appRepeater !== null);
1729 verify(appRepeater !== null);
1722− keyPress(Qt.Key_Control)
1731+ keyPress(Qt.Key_Alt)
1723 keyClick(Qt.Key_Tab);
1732 keyClick(Qt.Key_Tab);
1725 tryCompare(spreadRepeater, "highlightedIndex", 1);
1734 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1740,7 +1749,7 @@ Rectangle {
1741 verify(y < 4000);
1750 verify(y < 4000);
1743− keyRelease(Qt.Key_Control);
1752+ keyRelease(Qt.Key_Alt);
1746 function test_focusAppFromLauncherExitsSpread() {
1755 function test_focusAppFromLauncherExitsSpread() {
@@ -1750,7 +1759,7 @@ Rectangle {
1750 var launcher = findChild(shell, "launcher");
1759 var launcher = findChild(shell, "launcher");
1751 var bfb = findChild(launcher, "buttonShowDashHome");
1760 var bfb = findChild(launcher, "buttonShowDashHome");
1753− keyPress(Qt.Key_Control)
1762+ keyPress(Qt.Key_Alt)
1754 keyClick(Qt.Key_Tab);
1763 keyClick(Qt.Key_Tab);
1756 tryCompare(desktopSpread, "state", "altTab")
1765 tryCompare(desktopSpread, "state", "altTab")
@@ -1766,7 +1775,7 @@ Rectangle {
1767 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1776 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
1769− keyRelease(Qt.Key_Control);
1778+ keyRelease(Qt.Key_Alt);
1772 // regression test for http://pad.lv/1443319
1781 // regression test for http://pad.lv/1443319
@@ -1989,6 +1998,86 @@ Rectangle {
2001+ function test_superTabToCycleLauncher() {
2002+ loadShell("desktop");
2003+ shell.usageScenario = "desktop";
2004+ waitForRendering(shell);
2006+ var launcher = findChild(shell, "launcher");
2007+ var launcherPanel = findChild(launcher, "launcherPanel");
2008+ var firstAppInLauncher = LauncherModel.get(0).appId;
2010+ compare(launcher.state, "");
2011+ compare(launcherPanel.highlightIndex, -2);
2012+ compare(ApplicationManager.focusedApplicationId, "unity8-dash");
2014+ // Use Super + Tab Tab to cycle to the first entry in the launcher
2015+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2016+ keyClick(Qt.Key_Tab);
2017+ tryCompare(launcher, "state", "visible");
2018+ tryCompare(launcherPanel, "highlightIndex", -1);
2019+ keyClick(Qt.Key_Tab);
2020+ tryCompare(launcherPanel, "highlightIndex", 0);
2021+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2022+ tryCompare(launcher, "state", "");
2023+ tryCompare(launcherPanel, "highlightIndex", -2);
2024+ tryCompare(ApplicationManager, "focusedApplicationId", firstAppInLauncher);
2026+ // Now go back to the dash
2027+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2028+ keyClick(Qt.Key_Tab);
2029+ tryCompare(launcher, "state", "visible");
2030+ tryCompare(launcherPanel, "highlightIndex", -1);
2031+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2032+ tryCompare(launcher, "state", "");
2033+ tryCompare(launcherPanel, "highlightIndex", -2);
2034+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
2037+ function test_longpressSuperOpensLauncher() {
2038+ loadShell("desktop");
2039+ var launcher = findChild(shell, "launcher");
2040+ var shortcutHint = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint")
2042+ compare(launcher.state, "");
2043+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2044+ tryCompare(launcher, "state", "visible");
2045+ tryCompare(shortcutHint, "visible", true);
2047+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2048+ tryCompare(launcher, "state", "");
2049+ tryCompare(shortcutHint, "visible", false);
2052+ function test_metaNumberLaunchesFromLauncher_data() {
2054+ {tag: "Meta+1", key: Qt.Key_1, index: 0},
2055+ {tag: "Meta+2", key: Qt.Key_2, index: 1},
2056+ {tag: "Meta+4", key: Qt.Key_5, index: 4},
2057+ {tag: "Meta+0", key: Qt.Key_0, index: 9},
2061+ function test_metaNumberLaunchesFromLauncher(data) {
2062+ loadShell("desktop");
2063+ var launcher = findChild(shell, "launcher");
2064+ var appId = LauncherModel.get(data.index).appId;
2065+ waitForRendering(shell);
2067+ keyClick(data.key, Qt.MetaModifier);
2068+ tryCompare(ApplicationManager, "focusedApplicationId", appId);
2071+ function test_altF1OpensLauncherForKeyboardNavigation() {
2072+ loadShell("desktop");
2073+ waitForRendering(shell);
2074+ var launcher = findChild(shell, "launcher");
2076+ keyClick(Qt.Key_F1, Qt.AltModifier);
2077+ tryCompare(launcher, "state", "visible");
2078+ tryCompare(launcher, "focus", true)
1992 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
2081 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
1993 return [
2082 return [
1994 { tag: "phone", repeaterName: "spreadRepeater" },
2083 { tag: "phone", repeaterName: "spreadRepeater" },