-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix broken 'click span' Android tests
- Loading branch information
1 parent
06d9fcb
commit aaaa69e
Showing
2 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ndroid/library/src/androidTest/java/io/element/android/wysiwyg/test/utils/ClickActions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.element.android.wysiwyg.test.utils | ||
|
||
import android.view.InputDevice | ||
import android.view.MotionEvent | ||
import androidx.test.espresso.action.GeneralClickAction | ||
import androidx.test.espresso.action.Press | ||
import androidx.test.espresso.action.Tap | ||
|
||
fun clickXY(x: Float, y: Float): GeneralClickAction { | ||
return GeneralClickAction( | ||
Tap.SINGLE, | ||
{ view -> | ||
val screenPos = IntArray(2) | ||
view.getLocationOnScreen(screenPos) | ||
val screenX = screenPos[0] + x | ||
val screenY = screenPos[1] + y | ||
floatArrayOf(screenX, screenY) | ||
}, | ||
Press.FINGER, | ||
InputDevice.SOURCE_MOUSE, | ||
MotionEvent.BUTTON_PRIMARY, | ||
) | ||
} |