@@ -1,5 +1,5 @@
2− * Copyright (C) 2013-2014 Canonical, Ltd.
2+ * Copyright (C) 2013-2015 Canonical, Ltd.
5 * Daniel d'Andrada <daniel.dandrada@canonical.com>
5 * Daniel d'Andrada <daniel.dandrada@canonical.com>
@@ -29,14 +29,15 @@ import Unity.Application 0.1
29import Unity.Connectivity 0.1
29import Unity.Connectivity 0.1
30import Unity.Indicators 0.1
30import Unity.Indicators 0.1
31import Unity.Notifications 1.0
31import Unity.Notifications 1.0
32−import Unity.Test 0.1 as UT
32+import Unity.Test 0.1
33import Powerd 0.1
33import Powerd 0.1
35import "../../qml"
35import "../../qml"
39− width: units.gu(60)
40+ width: units.gu(100) + controls.width
40 height: units.gu(71)
41 height: units.gu(71)
42 Component.onCompleted: {
43 Component.onCompleted: {
@@ -62,12 +63,37 @@ Item {
66− anchors.fill: parent
67+ anchors.left: root.left
68+ anchors.right: controls.left
69+ anchors.top: root.top
70+ anchors.bottom: root.bottom
68 id: shellLoader
72 id: shellLoader
69 focus: true
73 focus: true
75+ anchors.centerIn: parent
71 active: false
97 active: false
72 property bool itemDestroyed: false
98 property bool itemDestroyed: false
73 sourceComponent: Component {
99 sourceComponent: Component {
@@ -80,43 +106,58 @@ Item {
115+ anchors.top: root.top
116+ anchors.bottom: root.bottom
117+ anchors.right: root.right
120+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
121+ spacing: units.gu(1)
123+ anchors { left: parent.left; right: parent.right }
125+ text: "Show Greeter"
126+ activeFocusOnPress: false
128+ if (shellLoader.status !== Loader.Ready)
87− height: shellLoader.height
90− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
93− anchors { left: parent.left; right: parent.right }
96− activeFocusOnPress: false
98− if (shellLoader.status !== Loader.Ready)
101− var greeter = testCase.findChild(shellLoader.item, "greeter");
131+ var greeter = testCase.findChild(shellLoader.item, "greeter");
102− if (!greeter.shown) {
132+ if (!greeter.shown) {
103− LightDM.Greeter.showGreeter();
133+ LightDM.Greeter.showGreeter();
108− ListItem.ItemSelector {
138+ ListItem.ItemSelector {
109− anchors { left: parent.left; right: parent.right }
139+ anchors { left: parent.left; right: parent.right }
110− activeFocusOnPress: false
140+ activeFocusOnPress: false
111− text: "LightDM mock mode"
141+ text: "LightDM mock mode"
112− model: ["single", "single-passphrase", "single-pin"]
142+ model: ["single", "single-passphrase", "single-pin", "full"]
113− onSelectedIndexChanged: {
143+ onSelectedIndexChanged: {
114− shellLoader.active = false;
144+ shellLoader.active = false;
115− LightDM.Greeter.mockMode = model[selectedIndex];
145+ LightDM.Greeter.mockMode = model[selectedIndex];
116− LightDM.Users.mockMode = model[selectedIndex];
146+ LightDM.Users.mockMode = model[selectedIndex];
117− shellLoader.active = true;
147+ shellLoader.active = true;
150+ ListItem.ItemSelector {
151+ anchors { left: parent.left; right: parent.right }
152+ activeFocusOnPress: false
154+ model: ["phone", "tablet"]
155+ onSelectedIndexChanged: {
156+ shellLoader.active = false;
157+ shellLoader.state = model[selectedIndex];
158+ shellLoader.active = true;
160+ MouseTouchEmulationCheckbox { color: "white" }
@@ -178,7 +219,7 @@ Item {
178 phoneNumber: "+447812221111"
219 phoneNumber: "+447812221111"
181− UT.UnityTestCase {
222+ UnityTestCase {
182 id: testCase
223 id: testCase
183 name: "Shell"
224 name: "Shell"
184 when: windowShown
225 when: windowShown
@@ -186,20 +227,49 @@ Item {
186 property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
227 property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
188 function init() {
229 function init() {
189− tryCompare(shell, "enabled", true); // enabled by greeter when ready
230+ if (shellLoader.active) {
190− shell.indicatorProfile = "phone";
231+ // happens for the very first test function as shell
232+ // is loaded by default
192− swipeAwayGreeter();
236+ }
238+ function cleanup() {
239+ tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
243+ function loadShell(formFactor) {
244+ shellLoader.state = formFactor;
245+ shellLoader.active = true;
246+ tryCompare(shellLoader, "status", Loader.Ready);
247+ removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
248+ tryCompare(shell, "enabled", true); // enabled by greeter when ready
194 sessionSpy.target = findChild(shell, "greeter")
250 sessionSpy.target = findChild(shell, "greeter")
195 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
251 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
197 var launcher = findChild(shell, "launcher");
253 var launcher = findChild(shell, "launcher");
198 launcherShowDashHomeSpy.target = launcher;
254 launcherShowDashHomeSpy.target = launcher;
256+ waitForGreeterToStabilize();
201− function cleanup() {
259+ function waitForGreeterToStabilize() {
202− tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
260+ var greeter = findChild(shell, "greeter");
263+ var loginList = findChild(greeter, "loginList");
264+ // Only present in WideView
266+ var userList = findChild(loginList, "userList");
268+ tryCompare(userList, "movingInternally", false);
272+ function tearDown() {
203 launcherShowDashHomeSpy.target = null;
273 launcherShowDashHomeSpy.target = null;
205 shellLoader.itemDestroyed = false;
275 shellLoader.itemDestroyed = false;
@@ -216,17 +286,17 @@ Item {
216 // Shell instance gets destroyed.
286 // Shell instance gets destroyed.
217 tryCompare(shellLoader, "itemDestroyed", true);
287 tryCompare(shellLoader, "itemDestroyed", true);
289+ setLightDMMockMode("single"); // back to the default value
291+ AccountsService.demoEdges = false;
219 // kill all (fake) running apps
293 // kill all (fake) running apps
220 killApps(ApplicationManager);
294 killApps(ApplicationManager);
222 unlockAllModemsSpy.clear()
296 unlockAllModemsSpy.clear()
223 LightDM.Greeter.authenticate(""); // reset greeter
297 LightDM.Greeter.authenticate(""); // reset greeter
225− // reload our test subject to get it in a fresh state once again
299+ sessionSpy.clear();
226− shellLoader.active = true;
228− tryCompare(shellLoader, "status", Loader.Ready);
229− removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
232 function killApps() {
302 function killApps() {
@@ -238,6 +308,8 @@ Item {
240 function test_snapDecisionDismissalReturnsFocus() {
310 function test_snapDecisionDismissalReturnsFocus() {
241 var notifications = findChild(shell, "notificationList");
313 var notifications = findChild(shell, "notificationList");
242 var app = ApplicationManager.startApplication("camera-app");
314 var app = ApplicationManager.startApplication("camera-app");
243 var stage = findChild(shell, "stage")
315 var stage = findChild(shell, "stage")
@@ -296,19 +368,41 @@ Item {
296 mockNotificationsModel.append(n)
368 mockNotificationsModel.append(n)
299− function test_leftEdgeDrag_data() {
371+ function test_phoneLeftEdgeDrag_data() {
373+ {tag: "without launcher",
301− {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
374+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
375+ launcherHides: true, greeterShown: false},
377+ {tag: "with launcher",
302− {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
378+ revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
379+ launcherHides: true, greeterShown: false},
381+ {tag: "small swipe",
303− {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: false},
382+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
383+ launcherHides: false, greeterShown: false},
304− {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
386+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
387+ launcherHides: true, greeterShown: false},
389+ {tag: "small swipe with greeter",
305− {tag: "small swipe with greeter", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: true},
390+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
391+ launcherHides: false, greeterShown: true},
393+ {tag: "long swipe with greeter",
306− {tag: "long swipe with greeter", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: true},
394+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
395+ launcherHides: true, greeterShown: true},
397+ {tag: "swipe over dash",
307− {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false, greeterShown: false},
398+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash",
399+ launcherHides: false, greeterShown: false},
311− function test_leftEdgeDrag(data) {
403+ function test_phoneLeftEdgeDrag(data) {
312 dragLauncherIntoView();
406 dragLauncherIntoView();
313 tapOnAppIconInLauncher();
407 tapOnAppIconInLauncher();
314 waitUntilApplicationWindowIsFullyVisible();
408 waitUntilApplicationWindowIsFullyVisible();
@@ -341,7 +435,32 @@ Item {
341 compare(animateTimer.nextState, "visible");
435 compare(animateTimer.nextState, "visible");
438+ function test_tabletLeftEdgeDrag_data() {
440+ {tag: "without password", user: "no-password", loggedIn: true, demo: false},
441+ {tag: "with password", user: "has-password", loggedIn: false, demo: false},
442+ {tag: "with demo", user: "has-password", loggedIn: true, demo: true},
446+ function test_tabletLeftEdgeDrag(data) {
447+ setLightDMMockMode("full");
448+ loadShell("tablet");
450+ selectUser(data.user)
452+ AccountsService.demoEdges = data.demo
453+ var tutorial = findChild(shell, "tutorial");
454+ tryCompare(tutorial, "running", data.demo);
456+ swipeFromLeftEdge(shell.width * 0.75)
457+ wait(500) // to give time to handle dash() signal from Launcher
458+ confirmLoggedIn(data.loggedIn)
344 function test_suspend() {
461 function test_suspend() {
345 var greeter = findChild(shell, "greeter");
464 var greeter = findChild(shell, "greeter");
347 // Launch an app from the launcher
466 // Launch an app from the launcher
@@ -401,6 +520,60 @@ Item {
401 waitForRendering(greeter);
520 waitForRendering(greeter);
523+ function selectUserAtIndex(i) {
524+ // We could be anywhere in list; find target index to know which direction
525+ var greeter = findChild(shell, "greeter")
526+ var userlist = findChild(greeter, "userList")
527+ if (userlist.currentIndex == i)
528+ keyClick(Qt.Key_Escape) // Reset state if we're not moving
529+ while (userlist.currentIndex != i) {
530+ var next = userlist.currentIndex + 1
531+ if (userlist.currentIndex > i) {
532+ next = userlist.currentIndex - 1
534+ tap(findChild(greeter, "username"+next));
535+ tryCompare(userlist, "currentIndex", next)
536+ tryCompare(userlist, "movingInternally", false)
540+ function selectUser(name) {
541+ // Find index of user with the right name
542+ for (var i = 0; i < LightDM.Users.count; i++) {
543+ if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == name) {
547+ if (i == LightDM.Users.count) {
548+ fail("Didn't find name")
551+ selectUserAtIndex(i)
555+ function clickPasswordInput(isButton) {
556+ var greeter = findChild(shell, "greeter")
557+ tryCompare(greeter, "fullyShown", true);
559+ var passwordMouseArea = findChild(shell, "passwordMouseArea")
560+ tryCompare(passwordMouseArea, "enabled", isButton)
562+ var passwordInput = findChild(shell, "passwordInput")
563+ mouseClick(passwordInput)
566+ function confirmLoggedIn(loggedIn) {
567+ var greeter = findChild(shell, "greeter");
568+ tryCompare(greeter, "shown", loggedIn ? false : true);
569+ verify(loggedIn ? sessionSpy.count > 0 : sessionSpy.count === 0);
572+ function setLightDMMockMode(mode) {
573+ LightDM.Greeter.mockMode = mode;
574+ LightDM.Users.mockMode = mode;
405 Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
578 Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
@@ -413,6 +586,8 @@ Item {
413 - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
586 - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
415 function test_minimizingAppTakesToDashApps() {
588 function test_minimizingAppTakesToDashApps() {
416 dragLauncherIntoView();
591 dragLauncherIntoView();
418 // Launch an app from the launcher
593 // Launch an app from the launcher
@@ -433,6 +608,8 @@ Item {
435 function test_showInputMethod() {
610 function test_showInputMethod() {
436 var item = findChild(shell, "inputMethod");
613 var item = findChild(shell, "inputMethod");
437 var surface = SurfaceManager.inputMethodSurface();
614 var surface = SurfaceManager.inputMethodSurface();
@@ -471,6 +648,8 @@ Item {
473 function test_surfaceLosesActiveFocusWhilePanelIsOpen() {
650 function test_surfaceLosesActiveFocusWhilePanelIsOpen() {
474 var app = ApplicationManager.startApplication("dialer-app");
653 var app = ApplicationManager.startApplication("dialer-app");
475 waitUntilAppWindowIsFullyLoaded(app);
654 waitUntilAppWindowIsFullyLoaded(app);
@@ -501,28 +680,26 @@ Item {
501 tryCompare(app.session.surface, "activeFocus", true);
680 tryCompare(app.session.surface, "activeFocus", true);
683+ function test_launchedAppHasActiveFocus_data() {
685+ {tag:"phone", formFactor:"phone"},
686+ {tag:"tablet", formFactor:"tablet"},
504− function test_launchedAppHasActiveFocus() {
690+ function test_launchedAppHasActiveFocus(data) {
691+ loadShell(data.formFactor);
505− var dialerApp = ApplicationManager.startApplication("dialer-app");
694+ var dialerApp = ApplicationManager.startApplication("webbrowser-app");
506 verify(dialerApp);
695 verify(dialerApp);
507− waitUntilAppSurfaceShowsUp("dialer-app")
696+ waitUntilAppSurfaceShowsUp("webbrowser-app")
509 verify(dialerApp.session.surface);
698 verify(dialerApp.session.surface);
511 tryCompare(dialerApp.session.surface, "activeFocus", true);
700 tryCompare(dialerApp.session.surface, "activeFocus", true);
514− // Wait for the whole UI to settle down
515− function waitForUIToSettle() {
516− var launcher = findChild(shell, "launcherPanel")
517− tryCompareFunction(function() {return launcher.x === 0 || launcher.x === -launcher.width;}, true);
518− if (launcher.x === 0) {
521− tryCompare(launcher, "x", -launcher.width)
523− waitForRendering(shell)
526 function waitUntilAppSurfaceShowsUp(appId) {
703 function waitUntilAppSurfaceShowsUp(appId) {
527 var appWindow = findChild(shell, "appWindow_" + appId);
704 var appWindow = findChild(shell, "appWindow_" + appId);
528 verify(appWindow);
705 verify(appWindow);
@@ -615,6 +792,8 @@ Item {
617 function test_greeterDoesNotChangeIndicatorProfile() {
794 function test_greeterDoesNotChangeIndicatorProfile() {
618 var panel = findChild(shell, "panel");
797 var panel = findChild(shell, "panel");
619 tryCompare(panel.indicators.indicatorsModel, "profile", shell.indicatorProfile);
798 tryCompare(panel.indicators.indicatorsModel, "profile", shell.indicatorProfile);
@@ -626,6 +805,8 @@ Item {
628 function test_shellProfileChangesReachIndicators() {
807 function test_shellProfileChangesReachIndicators() {
629 var panel = findChild(shell, "panel");
810 var panel = findChild(shell, "panel");
631 shell.indicatorProfile = "test1";
812 shell.indicatorProfile = "test1";
@@ -642,6 +823,8 @@ Item {
644 function test_focusRequestedHidesGreeter() {
825 function test_focusRequestedHidesGreeter() {
645 var greeter = findChild(shell, "greeter");
828 var greeter = findChild(shell, "greeter");
647 var app = ApplicationManager.startApplication("dialer-app");
830 var app = ApplicationManager.startApplication("dialer-app");
@@ -662,6 +845,8 @@ Item {
664 function test_focusRequestedHidesIndicators() {
847 function test_focusRequestedHidesIndicators() {
665 var indicators = findChild(shell, "indicators");
850 var indicators = findChild(shell, "indicators");
667 showIndicators();
852 showIndicators();
@@ -674,6 +859,8 @@ Item {
676 function test_showAndHideGreeterDBusCalls() {
861 function test_showAndHideGreeterDBusCalls() {
677 var greeter = findChild(shell, "greeter")
864 var greeter = findChild(shell, "greeter")
678 tryCompare(greeter, "shown", false)
865 tryCompare(greeter, "shown", false)
679 waitForRendering(greeter);
866 waitForRendering(greeter);
@@ -685,6 +872,9 @@ Item {
687 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
874 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
688 sessionSpy.clear();
878 sessionSpy.clear();
689 verify(sessionSpy.valid);
879 verify(sessionSpy.valid);
@@ -694,6 +884,8 @@ Item {
696 function test_fullscreen() {
886 function test_fullscreen() {
697 var panel = findChild(shell, "panel");
889 var panel = findChild(shell, "panel");
698 compare(panel.fullscreenMode, false);
890 compare(panel.fullscreenMode, false);
699 ApplicationManager.startApplication("camera-app");
891 ApplicationManager.startApplication("camera-app");
@@ -707,6 +899,8 @@ Item {
709 function test_leftEdgeDragFullscreen() {
901 function test_leftEdgeDragFullscreen() {
710 var panel = findChild(shell, "panel");
904 var panel = findChild(shell, "panel");
711 tryCompare(panel, "fullscreenMode", false)
905 tryCompare(panel, "fullscreenMode", false)
@@ -728,6 +922,8 @@ Item {
730 function test_unlockedProperties() {
924 function test_unlockedProperties() {
731 // Confirm that various properties have the correct values when unlocked
927 // Confirm that various properties have the correct values when unlocked
732 var greeter = findChild(shell, "greeter");
928 var greeter = findChild(shell, "greeter");
733 tryCompare(greeter, "locked", false);
929 tryCompare(greeter, "locked", false);
@@ -740,10 +936,14 @@ Item {
742 function test_unlockAllModemsOnBoot() {
938 function test_unlockAllModemsOnBoot() {
743 tryCompare(unlockAllModemsSpy, "count", 1)
941 tryCompare(unlockAllModemsSpy, "count", 1)
746 function test_tapOnRightEdgeReachesApplicationSurface() {
944 function test_tapOnRightEdgeReachesApplicationSurface() {
747 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
947 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
748 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
948 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
749 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
949 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
@@ -766,6 +966,8 @@ Item {
766 by the right-edge drag area)
966 by the right-edge drag area)
768 function test_rightEdgeDragDoesNotReachApplicationSurface() {
968 function test_rightEdgeDragDoesNotReachApplicationSurface() {
769 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
971 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
770 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
972 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
771 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
973 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
@@ -810,6 +1012,8 @@ Item {
812 function test_tapUbuntuIconInLauncherOverAppSpread() {
1014 function test_tapUbuntuIconInLauncherOverAppSpread() {
1015+ loadShell("phone");
1016+ swipeAwayGreeter();
814 waitUntilFocusedApplicationIsShowingItsSurface();
1018 waitUntilFocusedApplicationIsShowingItsSurface();
@@ -856,19 +1060,75 @@ Item {
856 function test_background_data() {
1060 function test_background_data() {
857 return [
1061 return [
858 {tag: "color", accounts: Qt.resolvedUrl("data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>"), gsettings: "", output: Qt.resolvedUrl("data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>")},
1062 {tag: "color", accounts: Qt.resolvedUrl("data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>"), gsettings: "", output: Qt.resolvedUrl("data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#dd4814'/></svg>")},
859− {tag: "empty", accounts: "", gsettings: "", output: shell.defaultBackground},
1063+ {tag: "empty", accounts: "", gsettings: "", output: "defaultBackground"},
860 {tag: "as-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: "", output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
1064 {tag: "as-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: "", output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
861 {tag: "gs-specified", accounts: "", gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
1065 {tag: "gs-specified", accounts: "", gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
862 {tag: "both-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
1066 {tag: "both-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
863 {tag: "invalid-as", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
1067 {tag: "invalid-as", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
864− {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: shell.defaultBackground},
1068+ {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: "defaultBackground"},
867 function test_background(data) {
1071 function test_background(data) {
1072+ loadShell("phone");
1073+ swipeAwayGreeter();
868 AccountsService.backgroundFile = data.accounts;
1074 AccountsService.backgroundFile = data.accounts;
869 var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
1075 var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
870 backgroundSettings.pictureUri = data.gsettings;
1076 backgroundSettings.pictureUri = data.gsettings;
1078+ if (data.output === "defaultBackground") {
1079+ tryCompare(shell, "background", shell.defaultBackground);
871− tryCompare(shell, "background", data.output);
1081+ tryCompare(shell, "background", data.output);
1085+ function test_tabletLogin_data() {
1087+ {tag: "auth error", user: "auth-error", loggedIn: false, password: ""},
1088+ {tag: "with password", user: "has-password", loggedIn: true, password: "password"},
1089+ {tag: "without password", user: "no-password", loggedIn: true, password: ""},
1093+ function test_tabletLogin(data) {
1094+ setLightDMMockMode("full");
1095+ loadShell("tablet");
1097+ selectUser(data.user);
1099+ clickPasswordInput(data.password === "" /* isButton */);
1101+ if (data.password !== "") {
1102+ typeString(data.password);
1103+ keyClick(Qt.Key_Enter);
1106+ confirmLoggedIn(data.loggedIn);
1109+ function test_appLaunchDuringGreeter_data() {
1111+ {tag: "auth error", user: "auth-error", loggedIn: false, passwordFocus: false},
1112+ {tag: "without password", user: "no-password", loggedIn: true, passwordFocus: false},
1113+ {tag: "with password", user: "has-password", loggedIn: false, passwordFocus: true},
1117+ function test_appLaunchDuringGreeter(data) {
1118+ setLightDMMockMode("full");
1119+ loadShell("tablet");
1121+ selectUser(data.user)
1123+ var greeter = findChild(shell, "greeter")
1124+ var app = ApplicationManager.startApplication("dialer-app")
1126+ confirmLoggedIn(data.loggedIn)
1128+ if (data.passwordFocus) {
1129+ var passwordInput = findChild(greeter, "passwordInput")
1130+ tryCompare(passwordInput, "focus", true)