@TestTargetNew( level = TestLevel.COMPLETE, method = "scheduleDrawable", args = {android.graphics.drawable.Drawable.class, java.lang.Runnable.class, long.class}) public void testScheduleDrawable() { MockCallback callback = new MockCallback(); mRotateDrawable.setCallback(callback); mRotateDrawable.scheduleDrawable(null, null, 0); assertTrue(callback.hasCalledSchedule()); callback.reset(); mRotateDrawable.scheduleDrawable( new BitmapDrawable(), new Runnable() { public void run() {} }, 1000L); assertTrue(callback.hasCalledSchedule()); callback.reset(); mRotateDrawable.setCallback(null); mRotateDrawable.scheduleDrawable(null, null, 0); assertFalse(callback.hasCalledSchedule()); }
@TestTargetNew( level = TestLevel.COMPLETE, method = "invalidateDrawable", args = {android.graphics.drawable.Drawable.class}) public void testInvalidateDrawable() { Drawable drawable = mContext.getResources().getDrawable(R.drawable.pass); MockCallback callback = new MockCallback(); mRotateDrawable.setCallback(callback); mRotateDrawable.invalidateDrawable(null); assertTrue(callback.hasCalledInvalidate()); callback.reset(); mRotateDrawable.invalidateDrawable(drawable); assertTrue(callback.hasCalledInvalidate()); callback.reset(); mRotateDrawable.setCallback(null); mRotateDrawable.invalidateDrawable(drawable); assertFalse(callback.hasCalledInvalidate()); }