How to perform multi touch using Culebratester-Client?

222 views Asked by At

I've succeeded to perform a quick tap using Culebra-Client by following code from this stackoverflow answer. But I still don't understand how to perform multiple touch

1

There are 1 answers

1
Diego Torres Milano On

A quick example using the newly introduced API in 2.0.47 to handle multi touch. It uses MultiTouch Tester to show the touches but you can use any app.

#! /usr/bin/env python3

from culebratester_client import PerformTwoPointerGestureBody, Point
from pprint import pprint
from com.dtmilano.android.viewclient import ViewClient, KEY_EVENT

helper = ViewClient(*ViewClient.connectToDeviceOrExit(), useuiautomatorhelper=True).uiAutomatorHelper

# multitouch tester
id = 'com.the511plus.MultiTouchTester:id/touchStr'
oid = helper.ui_device.find_object(ui_selector=f'res@{id}').oid

api_instance = helper.api_instance
try:
    body = PerformTwoPointerGestureBody(start_point1=Point(300, 100), start_point2=Point(900, 100), end_point1=Point(300, 1600), end_point2=Point(900, 1600), steps=500)
    api_response = api_instance.ui_object_oid_perform_two_pointer_gesture_post(oid, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->ui_object_oid_perform_two_pointer_gesture_post: %s\n" % e)

Once you run it, the 2 pointers will be recognized by the app.

enter image description here