Created
October 13, 2018 23:17
-
-
Save cdmunoz/09db417cca1015dda4f825adefc361ed to your computer and use it in GitHub Desktop.
WithSeekBarProgress: Matcher to check the value/progress of a SeekBar
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
public static Matcher<View> withSeekbarProgress(final int expectedProgress) { | |
return new BoundedMatcher<View, AppCompatSeekBar>(AppCompatSeekBar.class) { | |
@Override | |
public void describeTo(Description description) { | |
description.appendText("expected: "); | |
description.appendText("" + expectedProgress); | |
} | |
@Override | |
public boolean matchesSafely(AppCompatSeekBar seekBar) { | |
return seekBar.getProgress() == expectedProgress; | |
} | |
}; | |
} | |
//how to use it | |
onView(withId(R.id.my_seekbar)).check(matches(withSeekbarProgress(100))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment