Last active
August 29, 2015 13:57
-
-
Save mgasiorowski/9892682 to your computer and use it in GitHub Desktop.
Swipe to left for robotium test for android 2.x and 4.x
This file contains hidden or 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
private void swipeToLeft(int stepCount, int repNumber) { | |
for(int x = 0; x < repNumber; x++) { | |
solo.waitForActivity(solo.getCurrentActivity().toString(), 5000); | |
Display display = solo.getCurrentActivity().getWindowManager().getDefaultDisplay(); | |
int width = 0; | |
int height = 0; | |
if (android.os.Build.VERSION.SDK_INT <= 13) { | |
width = display.getWidth(); | |
height = display.getHeight(); | |
} else { | |
Point size = new Point(); | |
display.getSize(size); | |
width = size.x; | |
height = size.y; | |
} | |
float xStart = width - 10; | |
float xEnd = 10; | |
solo.drag(xStart, xEnd, height / 2, height / 2, stepCount); | |
x++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment