on xenial help sign in
Update and expand lockscreen qmluitests
3e2956aMichael Terry
qml/Components/DelayedLockscreen.qml+2
@@ -36,6 +36,8 @@ Item {
36 spacing: units.gu(2)
36 spacing: units.gu(2)
37
37
38 Label {
38 Label {
39+ id: deviceLockedLabel
40+ objectName: "deviceLockedLabel"
39 anchors.left: parent.left
41 anchors.left: parent.left
40 anchors.right: parent.right
42 anchors.right: parent.right
41 horizontalAlignment: Text.AlignHCenter
43 horizontalAlignment: Text.AlignHCenter
qml/Components/Lockscreen.qml+1−6
@@ -51,12 +51,6 @@ Showable {
51 signal emergencyCall()
51 signal emergencyCall()
52 signal infoPopupConfirmed()
52 signal infoPopupConfirmed()
53
53
54− onRequiredChanged: {
55− if (required && pinPadLoader.item) {
56− clear(false)
57− }
58− }
59−
60 function reset() {
54 function reset() {
61 // This causes the loader below to destry and recreate the source
55 // This causes the loader below to destry and recreate the source
62 pinPadLoader.resetting = true;
56 pinPadLoader.resetting = true;
@@ -118,6 +112,7 @@ Showable {
118 onSourceChanged: {
112 onSourceChanged: {
119 waiting = false
113 waiting = false
120 showWrongText = false
114 showWrongText = false
115+ clear(false)
121 }
116 }
122
117
123 Connections {
118 Connections {
tests/qmltests/Greeter/tst_Lockscreen.qml+16−33
@@ -34,12 +34,11 @@ Rectangle {
34 anchors.fill: parent
34 anchors.fill: parent
35 anchors.rightMargin: units.gu(40)
35 anchors.rightMargin: units.gu(40)
36 infoText: infoTextTextField.text
36 infoText: infoTextTextField.text
37− retryText: retryCountTextField.text
38 errorText: errorTextTextField.text
37 errorText: errorTextTextField.text
39 alphaNumeric: pinPadCheckBox.checked
38 alphaNumeric: pinPadCheckBox.checked
40 minPinLength: minPinLengthTextField.text
39 minPinLength: minPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
40 maxPinLength: maxPinLengthTextField.text
42− username: "Lola"
41+ delayMinutes: delayMinutesTextField.text
43 background: "../../../qml/graphics/phone_background.jpg"
42 background: "../../../qml/graphics/phone_background.jpg"
44 }
43 }
45
44
@@ -121,12 +120,12 @@ Rectangle {
121 }
120 }
122 Row {
121 Row {
123 TextField {
122 TextField {
124− id: retryCountTextField
123+ id: delayMinutesTextField
125 width: units.gu(7)
124 width: units.gu(7)
126− text: "3 retries left"
125+ text: "0"
127 }
126 }
128 Label {
127 Label {
129− text: "Retries left"
128+ text: "Delay Minutes"
130 }
129 }
131 }
130 }
132 Label {
131 Label {
@@ -193,6 +192,7 @@ Rectangle {
193
192
194 function cleanup() {
193 function cleanup() {
195 lockscreen.clear(false);
194 lockscreen.clear(false);
195+ delayMinutesTextField.text = "0"
196 }
196 }
197
197
198 function waitForLockscreenReady() {
198 function waitForLockscreenReady() {
@@ -237,8 +237,8 @@ Rectangle {
237
237
238 function test_labels_data() {
238 function test_labels_data() {
239 return [
239 return [
240− {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN", username: "foobar" },
240+ {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN" },
241− {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password", username: "Lola" }
241+ {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password" }
242 ]
242 ]
243 }
243 }
244
244
@@ -246,15 +246,9 @@ Rectangle {
246 pinPadCheckBox.checked = data.alphanumeric
246 pinPadCheckBox.checked = data.alphanumeric
247 lockscreen.infoText = data.infoText
247 lockscreen.infoText = data.infoText
248 waitForLockscreenReady();
248 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")
249+ compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
254− }
255 }
250 }
256
251
257−
258 function test_unlock_data() {
252 function test_unlock_data() {
259 return [
253 return [
260 {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
254 {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
@@ -274,8 +268,7 @@ Rectangle {
274
268
275 var inputField = findChild(lockscreen, "pinentryField")
269 var inputField = findChild(lockscreen, "pinentryField")
276 if (data.alphanumeric) {
270 if (data.alphanumeric) {
277− mouseClick(inputField, units.gu(1), units.gu(1))
278− tryCompare(inputField, "focus", true);
271+ tryCompare(inputField, "activeFocus", true);
279 typeString(data.password)
272 typeString(data.password)
280 keyClick(Qt.Key_Enter)
273 keyClick(Qt.Key_Enter)
281 } else {
274 } else {
@@ -305,7 +298,6 @@ Rectangle {
305
298
306 var inputField = findChild(lockscreen, "pinentryField")
299 var inputField = findChild(lockscreen, "pinentryField")
307 if (data.alphanumeric) {
300 if (data.alphanumeric) {
308− mouseClick(inputField, units.gu(1), units.gu(1))
309 tryCompare(inputField, "activeFocus", true);
301 tryCompare(inputField, "activeFocus", true);
310 typeString("1")
302 typeString("1")
311 } else {
303 } else {
@@ -419,22 +411,6 @@ Rectangle {
419 }
411 }
420 }
412 }
421
413
422− function test_retryDisplay_data() {
423− return [
424− {tag: "empty", retryText: " "},
425− {tag: "3 retries left", retryText: "3 retries left"},
426− ]
427− }
428−
429− function test_retryDisplay(data) {
430− pinPadCheckBox.checked = false
431− waitForLockscreenReady();
432−
433− retryCountTextField.text = data.retryText;
434− var label = findChild(lockscreen, "retryLabel")
435− compare(label.text, data.retryText);
436− }
437−
438 function test_infoPopup() {
414 function test_infoPopup() {
439 verify(findChild(root, "infoPopup") === null);
415 verify(findChild(root, "infoPopup") === null);
440 lockscreen.showInfoPopup("foo", "bar");
416 lockscreen.showInfoPopup("foo", "bar");
@@ -470,6 +446,13 @@ Rectangle {
470 var label = findChild(lockscreen, "infoTextLabel")
446 var label = findChild(lockscreen, "infoTextLabel")
471 compare(label.text, data.text);
447 compare(label.text, data.text);
472 }
448 }
449+
450+ function test_delayMinutes() {
451+ delayMinutesTextField.text = "4"
452+ waitForLockscreenReady()
453+ var label = findChild(lockscreen, "deviceLockedLabel")
454+ compare(label.text, "Device Locked")
455+ }
473 }
456 }
474
457
475 SignalSpy {
458 SignalSpy {