@@ -26,13 +26,17 @@ import Unity.Application 0.1
2626import Unity.Connectivity 0.1
2727import Unity.Indicators 0.1
2828import Unity.Notifications 1.0
29−import Unity.Test 0.1 as UT
29+import Unity.Test 0.1
3030import Powerd 0.1
31+import Wizard 0.1 as Wizard
3132
3233import "../../qml"
3334
34−Item {
35+Rectangle {
3536 id: root
37+ color: "grey"
38+ width: units.gu(100) + controls.width
39+ height: units.gu(71)
3640
3741 Component.onCompleted: {
3842 // must set the mock mode before loading the Shell
@@ -41,18 +45,36 @@ Item {
4145 shellLoader.active = true;
4246 }
4347
44− width: shellLoader.width + controlsRect.width
45− height: shellLoader.height
46−
47− Row {
48− anchors.fill: parent
48+ Item {
49+ anchors.left: root.left
50+ anchors.right: controls.left
51+ anchors.top: root.top
52+ anchors.bottom: root.bottom
4953 Loader {
5054 id: shellLoader
5155 focus: true
5256
53− property bool tablet: false
54− width: tablet ? units.gu(160) : units.gu(40)
55− height: tablet ? units.gu(100) : units.gu(71)
57+ anchors.centerIn: parent
58+
59+ state: "phone"
60+ states: [
61+ State {
62+ name: "phone"
63+ PropertyChanges {
64+ target: shellLoader
65+ width: units.gu(40)
66+ height: units.gu(71)
67+ }
68+ },
69+ State {
70+ name: "tablet"
71+ PropertyChanges {
72+ target: shellLoader
73+ width: units.gu(100)
74+ height: units.gu(71)
75+ }
76+ }
77+ ]
5678
5779 active: false
5880 property bool itemDestroyed: false
@@ -68,44 +90,58 @@ Item {
6890 }
6991 }
7092 }
93+ }
94+
95+ Rectangle {
96+ id: controls
97+ color: "darkgrey"
98+ width: units.gu(30)
99+ anchors.top: root.top
100+ anchors.bottom: root.bottom
101+ anchors.right: root.right
102+
103+ Column {
104+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
105+ spacing: units.gu(1)
106+ Row {
107+ anchors { left: parent.left; right: parent.right }
108+ Button {
109+ text: "Show Greeter"
110+ activeFocusOnPress: false
111+ onClicked: {
112+ if (shellLoader.status !== Loader.Ready)
113+ return;
71114
72− Rectangle {
73− id: controlsRect
74− color: "darkgrey"
75− width: units.gu(30)
76− height: shellLoader.height
77−
78− Column {
79− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
80− spacing: units.gu(1)
81− Row {
82− anchors { left: parent.left; right: parent.right }
83− Button {
84− text: "Show Greeter"
85− activeFocusOnPress: false
86− onClicked: {
87− if (shellLoader.status !== Loader.Ready)
88− return;
89−
90− var greeter = testCase.findChild(shellLoader.item, "greeter");
91− if (!greeter.shown) {
92− LightDM.Greeter.showGreeter();
93− }
115+ var greeter = testCase.findChild(shellLoader.item, "greeter");
116+ if (!greeter.shown) {
117+ LightDM.Greeter.showGreeter();
94118 }
95119 }
96120 }
97− ListItem.ItemSelector {
98− anchors { left: parent.left; right: parent.right }
99− activeFocusOnPress: false
100− text: "LightDM mock mode"
101− model: ["single", "single-passphrase", "single-pin"]
102− onSelectedIndexChanged: {
103− shellLoader.active = false;
104− LightDM.Greeter.mockMode = model[selectedIndex];
105− LightDM.Users.mockMode = model[selectedIndex];
106− shellLoader.active = true;
107− }
121+ }
122+ ListItem.ItemSelector {
123+ anchors { left: parent.left; right: parent.right }
124+ activeFocusOnPress: false
125+ text: "LightDM mock mode"
126+ model: ["single", "single-passphrase", "single-pin", "full"]
127+ onSelectedIndexChanged: {
128+ shellLoader.active = false;
129+ LightDM.Greeter.mockMode = model[selectedIndex];
130+ LightDM.Users.mockMode = model[selectedIndex];
131+ shellLoader.active = true;
132+ }
133+ }
134+ ListItem.ItemSelector {
135+ anchors { left: parent.left; right: parent.right }
136+ activeFocusOnPress: false
137+ text: "Size"
138+ model: ["phone", "tablet"]
139+ onSelectedIndexChanged: {
140+ shellLoader.active = false;
141+ shellLoader.state = model[selectedIndex];
142+ shellLoader.active = true;
108143 }
144+ MouseTouchEmulationCheckbox { color: "white" }
109145 }
110146 }
111147 }
@@ -167,7 +203,7 @@ Item {
167203 phoneNumber: "+447812221111"
168204 }
169205
170− UT.UnityTestCase {
206+ UnityTestCase {
171207 id: testCase
172208 name: "Shell"
173209 when: windowShown
@@ -175,19 +211,49 @@ Item {
175211 property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
176212
177213 function init() {
178− tryCompare(shell, "enabled", true); // enabled by greeter when ready
214+ if (shellLoader.active) {
215+ // happens for the very first test function as shell
216+ // is loaded by default
217+ tearDown();
218+ }
179219
180− swipeAwayGreeter();
220+ }
221+
222+ function cleanup() {
223+ tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
224+ tearDown();
225+ }
226+
227+ function loadShell(formFactor) {
228+ shellLoader.state = formFactor;
229+ shellLoader.active = true;
230+ tryCompare(shellLoader, "status", Loader.Ready);
231+ removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
232+ tryCompare(shell, "enabled", true); // enabled by greeter when ready
181233
182234 sessionSpy.target = findChild(shell, "greeter")
183235 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
184236
185237 var launcher = findChild(shell, "launcher");
186238 launcherShowDashHomeSpy.target = launcher;
239+
240+ waitForGreeterToStabilize();
187241 }
188242
189− function cleanup() {
190− tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
243+ function waitForGreeterToStabilize() {
244+ var greeter = findChild(shell, "greeter");
245+ verify(greeter);
246+
247+ var loginList = findChild(greeter, "loginList");
248+ // Only present in WideView
249+ if (loginList) {
250+ var userList = findChild(loginList, "userList");
251+ verify(userList);
252+ tryCompare(userList, "movingInternally", false);
253+ }
254+ }
255+
256+ function tearDown() {
191257 launcherShowDashHomeSpy.target = null;
192258
193259 shellLoader.itemDestroyed = false;
@@ -204,17 +270,18 @@ Item {
204270 // Shell instance gets destroyed.
205271 tryCompare(shellLoader, "itemDestroyed", true);
206272
273+ setLightDMMockMode("single"); // back to the default value
274+
275+ AccountsService.demoEdges = false;
276+ Wizard.System.wizardEnabled = false;
277+
207278 // kill all (fake) running apps
208279 killApps(ApplicationManager);
209280
210281 unlockAllModemsSpy.clear()
211282 LightDM.Greeter.authenticate(""); // reset greeter
212283
213− // reload our test subject to get it in a fresh state once again
214− shellLoader.active = true;
215−
216− tryCompare(shellLoader, "status", Loader.Ready);
217− removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
284+ sessionSpy.clear();
218285 }
219286
220287 function killApps() {
@@ -226,6 +293,8 @@ Item {
226293 }
227294
228295 function test_snapDecisionDismissalReturnsFocus() {
296+ loadShell("phone");
297+ swipeAwayGreeter();
229298 var notifications = findChild(shell, "notificationList");
230299 var app = ApplicationManager.startApplication("camera-app");
231300 var stage = findChild(shell, "stage")
@@ -284,19 +353,41 @@ Item {
284353 mockNotificationsModel.append(n)
285354 }
286355
287− function test_leftEdgeDrag_data() {
356+ function test_phoneLeftEdgeDrag_data() {
288357 return [
289− {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
290− {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
291− {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: false},
292− {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
293− {tag: "small swipe with greeter", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: true},
294− {tag: "long swipe with greeter", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: true},
295− {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false, greeterShown: false},
358+ {tag: "without launcher",
359+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
360+ launcherHides: true, greeterShown: false},
361+
362+ {tag: "with launcher",
363+ revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
364+ launcherHides: true, greeterShown: false},
365+
366+ {tag: "small swipe",
367+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
368+ launcherHides: false, greeterShown: false},
369+
370+ {tag: "long swipe",
371+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
372+ launcherHides: true, greeterShown: false},
373+
374+ {tag: "small swipe with greeter",
375+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
376+ launcherHides: false, greeterShown: true},
377+
378+ {tag: "long swipe with greeter",
379+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
380+ launcherHides: true, greeterShown: true},
381+
382+ {tag: "swipe over dash",
383+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash",
384+ launcherHides: false, greeterShown: false},
296385 ];
297386 }
298387
299− function test_leftEdgeDrag(data) {
388+ function test_phoneLeftEdgeDrag(data) {
389+ loadShell("phone");
390+ swipeAwayGreeter();
300391 dragLauncherIntoView();
301392 tapOnAppIconInLauncher();
302393 waitUntilApplicationWindowIsFullyVisible();
@@ -329,7 +420,32 @@ Item {
329420 compare(animateTimer.nextState, "visible");
330421 }
331422
423+ function test_tabletLeftEdgeDrag_data() {
424+ return [
425+ {tag: "without password", user: "no-password", loggedIn: true, demo: false},
426+ {tag: "with password", user: "has-password", loggedIn: false, demo: false},
427+ {tag: "with demo", user: "has-password", loggedIn: true, demo: true},
428+ ]
429+ }
430+
431+ function test_tabletLeftEdgeDrag(data) {
432+ setLightDMMockMode("full");
433+ loadShell("tablet");
434+
435+ selectUser(data.user)
436+
437+ AccountsService.demoEdges = data.demo
438+ var tutorial = findChild(shell, "tutorial");
439+ tryCompare(tutorial, "running", data.demo);
440+
441+ swipeFromLeftEdge(shell.width * 0.75)
442+ wait(500) // to give time to handle dash() signal from Launcher
443+ confirmLoggedIn(data.loggedIn)
444+ }
445+
332446 function test_suspend() {
447+ loadShell("phone");
448+ swipeAwayGreeter();
333449 var greeter = findChild(shell, "greeter");
334450
335451 // Launch an app from the launcher
@@ -389,6 +505,61 @@ Item {
389505 waitForRendering(greeter);
390506 }
391507
508+ function selectUserAtIndex(i) {
509+ // We could be anywhere in list; find target index to know which direction
510+ var greeter = findChild(shell, "greeter")
511+ var userlist = findChild(greeter, "userList")
512+ if (userlist.currentIndex == i)
513+ keyClick(Qt.Key_Escape) // Reset state if we're not moving
514+ while (userlist.currentIndex != i) {
515+ var next = userlist.currentIndex + 1
516+ if (userlist.currentIndex > i) {
517+ next = userlist.currentIndex - 1
518+ }
519+ tap(findChild(greeter, "username"+next));
520+ tryCompare(userlist, "currentIndex", next)
521+ tryCompare(userlist, "movingInternally", false)
522+ }
523+ tryCompare(shell, "enabled", true); // wait for PAM to settle
524+ }
525+
526+ function selectUser(name) {
527+ // Find index of user with the right name
528+ for (var i = 0; i < LightDM.Users.count; i++) {
529+ if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == name) {
530+ break
531+ }
532+ }
533+ if (i == LightDM.Users.count) {
534+ fail("Didn't find name")
535+ return -1
536+ }
537+ selectUserAtIndex(i)
538+ return i
539+ }
540+
541+ function clickPasswordInput(isButton) {
542+ var greeter = findChild(shell, "greeter")
543+ tryCompare(greeter, "fullyShown", true);
544+
545+ var passwordMouseArea = findChild(shell, "passwordMouseArea")
546+ tryCompare(passwordMouseArea, "enabled", isButton)
547+
548+ var passwordInput = findChild(shell, "passwordInput")
549+ mouseClick(passwordInput)
550+ }
551+
552+ function confirmLoggedIn(loggedIn) {
553+ var greeter = findChild(shell, "greeter");
554+ tryCompare(greeter, "shown", loggedIn ? false : true);
555+ verify(loggedIn ? sessionSpy.count > 0 : sessionSpy.count === 0);
556+ }
557+
558+ function setLightDMMockMode(mode) {
559+ LightDM.Greeter.mockMode = mode;
560+ LightDM.Users.mockMode = mode;
561+ }
562+
392563 /*
393564 Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
394565
@@ -401,6 +572,8 @@ Item {
401572 - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
402573 */
403574 function test_minimizingAppTakesToDashApps() {
575+ loadShell("phone");
576+ swipeAwayGreeter();
404577 dragLauncherIntoView();
405578
406579 // Launch an app from the launcher
@@ -421,6 +594,8 @@ Item {
421594 }
422595
423596 function test_showInputMethod() {
597+ loadShell("phone");
598+ swipeAwayGreeter();
424599 var item = findChild(shell, "inputMethod");
425600 var surface = SurfaceManager.inputMethodSurface();
426601
@@ -450,6 +625,8 @@ Item {
450625 }
451626
452627 function test_surfaceLosesActiveFocusWhilePanelIsOpen() {
628+ loadShell("phone");
629+ swipeAwayGreeter();
453630 var app = ApplicationManager.startApplication("dialer-app");
454631 waitUntilAppWindowIsFullyLoaded(app);
455632
@@ -480,28 +657,26 @@ Item {
480657 tryCompare(app.session.surface, "activeFocus", true);
481658 }
482659
483− function test_launchedAppHasActiveFocus() {
484− var dialerApp = ApplicationManager.startApplication("dialer-app");
660+ function test_launchedAppHasActiveFocus_data() {
661+ return [
662+ {tag:"phone", formFactor:"phone"},
663+ {tag:"tablet", formFactor:"tablet"},
664+ ];
665+ }
666+
667+ function test_launchedAppHasActiveFocus(data) {
668+ loadShell(data.formFactor);
669+ swipeAwayGreeter();
670+
671+ var dialerApp = ApplicationManager.startApplication("webbrowser-app");
485672 verify(dialerApp);
486− waitUntilAppSurfaceShowsUp("dialer-app")
673+ waitUntilAppSurfaceShowsUp("webbrowser-app")
487674
488675 verify(dialerApp.session.surface);
489676
490677 tryCompare(dialerApp.session.surface, "activeFocus", true);
491678 }
492679
493− // Wait for the whole UI to settle down
494− function waitForUIToSettle() {
495− var launcher = findChild(shell, "launcherPanel")
496− tryCompareFunction(function() {return launcher.x === 0 || launcher.x === -launcher.width;}, true);
497− if (launcher.x === 0) {
498− mouseClick(shell)
499− }
500− tryCompare(launcher, "x", -launcher.width)
501−
502− waitForRendering(shell)
503− }
504−
505680 function waitUntilAppSurfaceShowsUp(appId) {
506681 var appWindow = findChild(shell, "appWindow_" + appId);
507682 verify(appWindow);
@@ -594,6 +769,8 @@ Item {
594769 }
595770
596771 function test_focusRequestedHidesGreeter() {
772+ loadShell("phone");
773+ swipeAwayGreeter();
597774 var greeter = findChild(shell, "greeter");
598775
599776 var app = ApplicationManager.startApplication("dialer-app");
@@ -614,6 +791,8 @@ Item {
614791 }
615792
616793 function test_focusRequestedHidesIndicators() {
794+ loadShell("phone");
795+ swipeAwayGreeter();
617796 var indicators = findChild(shell, "indicators");
618797
619798 showIndicators();
@@ -626,6 +805,8 @@ Item {
626805 }
627806
628807 function test_showAndHideGreeterDBusCalls() {
808+ loadShell("phone");
809+ swipeAwayGreeter();
629810 var greeter = findChild(shell, "greeter")
630811 tryCompare(greeter, "shown", false)
631812 waitForRendering(greeter);
@@ -637,6 +818,9 @@ Item {
637818 }
638819
639820 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
821+ loadShell("phone");
822+ swipeAwayGreeter();
823+
640824 sessionSpy.clear();
641825 verify(sessionSpy.valid);
642826
@@ -646,6 +830,8 @@ Item {
646830 }
647831
648832 function test_fullscreen() {
833+ loadShell("phone");
834+ swipeAwayGreeter();
649835 var panel = findChild(shell, "panel");
650836 compare(panel.fullscreenMode, false);
651837 ApplicationManager.startApplication("camera-app");
@@ -659,6 +845,8 @@ Item {
659845 }
660846
661847 function test_leftEdgeDragFullscreen() {
848+ loadShell("phone");
849+ swipeAwayGreeter();
662850 var panel = findChild(shell, "panel");
663851 tryCompare(panel, "fullscreenMode", false)
664852
@@ -680,6 +868,8 @@ Item {
680868 }
681869
682870 function test_unlockedProperties() {
871+ loadShell("phone");
872+ swipeAwayGreeter();
683873 // Confirm that various properties have the correct values when unlocked
684874 var greeter = findChild(shell, "greeter");
685875 tryCompare(greeter, "locked", false);
@@ -692,10 +882,60 @@ Item {
692882 }
693883
694884 function test_unlockAllModemsOnBoot() {
885+ loadShell("phone");
886+ swipeAwayGreeter();
695887 tryCompare(unlockAllModemsSpy, "count", 1)
696888 }
697889
890+ function test_unlockAllModemsAfterWizard() {
891+ Wizard.System.wizardEnabled = true;
892+ loadShell("phone");
893+
894+ var wizard = findChild(shell, "wizard");
895+ compare(wizard.active, true);
896+ compare(Wizard.System.wizardEnabled, true);
897+ compare(unlockAllModemsSpy.count, 0);
898+
899+ wizard.hide();
900+ tryCompare(wizard, "active", false);
901+ compare(Wizard.System.wizardEnabled, false);
902+ compare(unlockAllModemsSpy.count, 1);
903+ }
904+
905+ function test_wizardEarlyExit() {
906+ Wizard.System.wizardEnabled = true;
907+ AccountsService.demoEdges = true;
908+ loadShell("phone");
909+
910+ var wizard = findChild(shell, "wizard");
911+ var tutorial = findChild(shell, "tutorial");
912+ tryCompare(wizard, "active", true);
913+ tryCompare(tutorial, "running", true);
914+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
915+
916+ // Make sure we stay running when nothing focused (can happen for
917+ // a moment when we restart the dash after switching language)
918+ ApplicationManager.stopApplication("unity8-dash");
919+ tryCompare(ApplicationManager, "focusedApplicationId", "");
920+ compare(wizard.shown, true);
921+ compare(tutorial.running, true);
922+
923+ // And make sure we stay running when dash focused again
924+ ApplicationManager.startApplication("unity8-dash");
925+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
926+ compare(wizard.shown, true);
927+ compare(tutorial.running, true);
928+
929+ // And make sure we stop when something else is focused
930+ ApplicationManager.startApplication("gallery-app");
931+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
932+ compare(wizard.shown, false);
933+ compare(tutorial.running, false);
934+ }
935+
698936 function test_tapOnRightEdgeReachesApplicationSurface() {
937+ loadShell("phone");
938+ swipeAwayGreeter();
699939 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
700940 verify(topmostSpreadDelegate);
701941
@@ -723,6 +963,8 @@ Item {
723963 by the right-edge drag area)
724964 */
725965 function test_rightEdgeDragDoesNotReachApplicationSurface() {
966+ loadShell("phone");
967+ swipeAwayGreeter();
726968 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
727969 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
728970 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
@@ -767,6 +1009,8 @@ Item {
7671009 }
7681010
7691011 function test_tapUbuntuIconInLauncherOverAppSpread() {
1012+ loadShell("phone");
1013+ swipeAwayGreeter();
7701014
7711015 waitUntilFocusedApplicationIsShowingItsSurface();
7721016
@@ -811,19 +1055,75 @@ Item {
8111055 function test_background_data() {
8121056 return [
8131057 {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>")},
814− {tag: "empty", accounts: "", gsettings: "", output: shell.defaultBackground},
1058+ {tag: "empty", accounts: "", gsettings: "", output: "defaultBackground"},
8151059 {tag: "as-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: "", output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
8161060 {tag: "gs-specified", accounts: "", gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
8171061 {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")},
8181062 {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")},
819− {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: shell.defaultBackground},
1063+ {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: "defaultBackground"},
8201064 ]
8211065 }
8221066 function test_background(data) {
1067+ loadShell("phone");
1068+ swipeAwayGreeter();
8231069 AccountsService.backgroundFile = data.accounts;
8241070 var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
8251071 backgroundSettings.pictureUri = data.gsettings;
826− tryCompare(shell, "background", data.output);
1072+
1073+ if (data.output === "defaultBackground") {
1074+ tryCompare(shell, "background", shell.defaultBackground);
1075+ } else {
1076+ tryCompare(shell, "background", data.output);
1077+ }
1078+ }
1079+
1080+ function test_tabletLogin_data() {
1081+ return [
1082+ {tag: "auth error", user: "auth-error", loggedIn: false, password: ""},
1083+ {tag: "with password", user: "has-password", loggedIn: true, password: "password"},
1084+ {tag: "without password", user: "no-password", loggedIn: true, password: ""},
1085+ ]
1086+ }
1087+
1088+ function test_tabletLogin(data) {
1089+ setLightDMMockMode("full");
1090+ loadShell("tablet");
1091+
1092+ selectUser(data.user);
1093+
1094+ clickPasswordInput(data.password === "" /* isButton */);
1095+
1096+ if (data.password !== "") {
1097+ typeString(data.password);
1098+ keyClick(Qt.Key_Enter);
1099+ }
1100+
1101+ confirmLoggedIn(data.loggedIn);
1102+ }
1103+
1104+ function test_appLaunchDuringGreeter_data() {
1105+ return [
1106+ {tag: "auth error", user: "auth-error", loggedIn: false, passwordFocus: false},
1107+ {tag: "without password", user: "no-password", loggedIn: true, passwordFocus: false},
1108+ {tag: "with password", user: "has-password", loggedIn: false, passwordFocus: true},
1109+ ]
1110+ }
1111+
1112+ function test_appLaunchDuringGreeter(data) {
1113+ setLightDMMockMode("full");
1114+ loadShell("tablet");
1115+
1116+ selectUser(data.user)
1117+
1118+ var greeter = findChild(shell, "greeter")
1119+ var app = ApplicationManager.startApplication("dialer-app")
1120+
1121+ confirmLoggedIn(data.loggedIn)
1122+
1123+ if (data.passwordFocus) {
1124+ var passwordInput = findChild(greeter, "passwordInput")
1125+ tryCompare(passwordInput, "focus", true)
1126+ }
8271127 }
8281128 }
8291129}