I’m trying to test a two finger gesture with the f...
# compose
l
I’m trying to test a two finger gesture with the following code:
Copy code
private fun SemanticsNodeInteraction
            .twoFingerGesture(offset1, offset2) {
        performTouchInput {
            down(0, offset1)
            down(1, offset2)

            up(0)
            up(1)
        }
    }
When I put logs in forEachGesture, it seems like the pointer id is set to 2 for all 4 events, and the event.changes size is always 1, instead of (1, 2, 2, 1) like when I do the same gesture manually. Is there something I’m doing wrong in my code?
a
Have you tried using
awaitEachGesture
instead of
forEachGesture
?
l
I currently have the following structure:
Copy code
forEachGesture {
        awaitPointerEventScope {
            do {
                val event: PointerEvent = awaitPointerEvent()
I’m not on the 1.4.0 pre-releases, so I can’t use awaitEachGesture yet.
After some fiddling, I found that point1 was actually pressing a view I forgot was over the one I’m testing. It makes sense I only got one touch event in that case, but I’m not sure why the id was 2 instead of 1 (the finger that touched the correct view). I tried changing the id of both fingers, but when one touched another view, the received id was always 2.