on xenial help sign in
fix qmltests
commiteefa025d0a46c8aa5bafcdf7ad108c15da3e3f67 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 18 Aug 2014, 12:51 (12 years ago) parent03049a3
4 files changed+40−23
qml/Components/Lockscreen.qml+2−7 qml/Components/PinLockscreen.qml+10−5 qml/Shell.qml+2 tests/qmltests/tst_ShellWithPin.qml+26−11
qml/Components/Lockscreen.qml+2−7
@@ -82,7 +82,6 @@ Showable {
8282
8383 Timer {
8484 id: forcedDelayTimer
85− onTriggered: pinPadLoader.showWrongText = false
8685 }
8786
8887 Rectangle {
@@ -119,10 +118,6 @@ Showable {
119118 property bool waiting: false
120119 property bool showWrongText: false
121120
122− readonly property string forcedDelayText: i18n.tr("Too many incorrect attempts") +
123− "\n" +
124− i18n.tr("Please wait")
125−
126121 source: (!resetting && root.required) ? (root.alphaNumeric ? "PassphraseLockscreen.qml" : "PinLockscreen.qml") : ""
127122 onSourceChanged: {
128123 waiting = false
@@ -160,12 +155,12 @@ Showable {
160155 Binding {
161156 target: pinPadLoader.item
162157 property: "retryText"
163− value: root.retryText
158+ value: forcedDelayTimer.running ? i18n.tr("Please wait") : root.retryText
164159 }
165160 Binding {
166161 target: pinPadLoader.item
167162 property: "errorText"
168− value: root.errorText
163+ value: forcedDelayTimer.running ? i18n.tr("Too many incorrect attempts") : root.errorText
169164 }
170165 Binding {
171166 target: pinPadLoader.item
qml/Components/PinLockscreen.qml+10−5
@@ -91,6 +91,11 @@ Column {
9191 }
9292
9393 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+ }
9499 }
95100
96101 function backspace() {
@@ -157,9 +162,9 @@ Column {
157162 text: index + 1
158163 height: numbersGrid.buttonHeight
159164 width: numbersGrid.buttonWidth
160− enabled: root.maxPinLength == -1 ||
165+ enabled: root.entryEnabled && (root.maxPinLength == -1 ||
161166 pinentryField.text.length < root.maxPinLength ||
162− pinentryField.incorrectOverride
167+ pinentryField.incorrectOverride)
163168
164169 onClicked: {
165170 pinentryField.appendNumber(index + 1)
@@ -174,9 +179,9 @@ Column {
174179 text: "0"
175180 height: numbersGrid.buttonHeight
176181 width: numbersGrid.buttonWidth
177− enabled: root.maxPinLength == -1 ||
182+ enabled: root.entryEnabled && (root.maxPinLength == -1 ||
178183 pinentryField.text.length < root.maxPinLength ||
179− pinentryField.incorrectOverride
184+ pinentryField.incorrectOverride)
180185
181186 onClicked: {
182187 pinentryField.appendNumber(0)
@@ -202,7 +207,7 @@ Column {
202207 objectName: "confirmButton"
203208 height: numbersGrid.buttonHeight
204209 width: numbersGrid.buttonWidth
205− enabled: pinentryField.text.length >= root.minPinLength
210+ enabled: root.enabled && pinentryField.text.length >= root.minPinLength
206211
207212 onClicked: root.entered(pinentryField.text)
208213 }
qml/Shell.qml+2
@@ -289,6 +289,7 @@ Item {
289289 // prompted for a password. We do this below after the promptless
290290 // early exit.
291291
292+ print("huppppa")
292293 if (LightDM.Greeter.promptless) {
293294 return;
294295 }
@@ -298,6 +299,7 @@ Item {
298299 greeter.login();
299300 } else {
300301 AccountsService.failedLogins++
302+ print("auth failed. failed logins", AccountsService.failedLogins, "max", maxFailedLogins)
301303 if (maxFailedLogins >= 2) { // require at least a warning
302304 if (AccountsService.failedLogins === maxFailedLogins - 1) {
303305 var title = lockscreen.alphaNumeric ?
tests/qmltests/tst_ShellWithPin.qml+26−11
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import Ubuntu.Components 1.0
1819import QtTest 1.0
1920import AccountsService 0.1
2021import GSettings 1.0
@@ -28,7 +29,7 @@ import "../../qml"
2829
2930Item {
3031 id: root
31− width: shell.width
32+ width: shell.width + units.gu(20)
3233 height: shell.height
3334
3435 QtObject {
@@ -49,6 +50,20 @@ Item {
4950
5051 Shell {
5152 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+ }
5267 }
5368
5469 SignalSpy {
@@ -74,7 +89,7 @@ Item {
7489 function init() {
7590 swipeAwayGreeter()
7691 shell.failedLoginsDelayAttempts = -1
77− shell.maxFailedLogins = -1
92+ maxRetriesTextField.text = "-1"
7893 }
7994
8095 function cleanup() {
@@ -139,7 +154,7 @@ Item {
139154 function test_emergencyCall() {
140155 var greeter = findChild(shell, "greeter")
141156 var lockscreen = findChild(shell, "lockscreen")
142− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
157+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
143158 var panel = findChild(shell, "panel")
144159 var indicators = findChild(shell, "indicators")
145160 var launcher = findChild(shell, "launcher")
@@ -170,7 +185,7 @@ Item {
170185
171186 function test_emergencyCallCrash() {
172187 var lockscreen = findChild(shell, "lockscreen")
173− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
188+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
174189 mouseClick(emergencyButton, units.gu(1), units.gu(1))
175190
176191 tryCompare(lockscreen, "shown", false)
@@ -180,7 +195,7 @@ Item {
180195
181196 function test_emergencyCallAppLaunch() {
182197 var lockscreen = findChild(shell, "lockscreen")
183− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
198+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
184199 mouseClick(emergencyButton, units.gu(1), units.gu(1))
185200
186201 tryCompare(lockscreen, "shown", false)
@@ -201,21 +216,21 @@ Item {
201216 function test_wrongEntries() {
202217 shell.failedLoginsDelayAttempts = 3
203218
204− var placeHolder = findChild(shell, "pinentryFieldPlaceHolder")
205− tryCompare(placeHolder, "text", "Enter your passcode")
219+ var placeHolder = findChild(shell, "wrongNoticeLabel")
220+ tryCompare(placeHolder, "text", "Incorrect passcode")
206221
207222 enterPin("1111")
208− tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
223+ tryCompare(placeHolder, "text", "Incorrect passcode")
209224
210225 enterPin("1111")
211− tryCompare(placeHolder, "text", "Incorrect passcode\nPlease re-enter")
226+ tryCompare(placeHolder, "text", "Incorrect passcode")
212227
213228 enterPin("1111")
214− tryCompare(placeHolder, "text", "Too many incorrect attempts\nPlease wait")
229+ tryCompare(placeHolder, "text", "Too many incorrect attempts")
215230 }
216231
217232 function test_factoryReset() {
218− shell.maxFailedLogins = 3
233+ maxRetriesTextField.text = "3"
219234 resetSpy.clear()
220235
221236 enterPin("1111")