on xenial help sign in
update Lockscreen tests for the brought back autoconfirm mode
commita67e845cd5eb0a19d768d4ff7c27375e45d75dec authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 18 Aug 2014, 16:06 (12 years ago) parent825dc3e
1 file changed+23−13
tests/qmltests/Greeter/tst_Lockscreen.qml+23−13
tests/qmltests/Greeter/tst_Lockscreen.qml+23−13
@@ -389,20 +389,30 @@ Rectangle {
389389 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
390390 tryCompare(backspaceButton, "opacity", 1)
391391
392− if (data.maxPinLength == -1) {
393− // Undefined maxLength... make sure all presses are recorded
394− compare(inputField.text.length, i+1);
392+ if (data.maxPinLength == data.minPinLength && data.minPinLength > 0) {
393+ // Autoconfirm mode. This will automatically confirm (and with it reset)
394+ // the textfield every data.minPinLength presses
395+ if (i+1 < data.minPinLength) {
396+ compare(inputField.text.length, i + 1);
397+ } else {
398+ compare(inputField.text.length, (i+1) % data.minPinLength)
399+ }
395400 } else {
396− // We have a max length. Make sure we're only accepting maxLength presses
397− compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
398− }
399−
400− if (data.minPinLength == -1) {
401− // Undefined minLength. Make sure confirm button is always enabled
402− compare(confirmButton.enabled, true);
403− } else {
404− // We have a min length. Make sure the confirm button is only enabled when met.
405− compare(confirmButton.enabled, (i+1) >= data.minPinLength);
401+ if (data.maxPinLength == -1) {
402+ // Undefined maxLength... make sure all presses are recorded
403+ compare(inputField.text.length, i+1);
404+ } else {
405+ // We have a max length. Make sure we're only accepting maxLength presses
406+ compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
407+ }
408+
409+ if (data.minPinLength == -1) {
410+ // Undefined minLength. Make sure confirm button is always enabled
411+ compare(confirmButton.enabled, true);
412+ } else {
413+ // We have a min length. Make sure the confirm button is only enabled when met.
414+ compare(confirmButton.enabled, (i+1) >= data.minPinLength);
415+ }
406416 }
407417 }
408418 }