Merge lp:~mterry/unity8/slim_greeter_select_user into lp:~josharenson/unity8/slim_greeter_real_lightdm
- slim_greeter_select_user
- Merge into slim_greeter_real_lightdm
Proposed by
Michael Terry
Status: | Merged |
---|---|
Approved by: | Josh Arenson |
Approved revision: | 1996 |
Merged at revision: | 1989 |
Proposed branch: | lp:~mterry/unity8/slim_greeter_select_user |
Merge into: | lp:~josharenson/unity8/slim_greeter_real_lightdm |
Diff against target: |
456 lines (+142/-71) 17 files modified
data/51-unity8-greeter.conf (+0/-3) data/unity8-greeter.desktop.in (+1/-1) data/unity8-greeter.pkla (+44/-0) debian/unity8-greeter.install (+1/-0) plugins/LightDM/Greeter.cpp (+6/-0) plugins/LightDM/Greeter.h (+2/-0) plugins/Unity/Indicators/indicatorsmanager.cpp (+1/-1) qml/Greeter/Greeter.qml (+19/-10) qml/Shell.qml (+8/-3) qml/Stages/ShimStage.qml (+0/-43) tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp (+16/-0) tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h (+5/-0) tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp (+8/-1) tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h (+1/-0) tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+1/-0) tests/qmltests/Greeter/TestView.qml (+2/-0) tests/qmltests/Greeter/tst_Greeter.qml (+27/-9) |
To merge this branch: | bzr merge lp:~mterry/unity8/slim_greeter_select_user |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Josh Arenson | Approve | ||
Review via email: mp+296854@code.launchpad.net |
Commit message
Support selectUserHint.
Description of the change
Support selectUserHint.
I also stuck some unrelated fixes in here, that we probably want in the base slim greeter branch.
To post a comment you must log in.
- 1993. By Michael Terry
-
Add pkla and nerf indicators as much as possible until we have proper app launching
- 1994. By Michael Terry
-
Use cmake install locations rather than hardcoding them
- 1995. By Michael Terry
-
Add more tests for selectUser
Revision history for this message
Michael Terry (mterry) wrote : | # |
Added test for non-existent user. (And we agreed to not worry about your inline comment.)
I'm looking at a failure in Greeter:
Revision history for this message
Michael Terry (mterry) wrote : | # |
Oh, that was easy. Fixed test_promptless.
- 1996. By Michael Terry
-
Fix test_promptless
Revision history for this message
Josh Arenson (josharenson) wrote : | # |
Looks good to me, now that my internet is fast enough to clone and test locally.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/51-unity8-greeter.conf' | |||
2 | --- data/51-unity8-greeter.conf 2016-06-07 16:20:53 +0000 | |||
3 | +++ data/51-unity8-greeter.conf 2016-06-09 21:56:24 +0000 | |||
4 | @@ -1,5 +1,2 @@ | |||
5 | 1 | [Seat:*] | 1 | [Seat:*] |
6 | 2 | greeter-session=unity8-greeter | 2 | greeter-session=unity8-greeter |
7 | 3 | |||
8 | 4 | # When unity8 can be run under mir on the desktop, change this to unity. | ||
9 | 5 | type=unity | ||
10 | 6 | 3 | ||
11 | === modified file 'data/unity8-greeter.desktop.in' | |||
12 | --- data/unity8-greeter.desktop.in 2016-01-22 15:41:14 +0000 | |||
13 | +++ data/unity8-greeter.desktop.in 2016-06-09 21:56:24 +0000 | |||
14 | @@ -2,6 +2,6 @@ | |||
15 | 2 | Type=Application | 2 | Type=Application |
16 | 3 | Name=Unity 8 Greeter | 3 | Name=Unity 8 Greeter |
17 | 4 | Comment=The converged Unity shell's Greeter | 4 | Comment=The converged Unity shell's Greeter |
19 | 5 | Exec=/usr/bin/unity8-greeter-wrapper /usr/bin/unity8 --mode=greeter | 5 | Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter-wrapper @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8 --mode=greeter |
20 | 6 | X-LightDM-Session-Type=mir | 6 | X-LightDM-Session-Type=mir |
21 | 7 | X-Ubuntu-Touch=true | 7 | X-Ubuntu-Touch=true |
22 | 8 | 8 | ||
23 | === added file 'data/unity8-greeter.pkla' | |||
24 | --- data/unity8-greeter.pkla 1970-01-01 00:00:00 +0000 | |||
25 | +++ data/unity8-greeter.pkla 2016-06-09 21:56:24 +0000 | |||
26 | @@ -0,0 +1,44 @@ | |||
27 | 1 | # DO NOT EDIT THIS FILE, it will be overwritten on update | ||
28 | 2 | # Place your local configurations under /etc/polkit-1/localauthority/ | ||
29 | 3 | |||
30 | 4 | [Disable Controlling of Network Devices] | ||
31 | 5 | Identity=unix-user:lightdm | ||
32 | 6 | Action=org.freedesktop.NetworkManager.enable-disable-network;org.freedesktop.NetworkManager.enable-disable-wifi;org.freedesktop.NetworkManager.enable-disable-wwan;org.freedesktop.NetworkManager.enable-disable-wimax; | ||
33 | 7 | ResultActive=no | ||
34 | 8 | ResultInactive=no | ||
35 | 9 | ResultsAny=no | ||
36 | 10 | |||
37 | 11 | [Disable Sleep and Wake] | ||
38 | 12 | Identity=unix-user:lightdm | ||
39 | 13 | Action=org.freedesktop.NetworkManager.sleep-wake | ||
40 | 14 | ResultActive=no | ||
41 | 15 | ResultInactive=no | ||
42 | 16 | ResultsAny=no | ||
43 | 17 | |||
44 | 18 | [Disable WiFi Sharing] | ||
45 | 19 | Identity=unix-user:lightdm | ||
46 | 20 | Action=org.freedesktop.NetworkManager.wifi.share.protected;org.freedesktop.NetworkManager.wifi.share.open | ||
47 | 21 | ResultActive=no | ||
48 | 22 | ResultInactive=no | ||
49 | 23 | ResultsAny=no | ||
50 | 24 | |||
51 | 25 | [Disable Settings Modifications] | ||
52 | 26 | Identity=unix-user:lightdm | ||
53 | 27 | Action=org.freedesktop.NetworkManager.settings.modify.own;org.freedesktop.NetworkManager.settings.modify.system;org.freedesktop.NetworkManager.settings.modify.hostname | ||
54 | 28 | ResultActive=no | ||
55 | 29 | ResultInactive=no | ||
56 | 30 | ResultsAny=no | ||
57 | 31 | |||
58 | 32 | [Disable User Connections] | ||
59 | 33 | Identity=unix-user:lightdm | ||
60 | 34 | Action=org.freedesktop.NetworkManager.use-user-connections | ||
61 | 35 | ResultActive=no | ||
62 | 36 | ResultInactive=no | ||
63 | 37 | ResultsAny=no | ||
64 | 38 | |||
65 | 39 | [Enable Controlling of Network Connections] | ||
66 | 40 | Identity=unix-user:lightdm | ||
67 | 41 | Action=org.freedesktop.NetworkManager.network-control | ||
68 | 42 | ResultActive=yes | ||
69 | 43 | ResultInactive=no | ||
70 | 44 | ResultsAny=no | ||
71 | 0 | 45 | ||
72 | === modified file 'debian/unity8-greeter.install' | |||
73 | --- debian/unity8-greeter.install 2016-01-22 15:24:02 +0000 | |||
74 | +++ debian/unity8-greeter.install 2016-06-09 21:56:24 +0000 | |||
75 | @@ -1,4 +1,5 @@ | |||
76 | 1 | data/unity8-greeter-wrapper usr/bin/ | 1 | data/unity8-greeter-wrapper usr/bin/ |
77 | 2 | data/unity8-greeter-init.conf usr/share/upstart/sessions/ | 2 | data/unity8-greeter-init.conf usr/share/upstart/sessions/ |
78 | 3 | data/unity8-greeter.pkla /var/lib/polkit-1/localauthority/10-vendor.d/ | ||
79 | 3 | usr/share/lightdm/greeters/unity8-greeter.desktop | 4 | usr/share/lightdm/greeters/unity8-greeter.desktop |
80 | 4 | usr/share/lightdm/lightdm.conf.d/51-unity8-greeter.conf | 5 | usr/share/lightdm/lightdm.conf.d/51-unity8-greeter.conf |
81 | 5 | 6 | ||
82 | === modified file 'plugins/LightDM/Greeter.cpp' | |||
83 | --- plugins/LightDM/Greeter.cpp 2015-10-01 23:54:24 +0000 | |||
84 | +++ plugins/LightDM/Greeter.cpp 2016-06-09 21:56:24 +0000 | |||
85 | @@ -78,6 +78,12 @@ | |||
86 | 78 | return d->promptless; | 78 | return d->promptless; |
87 | 79 | } | 79 | } |
88 | 80 | 80 | ||
89 | 81 | QString Greeter::selectUser() const | ||
90 | 82 | { | ||
91 | 83 | Q_D(const Greeter); | ||
92 | 84 | return d->m_greeter->selectUserHint(); | ||
93 | 85 | } | ||
94 | 86 | |||
95 | 81 | void Greeter::authenticate(const QString &username) | 87 | void Greeter::authenticate(const QString &username) |
96 | 82 | { | 88 | { |
97 | 83 | Q_D(Greeter); | 89 | Q_D(Greeter); |
98 | 84 | 90 | ||
99 | === modified file 'plugins/LightDM/Greeter.h' | |||
100 | --- plugins/LightDM/Greeter.h 2015-09-11 13:38:45 +0000 | |||
101 | +++ plugins/LightDM/Greeter.h 2016-06-09 21:56:24 +0000 | |||
102 | @@ -38,6 +38,7 @@ | |||
103 | 38 | Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged) | 38 | Q_PROPERTY(bool authenticated READ isAuthenticated NOTIFY isAuthenticatedChanged) |
104 | 39 | Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged) | 39 | Q_PROPERTY(QString authenticationUser READ authenticationUser NOTIFY authenticationUserChanged) |
105 | 40 | Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged) | 40 | Q_PROPERTY(bool promptless READ promptless NOTIFY promptlessChanged) |
106 | 41 | Q_PROPERTY(QString selectUser READ selectUser CONSTANT) | ||
107 | 41 | 42 | ||
108 | 42 | public: | 43 | public: |
109 | 43 | explicit Greeter(QObject* parent=0); | 44 | explicit Greeter(QObject* parent=0); |
110 | @@ -46,6 +47,7 @@ | |||
111 | 46 | bool isAuthenticated() const; | 47 | bool isAuthenticated() const; |
112 | 47 | QString authenticationUser() const; | 48 | QString authenticationUser() const; |
113 | 48 | bool promptless() const; | 49 | bool promptless() const; |
114 | 50 | QString selectUser() const; | ||
115 | 49 | 51 | ||
116 | 50 | public Q_SLOTS: | 52 | public Q_SLOTS: |
117 | 51 | void authenticate(const QString &username=QString()); | 53 | void authenticate(const QString &username=QString()); |
118 | 52 | 54 | ||
119 | === modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp' | |||
120 | --- plugins/Unity/Indicators/indicatorsmanager.cpp 2016-03-29 03:47:39 +0000 | |||
121 | +++ plugins/Unity/Indicators/indicatorsmanager.cpp 2016-06-09 21:56:24 +0000 | |||
122 | @@ -291,7 +291,7 @@ | |||
123 | 291 | // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs) | 291 | // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs) |
124 | 292 | if ((new_indicator->identifier() == QStringLiteral("indicator-session")) | 292 | if ((new_indicator->identifier() == QStringLiteral("indicator-session")) |
125 | 293 | || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) { | 293 | || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) { |
127 | 294 | new_indicator->setProfile(QStringLiteral("desktop")); | 294 | new_indicator->setProfile(m_profile.replace(QStringLiteral("phone"), QStringLiteral("desktop"))); |
128 | 295 | } else { | 295 | } else { |
129 | 296 | new_indicator->setProfile(m_profile); | 296 | new_indicator->setProfile(m_profile); |
130 | 297 | } | 297 | } |
131 | 298 | 298 | ||
132 | === modified file 'qml/Greeter/Greeter.qml' | |||
133 | --- qml/Greeter/Greeter.qml 2016-05-02 18:43:06 +0000 | |||
134 | +++ qml/Greeter/Greeter.qml 2016-06-09 21:56:24 +0000 | |||
135 | @@ -114,7 +114,8 @@ | |||
136 | 114 | id: d | 114 | id: d |
137 | 115 | 115 | ||
138 | 116 | readonly property bool multiUser: LightDMService.users.count > 1 | 116 | readonly property bool multiUser: LightDMService.users.count > 1 |
140 | 117 | property int currentIndex | 117 | readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser) |
141 | 118 | property int currentIndex: Math.max(selectUserIndex, 0) | ||
142 | 118 | property bool waiting | 119 | property bool waiting |
143 | 119 | 120 | ||
144 | 120 | // We want 'launcherOffset' to animate down to zero. But not to animate | 121 | // We want 'launcherOffset' to animate down to zero. But not to animate |
145 | @@ -131,7 +132,23 @@ | |||
146 | 131 | UbuntuNumberAnimation {} | 132 | UbuntuNumberAnimation {} |
147 | 132 | } | 133 | } |
148 | 133 | 134 | ||
149 | 135 | function getUserIndex(username) { | ||
150 | 136 | if (username === "") | ||
151 | 137 | return -1; | ||
152 | 138 | |||
153 | 139 | // Find index for requested user, if it exists | ||
154 | 140 | for (var i = 0; i < LightDMService.users.count; i++) { | ||
155 | 141 | if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) { | ||
156 | 142 | return i; | ||
157 | 143 | } | ||
158 | 144 | } | ||
159 | 145 | |||
160 | 146 | return -1; | ||
161 | 147 | } | ||
162 | 148 | |||
163 | 134 | function selectUser(uid, reset) { | 149 | function selectUser(uid, reset) { |
164 | 150 | if (uid < 0) | ||
165 | 151 | return; | ||
166 | 135 | d.waiting = true; | 152 | d.waiting = true; |
167 | 136 | if (reset) { | 153 | if (reset) { |
168 | 137 | loader.item.reset(); | 154 | loader.item.reset(); |
169 | @@ -440,15 +457,7 @@ | |||
170 | 440 | } | 457 | } |
171 | 441 | } | 458 | } |
172 | 442 | 459 | ||
182 | 443 | onRequestAuthenticationUser: { | 460 | onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true) |
174 | 444 | // Find index for requested user, if it exists | ||
175 | 445 | for (var i = 0; i < LightDMService.users.count; i++) { | ||
176 | 446 | if (user === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) { | ||
177 | 447 | d.selectUser(i, true); | ||
178 | 448 | return; | ||
179 | 449 | } | ||
180 | 450 | } | ||
181 | 451 | } | ||
183 | 452 | } | 461 | } |
184 | 453 | 462 | ||
185 | 454 | Connections { | 463 | Connections { |
186 | 455 | 464 | ||
187 | === modified file 'qml/Shell.qml' | |||
188 | --- qml/Shell.qml 2016-06-07 16:10:36 +0000 | |||
189 | +++ qml/Shell.qml 2016-06-09 21:56:24 +0000 | |||
190 | @@ -259,8 +259,8 @@ | |||
191 | 259 | ? "phone" | 259 | ? "phone" |
192 | 260 | : shell.usageScenario | 260 | : shell.usageScenario |
193 | 261 | readonly property string qmlComponent: { | 261 | readonly property string qmlComponent: { |
196 | 262 | if(shell.mode === "greeter") { | 262 | if (shell.mode === "greeter") { |
197 | 263 | return "Stages/ShimStage.qml" | 263 | return "Stages/AbstractStage.qml" |
198 | 264 | } else if (applicationsDisplayLoader.usageScenario === "phone") { | 264 | } else if (applicationsDisplayLoader.usageScenario === "phone") { |
199 | 265 | return "Stages/PhoneStage.qml"; | 265 | return "Stages/PhoneStage.qml"; |
200 | 266 | } else if (applicationsDisplayLoader.usageScenario === "tablet") { | 266 | } else if (applicationsDisplayLoader.usageScenario === "tablet") { |
201 | @@ -531,7 +531,12 @@ | |||
202 | 531 | 531 | ||
203 | 532 | indicatorsModel: Indicators.IndicatorsModel { | 532 | indicatorsModel: Indicators.IndicatorsModel { |
204 | 533 | // tablet and phone both use the same profile | 533 | // tablet and phone both use the same profile |
206 | 534 | profile: "phone" | 534 | // FIXME: use just "phone" for greeter too, but first fix |
207 | 535 | // greeter app launching to either load the app inside the | ||
208 | 536 | // greeter or tell the session to load the app. This will | ||
209 | 537 | // involve taking the url-dispatcher dbus name and using | ||
210 | 538 | // SessionBroadcast to tell the session. | ||
211 | 539 | profile: shell.mode === "greeter" ? "desktop_greeter" : "phone" | ||
212 | 535 | Component.onCompleted: load(); | 540 | Component.onCompleted: load(); |
213 | 536 | } | 541 | } |
214 | 537 | } | 542 | } |
215 | 538 | 543 | ||
216 | === removed file 'qml/Stages/ShimStage.qml' | |||
217 | --- qml/Stages/ShimStage.qml 2016-04-14 13:28:11 +0000 | |||
218 | +++ qml/Stages/ShimStage.qml 1970-01-01 00:00:00 +0000 | |||
219 | @@ -1,43 +0,0 @@ | |||
220 | 1 | /* | ||
221 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
222 | 3 | * | ||
223 | 4 | * This program is free software; you can redistribute it and/or modify | ||
224 | 5 | * it under the terms of the GNU General Public License as published by | ||
225 | 6 | * the Free Software Foundation; version 3. | ||
226 | 7 | * | ||
227 | 8 | * This program is distributed in the hope that it will be useful, | ||
228 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
229 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
230 | 11 | * GNU General Public License for more details. | ||
231 | 12 | * | ||
232 | 13 | * You should have received a copy of the GNU General Public License | ||
233 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
234 | 15 | */ | ||
235 | 16 | |||
236 | 17 | import QtQuick 2.4 | ||
237 | 18 | import Ubuntu.Components 1.3 | ||
238 | 19 | |||
239 | 20 | AbstractStage { | ||
240 | 21 | id: shimStage | ||
241 | 22 | |||
242 | 23 | anchors.fill: parent | ||
243 | 24 | |||
244 | 25 | Text { | ||
245 | 26 | id: greeterModeText | ||
246 | 27 | |||
247 | 28 | anchors.horizontalCenter: parent.horizontalCenter | ||
248 | 29 | anchors.top: parent.top | ||
249 | 30 | anchors.topMargin: units.gu(10) | ||
250 | 31 | font.bold: true | ||
251 | 32 | horizontalAlignment: Text.AlignHCenter | ||
252 | 33 | text: "Shell is in \"greeter\" mode" | ||
253 | 34 | } | ||
254 | 35 | |||
255 | 36 | Text { | ||
256 | 37 | anchors.centerIn: parent | ||
257 | 38 | color: UbuntuColors.orange | ||
258 | 39 | font.pointSize: units.gu(8) | ||
259 | 40 | horizontalAlignment: Text.AlignHCenter | ||
260 | 41 | text: "Shim \nStage" | ||
261 | 42 | } | ||
262 | 43 | } | ||
263 | 44 | 0 | ||
264 | === modified file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp' | |||
265 | --- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2015-09-25 13:01:00 +0000 | |||
266 | +++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2016-06-09 21:56:24 +0000 | |||
267 | @@ -33,3 +33,19 @@ | |||
268 | 33 | Q_EMIT mockModeChanged(mockMode); | 33 | Q_EMIT mockModeChanged(mockMode); |
269 | 34 | } | 34 | } |
270 | 35 | } | 35 | } |
271 | 36 | |||
272 | 37 | QString MockGreeter::selectUserHint() const | ||
273 | 38 | { | ||
274 | 39 | Q_D(const Greeter); | ||
275 | 40 | return d->m_greeter->selectUserHint(); | ||
276 | 41 | } | ||
277 | 42 | |||
278 | 43 | void MockGreeter::setSelectUserHint(const QString &selectUserHint) | ||
279 | 44 | { | ||
280 | 45 | Q_D(Greeter); | ||
281 | 46 | |||
282 | 47 | if (d->m_greeter->selectUserHint() != selectUserHint) { | ||
283 | 48 | d->m_greeter->setSelectUserHint(selectUserHint); | ||
284 | 49 | Q_EMIT selectUserHintChanged(); | ||
285 | 50 | } | ||
286 | 51 | } | ||
287 | 36 | 52 | ||
288 | === modified file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h' | |||
289 | --- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2015-09-25 13:01:00 +0000 | |||
290 | +++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2016-06-09 21:56:24 +0000 | |||
291 | @@ -25,13 +25,18 @@ | |||
292 | 25 | Q_OBJECT | 25 | Q_OBJECT |
293 | 26 | 26 | ||
294 | 27 | Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) | 27 | Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged) |
295 | 28 | Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged) | ||
296 | 28 | 29 | ||
297 | 29 | public: | 30 | public: |
298 | 30 | QString mockMode() const; | 31 | QString mockMode() const; |
299 | 31 | void setMockMode(QString mockMode); | 32 | void setMockMode(QString mockMode); |
300 | 32 | 33 | ||
301 | 34 | QString selectUserHint() const; | ||
302 | 35 | void setSelectUserHint(const QString &selectUserHint); | ||
303 | 36 | |||
304 | 33 | Q_SIGNALS: | 37 | Q_SIGNALS: |
305 | 34 | void mockModeChanged(QString mode); | 38 | void mockModeChanged(QString mode); |
306 | 39 | void selectUserHintChanged(); | ||
307 | 35 | }; | 40 | }; |
308 | 36 | 41 | ||
309 | 37 | #endif // MOCK_UNITY_GREETER_H | 42 | #endif // MOCK_UNITY_GREETER_H |
310 | 38 | 43 | ||
311 | === modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' | |||
312 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2015-08-19 14:24:07 +0000 | |||
313 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-06-09 21:56:24 +0000 | |||
314 | @@ -76,7 +76,14 @@ | |||
315 | 76 | 76 | ||
316 | 77 | QString Greeter::selectUserHint() const | 77 | QString Greeter::selectUserHint() const |
317 | 78 | { | 78 | { |
319 | 79 | return ""; | 79 | Q_D(const Greeter); |
320 | 80 | return d->selectUserHint; | ||
321 | 81 | } | ||
322 | 82 | |||
323 | 83 | void Greeter::setSelectUserHint(const QString &selectUserHint) | ||
324 | 84 | { | ||
325 | 85 | Q_D(Greeter); | ||
326 | 86 | d->selectUserHint = selectUserHint; | ||
327 | 80 | } | 87 | } |
328 | 81 | 88 | ||
329 | 82 | bool Greeter::selectGuestHint() const | 89 | bool Greeter::selectGuestHint() const |
330 | 83 | 90 | ||
331 | === modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h' | |||
332 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2015-02-20 15:30:19 +0000 | |||
333 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-06-09 21:56:24 +0000 | |||
334 | @@ -70,6 +70,7 @@ | |||
335 | 70 | bool lockHint () const; | 70 | bool lockHint () const; |
336 | 71 | bool hasGuestAccountHint() const; | 71 | bool hasGuestAccountHint() const; |
337 | 72 | QString selectUserHint() const; | 72 | QString selectUserHint() const; |
338 | 73 | void setSelectUserHint(const QString &selectUserHint); // only in mock | ||
339 | 73 | bool selectGuestHint() const; | 74 | bool selectGuestHint() const; |
340 | 74 | QString autologinUserHint() const; | 75 | QString autologinUserHint() const; |
341 | 75 | bool autologinGuestHint() const; | 76 | bool autologinGuestHint() const; |
342 | 76 | 77 | ||
343 | === modified file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h' | |||
344 | --- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-05-26 13:15:35 +0000 | |||
345 | +++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-06-09 21:56:24 +0000 | |||
346 | @@ -34,6 +34,7 @@ | |||
347 | 34 | bool authenticated; | 34 | bool authenticated; |
348 | 35 | QString authenticationUser; | 35 | QString authenticationUser; |
349 | 36 | bool twoFactorDone; | 36 | bool twoFactorDone; |
350 | 37 | QString selectUserHint; | ||
351 | 37 | 38 | ||
352 | 38 | QString mockMode; | 39 | QString mockMode; |
353 | 39 | 40 | ||
354 | 40 | 41 | ||
355 | === modified file 'tests/qmltests/Greeter/TestView.qml' | |||
356 | --- tests/qmltests/Greeter/TestView.qml 2015-07-15 15:07:19 +0000 | |||
357 | +++ tests/qmltests/Greeter/TestView.qml 2016-06-09 21:56:24 +0000 | |||
358 | @@ -33,6 +33,7 @@ | |||
359 | 33 | property var infographicModel | 33 | property var infographicModel |
360 | 34 | readonly property bool fullyShown: _fullyShown | 34 | readonly property bool fullyShown: _fullyShown |
361 | 35 | readonly property bool required: _required | 35 | readonly property bool required: _required |
362 | 36 | readonly property bool animating: false | ||
363 | 36 | 37 | ||
364 | 37 | property bool _fullyShown: true | 38 | property bool _fullyShown: true |
365 | 38 | property bool _required: true | 39 | property bool _required: true |
366 | @@ -41,6 +42,7 @@ | |||
367 | 41 | signal responded(string response) | 42 | signal responded(string response) |
368 | 42 | signal tease() | 43 | signal tease() |
369 | 43 | signal emergencyCall() | 44 | signal emergencyCall() |
370 | 45 | signal promptlessLogin() | ||
371 | 44 | 46 | ||
372 | 45 | signal _showMessageCalled(string html) | 47 | signal _showMessageCalled(string html) |
373 | 46 | signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt) | 48 | signal _showPromptCalled(string text, bool isSecret, bool isDefaultPrompt) |
374 | 47 | 49 | ||
375 | === modified file 'tests/qmltests/Greeter/tst_Greeter.qml' | |||
376 | --- tests/qmltests/Greeter/tst_Greeter.qml 2016-06-07 16:10:36 +0000 | |||
377 | +++ tests/qmltests/Greeter/tst_Greeter.qml 2016-06-09 21:56:24 +0000 | |||
378 | @@ -139,7 +139,9 @@ | |||
379 | 139 | 139 | ||
380 | 140 | function init() { | 140 | function init() { |
381 | 141 | greeterSettings.lockedOutTime = 0; | 141 | greeterSettings.lockedOutTime = 0; |
383 | 142 | resetLoader(); | 142 | LightDM.Greeter.selectUser = ""; |
384 | 143 | greeter.failedLoginsDelayAttempts = 7; | ||
385 | 144 | greeter.failedLoginsDelayMinutes = 5; | ||
386 | 143 | teaseSpy.clear(); | 145 | teaseSpy.clear(); |
387 | 144 | sessionStartedSpy.clear(); | 146 | sessionStartedSpy.clear(); |
388 | 145 | activeChangedSpy.clear(); | 147 | activeChangedSpy.clear(); |
389 | @@ -151,11 +153,7 @@ | |||
390 | 151 | viewAuthenticationFailedSpy.clear(); | 153 | viewAuthenticationFailedSpy.clear(); |
391 | 152 | viewResetSpy.clear(); | 154 | viewResetSpy.clear(); |
392 | 153 | viewTryToUnlockSpy.clear(); | 155 | viewTryToUnlockSpy.clear(); |
398 | 154 | tryCompare(greeter, "waiting", false); | 156 | resetLoader(); |
394 | 155 | view = findChild(greeter, "testView"); | ||
395 | 156 | verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole)); | ||
396 | 157 | greeter.failedLoginsDelayAttempts = 7; | ||
397 | 158 | greeter.failedLoginsDelayMinutes = 5; | ||
399 | 159 | } | 157 | } |
400 | 160 | 158 | ||
401 | 161 | function resetLoader() { | 159 | function resetLoader() { |
402 | @@ -167,6 +165,8 @@ | |||
403 | 167 | loader.active = true; | 165 | loader.active = true; |
404 | 168 | tryCompare(loader, "status", Loader.Ready); | 166 | tryCompare(loader, "status", Loader.Ready); |
405 | 169 | removeTimeConstraintsFromSwipeAreas(loader.item); | 167 | removeTimeConstraintsFromSwipeAreas(loader.item); |
406 | 168 | tryCompare(greeter, "waiting", false); | ||
407 | 169 | view = findChild(greeter, "testView"); | ||
408 | 170 | } | 170 | } |
409 | 171 | 171 | ||
410 | 172 | function getIndexOf(name) { | 172 | function getIndexOf(name) { |
411 | @@ -191,6 +191,7 @@ | |||
412 | 191 | compare(view.currentIndex, i); | 191 | compare(view.currentIndex, i); |
413 | 192 | compare(AccountsService.user, name); | 192 | compare(AccountsService.user, name); |
414 | 193 | compare(LightDM.Greeter.authenticationUser, name); | 193 | compare(LightDM.Greeter.authenticationUser, name); |
415 | 194 | return i; | ||
416 | 194 | } | 195 | } |
417 | 195 | 196 | ||
418 | 196 | function verifyLoggedIn() { | 197 | function verifyLoggedIn() { |
419 | @@ -229,11 +230,9 @@ | |||
420 | 229 | 230 | ||
421 | 230 | function test_promptless() { | 231 | function test_promptless() { |
422 | 231 | selectUser("no-password"); | 232 | selectUser("no-password"); |
425 | 232 | tryCompare(viewAuthenticationSucceededSpy, "count", 1); | 233 | tryCompare(view, "locked", false); |
424 | 233 | compare(sessionStartedSpy.count, 1); | ||
426 | 234 | compare(viewShowPromptSpy.count, 0); | 234 | compare(viewShowPromptSpy.count, 0); |
427 | 235 | compare(viewHideSpy.count, 0); | 235 | compare(viewHideSpy.count, 0); |
428 | 236 | compare(view.locked, false); | ||
429 | 237 | } | 236 | } |
430 | 238 | 237 | ||
431 | 239 | function test_twoFactorPass() { | 238 | function test_twoFactorPass() { |
432 | @@ -553,5 +552,24 @@ | |||
433 | 553 | compare(viewResetSpy.count, 1); | 552 | compare(viewResetSpy.count, 1); |
434 | 554 | tryCompare(viewShowPromptSpy, "count", 1); | 553 | tryCompare(viewShowPromptSpy, "count", 1); |
435 | 555 | } | 554 | } |
436 | 555 | |||
437 | 556 | function test_selectUserHint() { | ||
438 | 557 | LightDM.Greeter.selectUser = "info-prompt"; | ||
439 | 558 | resetLoader(); | ||
440 | 559 | var i = verifySelected("info-prompt"); | ||
441 | 560 | verify(i != 0); // sanity-check that info-prompt isn't default 0 answer | ||
442 | 561 | } | ||
443 | 562 | |||
444 | 563 | function test_selectUserHintUnset() { | ||
445 | 564 | LightDM.Greeter.selectUser = ""; | ||
446 | 565 | resetLoader(); | ||
447 | 566 | verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole)); | ||
448 | 567 | } | ||
449 | 568 | |||
450 | 569 | function test_selectUserHintInvalid() { | ||
451 | 570 | LightDM.Greeter.selectUser = "not-a-real-user"; | ||
452 | 571 | resetLoader(); | ||
453 | 572 | verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole)); | ||
454 | 573 | } | ||
455 | 556 | } | 574 | } |
456 | 557 | } | 575 | } |
Please add a test for a non-existent user and see the 1 inline comment