use of com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry 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.viewcontrollers.child.ChildControllersRegistry 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.viewcontrollers.child.ChildControllersRegistry in project react-native-navigation by wix.
the class SideMenuControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = createActivity();
childRegistry = new ChildControllersRegistry();
presenter = spy(new SideMenuPresenter());
child = new SimpleComponentViewController(activity, childRegistry, "child", new Options());
left = spy(new SimpleComponentViewController(activity, childRegistry, "left", new Options()));
right = spy(new SimpleComponentViewController(activity, childRegistry, "right", createSideMenuOptions()));
center = spy(new SimpleComponentViewController(activity, childRegistry, "center", createSideMenuOptions()));
uut = new SideMenuController(activity, childRegistry, "sideMenu", new Options(), presenter, new Presenter(activity, new Options())) {
@Override
public Options resolveCurrentOptions() {
resolvedOptions = super.resolveCurrentOptions();
return resolvedOptions;
}
};
uut.setCenterController(center);
parent = Mocks.INSTANCE.parentController(null);
Mockito.when(parent.resolveChildOptions(uut)).thenReturn(Options.EMPTY);
uut.setParentController(parent);
}
use of com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry in project react-native-navigation by wix.
the class ComponentViewControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
SystemUiUtils.saveStatusBarHeight(63);
view = Mockito.spy(new TestComponentLayout(activity, new TestReactView(activity)));
parent = TestUtils.newStackController(activity).build();
Presenter presenter = new Presenter(activity, new Options());
this.presenter = Mockito.spy(new ComponentPresenter(Options.EMPTY));
uut = Mockito.spy(new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, new Options(), presenter, this.presenter) {
@Override
public Options resolveCurrentOptions(Options defaultOptions) {
// Hacky way to return the same instance of resolvedOptions without copying it.
return resolvedOptions.withDefaultOptions(uut.options).withDefaultOptions(defaultOptions);
}
});
uut.setParentController(parent);
parent.ensureViewIsCreated();
}
use of com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry in project react-native-navigation by wix.
the class FloatingActionButtonTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
childRegistry = new ChildControllersRegistry();
stackController = TestUtils.newStackController(activity).setFabPresenter(createFabPresenter()).build();
stackController.ensureViewIsCreated();
Options options = getOptionsWithFab();
childFab = new SimpleViewController(activity, childRegistry, "child1", options);
childNoFab = new SimpleViewController(activity, childRegistry, "child2", new Options());
}
Aggregations