on xenial help sign in
Add test
commit34333399b1d2896a206f2cc27e8a0a6cf3602bcd authorJosh Arenson <joshua.arenson@canonical.com> dateMon 19 Dec 2016, 12:22 (10 years ago) parent57d7fc9
2 files changed+34−3
qml/Greeter/WideView.qml+16−1 tests/qmltests/Greeter/tst_WideView.qml+18−2
qml/Greeter/WideView.qml+16−1
@@ -144,12 +144,27 @@ FocusScope {
144144 currentSession: LightDMService.users.data(selectedUserIndex, LightDMService.userRoles.SessionRole);
145145 onResponded: root.responded(response)
146146 onSelected: {
147− root.selected(index)
147+ if (LightDMService.users.mock) {
148+ LightDMService.users.mock.currentUsername = currentUser;
149+ }
150+
148151 loginList.selectedUserIndex = index;
152+ root.selected(index)
153+ currentSession = LightDMService.users.data(index, LightDMService.userRoles.SessionRole);
149154 }
150155 onSessionChooserButtonClicked: parent.state = "SessionsList"
151156
152157 Keys.forwardTo: [sessionChooserLoader.item]
158+
159+ // This is only for testing
160+ Connections {
161+ // TODO when Qt 5.7
162+ //enabled: LightDM.Users.mock
163+ target: LightDMService.users
164+ onModelReset: {
165+ loginList.currentSession = LightDMService.users.data(loginList.selectedUserIndex, LightDMService.userRoles.SessionRole);
166+ }
167+ }
153168 }
154169
155170 Loader {
tests/qmltests/Greeter/tst_WideView.qml+18−2
@@ -409,7 +409,23 @@ StyledItem {
409409 waitForRendering(view);
410410 }
411411
412− function test_tease_data() {
412+ function test_changingSessionSticksToUser() {
413+ LightDM.Sessions.mock.sessionMode = "full";
414+ var loginList = findChild(view, "loginList");
415+ var fakeSessionName = "ASessionWillNeverBeCalledThis";
416+
417+ compare(LightDM.Sessions.count > 1, true);
418+ compare(loginList.currentSession != fakeSessionName, true);
419+
420+ LightDM.Users.mock.sessionName = fakeSessionName;
421+ tryCompare(loginList, "currentSession", fakeSessionName);
422+
423+ // Force a model reset
424+ LightDM.Users.mock.userMode = "single";
425+ LightDM.Users.mock.userMode = "full";
426+ }
427+
428+ /*function test_tease_data() {
413429 return [
414430 {tag: "locked", x: 0, offset: 0, count: 0, locked: true},
415431 {tag: "left", x: 0, offset: 0, count: 1, locked: false},
@@ -744,6 +760,6 @@ StyledItem {
744760
745761 view.showPrompt("", true, true);
746762 verify(promptField.activeFocus);
747− }
763+ }*/
748764 }
749765}