on xenial help sign in
Fix qml tests
commit9c4144c2fba3d48d497c250d00622f977c6b15cf authorMichael Terry <michael.terry@canonical.com> dateFri 1 Aug 2014, 11:38 (12 years ago) parent482b6d2
4 files changed+22−4
qml/Components/PinLockscreen.qml+1−1 qml/Shell.qml+1 tests/qmltests/Greeter/tst_Lockscreen.qml−2 tests/qmltests/tst_ShellWithPin.qml+20−1
qml/Components/PinLockscreen.qml+1−1
@@ -227,7 +227,7 @@ Column {
227227 root.entered(pinentryField.text);
228228 }
229229 }
230− enabled: entryEnabled
230+ enabled: priv.autoConfirm ? entryEnabled : pinentryField.text.length >= root.minPinLength
231231 }
232232 }
233233 }
qml/Shell.qml+1
@@ -19,6 +19,7 @@ import AccountsService 0.1
1919import GSettings 1.0
2020import Unity.Application 0.1
2121import Ubuntu.Components 0.1
22+import Ubuntu.Components.Popups 1.0
2223import Ubuntu.Gestures 0.1
2324import Ubuntu.SystemImage 0.1
2425import Unity.Launcher 0.1
tests/qmltests/Greeter/tst_Lockscreen.qml−2
@@ -319,11 +319,9 @@ Rectangle {
319319 if (data.animation) {
320320 if (data.alphanumeric) {
321321 tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
322− tryCompare(inputField, "placeholderText", lockscreen.placeholderText)
323322 } else {
324323 var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
325324 tryCompare(label, "text", lockscreen.wrongPlaceholderText)
326− tryCompare(label, "text", lockscreen.placeholderText)
327325 }
328326 }
329327
tests/qmltests/tst_ShellWithPin.qml+20−1
@@ -108,6 +108,8 @@ Item {
108108
109109 function init() {
110110 swipeAwayGreeter()
111+ shell.failedLoginsDelayAttempts = -1
112+ shell.maxFailedLogins = -1
111113 }
112114
113115 function cleanup() {
@@ -154,6 +156,7 @@ Item {
154156 }
155157
156158 function test_login() {
159+ sessionSpy.clear()
157160 tryCompare(sessionSpy, "count", 0)
158161 enterPin("1234")
159162 tryCompare(sessionSpy, "count", 1)
@@ -220,11 +223,27 @@ Item {
220223 tryCompare(AccountsService, "failedLogins", 0)
221224 }
222225
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+
223242 function test_factoryReset() {
243+ shell.maxFailedLogins = 3
224244 resetSpy.clear()
225245
226246 enterPin("1111")
227−
228247 enterPin("1111")
229248 tryCompareFunction(function() {return findChild(root, "factoryResetWarningDialog") !== null}, true)
230249