on xenial help sign in
add a signal to inform the caller when the infoPopup is closed

some more fixes/improvements for the wrongPlaceholderText tests

commit91548de3f831e7125b7dbe73c4a8df6077857eef authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 20 May 2014, 13:28 (12 years ago) parentf287dbe
4 files changed+41−3
qml/Greeter/Lockscreen.qml+12−1 qml/Greeter/PassphraseLockscreen.qml+3−1 qml/Greeter/PinLockscreen.qml+4−1 tests/qmltests/Greeter/tst_Lockscreen.qml+22
qml/Greeter/Lockscreen.qml+12−1
@@ -27,6 +27,8 @@ Showable {
2727
2828 // Placeholder text
2929 property string placeholderText: ""
30+ // Placeholder text while shaking (e.g. Incorrect passprase)
31+ property string wrongPlaceholderText: ""
3032
3133 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
3234 property string infoText: ""
@@ -53,6 +55,7 @@ Showable {
5355 signal entered(string passphrase)
5456 signal cancel()
5557 signal emergencyCall()
58+ signal infoPopupConfirmed()
5659
5760 onRequiredChanged: {
5861 if (required && pinPadLoader.item) {
@@ -172,6 +175,11 @@ Showable {
172175 property: "placeholderText"
173176 value: root.placeholderText
174177 }
178+ Binding {
179+ target: pinPadLoader.item
180+ property: "wrongPlaceholderText"
181+ value: root.wrongPlaceholderText
182+ }
175183 Binding {
176184 target: pinPadLoader.item
177185 property: "username"
@@ -222,7 +230,10 @@ Showable {
222230 Button {
223231 objectName: "infoPopupOkButton"
224232 text: i18n.tr("OK")
225− onClicked: PopupUtils.close(dialog)
233+ onClicked: {
234+ PopupUtils.close(dialog)
235+ root.infoPopupConfirmed();
236+ }
226237 }
227238 }
228239 }
qml/Greeter/PassphraseLockscreen.qml+3−1
@@ -22,7 +22,8 @@ Item {
2222 id: root
2323 height: highlightItem.height
2424
25− property alias placeholderText: pinentryField.placeholderText
25+ property string placeholderText
26+ property string wrongPlaceholderText
2627 property string username: ""
2728
2829 signal entered(string passphrase)
@@ -73,6 +74,7 @@ Item {
7374 echoMode: TextInput.Password
7475 opacity: 0.9
7576 hasClearButton: false
77+ placeholderText: wrongPasswordAnimation.running ? root.wrongPlaceholderText : root.placeholderText
7678
7779 onAccepted: {
7880 if (pinentryField.text) {
qml/Greeter/PinLockscreen.qml+4−1
@@ -25,6 +25,7 @@ Column {
2525 spacing: units.gu(3.5)
2626
2727 property alias placeholderText: pinentryField.placeholderText
28+ property alias wrongPlaceholderText: pinentryField.wrongPlaceholderText
2829 property int padWidth: units.gu(34)
2930 property int padHeight: units.gu(28)
3031 property int minPinLength: -1
@@ -57,6 +58,7 @@ Column {
5758 radius: "medium"
5859 property string text: ""
5960 property string placeholderText: ""
61+ property string wrongPlaceholderText: ""
6062
6163 function appendChar(character) {
6264 if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
@@ -86,9 +88,10 @@ Column {
8688 }
8789 Label {
8890 id: pinentryFieldPlaceHolder
91+ objectName: "pinentryFieldPlaceHolder"
8992 anchors.centerIn: parent
9093 color: "grey"
91− text: wrongPasswordAnimation.running ? i18n.tr("Incorrect passcode") : parent.placeholderText
94+ text: wrongPasswordAnimation.running ? parent.wrongPlaceholderText : parent.placeholderText
9295 visible: pinentryFieldLabel.text.length == 0
9396 }
9497
tests/qmltests/Greeter/tst_Lockscreen.qml+22
@@ -33,6 +33,7 @@ Rectangle {
3333 anchors.fill: parent
3434 anchors.rightMargin: units.gu(30)
3535 placeholderText: "Please enter your PIN"
36+ wrongPlaceholderText: "Incorrect PIN"
3637 alphaNumeric: pinPadCheckBox.checked
3738 minPinLength: minPinLengthTextField.text
3839 maxPinLength: maxPinLengthTextField.text
@@ -309,6 +310,16 @@ Rectangle {
309310
310311 wait(0) // Trigger event loop to make sure the animation would start running
311312 compare(animation.running, data.animation)
313+ if (data.animation) {
314+ if (data.alphanumeric) {
315+ tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
316+ tryCompare(inputField, "placeholderText", lockscreen.placeholderText)
317+ } else {
318+ var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
319+ tryCompare(label, "text", lockscreen.wrongPlaceholderText)
320+ tryCompare(label, "text", lockscreen.placeholderText)
321+ }
322+ }
312323
313324 // wait for animation to finish to not disturb other tests
314325 tryCompare(animation, "running", false)
@@ -411,10 +422,16 @@ Rectangle {
411422 var infoPopup = findChild(root, "infoPopup");
412423 compare(infoPopup.title, "foo");
413424 compare(infoPopup.text, "bar");
425+
426+ signalSpy.signalName = "infoPopupConfirmed"
427+ signalSpy.clear();
428+
414429 var okButton = findChild(root, "infoPopupOkButton");
415430 mouseClick(okButton, okButton.width / 2, okButton.height / 2);
416431
417432 tryCompareFunction(function() { return findChild(root, "infoPopup") === null}, true);
433+
434+ tryCompare(signalSpy, "count", 1);
418435 }
419436
420437 function test_infoTextDisplay_data() {
@@ -433,4 +450,9 @@ Rectangle {
433450 compare(label.visible, data.shown);
434451 }
435452 }
453+
454+ SignalSpy {
455+ id: signalSpy
456+ target: lockscreen
457+ }
436458}