37 """Swiping up while an app is active must show the 'show hud' button, following some behaviours.
38 The button must disappear not opening the HUD when releasing the
39 mouse again somewhere on the screen except on the button itself following a timeout.
40 The button must disappear when touching somewhere on the screen except the button itself.
44 unlock_unity(unity_proxy)
45 hud_show_button = self.main_window.get_hud_show_button()
46 edge_drag_area = self.main_window.get_hud_edge_drag_area()
47 hud = self.main_window.get_hud()
51 swipe_coords = hud.get_button_swipe_coords(
55 initialBottomMargin = int(hud_show_button.bottomMargin)
57 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
59 self.
_drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
60 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5)))
61 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin)))
62 self.
_drag(swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5, swipe_coords.end_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - int(edge_drag_area.commitDistance) - 5)
63 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
64 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0)))
66 self.assertThat(hud.shown, Equals(
False))
67 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
69 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
70 self.
_drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
71 self.assertThat(hud.shown, Equals(
False))
72 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
74 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
75 self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height))
76 self.assertThat(hud.shown, Equals(
False))
77 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))