on xenial help sign in
Rearchitect test
commitc3d68e5b8a92c1e4570dd4cff341e0d5f128cc07 authorJosh Arenson <joshua.arenson@canonical.com> dateFri 13 Jan 2017, 12:36 (10 years ago) parent58dc74f
2 files changed+16−16
qml/Greeter/WideView.qml−10 tests/qmltests/Greeter/tst_WideView.qml+16−6
qml/Greeter/WideView.qml−10
@@ -147,16 +147,6 @@ FocusScope {
147147 onSessionChooserButtonClicked: parent.state = "SessionsList"
148148
149149 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− }
160150 }
161151
162152 Loader {
tests/qmltests/Greeter/tst_WideView.qml+16−6
@@ -413,19 +413,29 @@ StyledItem {
413413
414414 function test_changingSessionSticksToUser() {
415415 LightDMController.sessionMode = "full";
416+
417+ var loginList = findChild(view, "loginList");
418+ var fakeSession1 = "ASessionWillNeverBeCalledThis";
419+ var fakeSession2 = "ASessionWillAlsoNeverBeCalledThis";
420+
416421 // For this test to work, a user has to be selected and the
417422 // mock must be made aware of that user
418423 selectUser("has-password")
419424 LightDMController.currentUsername = "has-password"
425+ compare(LightDM.Sessions.count > 1, true);
426+ compare(loginList.currentSession != fakeSession1, true);
427+ LightDMController.sessionName = fakeSession1;
420428
421− var loginList = findChild(view, "loginList");
422− var fakeSessionName = "ASessionWillNeverBeCalledThis";
429+ selectUser("has-pin")
430+ LightDMController.currentUsername = "has-pin"
431+ compare(loginList.currentSession != fakeSession2, true);
432+ LightDMController.sessionName = fakeSession2;
423433
424− compare(LightDM.Sessions.count > 1, true);
425− compare(loginList.currentSession != fakeSessionName, true);
434+ selectUser("has-password")
435+ tryCompare(loginList, "currentSession", fakeSession1);
426436
427− LightDMController.sessionName = fakeSessionName;
428− tryCompare(loginList, "currentSession", fakeSessionName);
437+ selectUser("has-pin")
438+ tryCompare(loginList, "currentSession", fakeSession2);
429439
430440 // Force a model reset
431441 LightDMController.userMode = "single";