@@ -21,7 +21,7 @@
2121
2222from __future__ import absolute_import
2323
24−from unity8.process_helpers import unlock_unity
24+from unity8.process_helpers import lock_unity, unlock_unity
2525from unity8.shell import disable_qml_mocking
2626from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2727
@@ -55,6 +55,18 @@ class ApplicationLifecycleTests(UnityTestCase):
5555 logger.info("Swiping screen from the right edge")
5656 self.touch.drag(start_x, start_y, end_x, end_y)
5757
58+ def swipe_screen_from_left(self):
59+ qml_view = self.main_window.get_qml_view()
60+ width = qml_view.width
61+ height = qml_view.height
62+ start_x = 0
63+ start_y = int(height/2)
64+ end_x = width
65+ end_y = start_y
66+
67+ logger.info("Swiping screen from the left edge")
68+ self.touch.drag(start_x, start_y, end_x, end_y)
69+
5870 def _get_current_focused_app_id(self):
5971 return self._proxy.select_single("Shell").currentFocusedAppId
6072
@@ -149,3 +161,32 @@ class ApplicationLifecycleTests(UnityTestCase):
149161 self._get_current_focused_app_id(),
150162 Eventually(Equals("messaging-app"))
151163 )
164+
165+ @disable_qml_mocking
166+ def test_greeter_hides_on_app_focus(self):
167+ """Greeter should hide when an app is re-focused"""
168+ unity_proxy = self.launch_unity()
169+ unlock_unity(unity_proxy)
170+
171+ app = self._launch_app("messaging-app")
172+ self.assertThat(
173+ self._get_current_focused_app_id(),
174+ Eventually(Equals("messaging-app"))
175+ )
176+
177+ self.swipe_screen_from_left()
178+ self.assertThat(
179+ self._get_current_focused_app_id(),
180+ Eventually(Equals(''))
181+ )
182+
183+ lock_unity()
184+ greeter = self.main_window.get_greeter()
185+ self.assertThat(greeter.created, Eventually(Equals(True)))
186+
187+ app = self._launch_app("messaging-app")
188+ self.assertThat(greeter.created, Eventually(Equals(False)))
189+ self.assertThat(
190+ self._get_current_focused_app_id(),
191+ Eventually(Equals("messaging-app"))
192+ )