@@ -18,15 +18,13 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20import "../../../qml/Components"
20import "../../../qml/Components"
21−import AccountsService 0.1
22−import LightDM 0.1 as LightDM
23import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
24import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
26Rectangle {
24Rectangle {
28 width: units.gu(80)
26 width: units.gu(80)
29− height: units.gu(70)
27+ height: units.gu(76)
30 color: "orange"
28 color: "orange"
32 Lockscreen {
30 Lockscreen {
@@ -39,7 +37,7 @@ Rectangle {
39 alphaNumeric: pinPadCheckBox.checked
37 alphaNumeric: pinPadCheckBox.checked
40 minPinLength: minPinLengthTextField.text
38 minPinLength: minPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
39 maxPinLength: maxPinLengthTextField.text
42− username: "Lola"
40+ delayMinutes: delayMinutesTextField.text
43 background: "../../../qml/graphics/phone_background.jpg"
41 background: "../../../qml/graphics/phone_background.jpg"
@@ -53,24 +51,6 @@ Rectangle {
56− function setUser(username) {
57− AccountsService.user = username
58− LightDM.Greeter.authenticate(username)
62− target: LightDM.Greeter
65− if (AccountsService.passwordDisplayHint === AccountsService.Numeric) {
66− pinPadCheckBox.checked = false
68− pinPadCheckBox.checked = true
70− lockscreen.infoText = text;
74 Rectangle {
54 Rectangle {
75 anchors.fill: parent
55 anchors.fill: parent
76 anchors.leftMargin: lockscreen.width
56 anchors.leftMargin: lockscreen.width
@@ -129,6 +109,16 @@ Rectangle {
129 text: "Retries left"
109 text: "Retries left"
114+ id: delayMinutesTextField
119+ text: "Delay Minutes"
133 id: pinLabel
123 id: pinLabel
134 anchors.verticalCenter: parent.verticalCenter
124 anchors.verticalCenter: parent.verticalCenter
@@ -141,17 +131,6 @@ Rectangle {
141 id: enteredLabel
131 id: enteredLabel
145− text: "start auth (1234)"
147− onClicked: setUser("has-pin")
150− text: "start auth (password)"
152− onClicked: setUser("has-password")
155 TextField {
134 TextField {
156 id: infoTextTextField
135 id: infoTextTextField
157 width: parent.width
136 width: parent.width
@@ -193,6 +172,7 @@ Rectangle {
194 function cleanup() {
173 function cleanup() {
195 lockscreen.clear(false);
174 lockscreen.clear(false);
175+ delayMinutesTextField.text = "0"
198 function waitForLockscreenReady() {
178 function waitForLockscreenReady() {
@@ -237,8 +217,8 @@ Rectangle {
238 function test_labels_data() {
218 function test_labels_data() {
240− {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN", username: "foobar" },
220+ {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN" },
241− {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password", username: "Lola" }
221+ {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password" }
@@ -246,22 +226,16 @@ Rectangle {
246 pinPadCheckBox.checked = data.alphanumeric
226 pinPadCheckBox.checked = data.alphanumeric
247 lockscreen.infoText = data.infoText
227 lockscreen.infoText = data.infoText
248 waitForLockscreenReady();
228 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")
253− compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
229+ compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
258 function test_unlock_data() {
232 function test_unlock_data() {
260− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
234+ {tag: "numeric", alphanumeric: false, password: "1234", minPinLength: 4, maxPinLength: 4},
261− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", minPinLength: -1, maxPinLength: -1},
235+ {tag: "alphanumeric", alphanumeric: true, password: "password", minPinLength: -1, maxPinLength: -1},
262− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", minPinLength: 4, maxPinLength: 4},
236+ {tag: "numeric (wrong)", alphanumeric: false, password: "4321", minPinLength: 4, maxPinLength: 4},
263− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", minPinLength: -1, maxPinLength: -1},
237+ {tag: "alphanumeric (wrong)", alphanumeric: true, password: "drowssap", minPinLength: -1, maxPinLength: -1},
264− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: -1, maxPinLength: -1},
238+ {tag: "flexible length", alphanumeric: false, password: "1234", minPinLength: -1, maxPinLength: -1},
@@ -269,13 +243,13 @@ Rectangle {
269 enteredLabel.text = ""
243 enteredLabel.text = ""
270 minPinLengthTextField.text = data.minPinLength
244 minPinLengthTextField.text = data.minPinLength
271 maxPinLengthTextField.text = data.maxPinLength
245 maxPinLengthTextField.text = data.maxPinLength
272− setUser(data.username)
246+ pinPadCheckBox.checked = data.alphanumeric
247+ infoTextTextField.text = "Enter " + (data.alphanumeric ? "passphrase" : "passcode")
273 waitForLockscreenReady();
248 waitForLockscreenReady();
275 var inputField = findChild(lockscreen, "pinentryField")
250 var inputField = findChild(lockscreen, "pinentryField")
276 if (data.alphanumeric) {
251 if (data.alphanumeric) {
277− mouseClick(inputField, units.gu(1), units.gu(1))
278− tryCompare(inputField, "focus", true);
252+ tryCompare(inputField, "activeFocus", true);
279 typeString(data.password)
253 typeString(data.password)
280 keyClick(Qt.Key_Enter)
254 keyClick(Qt.Key_Enter)
@@ -305,7 +279,6 @@ Rectangle {
306 var inputField = findChild(lockscreen, "pinentryField")
280 var inputField = findChild(lockscreen, "pinentryField")
307 if (data.alphanumeric) {
281 if (data.alphanumeric) {
308− mouseClick(inputField, units.gu(1), units.gu(1))
309 tryCompare(inputField, "activeFocus", true);
282 tryCompare(inputField, "activeFocus", true);
310 typeString("1")
283 typeString("1")
@@ -470,6 +443,13 @@ Rectangle {
470 var label = findChild(lockscreen, "infoTextLabel")
443 var label = findChild(lockscreen, "infoTextLabel")
471 compare(label.text, data.text);
444 compare(label.text, data.text);
447+ function test_delayMinutes() {
448+ delayMinutesTextField.text = "4"
449+ waitForLockscreenReady()
450+ var label = findChild(lockscreen, "deviceLockedLabel")
451+ compare(label.text, "Device Locked")
475 SignalSpy {
455 SignalSpy {