on xenial help sign in
Fixes the lockscreen and swiping on the greeter still being possible even when in tablet mode. Fixes: https://bugs.launchpad.net/bugs/1204984.
0c34390Michael Terry
Greeter/Greeter.qml+2−3
@@ -34,7 +34,7 @@ Showable {
34
34
35 property alias dragHandleWidth: dragHandle.width
35 property alias dragHandleWidth: dragHandle.width
36 property alias model: greeterContentLoader.model
36 property alias model: greeterContentLoader.model
37− property bool locked: shown && multiUser && !greeterContentLoader.promptless
37+ property bool locked: shown && !LightDM.Greeter.promptless
38
38
39 readonly property bool narrowMode: !multiUser && width <= units.gu(60)
39 readonly property bool narrowMode: !multiUser && width <= units.gu(60)
40 readonly property bool multiUser: LightDM.Users.count > 1
40 readonly property bool multiUser: LightDM.Users.count > 1
@@ -59,7 +59,6 @@ Showable {
59 anchors.fill: parent
59 anchors.fill: parent
60 property var model: LightDM.Users
60 property var model: LightDM.Users
61 property int currentIndex: 0
61 property int currentIndex: 0
62− property bool promptless: item ? item.promptless : false
63 property var infographicModel: LightDM.Infographic
62 property var infographicModel: LightDM.Infographic
64
63
65 source: required ? "GreeterContent.qml" : ""
64 source: required ? "GreeterContent.qml" : ""
@@ -113,7 +112,7 @@ Showable {
113 // UI element)
112 // UI element)
114 distanceThreshold: 0
113 distanceThreshold: 0
115
114
116− enabled: !greeter.locked
115+ enabled: greeter.narrowMode || !greeter.locked
117
116
118 direction: Direction.Leftwards
117 direction: Direction.Leftwards
119 }
118 }
Greeter/GreeterContent.qml−1
@@ -23,7 +23,6 @@ MouseArea {
23 id: root
23 id: root
24 anchors.fill: parent
24 anchors.fill: parent
25
25
26− property bool promptless: loginLoader.status == Loader.Ready && LightDM.Greeter.promptless
27 property bool ready: wallpaper.status == Image.Ready
26 property bool ready: wallpaper.status == Image.Ready
28 property bool leftTeaserPressed: teasingMouseArea.pressed &&
27 property bool leftTeaserPressed: teasingMouseArea.pressed &&
29 teasingMouseArea.mouseX < teasingMouseArea.width / 2
28 teasingMouseArea.mouseX < teasingMouseArea.width / 2
Shell.qml+1−1
@@ -552,7 +552,7 @@ FocusScope {
552 anchors.bottom: parent.bottom
552 anchors.bottom: parent.bottom
553 width: parent.width
553 width: parent.width
554 dragAreaWidth: shell.edgeSize
554 dragAreaWidth: shell.edgeSize
555− available: !greeter.locked
555+ available: !greeter.shown || greeter.narrowMode
556 onDashItemSelected: {
556 onDashItemSelected: {
557 greeter.hide()
557 greeter.hide()
558 // Animate if moving between application and dash
558 // Animate if moving between application and dash
tests/autopilot/unity8/shell/emulators/greeter.py+4−1
@@ -25,7 +25,7 @@ class Greeter(UnityEmulatorBase):
25
25
26 """An emulator that understands the greeter screen."""
26 """An emulator that understands the greeter screen."""
27
27
28− def unlock(self):
28+ def swipe(self):
29 """Swipe the greeter screen away."""
29 """Swipe the greeter screen away."""
30 self.created.wait_for(True)
30 self.created.wait_for(True)
31 touch = Touch.create()
31 touch = Touch.create()
@@ -38,3 +38,6 @@ class Greeter(UnityEmulatorBase):
38 touch.drag(start_x, start_y, stop_x, stop_y)
38 touch.drag(start_x, start_y, stop_x, stop_y)
39
39
40 self.created.wait_for(False)
40 self.created.wait_for(False)
41+
42+ def get_prompt(self):
43+ return self.select_single("TextField", objectName="passwordInput")
tests/autopilot/unity8/shell/tests/test_hud.py+5−5
@@ -37,7 +37,7 @@ class TestHud(UnityTestCase):
37
37
38 """
38 """
39 self.launch_unity()
39 self.launch_unity()
40− self.main_window.get_greeter().unlock()
40+ self.main_window.get_greeter().swipe()
41 window = self.main_window.get_qml_view()
41 window = self.main_window.get_qml_view()
42 hud_show_button = self.main_window.get_hud_show_button()
42 hud_show_button = self.main_window.get_hud_show_button()
43 hud = self.main_window.get_hud()
43 hud = self.main_window.get_hud()
@@ -58,7 +58,7 @@ class TestHud(UnityTestCase):
58
58
59 """
59 """
60 self.launch_unity()
60 self.launch_unity()
61− self.main_window.get_greeter().unlock()
61+ self.main_window.get_greeter().swipe()
62 window = self.main_window.get_qml_view()
62 window = self.main_window.get_qml_view()
63 hud_show_button = self.main_window.get_hud_show_button()
63 hud_show_button = self.main_window.get_hud_show_button()
64 hud = self.main_window.get_hud()
64 hud = self.main_window.get_hud()
@@ -81,7 +81,7 @@ class TestHud(UnityTestCase):
81 def test_hide_hud_click(self):
81 def test_hide_hud_click(self):
82 """Tapping the close button of the Hud must dismiss it."""
82 """Tapping the close button of the Hud must dismiss it."""
83 self.launch_unity()
83 self.launch_unity()
84− self.main_window.get_greeter().unlock()
84+ self.main_window.get_greeter().swipe()
85 hud = self.main_window.get_hud()
85 hud = self.main_window.get_hud()
86
86
87 self._launch_test_app_from_app_screen()
87 self._launch_test_app_from_app_screen()
@@ -97,7 +97,7 @@ class TestHud(UnityTestCase):
97
97
98 """
98 """
99 self.launch_unity()
99 self.launch_unity()
100− self.main_window.get_greeter().unlock()
100+ self.main_window.get_greeter().swipe()
101 hud = self.main_window.get_hud()
101 hud = self.main_window.get_hud()
102 window = self.main_window.get_qml_view()
102 window = self.main_window.get_qml_view()
103
103
@@ -114,7 +114,7 @@ class TestHud(UnityTestCase):
114 def test_launcher_hides_hud(self):
114 def test_launcher_hides_hud(self):
115 """Opening the Launcher while the Hud is active must close the Hud."""
115 """Opening the Launcher while the Hud is active must close the Hud."""
116 self.launch_unity()
116 self.launch_unity()
117− self.main_window.get_greeter().unlock()
117+ self.main_window.get_greeter().swipe()
118 hud = self.main_window.get_hud()
118 hud = self.main_window.get_hud()
119 launcher = self.main_window.get_launcher()
119 launcher = self.main_window.get_launcher()
120
120
tests/autopilot/unity8/shell/tests/test_lock_screen.py+58−26
@@ -40,52 +40,68 @@ class TestLockscreen(UnityTestCase):
40 """Must be able to unlock the PIN entry lock screen."""
40 """Must be able to unlock the PIN entry lock screen."""
41 self.launch_unity()
41 self.launch_unity()
42 greeter = self.main_window.get_greeter()
42 greeter = self.main_window.get_greeter()
43− greeter.unlock()
44
43
44+ if greeter.narrowMode:
45+ greeter.swipe()
45− lockscreen = self._wait_for_lockscreen()
46+ lockscreen = self._wait_for_lockscreen()
46− self._enter_pincode("1234")
47+ self._enter_pincode("1234")
47−
48+ self.assertThat(lockscreen.shown, Eventually(Equals(False)))
49+ else:
50+ self._enter_prompt_passphrase("1234")
48− self.assertThat(lockscreen.shown, Eventually(Equals(False)))
51+ self.assertThat(greeter.shown, Eventually(Equals(False)))
49
52
50 @with_lightdm_mock("single-passphrase")
53 @with_lightdm_mock("single-passphrase")
51 def test_can_unlock_passphrase_screen(self):
54 def test_can_unlock_passphrase_screen(self):
52 """Must be able to unlock the passphrase entry screen."""
55 """Must be able to unlock the passphrase entry screen."""
53 self.launch_unity()
56 self.launch_unity()
54 greeter = self.main_window.get_greeter()
57 greeter = self.main_window.get_greeter()
55− greeter.unlock()
56−
57− lockscreen = self._wait_for_lockscreen()
58− self._enter_passphrase("password")
59
58
59+ if greeter.narrowMode:
60+ greeter.swipe()
61+ lockscreen = self._wait_for_lockscreen()
62+ self._enter_pin_passphrase("password")
60− self.assertThat(lockscreen.shown, Eventually(Equals(False)))
63+ self.assertThat(lockscreen.shown, Eventually(Equals(False)))
64+ else:
65+ self._enter_prompt_passphrase("password")
66+ self.assertThat(greeter.shown, Eventually(Equals(False)))
61
67
62 @with_lightdm_mock("single-pin")
68 @with_lightdm_mock("single-pin")
63 def test_pin_screen_wrong_code(self):
69 def test_pin_screen_wrong_code(self):
64 """Entering the wrong pin code must not dismiss the lock screen."""
70 """Entering the wrong pin code must not dismiss the lock screen."""
65 self.launch_unity()
71 self.launch_unity()
66 greeter = self.main_window.get_greeter()
72 greeter = self.main_window.get_greeter()
67− greeter.unlock()
68−
69− lockscreen = self._wait_for_lockscreen()
70− self._enter_pincode("4321")
71
73
74+ if greeter.narrowMode:
75+ greeter.swipe()
76+ lockscreen = self._wait_for_lockscreen()
77+ self._enter_pincode("4321")
72− pinentryField = self.main_window.get_pinentryField()
78+ pinentryField = self.main_window.get_pinentryField()
73− self.assertThat(pinentryField.text, Eventually(Equals("")))
79+ self.assertThat(pinentryField.text, Eventually(Equals("")))
80+ self.assertThat(lockscreen.shown, Eventually(Equals(True)))
81+ else:
82+ self._enter_prompt_passphrase("4231")
83+ prompt = self.main_window.get_greeter().get_prompt()
84+ self.assertThat(prompt.text, Eventually(Equals("")))
74− self.assertThat(lockscreen.shown, Eventually(Equals(True)))
85+ self.assertThat(greeter.shown, Eventually(Equals(True)))
75
86
76 @with_lightdm_mock("single-passphrase")
87 @with_lightdm_mock("single-passphrase")
77 def test_passphrase_screen_wrong_password(self):
88 def test_passphrase_screen_wrong_password(self):
78 """Entering the wrong password must not dismiss the lock screen."""
89 """Entering the wrong password must not dismiss the lock screen."""
79 self.launch_unity()
90 self.launch_unity()
80 greeter = self.main_window.get_greeter()
91 greeter = self.main_window.get_greeter()
81− greeter.unlock()
82
92
93+ if greeter.narrowMode:
94+ greeter.swipe()
83− lockscreen = self._wait_for_lockscreen()
95+ lockscreen = self._wait_for_lockscreen()
84− self._enter_passphrase("foobar")
96+ self._enter_pin_passphrase("foobar")
85−
86− pinentryField = self.main_window.get_pinentryField()
97+ pinentryField = self.main_window.get_pinentryField()
87− self.assertThat(pinentryField.text, Eventually(Equals("")))
98+ self.assertThat(pinentryField.text, Eventually(Equals("")))
99+ self.assertThat(lockscreen.shown, Eventually(Equals(True)))
100+ else:
101+ self._enter_prompt_passphrase("foobar")
102+ prompt = self.main_window.get_greeter().get_prompt()
103+ self.assertThat(prompt.text, Eventually(Equals("")))
88− self.assertThat(lockscreen.shown, Eventually(Equals(True)))
104+ self.assertThat(greeter.shown, Eventually(Equals(True)))
89
105
90 def _wait_for_lockscreen(self):
106 def _wait_for_lockscreen(self):
91 """Wait for the lock screen to load, and return it."""
107 """Wait for the lock screen to load, and return it."""
@@ -114,9 +130,9 @@ class TestLockscreen(UnityTestCase):
114 )
130 )
115 self.touch.tap_object(self.main_window.get_pinPadButton(int(num)))
131 self.touch.tap_object(self.main_window.get_pinPadButton(int(num)))
116
132
117− def _enter_passphrase(self, passphrase):
133+ def _enter_pin_passphrase(self, passphrase):
118 """Enter the password specified in 'passphrase' into the password entry
134 """Enter the password specified in 'passphrase' into the password entry
119− field.
135+ field of the pin lock screen.
120
136
121 :param passphrase: The string you want to enter.
137 :param passphrase: The string you want to enter.
122 :raises: TypeError if passphrase is not a string.
138 :raises: TypeError if passphrase is not a string.
@@ -129,3 +145,19 @@ class TestLockscreen(UnityTestCase):
129 self.touch.tap_object(pinentryField)
145 self.touch.tap_object(pinentryField)
130 self.keyboard.type(passphrase)
146 self.keyboard.type(passphrase)
131 self.keyboard.type("\n")
147 self.keyboard.type("\n")
148+
149+ def _enter_prompt_passphrase(self, passphrase):
150+ """Enter the password specified in 'passphrase' into the password entry
151+ field of the main user list's prompt.
152+
153+ :param passphrase: The string you want to enter.
154+ :raises: TypeError if passphrase is not a string.
155+
156+ """
157+ if not isinstance(passphrase, basestring):
158+ raise TypeError("'passphrase' parameter must be a string.")
159+
160+ prompt = self.main_window.get_greeter().get_prompt()
161+ self.touch.tap_object(prompt)
162+ self.keyboard.type(passphrase)
163+ self.keyboard.type("\n")
tests/mocks/LightDM/single/GreeterPrivate.cpp+2−4
@@ -34,10 +34,8 @@ void GreeterPrivate::handleAuthenticate()
34{
34{
35 Q_Q(Greeter);
35 Q_Q(Greeter);
36
36
37− if (authenticationUser == "one") {
38− authenticated = true;
37+ authenticated = true;
39− Q_EMIT q->authenticationComplete();
38+ Q_EMIT q->authenticationComplete();
40− }
41}
39}
42
40
43void GreeterPrivate::handleRespond(QString const &response)
41void GreeterPrivate::handleRespond(QString const &response)