真快,在当前的 Robolectric 中有没有办法验证操作栏上操作项的存在和可见性? (我知道这基本上是为 UI 配置细节编写单元测试,但如果它很简单,我愿意这样做。)
最佳答案
据我所知,在早期版本的 Robolectric 中无法访问 ActionBar。尝试从 Activity 获取它返回 null。
自 Robolectirc 2.2 http://robolectric.blogspot.com/2013/10/robolectric-22-released.html你可以访问 ActionBar。
关于android - 如何从 Robolectric 测试 Action Bar 的 Action Items?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14142097/