184
187
callManager.foregroundCall = callManager.foregroundCall ? null : phoneCall;
189
text: "Show Launcher"
190
activeFocusOnPress: false
192
if (shellLoader.status !== Loader.Ready)
191
text: "Show Launcher"
192
activeFocusOnPress: false
194
if (shellLoader.status !== Loader.Ready)
195
var launcher = testCase.findChild(shellLoader.item, "launcher");
196
launcher.state = "visible";
197
var launcher = testCase.findChild(shellLoader.item, "launcher");
198
launcher.state = "visible";
202
text: "Print focused"
203
activeFocusOnPress: false
205
var childs = new Array(0);
206
childs.push(shellLoader.item)
207
while (childs.length > 0) {
208
if (childs[0].activeFocus && childs[0].focus && childs[0].objectName != "shell") {
209
console.log("Active focus is on item:", childs[0]);
212
for (var i in childs[0].children) {
213
childs.push(childs[0].children[i])
217
console.log("No active focused item found within shell.")
199
ListItem.ItemSelector {
200
anchors { left: parent.left; right: parent.right }
201
activeFocusOnPress: false
202
222
text: "LightDM mock mode"
225
ListItem.ItemSelector {
226
anchors { left: parent.left; right: parent.right }
227
activeFocusOnPress: false
203
228
model: ["single", "single-passphrase", "single-pin", "full"]
204
229
onSelectedIndexChanged: {
205
230
shellLoader.active = false;
208
233
shellLoader.active = true;
211
ListItem.ItemSelector {
212
anchors { left: parent.left; right: parent.right }
213
activeFocusOnPress: false
240
ListItem.ItemSelector {
242
anchors { left: parent.left; right: parent.right }
243
activeFocusOnPress: false
215
244
model: ["phone", "tablet", "desktop"]
216
245
onSelectedIndexChanged: {
217
shellLoader.active = false;
218
246
shellLoader.state = model[selectedIndex];
219
shellLoader.active = true;
250
text: "Usage scenario"
222
253
ListItem.ItemSelector {
223
254
id: usageScenarioSelector
224
255
anchors { left: parent.left; right: parent.right }
225
256
activeFocusOnPress: false
226
text: "Usage scenario"
227
257
model: ["phone", "tablet", "desktop"]
229
259
MouseTouchEmulationCheckbox {
230
260
id: mouseEmulation
233
267
ListItem.ItemSelector {
235
269
anchors { left: parent.left; right: parent.right }
236
270
activeFocusOnPress: false
238
271
model: ["Ctrl", "Alt", "Super"]
239
272
onSelectedIndexChanged: {
240
273
var keyMapper = testCase.findChild(shellContainer, "physicalKeysMapper");
571
605
compare(ApplicationManager.get(0).appId, "unity8-dash");
608
function test_phoneLeftEdgeDrag_data() {
610
{tag: "without launcher",
611
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
612
launcherHides: true, greeterShown: false},
614
{tag: "with launcher",
615
revealLauncher: true, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
616
launcherHides: true, greeterShown: false},
619
revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
620
launcherHides: false, greeterShown: false},
623
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
624
launcherHides: true, greeterShown: false},
626
{tag: "small swipe with greeter",
627
revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
628
launcherHides: false, greeterShown: true},
630
{tag: "long swipe with greeter",
631
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
632
launcherHides: true, greeterShown: true},
634
{tag: "swipe over dash",
635
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "unity8-dash",
636
launcherHides: false, greeterShown: false},
574
640
function test_snapDecisionDismissalReturnsFocus() {
575
641
loadShell("phone");
576
642
swipeAwayGreeter();
635
701
mockNotificationsModel.append(n)
638
function test_phoneLeftEdgeDrag_data() {
640
{tag: "without launcher",
641
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
642
launcherHides: true, greeterShown: false},
644
{tag: "with launcher",
645
revealLauncher: true, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
646
launcherHides: true, greeterShown: false},
649
revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
650
launcherHides: false, greeterShown: false},
653
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
654
launcherHides: true, greeterShown: false},
656
{tag: "small swipe with greeter",
657
revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
658
launcherHides: false, greeterShown: true},
660
{tag: "long swipe with greeter",
661
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "dialer-app",
662
launcherHides: true, greeterShown: true},
664
{tag: "swipe over dash",
665
revealLauncher: false, swipeLength: units.gu(30), appHides: true, focusedApp: "unity8-dash",
666
launcherHides: false, greeterShown: false},
670
704
function test_phoneLeftEdgeDrag(data) {
671
705
loadShell("phone");
672
706
swipeAwayGreeter();
1541
function test_stageLoader_data() {
1543
{tag: "phone", source: "Stages/PhoneStage.qml", formFactor: "phone", usageScenario: "phone"},
1544
{tag: "tablet", source: "Stages/TabletStage.qml", formFactor: "tablet", usageScenario: "tablet"},
1545
{tag: "desktop", source: "Stages/DesktopStage.qml", formFactor: "tablet", usageScenario: "desktop"}
1549
function test_stageLoader(data) {
1550
loadShell(data.formFactor);
1551
shell.usageScenario = data.usageScenario;
1552
var stageLoader = findChild(shell, "applicationsDisplayLoader");
1553
verify(String(stageLoader.source).indexOf(data.source) >= 0);
1556
1573
function test_launcherInverted_data() {
1558
1575
{tag: "phone", formFactor: "phone", usageScenario: "phone", launcherInverted: true},
1666
1683
function test_altTabWrapAround() {
1667
1684
loadDesktopShellWithApps();
1669
var desktopStage = findChild(shell, "stage");
1670
verify(desktopStage !== null)
1672
var desktopSpread = findChild(shell, "spread");
1673
verify(desktopSpread !== null)
1675
var spreadContainer = findInvisibleChild(shell, "spreadContainer")
1676
verify(spreadContainer !== null)
1678
var spreadRepeater = findInvisibleChild(shell, "spreadRepeater")
1679
verify(spreadRepeater !== null)
1686
var stage = findChild(shell, "stage");
1687
verify(stage !== null)
1689
var spread = findChild(shell, "spreadItem");
1690
verify(spread !== null)
1681
1692
// remember the focused appId
1682
1693
var focused = ApplicationManager.get(ApplicationManager.findApplication(ApplicationManager.focusedApplicationId));
1684
tryCompare(desktopSpread, "state", "")
1695
tryCompare(stage, "state", "windowed")
1686
1697
// Just press Alt, make sure the spread comes up
1687
1698
keyPress(Qt.Key_Alt);
1688
1699
keyClick(Qt.Key_Tab);
1689
tryCompare(desktopSpread, "state", "altTab")
1690
tryCompare(spreadRepeater, "highlightedIndex", 1)
1700
tryCompare(stage, "state", "spread")
1701
tryCompare(spread, "highlightedIndex", 1)
1691
1702
waitForRendering(shell)
1693
1704
// Now press and hold Tab, make sure the highlight moves all the way but stops at the last one
1694
1705
// We can't simulate a pressed key with keyPress() currently, so let's inject the events
1695
1706
// at API level. Jump for 10 times, verify that it's still at the last one and didn't wrap around.
1696
1707
for (var i = 0; i < 10; i++) {
1697
desktopSpread.selectNext(true); // true == isAutoRepeat
1708
spread.selectNext(true); // true == isAutoRepeat
1698
1709
wait(0); // Trigger the event loop to make sure all the things happen
1700
tryCompare(spreadRepeater, "highlightedIndex", 6)
1711
tryCompare(spread, "highlightedIndex", 6)
1702
1713
// Now release it once, and verify that it does wrap around with an additional Tab press
1703
1714
keyRelease(Qt.Key_Tab);
1704
1715
keyClick(Qt.Key_Tab);
1705
tryCompare(spreadRepeater, "highlightedIndex", 0)
1716
tryCompare(spread, "highlightedIndex", 0)
1707
1718
// Release control, check if spread disappears
1708
1719
keyRelease(Qt.Key_Alt)
1709
tryCompare(desktopSpread, "state", "")
1720
tryCompare(stage, "state", "windowed")
1711
1722
// Make sure that after wrapping around once, we have the same one focused as at the beginning
1712
1723
var focusedAppSurface = focused.surfaceList.get(0);
1717
1728
function test_altBackTabNavigation() {
1718
1729
loadDesktopShellWithApps();
1720
var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1721
verify(spreadRepeater !== null);
1731
var spreadItem = findChild(shell, "spreadItem");
1732
verify(spreadItem !== null);
1723
1734
keyPress(Qt.Key_Alt)
1724
1735
keyClick(Qt.Key_Tab);
1725
tryCompare(spreadRepeater, "highlightedIndex", 1);
1727
keyClick(Qt.Key_Tab);
1728
tryCompare(spreadRepeater, "highlightedIndex", 2);
1730
keyClick(Qt.Key_Tab);
1731
tryCompare(spreadRepeater, "highlightedIndex", 3);
1733
keyClick(Qt.Key_Tab);
1734
tryCompare(spreadRepeater, "highlightedIndex", 4);
1736
keyClick(Qt.Key_Backtab);
1737
tryCompare(spreadRepeater, "highlightedIndex", 3);
1739
keyClick(Qt.Key_Backtab);
1740
tryCompare(spreadRepeater, "highlightedIndex", 2);
1742
keyClick(Qt.Key_Backtab);
1743
tryCompare(spreadRepeater, "highlightedIndex", 1);
1736
tryCompare(spreadItem, "highlightedIndex", 1);
1738
keyClick(Qt.Key_Tab);
1739
tryCompare(spreadItem, "highlightedIndex", 2);
1741
keyClick(Qt.Key_Tab);
1742
tryCompare(spreadItem, "highlightedIndex", 3);
1744
keyClick(Qt.Key_Tab);
1745
tryCompare(spreadItem, "highlightedIndex", 4);
1747
keyClick(Qt.Key_Backtab);
1748
tryCompare(spreadItem, "highlightedIndex", 3);
1750
keyClick(Qt.Key_Backtab);
1751
tryCompare(spreadItem, "highlightedIndex", 2);
1753
keyClick(Qt.Key_Backtab);
1754
tryCompare(spreadItem, "highlightedIndex", 1);
1745
1756
keyRelease(Qt.Key_Alt);
1776
1787
function test_closeFromSpread() {
1777
1788
loadDesktopShellWithApps()
1779
var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1780
verify(spreadRepeater !== null);
1790
var appRepeater = findInvisibleChild(shell, "appRepeater");
1791
verify(appRepeater !== null);
1793
var spreadItem = findChild(shell, "spreadItem");
1794
verify(spreadItem !== null);
1782
1796
keyPress(Qt.Key_Alt)
1783
1797
keyClick(Qt.Key_Tab);
1785
1799
var surfaceId = topLevelSurfaceList.idAt(2);
1786
var spreadDelegate2 = spreadRepeater.itemAt(2);
1800
var spreadDelegate2 = appRepeater.itemAt(2);
1787
1801
var closeMouseArea = findChild(spreadDelegate2, "closeMouseArea");
1789
1803
// Move the mosue over tile 2 and verify the close button becomes visible
1791
1805
var y = shell.height * .5;
1792
1806
mouseMove(shell, x, y)
1793
while (spreadRepeater.highlightedIndex !== 2 && x <= 4000) {
1807
while (spreadItem.highlightedIndex !== 2 && x <= 4000) {
1795
1809
mouseMove(shell, x, y)
1796
1810
wait(0); // spin the loop so bindings get evaluated
1820
1834
loadDesktopShellWithApps()
1822
1836
var stage = findChild(shell, "stage");
1823
var spread = findChild(stage, "spread");
1824
waitForRendering(spread)
1837
var spreadItem = findChild(stage, "spreadItem");
1838
// waitForRendering(spread)
1826
var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1827
verify(spreadRepeater !== null);
1840
var appRepeater = findInvisibleChild(shell, "appRepeater");
1841
verify(appRepeater !== null);
1829
1843
keyPress(Qt.Key_Alt)
1830
1844
keyClick(Qt.Key_Tab);
1832
1846
var surface = topLevelSurfaceList.surfaceAt(2);
1833
var spreadDelegate2 = spreadRepeater.itemAt(2);
1834
var clippedSpreadDelegate = findChild(spreadDelegate2, "clippedSpreadDelegate");
1847
var spreadDelegate2 = appRepeater.itemAt(2);
1848
var decoratedWindow = findChild(spreadDelegate2, "decoratedWindow");
1836
tryCompare(spread, "state", "altTab");
1850
tryCompare(stage, "state", "spread");
1838
1852
// Move the mouse over tile 2 and verify the highlight becomes visible
1840
var y = shell.height * (data.tileInfo ? .95 : 0.5)
1854
var y = shell.height * (data.tileInfo ? .9 : 0.5)
1841
1855
mouseMove(shell, x, y)
1842
while (spreadRepeater.highlightedIndex !== 2 && x <= 4000) {
1856
while (spreadItem.highlightedIndex !== 2 && x <= 4000) {
1844
1858
mouseMove(shell, x, y)
1845
1859
wait(0); // spin the loop so bindings get evaluated
1847
tryCompare(clippedSpreadDelegate, "highlightShown", true);
1861
tryCompare(decoratedWindow, "showHighlight", true);
1849
1863
// Click the tile
1850
mouseClick(clippedSpreadDelegate, clippedSpreadDelegate.width / 2, clippedSpreadDelegate.height / 2)
1864
mouseClick(decoratedWindow, units.gu(2), decoratedWindow.height / 2)
1852
1866
// Verify that we left the spread and app2 is the focused one now
1853
tryCompare(stage, "state", "");
1867
tryCompare(stage, "state", "windowed");
1854
1868
tryCompare(surface, "focused", true);
1856
1870
keyRelease(Qt.Key_Alt);
1912
1926
tryCompare(hoverMouseArea, "visible", false)
1915
function test_workspacePreviewsHighlightedApp() {
1916
loadDesktopShellWithApps()
1918
var targetZ = topLevelSurfaceList.count + 1;
1920
var spreadRepeater = findInvisibleChild(shell, "spreadRepeater");
1921
verify(spreadRepeater !== null);
1923
var appRepeater = findInvisibleChild(shell, "appRepeater");
1924
verify(appRepeater !== null);
1926
keyPress(Qt.Key_Alt)
1927
keyClick(Qt.Key_Tab);
1929
tryCompare(spreadRepeater, "highlightedIndex", 1);
1930
tryCompare(appRepeater.itemAt(1), "z", targetZ)
1933
var y = shell.height * .75;
1934
mouseMove(shell, x, y)
1936
for (var i = 0; i < 7; i++) {
1937
while (spreadRepeater.highlightedIndex != i && x <= 4000) {
1938
tryCompare(appRepeater.itemAt(spreadRepeater.highlightedIndex), "z", targetZ)
1940
mouseMove(shell, x, y)
1941
wait(0); // spin the loop so bindings get evaluated
1947
keyRelease(Qt.Key_Alt);
1950
1929
function test_focusAppFromLauncherExitsSpread_data() {
1952
1931
{tag: "autohide launcher", launcherLocked: false },
2278
2257
function test_superTabToCycleLauncher(data) {
2279
2258
loadShell("desktop");
2280
2259
shell.usageScenario = "desktop";
2260
waitForRendering(shell);
2281
2261
GSettingsController.setAutohideLauncher(!data.launcherLocked);
2282
2262
waitForRendering(shell);
2264
var stage = findChild(shell, "stage");
2284
2265
var launcher = findChild(shell, "launcher");
2285
2266
var launcherPanel = findChild(launcher, "launcherPanel");
2286
2267
var firstAppInLauncher = LauncherModel.get(0).appId;
2288
2268
compare(launcher.state, data.launcherLocked ? "visible": "");
2289
2269
compare(launcherPanel.highlightIndex, -2);
2290
2270
compare(ApplicationManager.focusedApplicationId, "unity8-dash");
2292
2272
// Use Super + Tab Tab to cycle to the first entry in the launcher
2294
2273
keyPress(Qt.Key_Super_L, Qt.MetaModifier);
2295
2274
keyClick(Qt.Key_Tab);
2296
2275
tryCompare(launcher, "state", "visible");
2714
2697
tryCompare(topLevelSurfaceList, "count", countBeforeClose - 1);
2715
2698
tryCompareFunction(function() { return ApplicationManager.focusedApplicationId; }, "calendar-app");
2701
function test_oskDisplacesWindow_data() {
2703
{tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},
2704
{tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight, oskEnabled: true},
2705
{tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight, oskEnabled: true},
2706
{tag: "osk not on this screen", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: units.gu(10), oskEnabled: false},
2710
function test_oskDisplacesWindow(data) {
2711
loadShell("desktop");
2712
shell.usageScenario = "desktop";
2713
waitForRendering(shell);
2715
shell.oskEnabled = data.oskEnabled;
2717
var oldOSKState = SurfaceManager.inputMethodSurface.state;
2718
SurfaceManager.inputMethodSurface.state = Mir.RestoredState;
2719
var appRepeater = findChild(shell, "appRepeater");
2720
var dashAppDelegate = appRepeater.itemAt(0);
2721
verify(dashAppDelegate);
2722
dashAppDelegate.requestedHeight = data.windowHeight;
2723
dashAppDelegate.requestedY = data.windowY;
2724
SurfaceManager.inputMethodSurface.setInputBounds(Qt.rect(0, 0, 0, 0));
2725
var initialY = dashAppDelegate.y;
2726
print("intial", initialY, "panel", PanelState.panelHeight);
2727
verify(initialY > PanelState.panelHeight);
2729
SurfaceManager.inputMethodSurface.setInputBounds(Qt.rect(0, root.height / 2, root.width, root.height / 2));
2730
tryCompare(dashAppDelegate, "y", data.targetDisplacement);
2732
SurfaceManager.inputMethodSurface.setInputBounds(Qt.rect(0, 0, 0, 0));
2733
tryCompare(dashAppDelegate, "y", initialY);
2734
SurfaceManager.inputMethodSurface.state = oldOSKState;
2737
function test_cursorHidingWithFullscreenApp() {
2738
loadShell("desktop");
2739
shell.usageScenario = "desktop";
2740
waitForRendering(shell);
2743
// load some fullscreen app
2744
var cameraSurfaceId = topLevelSurfaceList.nextId;
2745
var cameraApp = ApplicationManager.startApplication("camera-app");
2746
waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
2748
var cursor = findChild(shell, "cursor");
2750
tryCompare(cursor, "opacity", 1);
2752
// let the timer kick in and verify the cursor got hidden
2754
tryCompare(cursor, "opacity", 0);
2756
// simulate moving the mouse, check the cursor is visible again
2757
cursor.mouseMoved();
2758
tryCompare(cursor, "opacity", 1);
2760
// let the timer kick in again and verify the cursor got hidden
2762
tryCompare(cursor, "opacity", 0);
2765
function test_launcherEnabledSetting_data() {
2767
{tag: "launcher enabled", enabled: true},
2768
{tag: "launcher disabled", enabled: false}
2772
function test_launcherEnabledSetting(data) {
2775
GSettingsController.setEnableLauncher(data.enabled);
2777
var launcher = findChild(shell, "launcher");
2778
compare(launcher.available, data.enabled);
2780
GSettingsController.setEnableLauncher(true);