Closed GoogleCodeExporter closed 9 years ago
I think you can do that by the below code. I have not tried the code but it
should work.
getInstrumentation().getTargetContext().getResources().getDrawable(id) and
check that you do not get an exception back.
Original comment by renasr...@gmail.com
on 7 Jan 2012 at 6:42
Thanks, I'll give it a shot!
Original comment by glenview...@gmail.com
on 7 Jan 2012 at 1:48
In a particular game and the buttons in game have different drawables. In
testing I want to test that this particular button has that specific drawable.
For example,
in my source code,
customerButton.setBackgroundResource(R.drawable.customer_button_background);
noncustomerButton.setBackgroundResource(R.drawable.noncustomer_button_background
);
Now in my test case, I want to do something like this
assertTrue(robotiumSolo.getCurrentActivity.getResources.getDrawable(R.drawable.n
oncustomer_button_background).equals(robotiumSolo.getCurrentActivity.getNoncusto
merButton().getBackground())
But this always return false.
This is not robotium problem, because equals method in Drawable may not be
implemeneted the way we want.
But several forums suggest that use getBackground().getConstantState() and
compare they should be equal, but they are still not.
So is there a way to achieve this using robotium.
Original comment by shrik...@gmail.com
on 1 Dec 2014 at 12:34
Original issue reported on code.google.com by
glenview...@gmail.com
on 16 Dec 2011 at 6:10