I have an ImageView that is rotated using RotateAnimation(). I am writing a test case where I want to test that after a button is clicked this view is rotated. So I thought that I can get the rotation angle before the click and after it to check the difference:
oldRotationDegrees = view.getRotation();
//click that button and wait for 3 seconds
assertTrue(Math.abs(view.getRotation() - oldRotationDegrees) > 0);
However this difference is always 0, because getRotation() always returns 0. I have checked that there is really a rotation visible, so it seems that RotateAnimation() doesn't affect the value returned by getRotation().
So how can I verify that the image has been rotated after the button is pressed?
In case it matters, I am using Robotium for these tests.
Update: I am now testing also with robolectric (unit tests) and the behaviour is (without surprise) the same.
Update 2: This answer https://stackoverflow.com/a/4213493/2160877 explains why this happens.