use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ModalStackTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
childRegistry = new ChildControllersRegistry();
root = new SimpleViewController(activity, childRegistry, "root", new Options());
FrameLayout rootLayout = new FrameLayout(activity);
CoordinatorLayout modalsLayout = new CoordinatorLayout(activity);
FrameLayout contentLayout = new FrameLayout(activity);
contentLayout.addView(rootLayout);
contentLayout.addView(modalsLayout);
activity.setContentView(contentLayout);
animator = spy(new ModalAnimatorMock(activity));
presenter = spy(new ModalPresenter(animator));
uut = new ModalStack(activity, presenter);
uut.setModalsLayout(modalsLayout);
uut.setRootLayout(rootLayout);
emitter = Mockito.mock(EventEmitter.class);
uut.setEventEmitter(emitter);
modal1 = spy(new SimpleViewController(activity, childRegistry, MODAL_ID_1, new Options()));
modal2 = spy(new SimpleViewController(activity, childRegistry, MODAL_ID_2, new Options()));
modal3 = spy(new SimpleViewController(activity, childRegistry, MODAL_ID_3, new Options()));
modal4 = spy(new SimpleViewController(activity, childRegistry, MODAL_ID_4, new Options()));
stack = TestUtils.newStackController(activity).setChildren(modal4).build();
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class OverlayManagerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
Activity activity = newActivity();
contentLayout = new FrameLayout(activity);
contentLayout.layout(0, 0, 1000, 1000);
activity.setContentView(contentLayout);
overlayContainer = new FrameLayout(activity);
contentLayout.addView(overlayContainer);
ChildControllersRegistry childRegistry = new ChildControllersRegistry();
overlay1 = spy(new SimpleViewController(activity, childRegistry, OVERLAY_ID_1, new Options()));
overlay2 = spy(new SimpleViewController(activity, childRegistry, OVERLAY_ID_2, new Options()));
uut = new OverlayManager();
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class SideMenuControllerTest method setRightController_matchesParentByDefault.
@Test
public void setRightController_matchesParentByDefault() {
SideMenuOptions options = new SideMenuOptions();
assertThat(options.width.hasValue()).isFalse();
assertThat(options.height.hasValue()).isFalse();
uut.options.sideMenuRootOptions.left = options;
SimpleComponentViewController componentViewController = new SimpleComponentViewController(activity, childRegistry, "right", new Options());
uut.setRightController(componentViewController);
LayoutParams params = componentViewController.getView().getLayoutParams();
assertThat(params.width).isEqualTo(MATCH_PARENT);
assertThat(params.height).isEqualTo(MATCH_PARENT);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class SideMenuControllerTest method setRightController_setHeightAndWidthWithOptions.
@Test
public void setRightController_setHeightAndWidthWithOptions() {
SideMenuOptions options = new SideMenuOptions();
options.height = new Number(100);
options.width = new Number(200);
uut.options.sideMenuRootOptions.left = options;
SimpleComponentViewController componentViewController = new SimpleComponentViewController(activity, childRegistry, "left", new Options());
uut.setLeftController(componentViewController);
int heightInDp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, Resources.getSystem().getDisplayMetrics());
int widthInDp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, Resources.getSystem().getDisplayMetrics());
LayoutParams params = componentViewController.getView().getLayoutParams();
assertThat(params.width).isEqualTo(widthInDp);
assertThat(params.height).isEqualTo(heightInDp);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class SideMenuControllerTest method openLeftMenu.
private void openLeftMenu() {
Options options = new Options();
options.sideMenuRootOptions.left.visible = new Bool(true);
options.sideMenuRootOptions.left.animate = new Bool(false);
uut.mergeOptions(options);
uut.onDrawerSlide(left.getView(), 1);
}
Aggregations