on xenial help sign in
Add test
3433339Josh Arenson
qml/Greeter/WideView.qml+16−1
@@ -144,12 +144,27 @@ FocusScope {
144 currentSession: LightDMService.users.data(selectedUserIndex, LightDMService.userRoles.SessionRole);
144 currentSession: LightDMService.users.data(selectedUserIndex, LightDMService.userRoles.SessionRole);
145 onResponded: root.responded(response)
145 onResponded: root.responded(response)
146 onSelected: {
146 onSelected: {
147− root.selected(index)
147+ if (LightDMService.users.mock) {
148+ LightDMService.users.mock.currentUsername = currentUser;
149+ }
150+
148 loginList.selectedUserIndex = index;
151 loginList.selectedUserIndex = index;
152+ root.selected(index)
153+ currentSession = LightDMService.users.data(index, LightDMService.userRoles.SessionRole);
149 }
154 }
150 onSessionChooserButtonClicked: parent.state = "SessionsList"
155 onSessionChooserButtonClicked: parent.state = "SessionsList"
151
156
152 Keys.forwardTo: [sessionChooserLoader.item]
157 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+ }
153 }
168 }
154
169
155 Loader {
170 Loader {
tests/qmltests/Greeter/tst_WideView.qml+18−2
@@ -409,7 +409,23 @@ StyledItem {
409 waitForRendering(view);
409 waitForRendering(view);
410 }
410 }
411
411
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+
412− function test_tease_data() {
428+ /*function test_tease_data() {
413 return [
429 return [
414 {tag: "locked", x: 0, offset: 0, count: 0, locked: true},
430 {tag: "locked", x: 0, offset: 0, count: 0, locked: true},
415 {tag: "left", x: 0, offset: 0, count: 1, locked: false},
431 {tag: "left", x: 0, offset: 0, count: 1, locked: false},
@@ -744,6 +760,6 @@ StyledItem {
744
760
745 view.showPrompt("", true, true);
761 view.showPrompt("", true, true);
746 verify(promptField.activeFocus);
762 verify(promptField.activeFocus);
747− }
763+ }*/
748 }
764 }
749}
765}