@@ -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,15 +175,15 @@ Rectangle {
176175
177176 function test_unlock_data() {
178177 return [
179− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", unlockedSignal: true},
180− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", unlockedSignal: true},
181− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", unlockedSignal: false},
182− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", unlockedSignal: false},
178+ {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234"},
179+ {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password"},
180+ {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321"},
181+ {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap"},
183182 ]
184183 }
185184
186185 function test_unlock(data) {
187− unlockedCheckBox.checked = false
186+ enteredLabel.text = ""
188187 LightDM.Greeter.authenticate(data.username)
189188 waitForRendering(lockscreen)
190189
@@ -200,13 +199,43 @@ Rectangle {
200199 mouseClick(button, units.gu(1), units.gu(1))
201200 }
202201 }
203− tryCompare(unlockedCheckBox, "checked", data.unlockedSignal)
204− if (!data.unlockedSignal) {
205− // make sure the input is cleared on wrong input
206− tryCompareFunction(function() {return inputField.text.length == 0}, true)
202+ tryCompare(enteredLabel, "text", data.password)
203+ }
204+
205+ function test_clear_data() {
206+ return [
207+ {tag: "animated PIN", animation: true, alphanumeric: false},
208+ {tag: "not animated PIN", animation: false, alphanumeric: false},
209+ {tag: "animated passphrase", animation: true, alphanumeric: true},
210+ {tag: "not animated passphrase", animation: false, alphanumeric: true}
211+ ];
212+ }
213+
214+ function test_clear(data) {
215+ pinPadCheckBox.checked = data.alphanumeric
216+ waitForRendering(lockscreen)
217+
218+ var inputField = findChild(lockscreen, "pinentryField")
219+ if (data.alphanumeric) {
220+ mouseClick(inputField, units.gu(1), units.gu(1))
221+ typeString("1")
207222 } else {
208− tryCompareFunction(function() {return inputField.text.length > 0}, true)
223+ var button = findChild(lockscreen, "pinPadButton1")
224+ mouseClick(button, units.gu(1), units.gu(1))
209225 }
226+
227+ var animation = findInvisibleChild(lockscreen, "wrongPasswordAnimation")
228+
229+ tryCompare(inputField, "text", "1")
230+
231+ lockscreen.clear(data.animation)
232+ tryCompare(inputField, "text", "")
233+
234+ wait(0) // Trigger event loop to make sure the animation would start running
235+ compare(animation.running, data.animation)
236+
237+ // wait for animation to finish to not disturb other tests
238+ tryCompare(animation, "running", false)
210239 }
211240 }
212241}