|
1 | | -package io.flutter.embedding.engine.mutatorsstack; |
2 | | - |
3 | | -import static org.junit.Assert.assertEquals; |
4 | | - |
5 | | -import org.junit.Test; |
6 | | -import org.junit.runner.RunWith; |
7 | | -import org.robolectric.RobolectricTestRunner; |
8 | | -import org.robolectric.annotation.Config; |
9 | | - |
10 | | -@Config(manifest = Config.NONE) |
11 | | -@RunWith(RobolectricTestRunner.class) |
12 | | -public class FlutterMutatorsStackTest { |
13 | | - |
14 | | - @Test |
15 | | - public void pushOpacity() { |
16 | | - final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
17 | | - mutatorsStack.pushOpacity(.5f); |
18 | | - |
19 | | - assertEquals(mutatorsStack.getMutators().size(), 1); |
20 | | - assertEquals(mutatorsStack.getMutators().get(0).getType(), FlutterMutatorsStack.FlutterMutatorType.OPACITY); |
21 | | - assertEquals(mutatorsStack.getMutators().get(0).getOpacity(), .5f, 0f); |
22 | | - } |
23 | | - |
24 | | - @Test |
25 | | - public void defaultOpacity() { |
26 | | - final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
27 | | - |
28 | | - assertEquals(1f, mutatorsStack.getFinalOpacity(), 0f); |
29 | | - } |
30 | | - |
31 | | - @Test |
32 | | - public void layeredOpacity() { |
33 | | - final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
34 | | - mutatorsStack.pushOpacity(.5f); |
35 | | - mutatorsStack.pushOpacity(.6f); |
36 | | - mutatorsStack.pushOpacity(1f); |
37 | | - |
38 | | - assertEquals(.3f, mutatorsStack.getFinalOpacity(), 1 / 255); |
39 | | - } |
40 | | -} |
| 1 | +package io.flutter.embedding.engine.mutatorsstack; |
| 2 | + |
| 3 | +import static org.junit.Assert.assertEquals; |
| 4 | + |
| 5 | +import org.junit.Test; |
| 6 | +import org.junit.runner.RunWith; |
| 7 | +import org.robolectric.RobolectricTestRunner; |
| 8 | +import org.robolectric.annotation.Config; |
| 9 | + |
| 10 | +@Config(manifest = Config.NONE) |
| 11 | +@RunWith(RobolectricTestRunner.class) |
| 12 | +public class FlutterMutatorsStackTest { |
| 13 | + |
| 14 | + @Test |
| 15 | + public void pushOpacity() { |
| 16 | + final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
| 17 | + mutatorsStack.pushOpacity(.5f); |
| 18 | + |
| 19 | + assertEquals(mutatorsStack.getMutators().size(), 1); |
| 20 | + assertEquals( |
| 21 | + mutatorsStack.getMutators().get(0).getType(), |
| 22 | + FlutterMutatorsStack.FlutterMutatorType.OPACITY); |
| 23 | + assertEquals(mutatorsStack.getMutators().get(0).getOpacity(), .5f, 0f); |
| 24 | + } |
| 25 | + |
| 26 | + @Test |
| 27 | + public void defaultOpacity() { |
| 28 | + final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
| 29 | + |
| 30 | + assertEquals(1f, mutatorsStack.getFinalOpacity(), 0f); |
| 31 | + } |
| 32 | + |
| 33 | + @Test |
| 34 | + public void layeredOpacity() { |
| 35 | + final FlutterMutatorsStack mutatorsStack = new FlutterMutatorsStack(); |
| 36 | + mutatorsStack.pushOpacity(.5f); |
| 37 | + mutatorsStack.pushOpacity(.6f); |
| 38 | + mutatorsStack.pushOpacity(1f); |
| 39 | + |
| 40 | + assertEquals(.3f, mutatorsStack.getFinalOpacity(), 1 / 255); |
| 41 | + } |
| 42 | +} |
0 commit comments