on xenial help sign in
More nits
commit93bc7e13082b3fc923829b996c904528e15e56c1 authorMichael Terry <michael.terry@canonical.com> dateTue 17 Feb 2015, 11:38 (12 years ago) parent015ad2d
7 files changed+58−38
qml/Greeter/Greeter.qml+8−8 qml/Greeter/NarrowView.qml+6−6 qml/Greeter/WideView.qml+6−4 tests/qmltests/Greeter/TestView.qml+8−3 tests/qmltests/Greeter/tst_Greeter.qml+16−15 tests/qmltests/Greeter/tst_NarrowView.qml+7−1 tests/qmltests/Greeter/tst_WideView.qml+7−1
qml/Greeter/Greeter.qml+8−8
@@ -72,10 +72,10 @@ Showable {
7272 hide(); // show locked app
7373 } else {
7474 show();
75− d.startUnlock(false);
75+ d.startUnlock(false /* toTheRight */);
7676 }
7777 } else if (appId !== "unity8-dash") { // dash isn't started by user
78− d.startUnlock(false);
78+ d.startUnlock(false /* toTheRight */);
7979 }
8080 }
8181
@@ -88,7 +88,7 @@ Showable {
8888 // a little more responsive, rather than waiting for the above
8989 // notifyAppFocused call. We also need this in case we have a locked
9090 // app, in order to show lockscreen instead of new app.
91− d.startUnlock(false);
91+ d.startUnlock(false /* toTheRight */);
9292 }
9393
9494 function notifyShowingDashFromDrag() {
@@ -99,7 +99,7 @@ Showable {
9999 // This is a just a glorified notifyAboutToFocusApp(), but it does one
100100 // other thing: it hides any cover pages to the RIGHT, because the user
101101 // just came from a launcher drag starting on the left.
102− d.startUnlock(true);
102+ d.startUnlock(true /* toTheRight */);
103103 }
104104
105105 QtObject {
@@ -140,9 +140,9 @@ Showable {
140140 enabled = false;
141141 if (LightDM.Greeter.startSessionSync()) {
142142 sessionStarted();
143− loader.item.authenticated(true);
143+ loader.item.notifyAuthenticationSucceeded();
144144 } else {
145− loader.item.authenticated(false);
145+ loader.item.notifyAuthenticationFailed();
146146 }
147147 enabled = true;
148148 }
@@ -163,7 +163,7 @@ Showable {
163163 onForcedUnlockChanged: {
164164 if (forcedUnlock && shown) {
165165 // pretend we were just authenticated
166− loader.item.authenticated(true);
166+ loader.item.notifyAuthenticationSucceeded();
167167 }
168168 }
169169
@@ -363,7 +363,7 @@ Showable {
363363 forcedDelayTimer.start();
364364 }
365365
366− loader.item.authenticated(false);
366+ loader.item.notifyAuthenticationFailed();
367367 if (!LightDM.Greeter.promptless) {
368368 d.selectUser(d.currentIndex, false);
369369 }
qml/Greeter/NarrowView.qml+6−6
@@ -64,12 +64,12 @@ FocusScope {
6464 coverPage.hide();
6565 }
6666
67− function authenticated(success) {
68− if (success) {
69− lockscreen.hide();
70− } else {
71− lockscreen.clear(true);
72− }
67+ function notifyAuthenticationSucceeded() {
68+ lockscreen.hide();
69+ }
70+
71+ function notifyAuthenticationFailed() {
72+ lockscreen.clear(true);
7373 }
7474
7575 function reset() {
qml/Greeter/WideView.qml+6−4
@@ -57,10 +57,12 @@ FocusScope {
5757 coverPage.hide();
5858 }
5959
60− function authenticated(success) {
61− if (!success) {
62− loginList.showError();
63− }
60+ function notifyAuthenticationSucceeded() {
61+ // Nothing needed
62+ }
63+
64+ function notifyAuthenticationFailed() {
65+ loginList.showError();
6466 }
6567
6668 function reset() {
tests/qmltests/Greeter/TestView.qml+8−3
@@ -46,7 +46,8 @@ Item {
4646 signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt)
4747 signal _showLastChanceCalled()
4848 signal _hideCalled()
49− signal _authenticatedCalled(bool success)
49+ signal _notifyAuthenticationSucceededCalled()
50+ signal _notifyAuthenticationFailedCalled()
5051 signal _resetCalled()
5152 signal _tryToUnlockCalled(bool toTheRight)
5253
@@ -68,8 +69,12 @@ Item {
6869 _fullyShown = false;
6970 }
7071
71− function authenticated(success) {
72− _authenticatedCalled(success);
72+ function notifyAuthenticationSucceeded() {
73+ _notifyAuthenticationSucceededCalled();
74+ }
75+
76+ function notifyAuthenticationFailed() {
77+ _notifyAuthenticationFailedCalled();
7378 }
7479
7580 function reset() {
tests/qmltests/Greeter/tst_Greeter.qml+16−15
@@ -108,9 +108,15 @@ Item {
108108 }
109109
110110 SignalSpy {
111− id: viewAuthenticatedSpy
111+ id: viewAuthenticationSucceededSpy
112112 target: testCase.view
113− signalName: "_authenticatedCalled"
113+ signalName: "_notifyAuthenticationSucceededCalled"
114+ }
115+
116+ SignalSpy {
117+ id: viewAuthenticationFailedSpy
118+ target: testCase.view
119+ signalName: "_notifyAuthenticationFailedCalled"
114120 }
115121
116122 SignalSpy {
@@ -133,7 +139,8 @@ Item {
133139 viewShowPromptSpy.clear();
134140 viewShowLastChanceSpy.clear();
135141 viewHideSpy.clear();
136− viewAuthenticatedSpy.clear();
142+ viewAuthenticationSucceededSpy.clear();
143+ viewAuthenticationFailedSpy.clear();
137144 viewResetSpy.clear();
138145 viewTryToUnlockSpy.clear();
139146 tryCompare(greeter, "waiting", false);
@@ -178,8 +185,7 @@ Item {
178185
179186 function verifyLoggedIn() {
180187 tryCompare(sessionStartedSpy, "count", 1);
181− verify(viewAuthenticatedSpy.count > 0);
182− compare(viewAuthenticatedSpy.signalArguments[viewAuthenticatedSpy.count - 1][0], true);
188+ verify(viewAuthenticationSucceededSpy.count > 0);
183189 compare(LightDM.Greeter.authenticated, true);
184190 compare(greeter.shown, false);
185191 }
@@ -203,8 +209,7 @@ Item {
203209 compare(viewShowPromptSpy.signalArguments[0][2], true);
204210
205211 view.responded("wr0ng p4ssw0rd");
206− tryCompare(viewAuthenticatedSpy, "count", 1);
207− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
212+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
208213
209214 tryCompare(viewShowPromptSpy, "count", 2);
210215 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -214,8 +219,7 @@ Item {
214219
215220 function test_promptless() {
216221 selectUser("no-password");
217− tryCompare(viewAuthenticatedSpy, "count", 1);
218− compare(viewAuthenticatedSpy.signalArguments[0][0], true);
222+ tryCompare(viewAuthenticationSucceededSpy, "count", 1);
219223 compare(sessionStartedSpy.count, 1);
220224 compare(viewShowPromptSpy.count, 0);
221225 compare(viewHideSpy.count, 0);
@@ -247,8 +251,7 @@ Item {
247251 compare(viewShowPromptSpy.signalArguments[0][2], true);
248252
249253 view.responded("wr0ng p4ssw0rd");
250− tryCompare(viewAuthenticatedSpy, "count", 1);
251− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
254+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
252255
253256 tryCompare(viewShowPromptSpy, "count", 2);
254257 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -270,8 +273,7 @@ Item {
270273 compare(viewShowPromptSpy.signalArguments[1][2], false);
271274
272275 view.responded("wr0ng p4ssw0rd");
273− tryCompare(viewAuthenticatedSpy, "count", 1);
274− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
276+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
275277
276278 tryCompare(viewShowPromptSpy, "count", 3);
277279 compare(viewShowPromptSpy.signalArguments[0][0], "Password");
@@ -400,8 +402,7 @@ Item {
400402
401403 function test_authError() {
402404 selectUser("auth-error");
403− tryCompare(viewAuthenticatedSpy, "count", 1);
404− compare(viewAuthenticatedSpy.signalArguments[0][0], false);
405+ tryCompare(viewAuthenticationFailedSpy, "count", 1);
405406 compare(viewShowPromptSpy.count, 0);
406407 compare(view.locked, true);
407408 }
tests/qmltests/Greeter/tst_NarrowView.qml+7−1
@@ -124,7 +124,13 @@ Item {
124124 Row {
125125 Button {
126126 text: "Authenticated"
127− onClicked: loader.item.authenticated(successCheckBox.checked)
127+ onClicked: {
128+ if (successCheckBox.checked) {
129+ loader.item.notifyAuthenticationSucceeded();
130+ } else {
131+ loader.item.notifyAuthenticationFailed();
132+ }
133+ }
128134 }
129135 CheckBox {
130136 id: successCheckBox
tests/qmltests/Greeter/tst_WideView.qml+7−1
@@ -166,7 +166,13 @@ Item {
166166 Row {
167167 Button {
168168 text: "Authenticated"
169− onClicked: loader.item.authenticated(successCheckBox.checked)
169+ onClicked: {
170+ if (successCheckBox.checked) {
171+ loader.item.notifyAuthenticationSucceeded();
172+ } else {
173+ loader.item.notifyAuthenticationFailed();
174+ }
175+ }
170176 }
171177 CheckBox {
172178 id: successCheckBox