20 """unity shell autopilot tests and emulators - sub level package."""
22 from time
import sleep
23 from functools
import wraps
27 logger = logging.getLogger(__name__)
30 def with_lightdm_mock(mock_type):
31 """A simple decorator that sets up the LightDM mock for a single test."""
32 def with_lightdm_mock_internal(fn):
34 def wrapper(*args, **kwargs):
36 tests_self.patch_lightdm_mock(mock_type)
37 return fn(*args, **kwargs)
39 return with_lightdm_mock_internal
42 def disable_qml_mocking(fn):
43 """Simple decorator that disables the QML mocks from being loaded."""
45 def wrapper(*args, **kwargs):
47 tests_self._qml_mock_enabled =
False
48 return fn(*args, **kwargs)
51 class DragMixin(object):
52 def _drag(self, x1, y1, x2, y2):
58 dx = 1.0 * (x2 - x1) / 100
59 dy = 1.0 * (y2 - y1) / 100
60 for i
in range(0, 100):
62 self.touch._finger_move(int(cur_x), int(cur_y))
63 except AttributeError:
64 self.touch._device.finger_move(int(cur_x), int(cur_y))
69 self.touch._finger_move(int(x2), int(y2))
70 except AttributeError:
71 self.touch._device.finger_move(int(x2), int(y2))