airtest.core.android.touch_methods.touch_proxy module

class TouchProxy(touch_method)[source]

Bases: object

Perform touch operation according to the specified method

TOUCH_METHODS = {'MAXTOUCH': <class 'airtest.core.android.touch_methods.touch_proxy.MaxtouchImplementation'>, 'MINITOUCH': <class 'airtest.core.android.touch_methods.touch_proxy.MinitouchImplementation'>}
classmethod check_touch(touch_impl)[source]
classmethod auto_setup(adb, default_method=None, ori_transformer=None, ori_function=None, input_event=None)[source]
Parameters:
  • adbairtest.core.android.adb.ADB
  • default_method – The default click method, such as “MINITOUCH”
  • ori_transformer – dev._touch_point_by_orientation
  • ori_function – dev.get_display_info
  • input_event – dev.input_event
  • *args
  • **kwargs

Returns: TouchProxy object

Examples

>>> dev = Android()
>>> touch_proxy = TouchProxy.auto_setup(dev.adb, ori_transformer=dev._touch_point_by_orientation)
>>> touch_proxy.touch((100, 100))
register_touch(cls)[source]
class AdbTouchImplementation(base_touch)[source]

Bases: object

METHOD_NAME = 'ADBTOUCH'
touch(pos, duration=0.01)[source]
swipe(p1, p2, duration=0.5, *args, **kwargs)[source]
class MinitouchImplementation(minitouch, ori_transformer)[source]

Bases: airtest.core.android.touch_methods.touch_proxy.AdbTouchImplementation

METHOD_NAME = 'MINITOUCH'
METHOD_CLASS

alias of airtest.core.android.touch_methods.minitouch.Minitouch

touch(pos, duration=0.01)[source]
swipe(p1, p2, duration=0.5, steps=5, fingers=1)[source]
pinch(center=None, percent=0.5, duration=0.5, steps=5, in_or_out='in')[source]
swipe_along(coordinates_list, duration=0.8, steps=5)[source]
two_finger_swipe(tuple_from_xy, tuple_to_xy, duration=0.8, steps=5, offset=(0, 50))[source]
perform(motion_events, interval=0.01)[source]
class MaxtouchImplementation(maxtouch, ori_transformer)[source]

Bases: airtest.core.android.touch_methods.touch_proxy.MinitouchImplementation

METHOD_NAME = 'MAXTOUCH'
METHOD_CLASS

alias of airtest.core.android.touch_methods.maxtouch.Maxtouch

perform(motion_events, interval=0.01)[source]