blob: b397cf3b3c861878a01a0e5626973ff412cd7cfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package com.bumptech.glide.request.animation;
import android.view.View;
import android.view.animation.AlphaAnimation;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static junit.framework.Assert.assertFalse;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@RunWith(RobolectricTestRunner.class)
public class ViewAnimationTest {
private AlphaAnimation animation;
private View view;
private ViewAnimation viewAnimation;
@Before
public void setUp() {
animation = new AlphaAnimation(0f, 1f);
view = mock(View.class);
viewAnimation = new ViewAnimation(animation);
}
@Test
public void testClearsAnimationOnAnimate() {
viewAnimation.animate(null, null, view, null);
verify(view).clearAnimation();
}
@Test
public void testAlwaysReturnsFalse() {
assertFalse(viewAnimation.animate(null, null, view, null));
}
@Test
public void testStartsAnimationOnAnimate() {
viewAnimation.animate(null, null, view, null);
verify(view).startAnimation(eq(animation));
}
}
|