使用“ hasTextColor”使用浓缩咖啡进行测试

罗伯托·皮涅罗

如何用文字颜色进行意式浓缩咖啡测试?当前使用hasTextColor()

onView(withId(R.id.editText)).check(matches(hasTextColor(Color.BLACK)));

但是会发生错误:

android.content.res.Resources $ NotFoundException:资源ID#0xff000000,位于android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:195)

...

细节:

<EditText
 android:id="@+id/editText"
 android:textColor="#ff000000"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_marginTop="48dp"/>
chrjs

您需要检查资源中定义的颜色,例如 hasTextColor(R.color.red)

它也写在您提供的文档链接中: colorResId : int

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章