on xenial help sign in
Make hud autopilot tests more reliable by fixing how it calculates relative coordinates.
5dc0288Michael Terry
tests/autopilot/unity8/shell/emulators/hud.py+4−7
@@ -38,13 +38,10 @@ class Hud(UnityEmulatorBase):
38 window = self.get_root_instance().select_single('QQuickView')
38 window = self.get_root_instance().select_single('QQuickView')
39 hud_show_button = window.select_single("HudButton")
39 hud_show_button = window.select_single("HudButton")
40
40
41− start_x = int(window.x + (window.width / 2))
41+ swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
42− end_x = start_x
43− start_y = window.y + window.height
44− end_y = int(hud_show_button.y + (hud_show_button.height/2))
45
42
46− touch.press(start_x, start_y)
43+ touch.press(swipe_coords.start_x, swipe_coords.start_y)
47− touch._finger_move(end_x, end_y)
44+ touch._finger_move(swipe_coords.end_x, swipe_coords.end_y)
48 try:
45 try:
49 hud_show_button.opacity.wait_for(1.0)
46 hud_show_button.opacity.wait_for(1.0)
50 touch.release()
47 touch.release()
@@ -78,6 +75,6 @@ class Hud(UnityEmulatorBase):
78 start_x = int(main_view.x + (main_view.width / 2))
75 start_x = int(main_view.x + (main_view.width / 2))
79 end_x = start_x
76 end_x = start_x
80 start_y = main_view.y + (main_view.height - 3)
77 start_y = main_view.y + (main_view.height - 3)
81− end_y = int(hud_show_button.y + (hud_show_button.height/2))
78+ end_y = main_view.y + int(hud_show_button.y + (hud_show_button.height/2))
82
79
83 return SwipeCoords(start_x, end_x, start_y, end_y)
80 return SwipeCoords(start_x, end_x, start_y, end_y)