use of android.support.test.espresso.action.GeneralClickAction in project CompactCalendarView by SundeepK.
the class ApplicationTest method clickXY.
public ViewAction clickXY(final float x, final float y) {
final DisplayMetrics dm = activity.getResources().getDisplayMetrics();
final float spX = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, x, dm);
final float spY = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, y, dm);
return new GeneralClickAction(Tap.SINGLE, new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final float screenX = screenPos[0] + spX;
final float screenY = screenPos[1] + spY;
float[] coordinates = { screenX, screenY };
return coordinates;
}
}, Press.FINGER);
}
Aggregations