on xenial help sign in
Revert to 330
commitc872390295a2671427786096b86f7d2e4f7da959 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateWed 2 Oct 2013, 10:01 (13 years ago) parent293b1a3
3 files changed+26−15
tests/autopilot/unity8/shell/emulators/__init__.py−13 tests/autopilot/unity8/shell/emulators/hud.py+13−1 tests/autopilot/unity8/shell/tests/test_hud.py+13−1
tests/autopilot/unity8/shell/emulators/__init__.py−13
@@ -19,20 +19,7 @@
1919
2020
2121from autopilot.introspection import CustomEmulatorBase
22−from time import sleep
2322
2423
2524class UnityEmulatorBase(CustomEmulatorBase):
2625 """A base class for all unity emulators."""
27−
28− def _drag(self, x1, y1, x2, y2):
29− cur_x = x1
30− cur_y = y1
31− dx = 1.0 * (x2 - x1) / 100
32− dy = 1.0 * (y2 - y1) / 100
33− for i in range(0, 100):
34− self.touch._finger_move(int(cur_x), int(cur_y))
35− sleep(0.002)
36− cur_x += dx
37− cur_y += dy
38− self.touch._finger_move(int(x2), int(y2))
tests/autopilot/unity8/shell/emulators/hud.py+13−1
@@ -22,7 +22,7 @@ from collections import namedtuple
2222from unity8 import get_grid_size
2323from unity8.shell.emulators import UnityEmulatorBase
2424from autopilot.input import Touch
25−
25+from time import sleep
2626
2727SwipeCoords = namedtuple('SwipeCoords', 'start_x end_x start_y end_y')
2828
@@ -77,3 +77,15 @@ class Hud(UnityEmulatorBase):
7777 end_y = main_view.y + int(hud_show_button.y + (hud_show_button.height/2))
7878
7979 return SwipeCoords(start_x, end_x, start_y, end_y)
80+
81+ def _drag(self, x1, y1, x2, y2):
82+ cur_x = x1
83+ cur_y = y1
84+ dx = 1.0 * (x2 - x1) / 100
85+ dy = 1.0 * (y2 - y1) / 100
86+ for i in range(0, 100):
87+ self.touch._finger_move(int(cur_x), int(cur_y))
88+ sleep(0.002)
89+ cur_x += dx
90+ cur_y += dy
91+ self.touch._finger_move(int(x2), int(y2))
tests/autopilot/unity8/shell/tests/test_hud.py+13−1
@@ -24,7 +24,7 @@ from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2424
2525from testtools.matchers import Equals
2626from autopilot.matchers import Eventually
27−
27+from time import sleep
2828
2929class TestHud(UnityTestCase):
3030
@@ -189,3 +189,15 @@ class TestHud(UnityTestCase):
189189 """Only release the finger if it is in fact down."""
190190 if self.touch._touch_finger is not None:
191191 self.touch.release()
192+
193+ def _drag(self, x1, y1, x2, y2):
194+ cur_x = x1
195+ cur_y = y1
196+ dx = 1.0 * (x2 - x1) / 100
197+ dy = 1.0 * (y2 - y1) / 100
198+ for i in range(0, 100):
199+ self.touch._finger_move(int(cur_x), int(cur_y))
200+ sleep(0.002)
201+ cur_x += dx
202+ cur_y += dy
203+ self.touch._finger_move(int(x2), int(y2))