22
22
from unity8 import get_grid_size
23
23
from unity8.shell.emulators import UnityEmulatorBase
24
from unity8.shell import DragMixin
24
25
from autopilot.input import Touch
27
27
SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y')
30
class Hud(UnityEmulatorBase):
29
class Hud(UnityEmulatorBase, DragMixin):
32
31
"""An emulator that understands the Hud."""
35
34
"""Swipes open the Hud."""
36
touch = Touch.create()
35
self.touch = Touch.create()
38
37
window = self.get_root_instance().select_single('QQuickView')
39
38
hud_show_button = window.select_single("HudButton")
41
40
swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
43
touch.press(swipe_coords.start_x, swipe_coords.start_y)
44
touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
42
self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
43
self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y)
46
45
hud_show_button.opacity.wait_for(1.0)
48
47
self.shown.wait_for(True)
49
48
except AssertionError:
52
if touch._touch_finger is not None:
51
if self.touch._touch_finger is not None:
56
55
"""Closes the open Hud."""