@@ -49,41 +49,34 @@ class TestHud(Unity8TestCase):
49 """Swiping up while an app is active must show the 'show hud' button."""
49 """Swiping up while an app is active must show the 'show hud' button."""
50 self.launch_unity()
50 self.launch_unity()
51 self.main_window.get_greeter().unlock()
51 self.main_window.get_greeter().unlock()
53 window = self.main_window.get_qml_view()
52 window = self.main_window.get_qml_view()
54 hud_show_button = self.main_window.get_hud_show_button()
53 hud_show_button = self.main_window.get_hud_show_button()
55 hud = self.main_window.get_hud()
54 hud = self.main_window.get_hud()
57− swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
59 self._launch_application_from_app_screen()
56 self._launch_application_from_app_screen()
58+ swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
61 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
59 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
62 self.addCleanup(self.touch.release)
60 self.addCleanup(self.touch.release)
63 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
61 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
65− hud_show_button.opacity.wait_for(1.0)
66 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
62 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
68 def test_show_hud_appears(self):
64 def test_show_hud_appears(self):
69 """Releasing the touch on the 'show hud' button must display the hud."""
65 """Releasing the touch on the 'show hud' button must display the hud."""
70 self.launch_unity()
66 self.launch_unity()
71 self.main_window.get_greeter().unlock()
67 self.main_window.get_greeter().unlock()
73 window = self.main_window.get_qml_view()
68 window = self.main_window.get_qml_view()
74 hud_show_button = self.main_window.get_hud_show_button()
69 hud_show_button = self.main_window.get_hud_show_button()
75 hud = self.main_window.get_hud()
70 hud = self.main_window.get_hud()
77− swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
79 self._launch_application_from_app_screen()
72 self._launch_application_from_app_screen()
74+ swipe_coords = self._get_hud_button_swipe_coords(window, hud_show_button)
81 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
75 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
82 self.addCleanup(self._maybe_release_finger)
76 self.addCleanup(self._maybe_release_finger)
83 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
77 self.touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
85 self.assertThat(hud.shown, Eventually(Equals(False)))
79 self.assertThat(hud.shown, Eventually(Equals(False)))
86− hud_show_button.opacity.wait_for(1.0)
87 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
80 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
88 self.touch.release()
81 self.touch.release()
89 self.assertThat(hud.shown, Eventually(Equals(True)))
82 self.assertThat(hud.shown, Eventually(Equals(True)))
@@ -125,10 +118,11 @@ class TestHud(Unity8TestCase):
125 """Tapping the close button of the Hud must dismiss it."""
118 """Tapping the close button of the Hud must dismiss it."""
126 self.launch_unity()
119 self.launch_unity()
127 self.main_window.get_greeter().unlock()
120 self.main_window.get_greeter().unlock()
128− self._launch_application_from_app_screen()
129 hud = self.main_window.get_hud()
121 hud = self.main_window.get_hud()
130 hud.show()
122 hud.show()
124+ self._launch_application_from_app_screen()
132 rect = hud.globalRect
126 rect = hud.globalRect
133 x = int(rect[0] + rect[2] / 2)
127 x = int(rect[0] + rect[2] / 2)
134 y = rect[1] + self.grid_size
128 y = rect[1] + self.grid_size
@@ -162,10 +156,11 @@ class TestHud(Unity8TestCase):
162 """Opening the Launcher while the Hud is active must close the Hud."""
156 """Opening the Launcher while the Hud is active must close the Hud."""
163 self.launch_unity()
157 self.launch_unity()
164 self.main_window.get_greeter().unlock()
158 self.main_window.get_greeter().unlock()
165− self._launch_application_from_app_screen()
166 hud = self.main_window.get_hud()
159 hud = self.main_window.get_hud()
167 launcher = self.main_window.get_launcher()
160 launcher = self.main_window.get_launcher()
162+ self._launch_application_from_app_screen()
169 hud.show()
164 hud.show()
170 launcher.show()
165 launcher.show()
@@ -195,7 +190,6 @@ class TestHud(Unity8TestCase):
195 if self.touch._touch_finger is not None:
190 if self.touch._touch_finger is not None:
196 self.touch.release()
191 self.touch.release()
199 def _get_hud_button_swipe_coords(self, main_view, hud_show_button):
193 def _get_hud_button_swipe_coords(self, main_view, hud_show_button):
200 start_x = int(main_view.x + (main_view.width / 2))
194 start_x = int(main_view.x + (main_view.width / 2))
201 end_x = start_x
195 end_x = start_x