@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2014 Canonical, Ltd.
2+ * Copyright (C) 2013-2015 Canonical, Ltd.
33 *
44 * Authors:
55 * Daniel d'Andrada <daniel.dandrada@canonical.com>
@@ -31,12 +31,14 @@ import Unity.Indicators 0.1
3131import Unity.Notifications 1.0
3232import Unity.Test 0.1
3333import Powerd 0.1
34+import Wizard 0.1 as Wizard
3435
3536import "../../qml"
3637
37−Item {
38+Rectangle {
3839 id: root
39− width: units.gu(70)
40+ color: "grey"
41+ width: units.gu(100) + controls.width
4042 height: units.gu(71)
4143
4244 Component.onCompleted: {
@@ -62,12 +64,37 @@ Item {
6264 }
6365 }
6466
65− Row {
66− anchors.fill: parent
67+ Item {
68+ anchors.left: root.left
69+ anchors.right: controls.left
70+ anchors.top: root.top
71+ anchors.bottom: root.bottom
6772 Loader {
6873 id: shellLoader
6974 focus: true
7075
76+ anchors.centerIn: parent
77+
78+ state: "phone"
79+ states: [
80+ State {
81+ name: "phone"
82+ PropertyChanges {
83+ target: shellLoader
84+ width: units.gu(40)
85+ height: units.gu(71)
86+ }
87+ },
88+ State {
89+ name: "tablet"
90+ PropertyChanges {
91+ target: shellLoader
92+ width: units.gu(100)
93+ height: units.gu(71)
94+ }
95+ }
96+ ]
97+
7198 active: false
7299 property bool itemDestroyed: false
73100 sourceComponent: Component {
@@ -80,42 +107,56 @@ Item {
80107 }
81108 }
82109 }
110+ }
111+
112+ Rectangle {
113+ id: controls
114+ color: "darkgrey"
115+ width: units.gu(30)
116+ anchors.top: root.top
117+ anchors.bottom: root.bottom
118+ anchors.right: root.right
119+
120+ Column {
121+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
122+ spacing: units.gu(1)
123+ Row {
124+ anchors { left: parent.left; right: parent.right }
125+ Button {
126+ text: "Show Greeter"
127+ activeFocusOnPress: false
128+ onClicked: {
129+ if (shellLoader.status !== Loader.Ready)
130+ return;
83131
84− Rectangle {
85− color: "darkgrey"
86− width: units.gu(30)
87− height: shellLoader.height
88−
89− Column {
90− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
91− spacing: units.gu(1)
92− Row {
93− anchors { left: parent.left; right: parent.right }
94− Button {
95− text: "Show Greeter"
96− activeFocusOnPress: false
97− onClicked: {
98− if (shellLoader.status !== Loader.Ready)
99− return;
100−
101− var greeter = testCase.findChild(shellLoader.item, "greeter");
102− if (!greeter.shown) {
103− LightDM.Greeter.showGreeter();
104− }
132+ var greeter = testCase.findChild(shellLoader.item, "greeter");
133+ if (!greeter.shown) {
134+ LightDM.Greeter.showGreeter();
105135 }
106136 }
107137 }
108− ListItem.ItemSelector {
109− anchors { left: parent.left; right: parent.right }
110− activeFocusOnPress: false
111− text: "LightDM mock mode"
112− model: ["single", "single-passphrase", "single-pin"]
113− onSelectedIndexChanged: {
114− shellLoader.active = false;
115− LightDM.Greeter.mockMode = model[selectedIndex];
116− LightDM.Users.mockMode = model[selectedIndex];
117− shellLoader.active = true;
118− }
138+ }
139+ ListItem.ItemSelector {
140+ anchors { left: parent.left; right: parent.right }
141+ activeFocusOnPress: false
142+ text: "LightDM mock mode"
143+ model: ["single", "single-passphrase", "single-pin", "full"]
144+ onSelectedIndexChanged: {
145+ shellLoader.active = false;
146+ LightDM.Greeter.mockMode = model[selectedIndex];
147+ LightDM.Users.mockMode = model[selectedIndex];
148+ shellLoader.active = true;
149+ }
150+ }
151+ ListItem.ItemSelector {
152+ anchors { left: parent.left; right: parent.right }
153+ activeFocusOnPress: false
154+ text: "Size"
155+ model: ["phone", "tablet"]
156+ onSelectedIndexChanged: {
157+ shellLoader.active = false;
158+ shellLoader.state = model[selectedIndex];
159+ shellLoader.active = true;
119160 }
120161 MouseTouchEmulationCheckbox { color: "white" }
121162 }
@@ -187,20 +228,49 @@ Item {
187228 property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
188229
189230 function init() {
190− tryCompare(shell, "enabled", true); // enabled by greeter when ready
191− shell.indicatorProfile = "phone";
231+ if (shellLoader.active) {
232+ // happens for the very first test function as shell
233+ // is loaded by default
234+ tearDown();
235+ }
192236
193− swipeAwayGreeter();
237+ }
238+
239+ function cleanup() {
240+ tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
241+ tearDown();
242+ }
243+
244+ function loadShell(formFactor) {
245+ shellLoader.state = formFactor;
246+ shellLoader.active = true;
247+ tryCompare(shellLoader, "status", Loader.Ready);
248+ removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
249+ tryCompare(shell, "enabled", true); // enabled by greeter when ready
194250
195251 sessionSpy.target = findChild(shell, "greeter")
196252 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
197253
198254 var launcher = findChild(shell, "launcher");
199255 launcherShowDashHomeSpy.target = launcher;
256+
257+ waitForGreeterToStabilize();
200258 }
201259
202− function cleanup() {
203− tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
260+ function waitForGreeterToStabilize() {
261+ var greeter = findChild(shell, "greeter");
262+ verify(greeter);
263+
264+ var loginList = findChild(greeter, "loginList");
265+ // Only present in WideView
266+ if (loginList) {
267+ var userList = findChild(loginList, "userList");
268+ verify(userList);
269+ tryCompare(userList, "movingInternally", false);
270+ }
271+ }
272+
273+ function tearDown() {
204274 launcherShowDashHomeSpy.target = null;
205275
206276 shellLoader.itemDestroyed = false;
@@ -217,17 +287,18 @@ Item {
217287 // Shell instance gets destroyed.
218288 tryCompare(shellLoader, "itemDestroyed", true);
219289
290+ setLightDMMockMode("single"); // back to the default value
291+
292+ AccountsService.demoEdges = false;
293+ Wizard.System.wizardEnabled = false;
294+
220295 // kill all (fake) running apps
221296 killApps(ApplicationManager);
222297
223298 unlockAllModemsSpy.clear()
224299 LightDM.Greeter.authenticate(""); // reset greeter
225300
226− // reload our test subject to get it in a fresh state once again
227− shellLoader.active = true;
228−
229− tryCompare(shellLoader, "status", Loader.Ready);
230− removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
301+ sessionSpy.clear();
231302 }
232303
233304 function killApps() {
@@ -239,6 +310,8 @@ Item {
239310 }
240311
241312 function test_snapDecisionDismissalReturnsFocus() {
313+ loadShell("phone");
314+ swipeAwayGreeter();
242315 var notifications = findChild(shell, "notificationList");
243316 var app = ApplicationManager.startApplication("camera-app");
244317 var stage = findChild(shell, "stage")
@@ -297,19 +370,41 @@ Item {
297370 mockNotificationsModel.append(n)
298371 }
299372
300− function test_leftEdgeDrag_data() {
373+ function test_phoneLeftEdgeDrag_data() {
301374 return [
302− {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
303− {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
304− {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: false},
305− {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
306− {tag: "small swipe with greeter", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: true},
307− {tag: "long swipe with greeter", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: true},
308− {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false, greeterShown: false},
375+ {tag: "without launcher",
376+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
377+ launcherHides: true, greeterShown: false},
378+
379+ {tag: "with launcher",
380+ revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
381+ launcherHides: true, greeterShown: false},
382+
383+ {tag: "small swipe",
384+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
385+ launcherHides: false, greeterShown: false},
386+
387+ {tag: "long swipe",
388+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
389+ launcherHides: true, greeterShown: false},
390+
391+ {tag: "small swipe with greeter",
392+ revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app",
393+ launcherHides: false, greeterShown: true},
394+
395+ {tag: "long swipe with greeter",
396+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app",
397+ launcherHides: true, greeterShown: true},
398+
399+ {tag: "swipe over dash",
400+ revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash",
401+ launcherHides: false, greeterShown: false},
309402 ];
310403 }
311404
312− function test_leftEdgeDrag(data) {
405+ function test_phoneLeftEdgeDrag(data) {
406+ loadShell("phone");
407+ swipeAwayGreeter();
313408 dragLauncherIntoView();
314409 tapOnAppIconInLauncher();
315410 waitUntilApplicationWindowIsFullyVisible();
@@ -342,7 +437,32 @@ Item {
342437 compare(animateTimer.nextState, "visible");
343438 }
344439
440+ function test_tabletLeftEdgeDrag_data() {
441+ return [
442+ {tag: "without password", user: "no-password", loggedIn: true, demo: false},
443+ {tag: "with password", user: "has-password", loggedIn: false, demo: false},
444+ {tag: "with demo", user: "has-password", loggedIn: true, demo: true},
445+ ]
446+ }
447+
448+ function test_tabletLeftEdgeDrag(data) {
449+ setLightDMMockMode("full");
450+ loadShell("tablet");
451+
452+ selectUser(data.user)
453+
454+ AccountsService.demoEdges = data.demo
455+ var tutorial = findChild(shell, "tutorial");
456+ tryCompare(tutorial, "running", data.demo);
457+
458+ swipeFromLeftEdge(shell.width * 0.75)
459+ wait(500) // to give time to handle dash() signal from Launcher
460+ confirmLoggedIn(data.loggedIn)
461+ }
462+
345463 function test_suspend() {
464+ loadShell("phone");
465+ swipeAwayGreeter();
346466 var greeter = findChild(shell, "greeter");
347467
348468 // Launch an app from the launcher
@@ -402,6 +522,61 @@ Item {
402522 waitForRendering(greeter);
403523 }
404524
525+ function selectUserAtIndex(i) {
526+ // We could be anywhere in list; find target index to know which direction
527+ var greeter = findChild(shell, "greeter")
528+ var userlist = findChild(greeter, "userList")
529+ if (userlist.currentIndex == i)
530+ keyClick(Qt.Key_Escape) // Reset state if we're not moving
531+ while (userlist.currentIndex != i) {
532+ var next = userlist.currentIndex + 1
533+ if (userlist.currentIndex > i) {
534+ next = userlist.currentIndex - 1
535+ }
536+ tap(findChild(greeter, "username"+next));
537+ tryCompare(userlist, "currentIndex", next)
538+ tryCompare(userlist, "movingInternally", false)
539+ }
540+ tryCompare(shell, "enabled", true); // wait for PAM to settle
541+ }
542+
543+ function selectUser(name) {
544+ // Find index of user with the right name
545+ for (var i = 0; i < LightDM.Users.count; i++) {
546+ if (LightDM.Users.data(i, LightDM.UserRoles.NameRole) == name) {
547+ break
548+ }
549+ }
550+ if (i == LightDM.Users.count) {
551+ fail("Didn't find name")
552+ return -1
553+ }
554+ selectUserAtIndex(i)
555+ return i
556+ }
557+
558+ function clickPasswordInput(isButton) {
559+ var greeter = findChild(shell, "greeter")
560+ tryCompare(greeter, "fullyShown", true);
561+
562+ var passwordMouseArea = findChild(shell, "passwordMouseArea")
563+ tryCompare(passwordMouseArea, "enabled", isButton)
564+
565+ var passwordInput = findChild(shell, "passwordInput")
566+ mouseClick(passwordInput)
567+ }
568+
569+ function confirmLoggedIn(loggedIn) {
570+ var greeter = findChild(shell, "greeter");
571+ tryCompare(greeter, "shown", loggedIn ? false : true);
572+ verify(loggedIn ? sessionSpy.count > 0 : sessionSpy.count === 0);
573+ }
574+
575+ function setLightDMMockMode(mode) {
576+ LightDM.Greeter.mockMode = mode;
577+ LightDM.Users.mockMode = mode;
578+ }
579+
405580 /*
406581 Regression test for bug https://bugs.launchpad.net/touch-preview-images/+bug/1193419
407582
@@ -414,6 +589,8 @@ Item {
414589 - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
415590 */
416591 function test_minimizingAppTakesToDashApps() {
592+ loadShell("phone");
593+ swipeAwayGreeter();
417594 dragLauncherIntoView();
418595
419596 // Launch an app from the launcher
@@ -434,6 +611,8 @@ Item {
434611 }
435612
436613 function test_showInputMethod() {
614+ loadShell("phone");
615+ swipeAwayGreeter();
437616 var item = findChild(shell, "inputMethod");
438617 var surface = SurfaceManager.inputMethodSurface();
439618
@@ -472,6 +651,8 @@ Item {
472651 }
473652
474653 function test_surfaceLosesActiveFocusWhilePanelIsOpen() {
654+ loadShell("phone");
655+ swipeAwayGreeter();
475656 var app = ApplicationManager.startApplication("dialer-app");
476657 waitUntilAppWindowIsFullyLoaded(app);
477658
@@ -502,28 +683,26 @@ Item {
502683 tryCompare(app.session.surface, "activeFocus", true);
503684 }
504685
505− function test_launchedAppHasActiveFocus() {
506− var dialerApp = ApplicationManager.startApplication("dialer-app");
686+ function test_launchedAppHasActiveFocus_data() {
687+ return [
688+ {tag:"phone", formFactor:"phone"},
689+ {tag:"tablet", formFactor:"tablet"},
690+ ];
691+ }
692+
693+ function test_launchedAppHasActiveFocus(data) {
694+ loadShell(data.formFactor);
695+ swipeAwayGreeter();
696+
697+ var dialerApp = ApplicationManager.startApplication("webbrowser-app");
507698 verify(dialerApp);
508− waitUntilAppSurfaceShowsUp("dialer-app")
699+ waitUntilAppSurfaceShowsUp("webbrowser-app")
509700
510701 verify(dialerApp.session.surface);
511702
512703 tryCompare(dialerApp.session.surface, "activeFocus", true);
513704 }
514705
515− // Wait for the whole UI to settle down
516− function waitForUIToSettle() {
517− var launcher = findChild(shell, "launcherPanel")
518− tryCompareFunction(function() {return launcher.x === 0 || launcher.x === -launcher.width;}, true);
519− if (launcher.x === 0) {
520− mouseClick(shell)
521− }
522− tryCompare(launcher, "x", -launcher.width)
523−
524− waitForRendering(shell)
525− }
526−
527706 function waitUntilAppSurfaceShowsUp(appId) {
528707 var appWindow = findChild(shell, "appWindow_" + appId);
529708 verify(appWindow);
@@ -616,6 +795,8 @@ Item {
616795 }
617796
618797 function test_greeterDoesNotChangeIndicatorProfile() {
798+ loadShell("phone");
799+ swipeAwayGreeter();
619800 var panel = findChild(shell, "panel");
620801 tryCompare(panel.indicators.indicatorsModel, "profile", shell.indicatorProfile);
621802
@@ -627,6 +808,8 @@ Item {
627808 }
628809
629810 function test_shellProfileChangesReachIndicators() {
811+ loadShell("phone");
812+ swipeAwayGreeter();
630813 var panel = findChild(shell, "panel");
631814
632815 shell.indicatorProfile = "test1";
@@ -643,6 +826,8 @@ Item {
643826 }
644827
645828 function test_focusRequestedHidesGreeter() {
829+ loadShell("phone");
830+ swipeAwayGreeter();
646831 var greeter = findChild(shell, "greeter");
647832
648833 var app = ApplicationManager.startApplication("dialer-app");
@@ -663,6 +848,8 @@ Item {
663848 }
664849
665850 function test_focusRequestedHidesIndicators() {
851+ loadShell("phone");
852+ swipeAwayGreeter();
666853 var indicators = findChild(shell, "indicators");
667854
668855 showIndicators();
@@ -675,6 +862,8 @@ Item {
675862 }
676863
677864 function test_showAndHideGreeterDBusCalls() {
865+ loadShell("phone");
866+ swipeAwayGreeter();
678867 var greeter = findChild(shell, "greeter")
679868 tryCompare(greeter, "shown", false)
680869 waitForRendering(greeter);
@@ -686,6 +875,8 @@ Item {
686875 }
687876
688877 function test_greeterLoginsAutomaticallyWhenNoPasswordSet() {
878+ loadShell("phone");
879+ swipeAwayGreeter();
689880 sessionSpy.clear();
690881 verify(sessionSpy.valid);
691882
@@ -695,6 +886,8 @@ Item {
695886 }
696887
697888 function test_fullscreen() {
889+ loadShell("phone");
890+ swipeAwayGreeter();
698891 var panel = findChild(shell, "panel");
699892 compare(panel.fullscreenMode, false);
700893 ApplicationManager.startApplication("camera-app");
@@ -708,6 +901,8 @@ Item {
708901 }
709902
710903 function test_leftEdgeDragFullscreen() {
904+ loadShell("phone");
905+ swipeAwayGreeter();
711906 var panel = findChild(shell, "panel");
712907 tryCompare(panel, "fullscreenMode", false)
713908
@@ -729,6 +924,8 @@ Item {
729924 }
730925
731926 function test_unlockedProperties() {
927+ loadShell("phone");
928+ swipeAwayGreeter();
732929 // Confirm that various properties have the correct values when unlocked
733930 var greeter = findChild(shell, "greeter");
734931 tryCompare(greeter, "locked", false);
@@ -741,10 +938,60 @@ Item {
741938 }
742939
743940 function test_unlockAllModemsOnBoot() {
941+ loadShell("phone");
942+ swipeAwayGreeter();
744943 tryCompare(unlockAllModemsSpy, "count", 1)
745944 }
746945
946+ function test_unlockAllModemsAfterWizard() {
947+ Wizard.System.wizardEnabled = true;
948+ loadShell("phone");
949+
950+ var wizard = findChild(shell, "wizard");
951+ compare(wizard.active, true);
952+ compare(Wizard.System.wizardEnabled, true);
953+ compare(unlockAllModemsSpy.count, 0);
954+
955+ wizard.hide();
956+ tryCompare(wizard, "active", false);
957+ compare(Wizard.System.wizardEnabled, false);
958+ compare(unlockAllModemsSpy.count, 1);
959+ }
960+
961+ function test_wizardEarlyExit() {
962+ Wizard.System.wizardEnabled = true;
963+ AccountsService.demoEdges = true;
964+ loadShell("phone");
965+
966+ var wizard = findChild(shell, "wizard");
967+ var tutorial = findChild(shell, "tutorial");
968+ tryCompare(wizard, "active", true);
969+ tryCompare(tutorial, "running", true);
970+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
971+
972+ // Make sure we stay running when nothing focused (can happen for
973+ // a moment when we restart the dash after switching language)
974+ ApplicationManager.stopApplication("unity8-dash");
975+ tryCompare(ApplicationManager, "focusedApplicationId", "");
976+ compare(wizard.shown, true);
977+ compare(tutorial.running, true);
978+
979+ // And make sure we stay running when dash focused again
980+ ApplicationManager.startApplication("unity8-dash");
981+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
982+ compare(wizard.shown, true);
983+ compare(tutorial.running, true);
984+
985+ // And make sure we stop when something else is focused
986+ ApplicationManager.startApplication("gallery-app");
987+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
988+ compare(wizard.shown, false);
989+ compare(tutorial.running, false);
990+ }
991+
747992 function test_tapOnRightEdgeReachesApplicationSurface() {
993+ loadShell("phone");
994+ swipeAwayGreeter();
748995 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
749996 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
750997 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
@@ -767,6 +1014,8 @@ Item {
7671014 by the right-edge drag area)
7681015 */
7691016 function test_rightEdgeDragDoesNotReachApplicationSurface() {
1017+ loadShell("phone");
1018+ swipeAwayGreeter();
7701019 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
7711020 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
7721021 var rightEdgeDragArea = findChild(shell, "spreadDragArea");
@@ -811,6 +1060,8 @@ Item {
8111060 }
8121061
8131062 function test_tapUbuntuIconInLauncherOverAppSpread() {
1063+ loadShell("phone");
1064+ swipeAwayGreeter();
8141065
8151066 waitUntilFocusedApplicationIsShowingItsSurface();
8161067
@@ -857,18 +1108,75 @@ Item {
8571108 function test_background_data() {
8581109 return [
8591110 {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>")},
860− {tag: "empty", accounts: "", gsettings: "", output: shell.defaultBackground},
1111+ {tag: "empty", accounts: "", gsettings: "", output: "defaultBackground"},
8611112 {tag: "as-specified", accounts: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), gsettings: "", output: Qt.resolvedUrl("../data/unity/backgrounds/blue.png")},
8621113 {tag: "gs-specified", accounts: "", gsettings: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), output: Qt.resolvedUrl("../data/unity/backgrounds/red.png")},
8631114 {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")},
8641115 {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")},
865− {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: shell.defaultBackground},
1116+ {tag: "invalid-both", accounts: Qt.resolvedUrl("../data/unity/backgrounds/nope.png"), gsettings: Qt.resolvedUrl("../data/unity/backgrounds/stillnope.png"), output: "defaultBackground"},
8661117 ]
8671118 }
8681119 function test_background(data) {
1120+ loadShell("phone");
1121+ swipeAwayGreeter();
8691122 AccountsService.backgroundFile = data.accounts;
870− GSettingsController.setPictureUri("org.gnome.desktop.background", data.gsettings);
871− tryCompare(shell, "background", data.output);
1123+ var backgroundSettings = findInvisibleChild(shell, "backgroundSettings");
1124+ backgroundSettings.pictureUri = data.gsettings;
1125+
1126+ if (data.output === "defaultBackground") {
1127+ tryCompare(shell, "background", shell.defaultBackground);
1128+ } else {
1129+ tryCompare(shell, "background", data.output);
1130+ }
1131+ }
1132+
1133+ function test_tabletLogin_data() {
1134+ return [
1135+ {tag: "auth error", user: "auth-error", loggedIn: false, password: ""},
1136+ {tag: "with password", user: "has-password", loggedIn: true, password: "password"},
1137+ {tag: "without password", user: "no-password", loggedIn: true, password: ""},
1138+ ]
1139+ }
1140+
1141+ function test_tabletLogin(data) {
1142+ setLightDMMockMode("full");
1143+ loadShell("tablet");
1144+
1145+ selectUser(data.user);
1146+
1147+ clickPasswordInput(data.password === "" /* isButton */);
1148+
1149+ if (data.password !== "") {
1150+ typeString(data.password);
1151+ keyClick(Qt.Key_Enter);
1152+ }
1153+
1154+ confirmLoggedIn(data.loggedIn);
1155+ }
1156+
1157+ function test_appLaunchDuringGreeter_data() {
1158+ return [
1159+ {tag: "auth error", user: "auth-error", loggedIn: false, passwordFocus: false},
1160+ {tag: "without password", user: "no-password", loggedIn: true, passwordFocus: false},
1161+ {tag: "with password", user: "has-password", loggedIn: false, passwordFocus: true},
1162+ ]
1163+ }
1164+
1165+ function test_appLaunchDuringGreeter(data) {
1166+ setLightDMMockMode("full");
1167+ loadShell("tablet");
1168+
1169+ selectUser(data.user)
1170+
1171+ var greeter = findChild(shell, "greeter")
1172+ var app = ApplicationManager.startApplication("dialer-app")
1173+
1174+ confirmLoggedIn(data.loggedIn)
1175+
1176+ if (data.passwordFocus) {
1177+ var passwordInput = findChild(greeter, "passwordInput")
1178+ tryCompare(passwordInput, "focus", true)
1179+ }
8721180 }
8731181 }
8741182}