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,6 +216,7 @@ public class TitleBar extends Toolbar {
216 216
     }
217 217
 
218 218
     public void setHeight(int height) {
219
+        if (height == getLayoutParams().height) return;
219 220
         ViewGroup.LayoutParams lp = getLayoutParams();
220 221
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
221 222
         setLayoutParams(lp);

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

@@ -74,6 +74,7 @@ public class TopBar extends AppBarLayout implements ScrollEventListener.ScrollAw
74 74
     }
75 75
 
76 76
     public void setHeight(int height) {
77
+        if (height == getLayoutParams().height) return;
77 78
         ViewGroup.LayoutParams lp = getLayoutParams();
78 79
         lp.height = (int) UiUtils.dpToPx(getContext(), height);
79 80
         setLayoutParams(lp);

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

@@ -55,7 +55,7 @@ public class TopBarBackgroundComponentTest extends BaseTest {
55 55
         TopBarBackgroundView background = (TopBarBackgroundView) ViewUtils.findChildrenByClassRecursive(uut, TopBarBackgroundView.class).get(0);
56 56
         assertThat(background).isNotNull();
57 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 61
     @Test