on xenial help sign in
fix qmltests
eefa025Michael Zanetti
qml/Components/Lockscreen.qml+2−7
@@ -82,7 +82,6 @@ Showable {
82
82
83 Timer {
83 Timer {
84 id: forcedDelayTimer
84 id: forcedDelayTimer
85− onTriggered: pinPadLoader.showWrongText = false
86 }
85 }
87
86
88 Rectangle {
87 Rectangle {
@@ -119,10 +118,6 @@ Showable {
119 property bool waiting: false
118 property bool waiting: false
120 property bool showWrongText: false
119 property bool showWrongText: false
121
120
122− readonly property string forcedDelayText: i18n.tr("Too many incorrect attempts") +
123− "\n" +
124− i18n.tr("Please wait")
125−
126 source: (!resetting && root.required) ? (root.alphaNumeric ? "PassphraseLockscreen.qml" : "PinLockscreen.qml") : ""
121 source: (!resetting && root.required) ? (root.alphaNumeric ? "PassphraseLockscreen.qml" : "PinLockscreen.qml") : ""
127 onSourceChanged: {
122 onSourceChanged: {
128 waiting = false
123 waiting = false
@@ -160,12 +155,12 @@ Showable {
160 Binding {
155 Binding {
161 target: pinPadLoader.item
156 target: pinPadLoader.item
162 property: "retryText"
157 property: "retryText"
163− value: root.retryText
158+ value: forcedDelayTimer.running ? i18n.tr("Please wait") : root.retryText
164 }
159 }
165 Binding {
160 Binding {
166 target: pinPadLoader.item
161 target: pinPadLoader.item
167 property: "errorText"
162 property: "errorText"
168− value: root.errorText
163+ value: forcedDelayTimer.running ? i18n.tr("Too many incorrect attempts") : root.errorText
169 }
164 }
170 Binding {
165 Binding {
171 target: pinPadLoader.item
166 target: pinPadLoader.item
qml/Components/PinLockscreen.qml+10−5
@@ -91,6 +91,11 @@ Column {
91 }
91 }
92
92
93 pinentryField.text = pinentryField.text + number
93 pinentryField.text = pinentryField.text + number
94+
95+ if (root.minPinLength > 0 && root.maxPinLength > 0
96+ && root.minPinLength == root.maxPinLength && pinentryField.text.length == root.minPinLength) {
97+ root.entered(pinentryField.text)
98+ }
94 }
99 }
95
100
96 function backspace() {
101 function backspace() {
@@ -157,9 +162,9 @@ Column {
157 text: index + 1
162 text: index + 1
158 height: numbersGrid.buttonHeight
163 height: numbersGrid.buttonHeight
159 width: numbersGrid.buttonWidth
164 width: numbersGrid.buttonWidth
160− enabled: root.maxPinLength == -1 ||
165+ enabled: root.entryEnabled && (root.maxPinLength == -1 ||
161 pinentryField.text.length < root.maxPinLength ||
166 pinentryField.text.length < root.maxPinLength ||
162− pinentryField.incorrectOverride
167+ pinentryField.incorrectOverride)
163
168
164 onClicked: {
169 onClicked: {
165 pinentryField.appendNumber(index + 1)
170 pinentryField.appendNumber(index + 1)
@@ -174,9 +179,9 @@ Column {
174 text: "0"
179 text: "0"
175 height: numbersGrid.buttonHeight
180 height: numbersGrid.buttonHeight
176 width: numbersGrid.buttonWidth
181 width: numbersGrid.buttonWidth
177− enabled: root.maxPinLength == -1 ||
182+ enabled: root.entryEnabled && (root.maxPinLength == -1 ||
178 pinentryField.text.length < root.maxPinLength ||
183 pinentryField.text.length < root.maxPinLength ||
179− pinentryField.incorrectOverride
184+ pinentryField.incorrectOverride)
180
185
181 onClicked: {
186 onClicked: {
182 pinentryField.appendNumber(0)
187 pinentryField.appendNumber(0)
@@ -202,7 +207,7 @@ Column {
202 objectName: "confirmButton"
207 objectName: "confirmButton"
203 height: numbersGrid.buttonHeight
208 height: numbersGrid.buttonHeight
204 width: numbersGrid.buttonWidth
209 width: numbersGrid.buttonWidth
205− enabled: pinentryField.text.length >= root.minPinLength
210+ enabled: root.enabled && pinentryField.text.length >= root.minPinLength
206
211
207 onClicked: root.entered(pinentryField.text)
212 onClicked: root.entered(pinentryField.text)
208 }
213 }
qml/Shell.qml+2
@@ -289,6 +289,7 @@ Item {
289 // prompted for a password. We do this below after the promptless
289 // prompted for a password. We do this below after the promptless
290 // early exit.
290 // early exit.
291
291
292+ print("huppppa")
292 if (LightDM.Greeter.promptless) {
293 if (LightDM.Greeter.promptless) {
293 return;
294 return;
294 }
295 }
@@ -298,6 +299,7 @@ Item {
298 greeter.login();
299 greeter.login();
299 } else {
300 } else {
300 AccountsService.failedLogins++
301 AccountsService.failedLogins++
302+ print("auth failed. failed logins", AccountsService.failedLogins, "max", maxFailedLogins)
301 if (maxFailedLogins >= 2) { // require at least a warning
303 if (maxFailedLogins >= 2) { // require at least a warning
302 if (AccountsService.failedLogins === maxFailedLogins - 1) {
304 if (AccountsService.failedLogins === maxFailedLogins - 1) {
303 var title = lockscreen.alphaNumeric ?
305 var title = lockscreen.alphaNumeric ?
tests/qmltests/tst_ShellWithPin.qml+26−11
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import Ubuntu.Components 1.0
18import QtTest 1.0
19import QtTest 1.0
19import AccountsService 0.1
20import AccountsService 0.1
20import GSettings 1.0
21import GSettings 1.0
@@ -28,7 +29,7 @@ import "../../qml"
28
29
29Item {
30Item {
30 id: root
31 id: root
31− width: shell.width
32+ width: shell.width + units.gu(20)
32 height: shell.height
33 height: shell.height
33
34
34 QtObject {
35 QtObject {
@@ -49,6 +50,20 @@ Item {
49
50
50 Shell {
51 Shell {
51 id: shell
52 id: shell
53+ maxFailedLogins: maxRetriesTextField.text
54+ }
55+ Column {
56+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom; margins:units.gu(1) }
57+ width: units.gu(18)
58+
59+ Label {
60+ text: "Max retries:"
61+ color: "black"
62+ }
63+ TextField {
64+ id: maxRetriesTextField
65+ text: "-1"
66+ }
52 }
67 }
53
68
54 SignalSpy {
69 SignalSpy {
@@ -74,7 +89,7 @@ Item {
74 function init() {
89 function init() {
75 swipeAwayGreeter()
90 swipeAwayGreeter()
76 shell.failedLoginsDelayAttempts = -1
91 shell.failedLoginsDelayAttempts = -1
77− shell.maxFailedLogins = -1
92+ maxRetriesTextField.text = "-1"
78 }
93 }
79
94
80 function cleanup() {
95 function cleanup() {
@@ -139,7 +154,7 @@ Item {
139 function test_emergencyCall() {
154 function test_emergencyCall() {
140 var greeter = findChild(shell, "greeter")
155 var greeter = findChild(shell, "greeter")
141 var lockscreen = findChild(shell, "lockscreen")
156 var lockscreen = findChild(shell, "lockscreen")
142− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
157+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
143 var panel = findChild(shell, "panel")
158 var panel = findChild(shell, "panel")
144 var indicators = findChild(shell, "indicators")
159 var indicators = findChild(shell, "indicators")
145 var launcher = findChild(shell, "launcher")
160 var launcher = findChild(shell, "launcher")
@@ -170,7 +185,7 @@ Item {
170
185
171 function test_emergencyCallCrash() {
186 function test_emergencyCallCrash() {
172 var lockscreen = findChild(shell, "lockscreen")
187 var lockscreen = findChild(shell, "lockscreen")
173− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
188+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
174 mouseClick(emergencyButton, units.gu(1), units.gu(1))
189 mouseClick(emergencyButton, units.gu(1), units.gu(1))
175
190
176 tryCompare(lockscreen, "shown", false)
191 tryCompare(lockscreen, "shown", false)
@@ -180,7 +195,7 @@ Item {
180
195
181 function test_emergencyCallAppLaunch() {
196 function test_emergencyCallAppLaunch() {
182 var lockscreen = findChild(shell, "lockscreen")
197 var lockscreen = findChild(shell, "lockscreen")
183− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
198+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
184 mouseClick(emergencyButton, units.gu(1), units.gu(1))
199 mouseClick(emergencyButton, units.gu(1), units.gu(1))
185
200
186 tryCompare(lockscreen, "shown", false)
201 tryCompare(lockscreen, "shown", false)
@@ -201,21 +216,21 @@ Item {
201 function test_wrongEntries() {
216 function test_wrongEntries() {
202 shell.failedLoginsDelayAttempts = 3
217 shell.failedLoginsDelayAttempts = 3
203
218
204− var placeHolder = findChild(shell, "pinentryFieldPlaceHolder")
219+ var placeHolder = findChild(shell, "wrongNoticeLabel")
205− tryCompare(placeHolder, "text", "Enter your passcode")
220+ tryCompare(placeHolder, "text", "Incorrect passcode")
206
221
207 enterPin("1111")
222 enterPin("1111")
208− tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
223+ tryCompare(placeHolder, "text", "Incorrect passcode")
209
224
210 enterPin("1111")
225 enterPin("1111")
211− tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
226+ tryCompare(placeHolder, "text", "Incorrect passcode")
212
227
213 enterPin("1111")
228 enterPin("1111")
214− tryCompare(placeHolder, "text", "Too many incorrect attempts\nPlease wait")
229+ tryCompare(placeHolder, "text", "Too many incorrect attempts")
215 }
230 }
216
231
217 function test_factoryReset() {
232 function test_factoryReset() {
218− shell.maxFailedLogins = 3
233+ maxRetriesTextField.text = "3"
219 resetSpy.clear()
234 resetSpy.clear()
220
235
221 enterPin("1111")
236 enterPin("1111")