Search in sources :

Example 1 with LayoutInsets

use of com.reactnativenavigation.options.layout.LayoutInsets in project react-native-navigation by wix.

the class PresenterTest method shouldApplyInsetsOnTopMostParent.

@Test
public void shouldApplyInsetsOnTopMostParent() {
    final ViewGroup spy = Mockito.mock(ViewGroup.class);
    Mockito.when(spy.getLayoutParams()).thenReturn(new ViewGroup.LayoutParams(0, 0));
    Mockito.when(controller.getView()).thenReturn(spy);
    Options options = new Options();
    options.layout.setInsets(new LayoutInsets(1, 2, 3, 4));
    uut.applyOptions(controller, options);
    verify(parentView).setPadding(2, 1, 4, 3);
}
Also used : Options(com.reactnativenavigation.options.Options) ViewGroup(android.view.ViewGroup) LayoutInsets(com.reactnativenavigation.options.layout.LayoutInsets) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 2 with LayoutInsets

use of com.reactnativenavigation.options.layout.LayoutInsets in project react-native-navigation by wix.

the class PresenterTest method shouldMergeInsetsOnTopMostParent.

@Test
public void shouldMergeInsetsOnTopMostParent() {
    final ViewGroup spy = Mockito.mock(ViewGroup.class);
    Mockito.when(spy.getLayoutParams()).thenReturn(new ViewGroup.LayoutParams(0, 0));
    Mockito.when(controller.getView()).thenReturn(spy);
    Mockito.when(controller.resolveCurrentOptions()).thenReturn(Options.EMPTY);
    Options options = new Options();
    options.layout.setInsets(new LayoutInsets(1, 2, 3, 4));
    uut.mergeOptions(controller, options);
    verify(parentView).setPadding(2, 1, 4, 3);
}
Also used : Options(com.reactnativenavigation.options.Options) ViewGroup(android.view.ViewGroup) LayoutInsets(com.reactnativenavigation.options.layout.LayoutInsets) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

ViewGroup (android.view.ViewGroup)2 BaseTest (com.reactnativenavigation.BaseTest)2 Options (com.reactnativenavigation.options.Options)2 LayoutInsets (com.reactnativenavigation.options.layout.LayoutInsets)2 Test (org.junit.Test)2