1
我創建一個額外的方法:如何從Robotium檢查我的PNG是否存在於屏幕上?
public boolean exampleEdTxt1(){
try{
solo.getCurrentActivity().getResources().getDrawable(R.drawable.action_drw);
return true;
}
catch(AssertionError e){
return false;
}
}
但是,當測試乳寧,代碼
assertTrue(exampleEdTxt1());
總是返回成功代碼
assertFalse(exampleEdTxt1());
總是返回失敗。
如何從Robotium檢查我的PNG是否存在於屏幕上?
不幸的是,這種方法失敗。 「isShown()」IDE用紅色突出顯示消息:「無法解析方法」isShown()'「。 雖然我成功使用了代碼: assertTrue(solo.getView(R.id.action_search).isShown());如果我嘗試檢查: assertEquals(false,getActivity()。getResources()。getDrawable(R.drawable.edit_btn).isVisible()); 測試落在這條線上,出現錯誤:預期:但是: – 2014-10-02 08:26:53
檢查我編輯的答案,並告訴我這次是否工作 – gionnut 2014-10-03 09:39:10
對於 布爾isVisible2 =(布爾值)solo.getCurrentActivity()。getResources()。getDrawable (R.drawable.image).isVisible();代碼 assertTrue(isVisible2); - 總是返回成功(即使屏幕上沒有可繪製的)和代碼 assertFalse(isVisible2); - 總是返回失敗。 – 2014-10-13 09:04:28