@@ -41,7 +41,7 @@ Rectangle {
41 target: lockscreen
41 target: lockscreen
43 onEmergencyCall: emergencyCheckBox.checked = true
43 onEmergencyCall: emergencyCheckBox.checked = true
44− onUnlocked: unlockedCheckBox.checked = true
44+ onEntered: enteredLabel.text = passphrase
47 Connections {
47 Connections {
@@ -99,12 +99,11 @@ Rectangle {
99 anchors.verticalCenter: parent.verticalCenter
99 anchors.verticalCenter: parent.verticalCenter
102− CheckBox {
102+ Label {
103− id: unlockedCheckBox
103+ text: "Entered:"
106− text: "Unlocked signal"
106+ id: enteredLabel
107− anchors.verticalCenter: parent.verticalCenter
@@ -176,16 +175,16 @@ Rectangle {
177 function test_unlock_data() {
176 function test_unlock_data() {
179− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: 4},
178+ {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", pinLength: 4},
180− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", unlockedSignal: true, pinLength: -1},
179+ {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", pinLength: -1},
181− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", unlockedSignal: false, pinLength: 4},
180+ {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", pinLength: 4},
182− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", unlockedSignal: false, pinLength: -1},
181+ {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", pinLength: -1},
183− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: -1},
182+ {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", pinLength: -1},
187 function test_unlock(data) {
186 function test_unlock(data) {
188− unlockedCheckBox.checked = false
187+ enteredLabel.text = ""
189 pinLengthTextField.text = data.pinLength
188 pinLengthTextField.text = data.pinLength
190 LightDM.Greeter.authenticate(data.username)
189 LightDM.Greeter.authenticate(data.username)
191 waitForRendering(lockscreen)
190 waitForRendering(lockscreen)
@@ -206,14 +205,43 @@ Rectangle {
206 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
205 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
208+ tryCompare(enteredLabel, "text", data.password)
211+ function test_clear_data() {
213+ {tag: "animated PIN", animation: true, alphanumeric: false},
214+ {tag: "not animated PIN", animation: false, alphanumeric: false},
215+ {tag: "animated passphrase", animation: true, alphanumeric: true},
216+ {tag: "not animated passphrase", animation: false, alphanumeric: true}
220+ function test_clear(data) {
221+ pinPadCheckBox.checked = data.alphanumeric
222+ waitForRendering(lockscreen)
210− tryCompare(unlockedCheckBox, "checked", data.unlockedSignal)
224+ var inputField = findChild(lockscreen, "pinentryField")
211− if (!data.unlockedSignal) {
225+ if (data.alphanumeric) {
212− // make sure the input is cleared on wrong input
226+ mouseClick(inputField, units.gu(1), units.gu(1))
213− tryCompareFunction(function() {return inputField.text.length == 0}, true)
227+ typeString("1")
215− tryCompareFunction(function() {return inputField.text.length > 0}, true)
229+ var button = findChild(lockscreen, "pinPadButton1")
230+ mouseClick(button, units.gu(1), units.gu(1))
233+ var animation = findInvisibleChild(lockscreen, "wrongPasswordAnimation")
235+ tryCompare(inputField, "text", "1")
237+ lockscreen.clear(data.animation)
238+ tryCompare(inputField, "text", "")
240+ wait(0) // Trigger event loop to make sure the animation would start running
241+ compare(animation.running, data.animation)
243+ // wait for animation to finish to not disturb other tests
244+ tryCompare(animation, "running", false)
219 function test_backspace_data() {
247 function test_backspace_data() {
@@ -224,7 +252,7 @@ Rectangle {
226 function test_backspace(data) {
254 function test_backspace(data) {
227− LightDM.Greeter.authenticate("has-pin");
255+ pinPadCheckBox.checked = false
228 pinLengthTextField.text = data.pinLength
256 pinLengthTextField.text = data.pinLength
229 waitForRendering(lockscreen);
257 waitForRendering(lockscreen);