on xenial help sign in
Redo visuals for greeter prompt box.
2fe35fdMichael Terry
qml/Components/FadingLabel.qmlnew file+42
@@ -0,0 +1,42 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.4
18+import QtGraphicalEffects 1.0
19+import Ubuntu.Components 1.3
20+
21+Label {
22+ property real fadeDistance: units.gu(8)
23+
24+ layer.enabled: contentWidth > width
25+ layer.effect: ShaderEffect {
26+ property real fadeThreshold: Math.min(1, Math.max(0, 1 - fadeDistance / width))
27+
28+ fragmentShader: "
29+ varying highp vec2 qt_TexCoord0;
30+ uniform lowp float qt_Opacity;
31+ uniform sampler2D source;
32+ uniform lowp float fadeThreshold;
33+ void main(void)
34+ {
35+ highp vec4 sourceColor = texture2D(source, qt_TexCoord0);
36+ lowp float alpha = 1.0;
37+ if (qt_TexCoord0.x > fadeThreshold && fadeThreshold < 1.0)
38+ alpha = (1.0 - qt_TexCoord0.x) / (1.0 - fadeThreshold);
39+ gl_FragColor = sourceColor * alpha * qt_Opacity;
40+ }"
41+ }
42+}
qml/Greeter/CoverPage.qml+1
@@ -88,6 +88,7 @@ Showable {
88 sourceSize.width: width
88 sourceSize.width: width
89 }
89 }
90
90
91+ // Darkens wallpaper so that we can read text on it and see infographic
91 Rectangle {
92 Rectangle {
92 anchors.fill: parent
93 anchors.fill: parent
93 color: "black"
94 color: "black"
qml/Greeter/GreeterPrompt.qmlnew file+142
@@ -0,0 +1,142 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+
20+FocusScope {
21+ id: root
22+ implicitHeight: units.gu(5)
23+ focus: true
24+
25+ property bool isPrompt
26+ property bool isAlphanumeric
27+ property string text
28+ property bool isSecret
29+
30+ signal clicked()
31+ signal canceled()
32+ signal responded(string text)
33+
34+ function reset() {
35+ passwordInput.text = "";
36+ d.enabled = true;
37+ }
38+
39+ StyledItem {
40+ id: d
41+
42+ property bool enabled: true
43+ readonly property color textColor: passwordInput.enabled ? theme.palette.normal.raisedText
44+ : theme.palette.disabled.raisedText
45+ readonly property color selectedColor: passwordInput.enabled ? theme.palette.normal.raised
46+ : theme.palette.disabled.raised
47+ readonly property color drawColor: passwordInput.enabled ? theme.palette.normal.raisedSecondaryText
48+ : theme.palette.disabled.raisedSecondaryText
49+ readonly property color errorColor: passwordInput.enabled ? theme.palette.normal.negative
50+ : theme.palette.disabled.negative
51+ }
52+
53+ Rectangle {
54+ anchors.fill: parent
55+ border.width: units.dp(1)
56+ border.color: d.drawColor
57+ radius: units.gu(0.5)
58+ color: "transparent"
59+ }
60+
61+ AbstractButton {
62+ objectName: "promptButton"
63+ anchors.fill: parent
64+ visible: !root.isPrompt
65+ enabled: d.enabled
66+ focus: visible
67+
68+ onClicked: root.clicked()
69+
70+ Label {
71+ anchors.centerIn: parent
72+ color: d.textColor
73+ text: root.text
74+ }
75+ }
76+
77+ TextField {
78+ id: passwordInput
79+ objectName: "promptField"
80+ anchors.fill: parent
81+ visible: root.isPrompt
82+ enabled: d.enabled
83+ focus: visible
84+
85+ inputMethodHints: root.isAlphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
86+ echoMode: root.isSecret ? TextInput.Password : TextInput.Normal
87+ hasClearButton: false
88+
89+ readonly property real frameSpacing: units.gu(0.5)
90+
91+ style: Item {
92+ property color color: d.textColor
93+ property color selectedTextColor: d.selectedColor
94+ property color selectionColor: d.textColor
95+ property color borderColor: "transparent"
96+ property color backgroundColor: "transparent"
97+ property color errorColor: d.errorColor
98+ property real frameSpacing: passwordInput.frameSpacing
99+ anchors.fill: parent
100+ }
101+
102+ secondaryItem: [
103+ Icon {
104+ id: capsIcon
105+ name: "keyboard-caps-enabled"
106+ height: units.gu(3)
107+ width: units.gu(3)
108+ color: d.textColor
109+ visible: root.isSecret && false // TODO: detect when caps lock is on
110+ }
111+ ]
112+
113+ onAccepted: {
114+ if (!enabled)
115+ return;
116+ d.enabled = false;
117+ root.responded(text);
118+ }
119+
120+ Keys.onEscapePressed: root.canceled()
121+
122+ // We use our own custom placeholder label instead of the standard
123+ // TextField one because the standard one hardcodes baseText as the
124+ // palette color, whereas we want raisedSecondaryText.
125+ Label {
126+ id: hint
127+ anchors {
128+ left: parent.left
129+ right: parent.right
130+ verticalCenter: parent.verticalCenter
131+ leftMargin: units.gu(1.5)
132+ rightMargin: anchors.leftMargin +
133+ (capsIcon.visible ? capsIcon.width + passwordInput.frameSpacing
134+ : 0)
135+ }
136+ text: root.text
137+ visible: passwordInput.text == "" && !passwordInput.inputMethodComposing
138+ color: d.drawColor
139+ elide: Text.ElideRight
140+ }
141+ }
142+}
qml/Greeter/LoginList.qml+59−76
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -15,10 +15,11 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18+import QtGraphicalEffects 1.0
18import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
19import "../Components"
20import "../Components"
20
21
21−Item {
22+StyledItem {
22 id: root
23 id: root
23
24
24 property alias model: userList.model
25 property alias model: userList.model
@@ -28,7 +29,7 @@ Item {
28
29
29 readonly property int numAboveBelow: 4
30 readonly property int numAboveBelow: 4
30 readonly property int cellHeight: units.gu(5)
31 readonly property int cellHeight: units.gu(5)
31− readonly property int highlightedHeight: units.gu(10)
32+ readonly property int highlightedHeight: units.gu(15)
32 readonly property int moveDuration: 200
33 readonly property int moveDuration: 200
33 readonly property string currentUser: userList.currentItem.username
34 readonly property string currentUser: userList.currentItem.username
34 property bool wasPrompted: false
35 property bool wasPrompted: false
@@ -57,10 +58,9 @@ Item {
57 }
58 }
58
59
59 function showPrompt(text, isSecret, isDefaultPrompt) {
60 function showPrompt(text, isSecret, isDefaultPrompt) {
60− passwordInput.text = "";
61− passwordInput.promptText = text;
61+ d.promptText = text;
62− passwordInput.enabled = true;
62+ passwordInput.reset();
63− passwordInput.echoMode = isSecret ? TextInput.Password : TextInput.Normal;
63+ passwordInput.isSecret = isSecret;
64 if (wasPrompted) // stay in text field if second prompt
64 if (wasPrompted) // stay in text field if second prompt
65 passwordInput.focus = true;
65 passwordInput.focus = true;
66 wasPrompted = true;
66 wasPrompted = true;
@@ -78,6 +78,16 @@ Item {
78 root.resetAuthentication();
78 root.resetAuthentication();
79 }
79 }
80
80
81+ QtObject {
82+ id: d
83+
84+ property string promptText
85+ }
86+
87+ theme: ThemeSettings {
88+ name: "Ubuntu.Components.Themes.Ambiance"
89+ }
90+
81 Keys.onEscapePressed: {
91 Keys.onEscapePressed: {
82 selected(currentIndex);
92 selected(currentIndex);
83 }
93 }
@@ -86,19 +96,30 @@ Item {
86 userList.currentIndex = currentIndex;
96 userList.currentIndex = currentIndex;
87 }
97 }
88
98
89− Rectangle {
99+ BorderImage {
100+ anchors {
101+ fill: highlightItem
102+ topMargin: -units.gu(1)
103+ leftMargin: -units.gu(1.5)
104+ rightMargin: -units.gu(1.5)
105+ bottomMargin: -units.gu(1.5)
106+ }
107+ source: "../Stages/graphics/dropshadow2gu.sci"
108+ opacity: 0.35
109+ }
110+
111+ UbuntuShape {
90 id: highlightItem
112 id: highlightItem
91 anchors {
113 anchors {
92 left: parent.left
114 left: parent.left
115+ leftMargin: units.gu(2)
93 right: parent.right
116 right: parent.right
117+ rightMargin: units.gu(2)
94 verticalCenter: parent.verticalCenter
118 verticalCenter: parent.verticalCenter
95 }
119 }
96 height: root.highlightedHeight
120 height: root.highlightedHeight
97− color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
121+ aspect: UbuntuShape.Flat
98− border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
122+ backgroundColor: theme.palette.normal.raised
99− border.width: units.dp(1)
100− radius: units.gu(1.5)
101− antialiasing: true
102 }
123 }
103
124
104 ListView {
125 ListView {
@@ -106,6 +127,8 @@ Item {
106 objectName: "userList"
127 objectName: "userList"
107
128
108 anchors.fill: parent
129 anchors.fill: parent
130+ anchors.leftMargin: units.gu(2)
131+ anchors.rightMargin: units.gu(2)
109
132
110 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
133 preferredHighlightBegin: userList.height / 2 - root.highlightedHeight / 2
111 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
134 preferredHighlightEnd: userList.height / 2 - root.highlightedHeight / 2
@@ -151,7 +174,7 @@ Item {
151 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
174 return 1 - Math.min(1, (Math.abs(highlightDist) + root.cellHeight) / ((root.numAboveBelow + 1) * root.cellHeight))
152 }
175 }
153
176
154− Label {
177+ FadingLabel {
155 objectName: "username" + index
178 objectName: "username" + index
156
179
157 anchors {
180 anchors {
@@ -159,13 +182,12 @@ Item {
159 leftMargin: units.gu(2)
182 leftMargin: units.gu(2)
160 right: parent.right
183 right: parent.right
161 rightMargin: units.gu(2)
184 rightMargin: units.gu(2)
162− top: parent.top
185+ bottom: parent.top
163− // Add an offset to topMargin for any items below the highlight
186+ // Add an offset to bottomMargin for any items below the highlight
164− topMargin: units.gu(1) + (parent.belowHighlight ? parent.belowOffset : 0)
187+ bottomMargin: -(units.gu(4) + (parent.belowHighlight ? parent.belowOffset : 0))
165 }
188 }
166 text: realName
189 text: realName
167− color: "white"
190+ color: userList.currentIndex !== index ? theme.palette.normal.raised : theme.palette.normal.raisedText
168− elide: Text.ElideRight
169
191
170 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
192 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
171 }
193 }
@@ -196,23 +218,22 @@ Item {
196 }
218 }
197 }
219 }
198
220
199− Label {
221+ FadingLabel {
200 id: infoLabel
222 id: infoLabel
201 objectName: "infoLabel"
223 objectName: "infoLabel"
202 anchors {
224 anchors {
203 bottom: passwordInput.top
225 bottom: passwordInput.top
204− left: parent.left
226+ left: highlightItem.left
205 topMargin: units.gu(1)
227 topMargin: units.gu(1)
206 bottomMargin: units.gu(1)
228 bottomMargin: units.gu(1)
207 leftMargin: units.gu(2)
229 leftMargin: units.gu(2)
208 rightMargin: units.gu(1)
230 rightMargin: units.gu(1)
209 }
231 }
210
232
211− color: "white"
233+ color: theme.palette.normal.raisedText
212 width: root.width - anchors.leftMargin - anchors.rightMargin
234 width: root.width - anchors.leftMargin - anchors.rightMargin
213 fontSize: "small"
235 fontSize: "small"
214 textFormat: Text.StyledText
236 textFormat: Text.StyledText
215− clip: true
216
237
217 opacity: (userList.movingInternally || text == "") ? 0 : 1
238 opacity: (userList.movingInternally || text == "") ? 0 : 1
218 Behavior on opacity {
239 Behavior on opacity {
@@ -220,72 +241,36 @@ Item {
220 }
241 }
221 }
242 }
222
243
223− TextField {
244+ GreeterPrompt {
224 id: passwordInput
245 id: passwordInput
225 objectName: "passwordInput"
246 objectName: "passwordInput"
226 anchors {
247 anchors {
227 bottom: highlightItem.bottom
248 bottom: highlightItem.bottom
228− horizontalCenter: parent.horizontalCenter
249+ horizontalCenter: highlightItem.horizontalCenter
229− margins: units.gu(1)
250+ margins: units.gu(2)
230 }
251 }
231− height: units.gu(4.5)
232− width: parent.width - anchors.margins * 2
252+ width: highlightItem.width - anchors.margins * 2
233 opacity: userList.movingInternally ? 0 : 1
253 opacity: userList.movingInternally ? 0 : 1
234
254
235− inputMethodHints: root.alphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
255+ isPrompt: root.wasPrompted
256+ isAlphanumeric: root.alphanumeric
236
257
237− property string promptText
238− placeholderText: root.wasPrompted ? promptText
258+ text: root.wasPrompted ? d.promptText
239− : (root.locked ? i18n.tr("Retry")
259+ : (root.locked ? i18n.tr("Retry")
240− : i18n.tr("Tap to unlock"))
260+ : i18n.tr("Log In"))
261+
262+ onClicked: root.tryToUnlock()
263+ onResponded: root.responded(text)
264+ onCanceled: root.selected(currentIndex)
241
265
242 Behavior on opacity {
266 Behavior on opacity {
243 NumberAnimation { duration: 100 }
267 NumberAnimation { duration: 100 }
244 }
268 }
245
269
246− onAccepted: {
247− if (!enabled)
248− return;
249− root.focus = true; // so that it can handle Escape presses for us
250− enabled = false;
251− root.responded(text);
252− }
253− Keys.onEscapePressed: {
254− root.selected(currentIndex);
255− }
256−
257− Image {
258− anchors {
259− right: parent.right
260− rightMargin: units.gu(2)
261− verticalCenter: parent.verticalCenter
262− }
263− visible: !root.wasPrompted
264− source: "graphics/icon_arrow.png"
265− }
266−
267 WrongPasswordAnimation {
270 WrongPasswordAnimation {
268 id: wrongPasswordAnimation
271 id: wrongPasswordAnimation
269 target: passwordInput
272 target: passwordInput
270 }
273 }
271−
272− Connections {
273− target: Qt.inputMethod
274− onVisibleChanged: {
275− if (!Qt.inputMethod.visible) {
276− passwordInput.focus = false;
277− }
278− }
279− }
280−
281− }
282−
283− MouseArea {
284− id: passwordMouseArea
285− objectName: "passwordMouseArea"
286− anchors.fill: passwordInput
287− enabled: !root.wasPrompted
288− onClicked: root.tryToUnlock()
289 }
274 }
290
275
291 function resetAuthentication() {
276 function resetAuthentication() {
@@ -293,10 +278,8 @@ Item {
293 return;
278 return;
294 }
279 }
295 infoLabel.text = "";
280 infoLabel.text = "";
296− passwordInput.promptText = "";
281+ d.promptText = "";
297− passwordInput.text = "";
282+ passwordInput.reset();
298− passwordInput.focus = false;
299− passwordInput.enabled = true;
300 root.wasPrompted = false;
283 root.wasPrompted = false;
301 }
284 }
302}
285}
qml/Greeter/WideView.qml+1−1
@@ -121,7 +121,7 @@ FocusScope {
121 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
121 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
122 top: parent.top
122 top: parent.top
123 }
123 }
124− width: units.gu(29)
124+ width: units.gu(40)
125 height: inputMethod && inputMethod.visible ? parent.height - inputMethod.keyboardRectangle.height
125 height: inputMethod && inputMethod.visible ? parent.height - inputMethod.keyboardRectangle.height
126 : parent.height
126 : parent.height
127 Behavior on height { UbuntuNumberAnimation {} }
127 Behavior on height { UbuntuNumberAnimation {} }
tests/mocks/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp+1−1
@@ -89,7 +89,7 @@ void UsersModelPrivate::resetEntries_full()
89 { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, 0, 0 },
89 { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, 0, 0 },
90 { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, 0, 0 },
90 { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, 0, 0 },
91 { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, 0, 0 },
91 { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, 0, 0 },
92− { "long-name", "Long name (far far too long to fit)", 0, 0, false, false, 0, 0 },
92+ { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, 0, 0 },
93 { "color-background", "Color Background", "#dd4814", 0, false, false, 0, 0 },
93 { "color-background", "Color Background", "#dd4814", 0, false, false, 0, 0 },
94 // white and black are a bit redundant, but useful for manually testing if UI is still readable
94 // white and black are a bit redundant, but useful for manually testing if UI is still readable
95 { "white-background", "White Background", "#ffffff", 0, false, false, 0, 0 },
95 { "white-background", "White Background", "#ffffff", 0, false, false, 0, 0 },
tests/qmltests/Greeter/tst_WideView.qml+21−28
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -22,11 +22,13 @@ import IntegratedLightDM 0.1 as LightDM
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
24
24
25−Item {
25+StyledItem {
26 id: root
26 id: root
27 width: units.gu(120)
27 width: units.gu(120)
28 height: units.gu(80)
28 height: units.gu(80)
29
29
30+ theme.name: "Ubuntu.Components.Themes.SuruDark"
31+
30 Binding {
32 Binding {
31 target: LightDM.Users
33 target: LightDM.Users
32 property: "mockMode"
34 property: "mockMode"
@@ -103,7 +105,7 @@ Item {
103
105
104 Rectangle {
106 Rectangle {
105 id: controls
107 id: controls
106− color: "white"
108+ color: theme.palette.normal.background
107 width: units.gu(40)
109 width: units.gu(40)
108 height: parent.height
110 height: parent.height
109
111
@@ -392,8 +394,8 @@ Item {
392 view.locked = true;
394 view.locked = true;
393 view.showPrompt("Prompt", true, true);
395 view.showPrompt("Prompt", true, true);
394 var passwordInput = findChild(view, "passwordInput");
396 var passwordInput = findChild(view, "passwordInput");
395− compare(passwordInput.placeholderText, "Prompt");
397+ compare(passwordInput.text, "Prompt");
396− compare(passwordInput.echoMode, TextInput.Password);
398+ verify(passwordInput.isSecret);
397 tap(passwordInput);
399 tap(passwordInput);
398 typeString("password");
400 typeString("password");
399 keyClick(Qt.Key_Enter);
401 keyClick(Qt.Key_Enter);
@@ -405,8 +407,8 @@ Item {
405 view.locked = true;
407 view.locked = true;
406 view.showPrompt("otp", false, false);
408 view.showPrompt("otp", false, false);
407 var passwordInput = findChild(view, "passwordInput");
409 var passwordInput = findChild(view, "passwordInput");
408− compare(passwordInput.placeholderText, "otp");
410+ compare(passwordInput.text, "otp");
409− compare(passwordInput.echoMode, TextInput.Normal);
411+ verify(!passwordInput.isSecret);
410 tap(passwordInput);
412 tap(passwordInput);
411 typeString("foo");
413 typeString("foo");
412 keyClick(Qt.Key_Enter);
414 keyClick(Qt.Key_Enter);
@@ -439,7 +441,6 @@ Item {
439 var infoLabel = findChild(view, "infoLabel");
441 var infoLabel = findChild(view, "infoLabel");
440 compare(infoLabel.text, "Welcome to Unity Greeter<br><font color=\"#df382c\">This is an error</font><br>You should have seen three messages and this is a really long message too. wow so long much length");
442 compare(infoLabel.text, "Welcome to Unity Greeter<br><font color=\"#df382c\">This is an error</font><br>You should have seen three messages and this is a really long message too. wow so long much length");
441 compare(infoLabel.textFormat, Text.StyledText);
443 compare(infoLabel.textFormat, Text.StyledText);
442− compare(infoLabel.clip, true);
443 verify(infoLabel.contentWidth > infoLabel.width);
444 verify(infoLabel.contentWidth > infoLabel.width);
444 verify(infoLabel.opacity < 1);
445 verify(infoLabel.opacity < 1);
445 tryCompare(infoLabel, "opacity", 1);
446 tryCompare(infoLabel, "opacity", 1);
@@ -451,15 +452,15 @@ Item {
451 selectedSpy.clear();
452 selectedSpy.clear();
452 view.locked = true;
453 view.locked = true;
453 view.showPrompt("Prompt", true, true);
454 view.showPrompt("Prompt", true, true);
454− var passwordInput = findChild(view, "passwordInput");
455+ var promptField = findChild(view, "promptField");
455− tap(passwordInput);
456+ tap(promptField);
456− compare(passwordInput.focus, true);
457+ compare(promptField.focus, true);
457− compare(passwordInput.enabled, true);
458+ compare(promptField.enabled, true);
458
459
459 typeString("password");
460 typeString("password");
460 keyClick(Qt.Key_Enter);
461 keyClick(Qt.Key_Enter);
461− compare(passwordInput.focus, false);
462+ compare(promptField.focus, true);
462− compare(passwordInput.enabled, false);
463+ compare(promptField.enabled, false);
463
464
464 compare(selectedSpy.count, 0);
465 compare(selectedSpy.count, 0);
465 keyClick(Qt.Key_Escape);
466 keyClick(Qt.Key_Escape);
@@ -467,8 +468,8 @@ Item {
467 compare(selectedSpy.signalArguments[0][0], 1);
468 compare(selectedSpy.signalArguments[0][0], 1);
468
469
469 view.reset();
470 view.reset();
470− compare(passwordInput.focus, false);
471+ compare(promptField.focus, false);
471− compare(passwordInput.enabled, true);
472+ compare(promptField.enabled, true);
472 }
473 }
473
474
474 function test_unicode() {
475 function test_unicode() {
@@ -477,17 +478,11 @@ Item {
477 tryCompare(label, "text", "가나다라마");
478 tryCompare(label, "text", "가나다라마");
478 }
479 }
479
480
480− function test_longName() {
481− var index = selectUser("long-name");
482− var label = findChild(view, "username" + index);
483− tryCompare(label, "truncated", true);
484− }
485−
486 function test_promptless() {
481 function test_promptless() {
487 var passwordInput = findChild(view, "passwordInput");
482 var passwordInput = findChild(view, "passwordInput");
488
483
489 view.locked = true;
484 view.locked = true;
490− compare(passwordInput.placeholderText, "Retry");
485+ compare(passwordInput.text, "Retry");
491 tap(passwordInput);
486 tap(passwordInput);
492 compare(respondedSpy.count, 0);
487 compare(respondedSpy.count, 0);
493 compare(selectedSpy.count, 1);
488 compare(selectedSpy.count, 1);
@@ -495,7 +490,7 @@ Item {
495 selectedSpy.clear();
490 selectedSpy.clear();
496
491
497 view.locked = false;
492 view.locked = false;
498− compare(passwordInput.placeholderText, "Tap to unlock");
493+ compare(passwordInput.text, "Log In");
499 tap(passwordInput);
494 tap(passwordInput);
500 compare(selectedSpy.count, 0);
495 compare(selectedSpy.count, 0);
501 compare(respondedSpy.count, 1);
496 compare(respondedSpy.count, 1);
@@ -527,11 +522,9 @@ Item {
527 var passwordInput = findChild(view, "passwordInput");
522 var passwordInput = findChild(view, "passwordInput");
528
523
529 verify(view.alphanumeric);
524 verify(view.alphanumeric);
530− compare(passwordInput.inputMethodHints, Qt.ImhNone);
525+ verify(passwordInput.isAlphanumeric);
531 view.alphanumeric = false;
526 view.alphanumeric = false;
532− compare(passwordInput.inputMethodHints, Qt.ImhDigitsOnly);
527+ verify(!passwordInput.isAlphanumeric);
533− view.alphanumeric = true;
534− compare(passwordInput.inputMethodHints, Qt.ImhNone);
535 }
528 }
536 }
529 }
537}
530}
tests/qmltests/tst_Shell.qml+8−4
@@ -810,10 +810,14 @@ Rectangle {
810 var greeter = findChild(shell, "greeter")
810 var greeter = findChild(shell, "greeter")
811 tryCompare(greeter, "fullyShown", true);
811 tryCompare(greeter, "fullyShown", true);
812
812
813− var passwordMouseArea = findChild(shell, "passwordMouseArea")
813+ var passwordInput = findChild(shell, "passwordInput");
814+
815+ var promptButton = findChild(passwordInput, "promptButton");
816+ tryCompare(promptButton, "visible", isButton);
817+
818+ var promptField = findChild(passwordInput, "promptField");
814− tryCompare(passwordMouseArea, "enabled", isButton)
819+ tryCompare(promptField, "visible", !isButton);
815
820
816− var passwordInput = findChild(shell, "passwordInput")
817 mouseClick(passwordInput)
821 mouseClick(passwordInput)
818 }
822 }
819
823
@@ -2370,7 +2374,7 @@ Rectangle {
2370 function test_switchKeymap() {
2374 function test_switchKeymap() {
2371 // start with phone shell
2375 // start with phone shell
2372 loadShell("phone");
2376 loadShell("phone");
2373− shell.usageScenario = "shell";
2377+ shell.usageScenario = "phone";
2374 waitForRendering(shell);
2378 waitForRendering(shell);
2375 swipeAwayGreeter();
2379 swipeAwayGreeter();
2376
2380