@@ -26,22 +26,21 @@ import Unity.Test 0.1 as UT
26Rectangle {
26Rectangle {
28 width: units.gu(80)
28 width: units.gu(80)
29− height: units.gu(80)
29+ height: units.gu(70)
30 color: "orange"
30 color: "orange"
32 Lockscreen {
32 Lockscreen {
33 id: lockscreen
33 id: lockscreen
34 anchors.fill: parent
34 anchors.fill: parent
35− anchors.rightMargin: units.gu(30)
35+ anchors.rightMargin: units.gu(40)
36− placeholderText: "Please enter your PIN"
36+ infoText: infoTextTextField.text
37− wrongPlaceholderText: "Incorrect PIN"
38 retryText: retryCountTextField.text
37 retryText: retryCountTextField.text
38+ errorText: errorTextTextField.text
39 alphaNumeric: pinPadCheckBox.checked
39 alphaNumeric: pinPadCheckBox.checked
40 minPinLength: minPinLengthTextField.text
40 minPinLength: minPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
42 username: "Lola"
42 username: "Lola"
43 background: "../../../qml/graphics/phone_background.jpg"
43 background: "../../../qml/graphics/phone_background.jpg"
44− infoText: infoTextTextField.text
47 Connections {
46 Connections {
@@ -68,7 +67,7 @@ Rectangle {
69 pinPadCheckBox.checked = true
68 pinPadCheckBox.checked = true
71− lockscreen.placeholderText = text;
70+ lockscreen.infoText = text;
@@ -157,7 +156,14 @@ Rectangle {
157 id: infoTextTextField
156 id: infoTextTextField
158 width: parent.width
157 width: parent.width
159 placeholderText: "Infotext"
158 placeholderText: "Infotext"
160− text: "+49 179 3253553"
159+ text: "Enter SIM1 PIN"
163+ id: errorTextTextField
165+ placeholderText: "Error text"
166+ text: "Sorry, incorrect PIN"
163 TextField {
169 TextField {
@@ -223,7 +229,7 @@ Rectangle {
223 emergencyCheckBox.checked = false
229 emergencyCheckBox.checked = false
224 pinPadCheckBox.checked = data.alphanumeric
230 pinPadCheckBox.checked = data.alphanumeric
225 waitForLockscreenReady();
231 waitForLockscreenReady();
226− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
232+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
227 mouseClick(emergencyButton, units.gu(1), units.gu(1))
233 mouseClick(emergencyButton, units.gu(1), units.gu(1))
228 tryCompare(emergencyCheckBox, "checked", true)
234 tryCompare(emergencyCheckBox, "checked", true)
@@ -231,18 +237,20 @@ Rectangle {
232 function test_labels_data() {
238 function test_labels_data() {
234− {tag: "numeric", alphanumeric: false, placeholderText: "Please enter your PIN", username: "foobar" },
240+ {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN", username: "foobar" },
235− {tag: "alphanumeric", alphanumeric: true, placeholderText: "Please enter your password", username: "Lola" }
241+ {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password", username: "Lola" }
239 function test_labels(data) {
245 function test_labels(data) {
240 pinPadCheckBox.checked = data.alphanumeric
246 pinPadCheckBox.checked = data.alphanumeric
241− lockscreen.placeholderText = data.placeholderText
247+ lockscreen.infoText = data.infoText
242 waitForLockscreenReady();
248 waitForLockscreenReady();
243− compare(findChild(lockscreen, "pinentryField").placeholderText, data.placeholderText, "Placeholdertext is not what it should be")
244 if (data.alphanumeric) {
249 if (data.alphanumeric) {
250+ compare(findChild(lockscreen, "pinentryField").placeholderText, data.infoText, "Placeholdertext is not what it should be")
245 compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
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")
@@ -276,10 +284,8 @@ Rectangle {
276 var button = findChild(lockscreen, "pinPadButton" + character)
284 var button = findChild(lockscreen, "pinPadButton" + character)
277 mouseClick(button, units.gu(1), units.gu(1))
285 mouseClick(button, units.gu(1), units.gu(1))
279− if (data.minPinLength !== data.maxPinLength || data.minPinLength == -1) {
280− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
287+ var confirmButton = findChild(lockscreen, "confirmButton");
281− mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
288+ mouseClick(confirmButton, units.gu(1), units.gu(1));
284 tryCompare(enteredLabel, "text", data.password)
290 tryCompare(enteredLabel, "text", data.password)
@@ -317,11 +323,9 @@ Rectangle {
317 wait(0) // Trigger event loop to make sure the animation would start running
323 wait(0) // Trigger event loop to make sure the animation would start running
318 compare(animation.running, data.animation)
324 compare(animation.running, data.animation)
319 if (data.animation) {
325 if (data.animation) {
320− if (data.alphanumeric) {
326+ if (!data.alphanumeric) {
321− tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
323− var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
327+ var label = findChild(lockscreen, "wrongNoticeLabel");
324− tryCompare(label, "text", lockscreen.wrongPlaceholderText)
328+ tryCompare(label, "visible", true)
@@ -343,24 +347,21 @@ Rectangle {
343 maxPinLengthTextField.text = data.maxPinLength
347 maxPinLengthTextField.text = data.maxPinLength
344 waitForLockscreenReady();
348 waitForLockscreenReady();
346− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
347 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
350 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
348 var pinEntryField = findChild(lockscreen, "pinentryField");
351 var pinEntryField = findChild(lockscreen, "pinentryField");
350− var autoConfirmEnabled = data.minPinLength === data.maxPinLength && data.minPinLength !== -1;
351− compare(pinPadButtonErase.iconName, autoConfirmEnabled ? "erase" : "");
352− compare(backspaceIcon.visible, !autoConfirmEnabled);
353+ compare(backspaceIcon.opacity, 0);
354 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
355 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
355 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
356 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
356 compare(pinEntryField.text, "5");
357 compare(pinEntryField.text, "5");
358− if (data.minPinLength !== data.maxPinLength) {
359− mouseClick(backspaceIcon, units.gu(1), units.gu(1));
359+ tryCompare(backspaceIcon, "opacity", 1);
361− mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
361+ mouseClick(backspaceIcon, units.gu(1), units.gu(1));
363 compare(pinEntryField.text, "");
362 compare(pinEntryField.text, "");
364+ tryCompare(backspaceIcon, "opacity", 0);
366 function test_minMaxLength_data() {
367 function test_minMaxLength_data() {
@@ -373,37 +374,55 @@ Rectangle {
374 function test_minMaxLength(data) {
375 function test_minMaxLength(data) {
375 pinPadCheckBox.checked = false
376 pinPadCheckBox.checked = false
376− minPinLengthTextField.text = data.minPinLength
377+ minPinLengthTextField.text = data.minPinLength;
377− maxPinLengthTextField.text = data.maxPinLength
378+ maxPinLengthTextField.text = data.maxPinLength;
378 waitForLockscreenReady();
379 waitForLockscreenReady();
380 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
381 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
381− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
382+ var backspaceButton = findChild(lockscreen, "backspaceIcon");
383+ var confirmButton = findChild(lockscreen, "confirmButton");
382− var inputField = findChild(lockscreen, "pinentryField")
384+ var inputField = findChild(lockscreen, "pinentryField");
386+ tryCompare(backspaceButton, "opacity", 0);
388+ tryCompare(confirmButton, "visible", (data.minPinLength != data.maxPinLength) || (data.minPinLength == -1));
384 for (var i = 0; i < 10; i++) {
390 for (var i = 0; i < 10; i++) {
385 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
391 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
392+ tryCompare(backspaceButton, "opacity", 1)
387− if (data.minPinLength == data.maxPinLength && data.minPinLength != -1) {
394+ if (data.maxPinLength == data.minPinLength && data.minPinLength > 0) {
388− // auto confirm mode...
395+ // Autoconfirm mode. This will automatically confirm (and with it reset)
396+ // the textfield every data.minPinLength presses
397+ if (i+1 < data.minPinLength) {
389− compare(inputField.text.length, (i+1) % data.minPinLength);
398+ compare(inputField.text.length, i + 1);
400+ compare(inputField.text.length, (i+1) % data.minPinLength)
391− // manual confirm mode
392− tryCompare(pinPadButtonErase, "enabled", (i+1) >= data.minPinLength)
393 if (data.maxPinLength == -1) {
403 if (data.maxPinLength == -1) {
404+ // Undefined maxLength... make sure all presses are recorded
394 compare(inputField.text.length, i+1);
405 compare(inputField.text.length, i+1);
407+ // We have a max length. Make sure we're only accepting maxLength presses
396 compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
408 compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
411+ if (data.minPinLength == -1) {
412+ // Undefined minLength. Make sure confirm button is always enabled
413+ compare(confirmButton.enabled, true);
415+ // We have a min length. Make sure the confirm button is only enabled when met.
416+ compare(confirmButton.enabled, (i+1) >= data.minPinLength);
403 function test_retryDisplay_data() {
422 function test_retryDisplay_data() {
405− {tag: "empty", retryText: "", shown: false},
424+ {tag: "empty", retryText: " "},
406− {tag: "3 retries left", retryText: "3 retries left", shown: true},
425+ {tag: "3 retries left", retryText: "3 retries left"},
@@ -412,8 +431,8 @@ Rectangle {
412 waitForLockscreenReady();
431 waitForLockscreenReady();
414 retryCountTextField.text = data.retryText;
433 retryCountTextField.text = data.retryText;
415− var label = findChild(lockscreen, "retryCountLabel")
434+ var label = findChild(lockscreen, "retryLabel")
416− compare(label.visible, data.shown);
435+ compare(label.text, data.retryText);
419 function test_infoPopup() {
438 function test_infoPopup() {
@@ -438,8 +457,8 @@ Rectangle {
439 function test_infoTextDisplay_data() {
458 function test_infoTextDisplay_data() {
441− {tag: "empty string", text: "", shown: false},
460+ {tag: "empty string", text: ""},
442− {tag: "hello world", text: "hello world", shown: true},
461+ {tag: "hello world", text: "hello world"},
@@ -449,7 +468,7 @@ Rectangle {
450 infoTextTextField.text = data.text;
469 infoTextTextField.text = data.text;
451 var label = findChild(lockscreen, "infoTextLabel")
470 var label = findChild(lockscreen, "infoTextLabel")
452− compare(label.visible, data.shown);
471+ compare(label.text, data.text);