@@ -26,6 +26,7 @@ import Unity.Application 0.1
2626import Unity.Connectivity 0.1
2727import Unity.Indicators 0.1
2828import Unity.Notifications 1.0
29+import Unity.Launcher 0.1
2930import Unity.Test 0.1
3031import Powerd 0.1
3132import Wizard 0.1 as Wizard
@@ -121,10 +122,6 @@ Rectangle {
121122 Component.onDestruction: {
122123 shellLoader.itemDestroyed = true;
123124 }
124− Component.onCompleted: {
125− var keyMapper = testCase.findChild(__shell, "physicalKeysMapper");
126− keyMapper.controlInsteadOfAlt = true;
127− }
128125 }
129126 }
130127 }
@@ -213,6 +210,18 @@ Rectangle {
213210 checked: true
214211 color: "white"
215212 }
213+ ListItem.ItemSelector {
214+ id: ctrlModifier
215+ anchors { left: parent.left; right: parent.right }
216+ activeFocusOnPress: false
217+ text: "Ctrl key as"
218+ model: ["Ctrl", "Alt", "Super"]
219+ onSelectedIndexChanged: {
220+ var keyMapper = testCase.findChild(shellContainer, "physicalKeysMapper");
221+ keyMapper.controlInsteadOfAlt = selectedIndex == 1;
222+ keyMapper.controlInsteadOfSuper = selectedIndex == 2;
223+ }
224+ }
216225
217226 Label { text: "Applications"; font.bold: true }
218227
@@ -1441,7 +1450,7 @@ Rectangle {
14411450
14421451 // Do a quick alt-tab and see if focus changes
14431452 tryCompare(app3.session.lastSurface, "activeFocus", true)
1444− keyClick(Qt.Key_Tab, Qt.ControlModifier)
1453+ keyClick(Qt.Key_Tab, Qt.AltModifier)
14451454 tryCompare(app2.session.lastSurface, "activeFocus", true)
14461455
14471456 var desktopSpread = findChild(shell, "spread")
@@ -1449,12 +1458,12 @@ Rectangle {
14491458 tryCompare(desktopSpread, "state", "")
14501459
14511460 // Just press Alt, make sure the spread comes up
1452− keyPress(Qt.Key_Control);
1461+ keyPress(Qt.Key_Alt);
14531462 keyClick(Qt.Key_Tab);
14541463 tryCompare(desktopSpread, "state", "altTab")
14551464
14561465 // Release control, check if spread disappears
1457− keyRelease(Qt.Key_Control)
1466+ keyRelease(Qt.Key_Alt)
14581467 tryCompare(desktopSpread, "state", "")
14591468
14601469 // Focus should have switched back now
@@ -1482,7 +1491,7 @@ Rectangle {
14821491 tryCompare(desktopSpread, "state", "")
14831492
14841493 // Just press Alt, make sure the spread comes up
1485− keyPress(Qt.Key_Control);
1494+ keyPress(Qt.Key_Alt);
14861495 keyClick(Qt.Key_Tab);
14871496 tryCompare(desktopSpread, "state", "altTab")
14881497 tryCompare(spreadRepeater, "highlightedIndex", 1)
@@ -1503,7 +1512,7 @@ Rectangle {
15031512 tryCompare(spreadRepeater, "highlightedIndex", 0)
15041513
15051514 // Release control, check if spread disappears
1506− keyRelease(Qt.Key_Control)
1515+ keyRelease(Qt.Key_Alt)
15071516 tryCompare(desktopSpread, "state", "")
15081517
15091518 // Make sure that after wrapping around once, we have the same one focused as at the beginning
@@ -1516,7 +1525,7 @@ Rectangle {
15161525 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
15171526 verify(spreadRepeater !== null);
15181527
1519− keyPress(Qt.Key_Control)
1528+ keyPress(Qt.Key_Alt)
15201529 keyClick(Qt.Key_Tab);
15211530 tryCompare(spreadRepeater, "highlightedIndex", 1);
15221531
@@ -1538,7 +1547,7 @@ Rectangle {
15381547 keyClick(Qt.Key_Backtab);
15391548 tryCompare(spreadRepeater, "highlightedIndex", 1);
15401549
1541− keyRelease(Qt.Key_Control);
1550+ keyRelease(Qt.Key_Alt);
15421551 }
15431552
15441553 function test_highlightFollowsMouse() {
@@ -1547,7 +1556,7 @@ Rectangle {
15471556 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
15481557 verify(spreadRepeater !== null);
15491558
1550− keyPress(Qt.Key_Control)
1559+ keyPress(Qt.Key_Alt)
15511560 keyClick(Qt.Key_Tab);
15521561
15531562 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1566,7 +1575,7 @@ Rectangle {
15661575
15671576 verify(y < 4000);
15681577
1569− keyRelease(Qt.Key_Control);
1578+ keyRelease(Qt.Key_Alt);
15701579 }
15711580
15721581 function test_closeFromSpread() {
@@ -1575,7 +1584,7 @@ Rectangle {
15751584 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
15761585 verify(spreadRepeater !== null);
15771586
1578− keyPress(Qt.Key_Control)
1587+ keyPress(Qt.Key_Alt)
15791588 keyClick(Qt.Key_Tab);
15801589
15811590 appRemovedSpy.clear();
@@ -1602,7 +1611,7 @@ Rectangle {
16021611 tryCompare(appRemovedSpy, "count", 1)
16031612 compare(appRemovedSpy.signalArguments[0][0], closedAppId);
16041613
1605− keyRelease(Qt.Key_Control);
1614+ keyRelease(Qt.Key_Alt);
16061615 }
16071616
16081617 function test_selectFromSpreadWithMouse_data() {
@@ -1622,7 +1631,7 @@ Rectangle {
16221631 var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
16231632 verify(spreadRepeater !== null);
16241633
1625− keyPress(Qt.Key_Control)
1634+ keyPress(Qt.Key_Alt)
16261635 keyClick(Qt.Key_Tab);
16271636
16281637 var focusAppId = ApplicationManager.get(2).appId;
@@ -1649,7 +1658,7 @@ Rectangle {
16491658 tryCompare(stage, "state", "");
16501659 tryCompare(ApplicationManager, "focusedApplicationId", focusAppId);
16511660
1652− keyRelease(Qt.Key_Control);
1661+ keyRelease(Qt.Key_Alt);
16531662 }
16541663
16551664 function test_progressiveAutoScrolling() {
@@ -1658,7 +1667,7 @@ Rectangle {
16581667 var appRepeater = findInvisibleChild(shell, "appRepeater");
16591668 verify(appRepeater !== null);
16601669
1661− keyPress(Qt.Key_Control)
1670+ keyPress(Qt.Key_Alt)
16621671 keyClick(Qt.Key_Tab);
16631672
16641673 var spreadFlickable = findChild(shell, "spreadFlickable")
@@ -1684,7 +1693,7 @@ Rectangle {
16841693 }
16851694 tryCompare(spreadFlickable, "contentX", 0);
16861695
1687− keyRelease(Qt.Key_Control);
1696+ keyRelease(Qt.Key_Alt);
16881697 }
16891698
16901699 // This makes sure the hoverMouseArea is set to invisible AND disabled
@@ -1696,13 +1705,13 @@ Rectangle {
16961705 tryCompare(hoverMouseArea, "enabled", false)
16971706 tryCompare(hoverMouseArea, "visible", false)
16981707
1699− keyPress(Qt.Key_Control)
1708+ keyPress(Qt.Key_Alt)
17001709 keyClick(Qt.Key_Tab);
17011710
17021711 tryCompare(hoverMouseArea, "enabled", true)
17031712 tryCompare(hoverMouseArea, "visible", true)
17041713
1705− keyRelease(Qt.Key_Control)
1714+ keyRelease(Qt.Key_Alt)
17061715
17071716 tryCompare(hoverMouseArea, "enabled", false)
17081717 tryCompare(hoverMouseArea, "visible", false)
@@ -1719,7 +1728,7 @@ Rectangle {
17191728 var appRepeater = findInvisibleChild(shell, "appRepeater");
17201729 verify(appRepeater !== null);
17211730
1722− keyPress(Qt.Key_Control)
1731+ keyPress(Qt.Key_Alt)
17231732 keyClick(Qt.Key_Tab);
17241733
17251734 tryCompare(spreadRepeater, "highlightedIndex", 1);
@@ -1740,7 +1749,7 @@ Rectangle {
17401749
17411750 verify(y < 4000);
17421751
1743− keyRelease(Qt.Key_Control);
1752+ keyRelease(Qt.Key_Alt);
17441753 }
17451754
17461755 function test_focusAppFromLauncherExitsSpread() {
@@ -1750,7 +1759,7 @@ Rectangle {
17501759 var launcher = findChild(shell, "launcher");
17511760 var bfb = findChild(launcher, "buttonShowDashHome");
17521761
1753− keyPress(Qt.Key_Control)
1762+ keyPress(Qt.Key_Alt)
17541763 keyClick(Qt.Key_Tab);
17551764
17561765 tryCompare(desktopSpread, "state", "altTab")
@@ -1766,7 +1775,7 @@ Rectangle {
17661775
17671776 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash")
17681777
1769− keyRelease(Qt.Key_Control);
1778+ keyRelease(Qt.Key_Alt);
17701779 }
17711780
17721781 // regression test for http://pad.lv/1443319
@@ -1989,6 +1998,86 @@ Rectangle {
19891998 }
19901999 }
19912000
2001+ function test_superTabToCycleLauncher() {
2002+ loadShell("desktop");
2003+ shell.usageScenario = "desktop";
2004+ waitForRendering(shell);
2005+
2006+ var launcher = findChild(shell, "launcher");
2007+ var launcherPanel = findChild(launcher, "launcherPanel");
2008+ var firstAppInLauncher = LauncherModel.get(0).appId;
2009+
2010+ compare(launcher.state, "");
2011+ compare(launcherPanel.highlightIndex, -2);
2012+ compare(ApplicationManager.focusedApplicationId, "unity8-dash");
2013+
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);
2025+
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");
2035+ }
2036+
2037+ function test_longpressSuperOpensLauncher() {
2038+ loadShell("desktop");
2039+ var launcher = findChild(shell, "launcher");
2040+ var shortcutHint = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint")
2041+
2042+ compare(launcher.state, "");
2043+ keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2044+ tryCompare(launcher, "state", "visible");
2045+ tryCompare(shortcutHint, "visible", true);
2046+
2047+ keyRelease(Qt.Key_Super_L, Qt.MetaModifier);
2048+ tryCompare(launcher, "state", "");
2049+ tryCompare(shortcutHint, "visible", false);
2050+ }
2051+
2052+ function test_metaNumberLaunchesFromLauncher_data() {
2053+ return [
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},
2058+ ]
2059+ }
2060+
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);
2066+
2067+ keyClick(data.key, Qt.MetaModifier);
2068+ tryCompare(ApplicationManager, "focusedApplicationId", appId);
2069+ }
2070+
2071+ function test_altF1OpensLauncherForKeyboardNavigation() {
2072+ loadShell("desktop");
2073+ waitForRendering(shell);
2074+ var launcher = findChild(shell, "launcher");
2075+
2076+ keyClick(Qt.Key_F1, Qt.AltModifier);
2077+ tryCompare(launcher, "state", "visible");
2078+ tryCompare(launcher, "focus", true)
2079+ }
2080+
19922081 function test_inputEventsOnEdgesEndUpInAppSurface_data() {
19932082 return [
19942083 { tag: "phone", repeaterName: "spreadRepeater" },