@@ -66,10 +66,39 @@ class TestLockscreen(Unity8TestCase):
6666
6767 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
6868
69+ @with_lightdm_mock("single-pin")
70+ def test_pin_screen_wrong_code(self):
71+ """Entering the wrong pin code must not dismiss the lock screen."""
72+ self.app = self.launch_unity()
73+ self._unlock_greeter()
74+
75+ lockscreen = self._wait_for_lockscreen()
76+ self._enter_pincode("4321")
77+
78+ pinentryField = self.main_window.get_pinentryField()
79+ self.assertThat(pinentryField.text, Eventually(Equals("")))
80+ self.assertThat(lockscreen.shown, Eventually(Equals(True)))
81+
82+ @skipUnless(model() == 'Desktop', "Passphrase applicable to desktop only.")
83+ @with_lightdm_mock("single-passphrase")
84+ def test_passphrase_screen_wrong_password(self):
85+ """Entering the wrong password must not dismiss the lock screen."""
86+ self.app = self.launch_unity()
87+ self._unlock_greeter()
88+
89+ lockscreen = self._wait_for_lockscreen()
90+ self._enter_passphrase("foobar")
91+
92+ pinentryField = self.main_window.get_pinentryField()
93+ self.assertThat(pinentryField.text, Eventually(Equals("")))
94+ self.assertThat(lockscreen.shown, Eventually(Equals(True)))
95+
6996 def _unlock_greeter(self):
97+ """Swipe the greeter out of the way."""
7098 greeter = self.main_window.get_greeter()
7199 self.assertThat(greeter.created, Eventually(Equals(True)))
72100
101+ # TODO: Is this ever called? Find out, and maybe remove this branch:
73102 if greeter.multiUser:
74103 password_field = self.select_greeter_user("No Password")
75104 self.assertThat(password_field.opacity, Eventually(Equals(1)))
@@ -130,26 +159,3 @@ class TestLockscreen(Unity8TestCase):
130159
131160
132161
133− # def test_unlock_wrong(self):
134− # self.unlock_greeter()
135−
136− # pinPadLoader = self.main_window.get_pinPadLoader();
137− # self.assertThat(pinPadLoader.progress, Eventually(Equals(1)))
138− # lockscreen = self.main_window.get_lockscreen();
139− # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
140− # pinentryField = self.main_window.get_pinentryField()
141−
142− # if self.lightdm_mock == "single-pin":
143− # self.touch.tap_object(self.main_window.get_pinPadButton(4))
144− # self.touch.tap_object(self.main_window.get_pinPadButton(3))
145− # self.touch.tap_object(self.main_window.get_pinPadButton(2))
146− # self.assertThat(pinentryField.text, Eventually(Equals("432")))
147− # self.touch.tap_object(self.main_window.get_pinPadButton(1))
148−
149− # self.assertThat(pinentryField.text, Eventually(Equals("")))
150− # self.assertThat(lockscreen.shown, Eventually(Equals(True)))
151− # else:
152− # self.touch.tap_object(pinentryField)
153− # self.keyboard.type("foobar\n")
154− # self.assertThat(pinentryField.text, Eventually(Equals("")))
155− # self.assertThat(lockscreen.shown, Eventually(Equals(True)))