@@ -18,15 +18,13 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Components"
21−import AccountsService 0.1
22−import LightDM 0.1 as LightDM
2321import Ubuntu.Components 0.1
2422import Unity.Test 0.1 as UT
2523
2624Rectangle {
2725 id: root
2826 width: units.gu(80)
29− height: units.gu(70)
27+ height: units.gu(76)
3028 color: "orange"
3129
3230 Lockscreen {
@@ -39,7 +37,7 @@ Rectangle {
3937 alphaNumeric: pinPadCheckBox.checked
4038 minPinLength: minPinLengthTextField.text
4139 maxPinLength: maxPinLengthTextField.text
42− username: "Lola"
40+ delayMinutes: delayMinutesTextField.text
4341 background: "../../../qml/graphics/phone_background.jpg"
4442 }
4543
@@ -53,24 +51,6 @@ Rectangle {
5351 }
5452 }
5553
56− function setUser(username) {
57− AccountsService.user = username
58− LightDM.Greeter.authenticate(username)
59− }
60−
61− Connections {
62− target: LightDM.Greeter
63−
64− onShowPrompt: {
65− if (AccountsService.passwordDisplayHint === AccountsService.Numeric) {
66− pinPadCheckBox.checked = false
67− } else {
68− pinPadCheckBox.checked = true
69− }
70− lockscreen.infoText = text;
71− }
72− }
73−
7454 Rectangle {
7555 anchors.fill: parent
7656 anchors.leftMargin: lockscreen.width
@@ -129,6 +109,16 @@ Rectangle {
129109 text: "Retries left"
130110 }
131111 }
112+ Row {
113+ TextField {
114+ id: delayMinutesTextField
115+ width: units.gu(7)
116+ text: "0"
117+ }
118+ Label {
119+ text: "Delay Minutes"
120+ }
121+ }
132122 Label {
133123 id: pinLabel
134124 anchors.verticalCenter: parent.verticalCenter
@@ -141,17 +131,6 @@ Rectangle {
141131 id: enteredLabel
142132 }
143133 }
144− Button {
145− text: "start auth (1234)"
146− width: parent.width
147− onClicked: setUser("has-pin")
148− }
149− Button {
150− text: "start auth (password)"
151− width: parent.width
152− onClicked: setUser("has-password")
153− }
154−
155134 TextField {
156135 id: infoTextTextField
157136 width: parent.width
@@ -193,6 +172,7 @@ Rectangle {
193172
194173 function cleanup() {
195174 lockscreen.clear(false);
175+ delayMinutesTextField.text = "0"
196176 }
197177
198178 function waitForLockscreenReady() {
@@ -237,8 +217,8 @@ Rectangle {
237217
238218 function test_labels_data() {
239219 return [
240− {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN", username: "foobar" },
241− {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password", username: "Lola" }
220+ {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN" },
221+ {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password" }
242222 ]
243223 }
244224
@@ -246,22 +226,16 @@ Rectangle {
246226 pinPadCheckBox.checked = data.alphanumeric
247227 lockscreen.infoText = data.infoText
248228 waitForLockscreenReady();
249− if (data.alphanumeric) {
250− compare(findChild(lockscreen, "pinentryField").placeholderText, data.infoText, "Placeholdertext is not what it should be")
251− compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
252− } else {
253− compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
254− }
229+ compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
255230 }
256231
257−
258232 function test_unlock_data() {
259233 return [
260− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
261− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", minPinLength: -1, maxPinLength: -1},
262− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", minPinLength: 4, maxPinLength: 4},
263− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", minPinLength: -1, maxPinLength: -1},
264− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: -1, maxPinLength: -1},
234+ {tag: "numeric", alphanumeric: false, password: "1234", minPinLength: 4, maxPinLength: 4},
235+ {tag: "alphanumeric", alphanumeric: true, password: "password", minPinLength: -1, maxPinLength: -1},
236+ {tag: "numeric (wrong)", alphanumeric: false, password: "4321", minPinLength: 4, maxPinLength: 4},
237+ {tag: "alphanumeric (wrong)", alphanumeric: true, password: "drowssap", minPinLength: -1, maxPinLength: -1},
238+ {tag: "flexible length", alphanumeric: false, password: "1234", minPinLength: -1, maxPinLength: -1},
265239 ]
266240 }
267241
@@ -269,13 +243,13 @@ Rectangle {
269243 enteredLabel.text = ""
270244 minPinLengthTextField.text = data.minPinLength
271245 maxPinLengthTextField.text = data.maxPinLength
272− setUser(data.username)
246+ pinPadCheckBox.checked = data.alphanumeric
247+ infoTextTextField.text = "Enter " + (data.alphanumeric ? "passphrase" : "passcode")
273248 waitForLockscreenReady();
274249
275250 var inputField = findChild(lockscreen, "pinentryField")
276251 if (data.alphanumeric) {
277− mouseClick(inputField, units.gu(1), units.gu(1))
278− tryCompare(inputField, "focus", true);
252+ tryCompare(inputField, "activeFocus", true);
279253 typeString(data.password)
280254 keyClick(Qt.Key_Enter)
281255 } else {
@@ -305,7 +279,6 @@ Rectangle {
305279
306280 var inputField = findChild(lockscreen, "pinentryField")
307281 if (data.alphanumeric) {
308− mouseClick(inputField, units.gu(1), units.gu(1))
309282 tryCompare(inputField, "activeFocus", true);
310283 typeString("1")
311284 } else {
@@ -470,6 +443,13 @@ Rectangle {
470443 var label = findChild(lockscreen, "infoTextLabel")
471444 compare(label.text, data.text);
472445 }
446+
447+ function test_delayMinutes() {
448+ delayMinutesTextField.text = "4"
449+ waitForLockscreenReady()
450+ var label = findChild(lockscreen, "deviceLockedLabel")
451+ compare(label.text, "Device Locked")
452+ }
473453 }
474454
475455 SignalSpy {