Browse Source

Fix unit tests

Guy Carmeli 6 years ago
parent
commit
0b7edc2e81

+ 1
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java View File

216
     }
216
     }
217
 
217
 
218
     public void setHeight(int height) {
218
     public void setHeight(int height) {
219
+        if (height == getLayoutParams().height) return;
219
         ViewGroup.LayoutParams lp = getLayoutParams();
220
         ViewGroup.LayoutParams lp = getLayoutParams();
220
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
221
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
221
         setLayoutParams(lp);
222
         setLayoutParams(lp);

+ 1
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/topbar/TopBar.java View File

74
     }
74
     }
75
 
75
 
76
     public void setHeight(int height) {
76
     public void setHeight(int height) {
77
+        if (height == getLayoutParams().height) return;
77
         ViewGroup.LayoutParams lp = getLayoutParams();
78
         ViewGroup.LayoutParams lp = getLayoutParams();
78
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
79
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
79
         setLayoutParams(lp);
80
         setLayoutParams(lp);

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/views/TopBarBackgroundComponentTest.java View File

55
         TopBarBackgroundView background = (TopBarBackgroundView) ViewUtils.findChildrenByClassRecursive(uut, TopBarBackgroundView.class).get(0);
55
         TopBarBackgroundView background = (TopBarBackgroundView) ViewUtils.findChildrenByClassRecursive(uut, TopBarBackgroundView.class).get(0);
56
         assertThat(background).isNotNull();
56
         assertThat(background).isNotNull();
57
         assertThat(background.getLayoutParams().width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
57
         assertThat(background.getLayoutParams().width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
58
-        assertThat(background.getLayoutParams().height).isEqualTo(uut.getHeight());
58
+        assertThat(background.getLayoutParams().height).isEqualTo(100);
59
     }
59
     }
60
 
60
 
61
     @Test
61
     @Test