@@ -21,7 +21,7 @@
22from __future__ import absolute_import
22from __future__ import absolute_import
24−from unity8.process_helpers import unlock_unity
24+from unity8.process_helpers import lock_unity, unlock_unity
25from unity8.shell import disable_qml_mocking
25from unity8.shell import disable_qml_mocking
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
@@ -55,6 +55,18 @@ class ApplicationLifecycleTests(UnityTestCase):
55 logger.info("Swiping screen from the right edge")
55 logger.info("Swiping screen from the right edge")
56 self.touch.drag(start_x, start_y, end_x, end_y)
56 self.touch.drag(start_x, start_y, end_x, end_y)
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
63+ start_y = int(height/2)
67+ logger.info("Swiping screen from the left edge")
68+ self.touch.drag(start_x, start_y, end_x, end_y)
58 def _get_current_focused_app_id(self):
70 def _get_current_focused_app_id(self):
59 return self._proxy.select_single("Shell").currentFocusedAppId
71 return self._proxy.select_single("Shell").currentFocusedAppId
@@ -149,3 +161,32 @@ class ApplicationLifecycleTests(UnityTestCase):
149 self._get_current_focused_app_id(),
161 self._get_current_focused_app_id(),
150 Eventually(Equals("messaging-app"))
162 Eventually(Equals("messaging-app"))
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)
171+ app = self._launch_app("messaging-app")
173+ self._get_current_focused_app_id(),
174+ Eventually(Equals("messaging-app"))
177+ self.swipe_screen_from_left()
179+ self._get_current_focused_app_id(),
180+ Eventually(Equals(''))
184+ greeter = self.main_window.get_greeter()
185+ self.assertThat(greeter.created, Eventually(Equals(True)))
187+ app = self._launch_app("messaging-app")
188+ self.assertThat(greeter.created, Eventually(Equals(False)))
190+ self._get_current_focused_app_id(),
191+ Eventually(Equals("messaging-app"))