|
@@ -5,10 +5,12 @@ import android.app.Activity;
|
5
|
5
|
import com.reactnativenavigation.BaseTest;
|
6
|
6
|
import com.reactnativenavigation.anim.TopBarAnimator;
|
7
|
7
|
import com.reactnativenavigation.parse.AnimationOptions;
|
|
8
|
+import com.reactnativenavigation.utils.UiUtils;
|
8
|
9
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
9
|
10
|
import com.reactnativenavigation.views.topbar.TopBar;
|
10
|
11
|
|
11
|
12
|
import org.junit.Test;
|
|
13
|
+import org.robolectric.annotation.Config;
|
12
|
14
|
|
13
|
15
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
14
|
16
|
import static org.mockito.ArgumentMatchers.any;
|
|
@@ -17,15 +19,17 @@ import static org.mockito.Mockito.spy;
|
17
|
19
|
import static org.mockito.Mockito.times;
|
18
|
20
|
import static org.mockito.Mockito.verify;
|
19
|
21
|
|
|
22
|
+@Config(qualifiers = "xxhdpi")
|
20
|
23
|
public class TopBarTest extends BaseTest {
|
21
|
24
|
|
22
|
25
|
private TopBar uut;
|
23
|
26
|
private TopBarAnimator animator;
|
|
27
|
+ private Activity activity;
|
24
|
28
|
|
25
|
29
|
@SuppressWarnings("Convert2Lambda")
|
26
|
30
|
@Override
|
27
|
31
|
public void beforeEach() {
|
28
|
|
- Activity activity = newActivity();
|
|
32
|
+ activity = newActivity();
|
29
|
33
|
StackLayout parent = new StackLayout(activity, new TopBarController(), null);
|
30
|
34
|
uut = new TopBar(activity, parent);
|
31
|
35
|
animator = spy(new TopBarAnimator(uut));
|
|
@@ -54,4 +58,14 @@ public class TopBarTest extends BaseTest {
|
54
|
58
|
uut.showAnimate(options);
|
55
|
59
|
verify(animator, times(1)).show(options);
|
56
|
60
|
}
|
|
61
|
+
|
|
62
|
+ @Test
|
|
63
|
+ public void setElevation_ignoreValuesNotSetByNavigation() {
|
|
64
|
+ float initialElevation = uut.getElevation();
|
|
65
|
+ uut.setElevation(1f);
|
|
66
|
+ assertThat(uut.getElevation()).isEqualTo(initialElevation);
|
|
67
|
+
|
|
68
|
+ uut.setElevation(Double.valueOf(2));
|
|
69
|
+ assertThat(uut.getElevation()).isEqualTo(UiUtils.dpToPx(activity, 2));
|
|
70
|
+ }
|
57
|
71
|
}
|