on xenial help sign in
Fix qml tests
9c4144cMichael Terry
qml/Components/PinLockscreen.qml+1−1
@@ -227,7 +227,7 @@ Column {
227 root.entered(pinentryField.text);
227 root.entered(pinentryField.text);
228 }
228 }
229 }
229 }
230− enabled: entryEnabled
230+ enabled: priv.autoConfirm ? entryEnabled : pinentryField.text.length >= root.minPinLength
231 }
231 }
232 }
232 }
233 }
233 }
qml/Shell.qml+1
@@ -19,6 +19,7 @@ import AccountsService 0.1
19import GSettings 1.0
19import GSettings 1.0
20import Unity.Application 0.1
20import Unity.Application 0.1
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22+import Ubuntu.Components.Popups 1.0
22import Ubuntu.Gestures 0.1
23import Ubuntu.Gestures 0.1
23import Ubuntu.SystemImage 0.1
24import Ubuntu.SystemImage 0.1
24import Unity.Launcher 0.1
25import Unity.Launcher 0.1
tests/qmltests/Greeter/tst_Lockscreen.qml−2
@@ -319,11 +319,9 @@ Rectangle {
319 if (data.animation) {
319 if (data.animation) {
320 if (data.alphanumeric) {
320 if (data.alphanumeric) {
321 tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
321 tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
322− tryCompare(inputField, "placeholderText", lockscreen.placeholderText)
323 } else {
322 } else {
324 var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
323 var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
325 tryCompare(label, "text", lockscreen.wrongPlaceholderText)
324 tryCompare(label, "text", lockscreen.wrongPlaceholderText)
326− tryCompare(label, "text", lockscreen.placeholderText)
327 }
325 }
328 }
326 }
329
327
tests/qmltests/tst_ShellWithPin.qml+20−1
@@ -108,6 +108,8 @@ Item {
108
108
109 function init() {
109 function init() {
110 swipeAwayGreeter()
110 swipeAwayGreeter()
111+ shell.failedLoginsDelayAttempts = -1
112+ shell.maxFailedLogins = -1
111 }
113 }
112
114
113 function cleanup() {
115 function cleanup() {
@@ -154,6 +156,7 @@ Item {
154 }
156 }
155
157
156 function test_login() {
158 function test_login() {
159+ sessionSpy.clear()
157 tryCompare(sessionSpy, "count", 0)
160 tryCompare(sessionSpy, "count", 0)
158 enterPin("1234")
161 enterPin("1234")
159 tryCompare(sessionSpy, "count", 1)
162 tryCompare(sessionSpy, "count", 1)
@@ -220,11 +223,27 @@ Item {
220 tryCompare(AccountsService, "failedLogins", 0)
223 tryCompare(AccountsService, "failedLogins", 0)
221 }
224 }
222
225
226+ function test_wrongEntries() {
227+ shell.failedLoginsDelayAttempts = 3
228+
229+ var placeHolder = findChild(shell, "pinentryFieldPlaceHolder")
230+ tryCompare(placeHolder, "text", "Enter your passcode")
231+
232+ enterPin("1111")
233+ tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
234+
235+ enterPin("1111")
236+ tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
237+
238+ enterPin("1111")
239+ tryCompare(placeHolder, "text", "Too many incorrect attempts\nPlease wait")
240+ }
241+
223 function test_factoryReset() {
242 function test_factoryReset() {
243+ shell.maxFailedLogins = 3
224 resetSpy.clear()
244 resetSpy.clear()
225
245
226 enterPin("1111")
246 enterPin("1111")
227−
228 enterPin("1111")
247 enterPin("1111")
229 tryCompareFunction(function() {return findChild(root, "factoryResetWarningDialog") !== null}, true)
248 tryCompareFunction(function() {return findChild(root, "factoryResetWarningDialog") !== null}, true)
230
249