/**
* A customized {@link Matcher} for testing that
* if one color match the background color of current view.
* @param backgroundColor A color int value.
*
* @return Match or not.
*/
public static Matcher<View> withBackgroundColor(final int backgroundColor) {
return new TypeSafeMatcher<View>() {
@Override
public boolean matchesSafely(View view) {
int color = ((ColorDrawable) view.getBackground().getCurrent()).getColor();
return color == backgroundColor;
}
@Override
public void describeTo(Description description) {
description.appendText("with background color value: " + backgroundColor);
}
};
}
AppNavigationTest.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:Espresso
作者:
评论列表
文章目录