@@ -41,7 +41,7 @@ Rectangle {
4141 target: lockscreen
4242
4343 onEmergencyCall: emergencyCheckBox.checked = true
44− onUnlocked: unlockedCheckBox.checked = true
44+ onEntered: enteredLabel.text = passphrase
4545 }
4646
4747 Connections {
@@ -99,12 +99,11 @@ Rectangle {
9999 anchors.verticalCenter: parent.verticalCenter
100100 }
101101 Row {
102− CheckBox {
103− id: unlockedCheckBox
102+ Label {
103+ text: "Entered:"
104104 }
105105 Label {
106− text: "Unlocked signal"
107− anchors.verticalCenter: parent.verticalCenter
106+ id: enteredLabel
108107 }
109108 }
110109 Button {
@@ -176,16 +175,16 @@ Rectangle {
176175
177176 function test_unlock_data() {
178177 return [
179− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: 4},
180− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", unlockedSignal: true, pinLength: -1},
181− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", unlockedSignal: false, pinLength: 4},
182− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", unlockedSignal: false, pinLength: -1},
183− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true, pinLength: -1},
178+ {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", pinLength: 4},
179+ {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", pinLength: -1},
180+ {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", pinLength: 4},
181+ {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", pinLength: -1},
182+ {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", pinLength: -1},
184183 ]
185184 }
186185
187186 function test_unlock(data) {
188− unlockedCheckBox.checked = false
187+ enteredLabel.text = ""
189188 pinLengthTextField.text = data.pinLength
190189 LightDM.Greeter.authenticate(data.username)
191190 waitForRendering(lockscreen)
@@ -206,14 +205,43 @@ Rectangle {
206205 mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
207206 }
208207 }
208+ tryCompare(enteredLabel, "text", data.password)
209+ }
210+
211+ function test_clear_data() {
212+ return [
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}
217+ ];
218+ }
219+
220+ function test_clear(data) {
221+ pinPadCheckBox.checked = data.alphanumeric
222+ waitForRendering(lockscreen)
209223
210− tryCompare(unlockedCheckBox, "checked", data.unlockedSignal)
211− if (!data.unlockedSignal) {
212− // make sure the input is cleared on wrong input
213− tryCompareFunction(function() {return inputField.text.length == 0}, true)
224+ var inputField = findChild(lockscreen, "pinentryField")
225+ if (data.alphanumeric) {
226+ mouseClick(inputField, units.gu(1), units.gu(1))
227+ typeString("1")
214228 } else {
215− tryCompareFunction(function() {return inputField.text.length > 0}, true)
229+ var button = findChild(lockscreen, "pinPadButton1")
230+ mouseClick(button, units.gu(1), units.gu(1))
216231 }
232+
233+ var animation = findInvisibleChild(lockscreen, "wrongPasswordAnimation")
234+
235+ tryCompare(inputField, "text", "1")
236+
237+ lockscreen.clear(data.animation)
238+ tryCompare(inputField, "text", "")
239+
240+ wait(0) // Trigger event loop to make sure the animation would start running
241+ compare(animation.running, data.animation)
242+
243+ // wait for animation to finish to not disturb other tests
244+ tryCompare(animation, "running", false)
217245 }
218246
219247 function test_backspace_data() {
@@ -224,7 +252,7 @@ Rectangle {
224252 }
225253
226254 function test_backspace(data) {
227− LightDM.Greeter.authenticate("has-pin");
255+ pinPadCheckBox.checked = false
228256 pinLengthTextField.text = data.pinLength
229257 waitForRendering(lockscreen);
230258