on xenial help sign in
add test for the new backspace button
commit962f4ac5392d790608e62864b026240b26f52f4a authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 17 Oct 2013, 15:08 (13 years ago) parent7f29b04
2 files changed+32
Greeter/PinLockscreen.qml+1 tests/qmltests/Greeter/tst_Lockscreen.qml+31
Greeter/PinLockscreen.qml+1
@@ -82,6 +82,7 @@ Column {
8282
8383 Icon {
8484 id: backspaceIcon
85+ objectName: "backspaceIcon"
8586 anchors {
8687 top: parent.top
8788 topMargin: units.gu(1)
tests/qmltests/Greeter/tst_Lockscreen.qml+31
@@ -215,5 +215,36 @@ Rectangle {
215215 tryCompareFunction(function() {return inputField.text.length > 0}, true)
216216 }
217217 }
218+
219+ function test_backspace_data() {
220+ return [
221+ {tag: "fixed length", pinLength: 4},
222+ {tag: "variable length", pinLength: -1}
223+ ];
224+ }
225+
226+ function test_backspace(data) {
227+ LightDM.Greeter.authenticate("has-pin");
228+ pinLengthTextField.text = data.pinLength
229+ waitForRendering(lockscreen);
230+
231+ var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
232+ var backspaceIcon = findChild(lockscreen, "backspaceIcon");
233+ var pinEntryField = findChild(lockscreen, "pinentryField");
234+
235+ compare(pinPadButtonErase.iconName, data.pinLength == -1 ? "" : "erase");
236+ compare(backspaceIcon.visible, data.pinLength == -1);
237+
238+ var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
239+ mouseClick(pinPadButton5, units.gu(1), units.gu(1));
240+ compare(pinEntryField.text, "5");
241+
242+ if (data.pinLength == -1) {
243+ mouseClick(backspaceIcon, units.gu(1), units.gu(1));
244+ } else {
245+ mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
246+ }
247+ compare(pinEntryField.text, "");
248+ }
218249 }
219250}