0

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

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 20 '22 at 04:51
  • Can you describe your use case? How many pointers do you need? The difference is that [UiDevice](https://developer.android.com/reference/androidx/test/uiautomator/UiDevice) does not support multitouch. However, it might be implemented in [CulebraTester-public](https://github.com/dtmilano/CulebraTester2-public) using [UiObject](https://developer.android.com/reference/androidx/test/uiautomator/UiObject), currently it's not implemented. – Diego Torres Milano Sep 20 '22 at 18:52
  • Check https://github.com/dtmilano/CulebraTester2-client/blob/master/docs/DefaultApi.md#ui_object_oid_perform_two_pointer_gesture_post which adds 2-pointer multitouch gestures – Diego Torres Milano Oct 05 '22 at 00:55

1 Answers1

0

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

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134