Created
October 13, 2018 23:19
-
-
Save cdmunoz/3b6dd824663991911076c625a0916b35 to your computer and use it in GitHub Desktop.
TextViewColorMatcher: Verifies that a TextView has an specific color
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> textViewTextColorMatcher(final int matcherColor) { | |
return new BoundedMatcher<View, TextView>(TextView.class) { | |
@Override | |
public void describeTo(Description description) { | |
description.appendText("with text color: " + matcherColor); | |
} | |
@Override | |
protected boolean matchesSafely(TextView textView) { | |
return matcherColor == textView.getCurrentTextColor(); | |
} | |
}; | |
} | |
//how to use it | |
onView(withId(R.id.search_action_button)).check(matches(textViewTextColorMatcher(TEXT_BTN_COLOR_DISABLED))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment