Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testcase with multitouch on Android?

The TouchUtils class in the android documentation has functions like drag():

https://developer.android.com/reference/android/test/TouchUtils.html#drag(android.test.InstrumentationTestCase,%20float,%20float,%20float,%20float,%20int)

but they do not support multi touch gestures, like a two finger swipe.

Looking at the MotionEvent.obtain() methods, there does not seem to be any way of invoking a "virtual" multi touch event from a testcase.

Anyone has got it working?

like image 950
makke Avatar asked Nov 05 '22 12:11

makke


1 Answers

Apparently there is no other way than to use the private function MotionEvent.obtainNano() to mock the multi touch events. Hopefully this will change in future versions.

like image 199
makke Avatar answered Nov 12 '22 19:11

makke