on xenial help sign in
Rearchitect test
c3d68e5Josh Arenson
qml/Greeter/WideView.qml−10
@@ -147,16 +147,6 @@ FocusScope {
147 onSessionChooserButtonClicked: parent.state = "SessionsList"
147 onSessionChooserButtonClicked: parent.state = "SessionsList"
148
148
149 Keys.forwardTo: [sessionChooserLoader.item]
149 Keys.forwardTo: [sessionChooserLoader.item]
150−
151− // This is only for testing
152− Connections {
153− // TODO when Qt 5.7
154− //enabled: LightDM.Users.mock
155− target: LightDMService.users
156− onDataChanged: {
157− loginList.currentSession = LightDMService.users.data(loginList.currentIndex, LightDMService.userRoles.SessionRole);
158− }
159− }
160 }
150 }
161
151
162 Loader {
152 Loader {
tests/qmltests/Greeter/tst_WideView.qml+16−6
@@ -413,19 +413,29 @@ StyledItem {
413
413
414 function test_changingSessionSticksToUser() {
414 function test_changingSessionSticksToUser() {
415 LightDMController.sessionMode = "full";
415 LightDMController.sessionMode = "full";
416+
417+ var loginList = findChild(view, "loginList");
418+ var fakeSession1 = "ASessionWillNeverBeCalledThis";
419+ var fakeSession2 = "ASessionWillAlsoNeverBeCalledThis";
420+
416 // For this test to work, a user has to be selected and the
421 // For this test to work, a user has to be selected and the
417 // mock must be made aware of that user
422 // mock must be made aware of that user
418 selectUser("has-password")
423 selectUser("has-password")
419 LightDMController.currentUsername = "has-password"
424 LightDMController.currentUsername = "has-password"
425+ compare(LightDM.Sessions.count > 1, true);
426+ compare(loginList.currentSession != fakeSession1, true);
427+ LightDMController.sessionName = fakeSession1;
420
428
421− var loginList = findChild(view, "loginList");
429+ selectUser("has-pin")
422− var fakeSessionName = "ASessionWillNeverBeCalledThis";
430+ LightDMController.currentUsername = "has-pin"
431+ compare(loginList.currentSession != fakeSession2, true);
432+ LightDMController.sessionName = fakeSession2;
423
433
424− compare(LightDM.Sessions.count > 1, true);
434+ selectUser("has-password")
425− compare(loginList.currentSession != fakeSessionName, true);
435+ tryCompare(loginList, "currentSession", fakeSession1);
426
436
427− LightDMController.sessionName = fakeSessionName;
437+ selectUser("has-pin")
428− tryCompare(loginList, "currentSession", fakeSessionName);
438+ tryCompare(loginList, "currentSession", fakeSession2);
429
439
430 // Force a model reset
440 // Force a model reset
431 LightDMController.userMode = "single";
441 LightDMController.userMode = "single";