on xenial help sign in
More nits
93bc7e1Michael Terry
qml/Greeter/Greeter.qml+8−8
@@ -72,10 +72,10 @@ Showable {
72 hide(); // show locked app
72 hide(); // show locked app
73 } else {
73 } else {
74 show();
74 show();
75− d.startUnlock(false);
75+ d.startUnlock(false /* toTheRight */);
76 }
76 }
77 } else if (appId !== "unity8-dash") { // dash isn't started by user
77 } else if (appId !== "unity8-dash") { // dash isn't started by user
78− d.startUnlock(false);
78+ d.startUnlock(false /* toTheRight */);
79 }
79 }
80 }
80 }
81
81
@@ -88,7 +88,7 @@ Showable {
88 // a little more responsive, rather than waiting for the above
88 // a little more responsive, rather than waiting for the above
89 // notifyAppFocused call. We also need this in case we have a locked
89 // notifyAppFocused call. We also need this in case we have a locked
90 // app, in order to show lockscreen instead of new app.
90 // app, in order to show lockscreen instead of new app.
91− d.startUnlock(false);
91+ d.startUnlock(false /* toTheRight */);
92 }
92 }
93
93
94 function notifyShowingDashFromDrag() {
94 function notifyShowingDashFromDrag() {
@@ -99,7 +99,7 @@ Showable {
99 // This is a just a glorified notifyAboutToFocusApp(), but it does one
99 // This is a just a glorified notifyAboutToFocusApp(), but it does one
100 // other thing: it hides any cover pages to the RIGHT, because the user
100 // other thing: it hides any cover pages to the RIGHT, because the user
101 // just came from a launcher drag starting on the left.
101 // just came from a launcher drag starting on the left.
102− d.startUnlock(true);
102+ d.startUnlock(true /* toTheRight */);
103 }
103 }
104
104
105 QtObject {
105 QtObject {
@@ -140,9 +140,9 @@ Showable {
140 enabled = false;
140 enabled = false;
141 if (LightDM.Greeter.startSessionSync()) {
141 if (LightDM.Greeter.startSessionSync()) {
142 sessionStarted();
142 sessionStarted();
143− loader.item.authenticated(true);
143+ loader.item.notifyAuthenticationSucceeded();
144 } else {
144 } else {
145− loader.item.authenticated(false);
145+ loader.item.notifyAuthenticationFailed();
146 }
146 }
147 enabled = true;
147 enabled = true;
148 }
148 }
@@ -163,7 +163,7 @@ Showable {
163 onForcedUnlockChanged: {
163 onForcedUnlockChanged: {
164 if (forcedUnlock && shown) {
164 if (forcedUnlock && shown) {
165 // pretend we were just authenticated
165 // pretend we were just authenticated
166− loader.item.authenticated(true);
166+ loader.item.notifyAuthenticationSucceeded();
167 }
167 }
168 }
168 }
169
169
@@ -363,7 +363,7 @@ Showable {
363 forcedDelayTimer.start();
363 forcedDelayTimer.start();
364 }
364 }
365
365
366− loader.item.authenticated(false);
366+ loader.item.notifyAuthenticationFailed();
367 if (!LightDM.Greeter.promptless) {
367 if (!LightDM.Greeter.promptless) {
368 d.selectUser(d.currentIndex, false);
368 d.selectUser(d.currentIndex, false);
369 }
369 }
qml/Greeter/NarrowView.qml+6−6
@@ -64,12 +64,12 @@ FocusScope {
64 coverPage.hide();
64 coverPage.hide();
65 }
65 }
66
66
67− function authenticated(success) {
67+ function notifyAuthenticationSucceeded() {
68− if (success) {
69− lockscreen.hide();
68+ lockscreen.hide();
70− } else {
69+ }
70+
71+ function notifyAuthenticationFailed() {
71− lockscreen.clear(true);
72+ lockscreen.clear(true);
72− }
73 }
73 }
74
74
75 function reset() {
75 function reset() {
qml/Greeter/WideView.qml+6−4
@@ -57,10 +57,12 @@ FocusScope {
57 coverPage.hide();
57 coverPage.hide();
58 }
58 }
59
59
60− function authenticated(success) {
60+ function notifyAuthenticationSucceeded() {
61− if (!success) {
61+ // Nothing needed
62+ }
63+
64+ function notifyAuthenticationFailed() {
62− loginList.showError();
65+ loginList.showError();
63− }
64 }
66 }
65
67
66 function reset() {
68 function reset() {
tests/qmltests/Greeter/TestView.qml+8−3
@@ -46,7 +46,8 @@ Item {
46 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
46 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
47 signal _showLastChanceCalled()
47 signal _showLastChanceCalled()
48 signal _hideCalled()
48 signal _hideCalled()
49− signal _authenticatedCalled(bool success)
49+ signal _notifyAuthenticationSucceededCalled()
50+ signal _notifyAuthenticationFailedCalled()
50 signal _resetCalled()
51 signal _resetCalled()
51 signal _tryToUnlockCalled(bool toTheRight)
52 signal _tryToUnlockCalled(bool toTheRight)
52
53
@@ -68,8 +69,12 @@ Item {
68 _fullyShown = false;
69 _fullyShown = false;
69 }
70 }
70
71
71− function authenticated(success) {
72+ function notifyAuthenticationSucceeded() {
72− _authenticatedCalled(success);
73+ _notifyAuthenticationSucceededCalled();
74+ }
75+
76+ function notifyAuthenticationFailed() {
77+ _notifyAuthenticationFailedCalled();
73 }
78 }
74
79
75 function reset() {
80 function reset() {
tests/qmltests/Greeter/tst_Greeter.qml+16−15
@@ -108,9 +108,15 @@ Item {
108 }
108 }
109
109
110 SignalSpy {
110 SignalSpy {
111− id: viewAuthenticatedSpy
111+ id: viewAuthenticationSucceededSpy
112 target: testCase.view
112 target: testCase.view
113− signalName: "_authenticatedCalled"
113+ signalName: "_notifyAuthenticationSucceededCalled"
114+ }
115+
116+ SignalSpy {
117+ id: viewAuthenticationFailedSpy
118+ target: testCase.view
119+ signalName: "_notifyAuthenticationFailedCalled"
114 }
120 }
115
121
116 SignalSpy {
122 SignalSpy {
@@ -133,7 +139,8 @@ Item {
133 viewShowPromptSpy.clear();
139 viewShowPromptSpy.clear();
134 viewShowLastChanceSpy.clear();
140 viewShowLastChanceSpy.clear();
135 viewHideSpy.clear();
141 viewHideSpy.clear();
136− viewAuthenticatedSpy.clear();
142+ viewAuthenticationSucceededSpy.clear();
143+ viewAuthenticationFailedSpy.clear();
137 viewResetSpy.clear();
144 viewResetSpy.clear();
138 viewTryToUnlockSpy.clear();
145 viewTryToUnlockSpy.clear();
139 tryCompare(greeter, "waiting", false);
146 tryCompare(greeter, "waiting", false);
@@ -178,8 +185,7 @@ Item {
178
185
179 function verifyLoggedIn() {
186 function verifyLoggedIn() {
180 tryCompare(sessionStartedSpy, "count", 1);
187 tryCompare(sessionStartedSpy, "count", 1);
181− verify(viewAuthenticatedSpy.count > 0);
188+ verify(viewAuthenticationSucceededSpy.count > 0);
182− compare(viewAuthenticatedSpy.signalArguments[viewAuthenticatedSpy.count - 1][0], true);
183 compare(LightDM.Greeter.authenticated, true);
189 compare(LightDM.Greeter.authenticated, true);
184 compare(greeter.shown, false);
190 compare(greeter.shown, false);
185 }
191 }
@@ -203,8 +209,7 @@ Item {
203 compare(viewShowPromptSpy.signalArguments[0][2], true);
209 compare(viewShowPromptSpy.signalArguments[0][2], true);
204
210
205 view.responded("wr0ng p4ssw0rd");
211 view.responded("wr0ng p4ssw0rd");
206− tryCompare(viewAuthenticatedSpy, "count", 1);
212+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
207− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
208
213
209 tryCompare(viewShowPromptSpy, "count", 2);
214 tryCompare(viewShowPromptSpy, "count", 2);
210 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
215 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -214,8 +219,7 @@ Item {
214
219
215 function test_promptless() {
220 function test_promptless() {
216 selectUser("no-password");
221 selectUser("no-password");
217− tryCompare(viewAuthenticatedSpy, "count", 1);
222+ tryCompare(viewAuthenticationSucceededSpy, "count", 1);
218− compare(viewAuthenticatedSpy.signalArguments[0][0], true);
219 compare(sessionStartedSpy.count, 1);
223 compare(sessionStartedSpy.count, 1);
220 compare(viewShowPromptSpy.count, 0);
224 compare(viewShowPromptSpy.count, 0);
221 compare(viewHideSpy.count, 0);
225 compare(viewHideSpy.count, 0);
@@ -247,8 +251,7 @@ Item {
247 compare(viewShowPromptSpy.signalArguments[0][2], true);
251 compare(viewShowPromptSpy.signalArguments[0][2], true);
248
252
249 view.responded("wr0ng p4ssw0rd");
253 view.responded("wr0ng p4ssw0rd");
250− tryCompare(viewAuthenticatedSpy, "count", 1);
254+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
251− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
252
255
253 tryCompare(viewShowPromptSpy, "count", 2);
256 tryCompare(viewShowPromptSpy, "count", 2);
254 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
257 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -270,8 +273,7 @@ Item {
270 compare(viewShowPromptSpy.signalArguments[1][2], false);
273 compare(viewShowPromptSpy.signalArguments[1][2], false);
271
274
272 view.responded("wr0ng p4ssw0rd");
275 view.responded("wr0ng p4ssw0rd");
273− tryCompare(viewAuthenticatedSpy, "count", 1);
276+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
274− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
275
277
276 tryCompare(viewShowPromptSpy, "count", 3);
278 tryCompare(viewShowPromptSpy, "count", 3);
277 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
279 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -400,8 +402,7 @@ Item {
400
402
401 function test_authError() {
403 function test_authError() {
402 selectUser("auth-error");
404 selectUser("auth-error");
403− tryCompare(viewAuthenticatedSpy, "count", 1);
405+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
404− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
405 compare(viewShowPromptSpy.count, 0);
406 compare(viewShowPromptSpy.count, 0);
406 compare(view.locked, true);
407 compare(view.locked, true);
407 }
408 }
tests/qmltests/Greeter/tst_NarrowView.qml+7−1
@@ -124,7 +124,13 @@ Item {
124 Row {
124 Row {
125 Button {
125 Button {
126 text: "Authenticated"
126 text: "Authenticated"
127+ onClicked: {
127− onClicked: loader.item.authenticated(successCheckBox.checked)
128+ if (successCheckBox.checked) {
129+ loader.item.notifyAuthenticationSucceeded();
130+ } else {
131+ loader.item.notifyAuthenticationFailed();
132+ }
133+ }
128 }
134 }
129 CheckBox {
135 CheckBox {
130 id: successCheckBox
136 id: successCheckBox
tests/qmltests/Greeter/tst_WideView.qml+7−1
@@ -166,7 +166,13 @@ Item {
166 Row {
166 Row {
167 Button {
167 Button {
168 text: "Authenticated"
168 text: "Authenticated"
169+ onClicked: {
169− onClicked: loader.item.authenticated(successCheckBox.checked)
170+ if (successCheckBox.checked) {
171+ loader.item.notifyAuthenticationSucceeded();
172+ } else {
173+ loader.item.notifyAuthenticationFailed();
174+ }
175+ }
170 }
176 }
171 CheckBox {
177 CheckBox {
172 id: successCheckBox
178 id: successCheckBox