android - How to create custom methods to swipe my view up and down, Espresso - ViewActions -
i want create custom methods swipe view , down, example 25% down/up, or other cases. tried override methods this:
public static viewaction swipedown(){ return new generalswipeaction(swipe.fast, generallocation.center, generallocation.top_center, press.finger); }
but it's top center , need shorter ones. wanted use new coordinatesprovider() :
public static viewaction swipedown(){ return new generalswipeaction(swipe.fast, new coordinatesprovider() { @override public float[] calculatecoordinates(view view) { return new float[0]; } }, generallocation.top_center, press.finger); }
...and might answer, don't know how calculate coordinates.
robotium
has drag()
function pretty similar swipe[direction]
functions in espresso, uses defined coordinates.
* @param fromx x coordinate of initial touch, in screen coordinates * @param tox x coordinate of drag destination, in screen coordinates * @param fromy y coordinate of initial touch, in screen coordinates * @param toy y coordinate of drag destination, in screen coordinates * @param stepcount how many move steps include in drag. less steps results in faster drag
you can use both frameworks along or try rewrite robotium
's drag
function in own way.
this might handful: https://github.com/piotrek1543/robotium-showcase
Comments
Post a Comment