Search in sources :

Example 1 with ButtonPresenter

use of com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter in project react-native-navigation by wix.

the class ButtonPresenterTest method initUUt.

private void initUUt(ImageLoader imageLoaderMock) {
    IconResolverFake iconResolver = new IconResolverFake(activity, imageLoaderMock);
    uut = new ButtonPresenter(activity, button, iconResolver);
    buttonController = new ButtonController(activity, uut, button, mock(TitleBarButtonCreator.class), mock(ButtonController.OnClickListener.class));
}
Also used : IconResolverFake(com.reactnativenavigation.fakes.IconResolverFake) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter)

Example 2 with ButtonPresenter

use of com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter in project react-native-navigation by wix.

the class StackPresenter method createButtonController.

private ButtonController createButtonController(ButtonOptions button) {
    ButtonController controller = new ButtonController(activity, new ButtonPresenter(activity, button, iconResolver), button, buttonCreator, onClickListener);
    controller.setWaitForRender(button.component.waitForRender);
    return controller;
}
Also used : ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter)

Example 3 with ButtonPresenter

use of com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter in project react-native-navigation by wix.

the class TitleBarButtonControllerTest method beforeEach.

@Override
public void beforeEach() {
    Activity activity = newActivity();
    titleBar = new ButtonBar(activity);
    ButtonOptions button = createComponentButton();
    uut = new ButtonController(activity, new ButtonPresenter(activity, button, new IconResolver(activity, ImageLoaderMock.mock())), button, new TitleBarButtonCreatorMock(), Mockito.mock(ButtonController.OnClickListener.class));
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonBar(com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) IconResolver(com.reactnativenavigation.viewcontrollers.stack.topbar.button.IconResolver) Activity(android.app.Activity) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)

Example 4 with ButtonPresenter

use of com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter in project react-native-navigation by wix.

the class TopBarButtonControllerTest method beforeEach.

@Override
public void beforeEach() {
    button = new ButtonOptions();
    final Activity activity = newActivity();
    TitleBarButtonCreatorMock buttonCreatorMock = new TitleBarButtonCreatorMock();
    stackController = spy(TestUtils.newStackController(activity).build());
    stackController.getView().layout(0, 0, 1080, 1920);
    stackController.getTopBar().layout(0, 0, 1080, 200);
    getTitleBar().layout(0, 0, 1080, 200);
    optionsPresenter = spy(new ButtonPresenter(activity, button, new IconResolverFake(activity, ImageLoaderMock.mock())));
    uut = new ButtonController(activity, optionsPresenter, button, buttonCreatorMock, (buttonId) -> {
    });
    stackController.ensureViewIsCreated();
}
Also used : IconResolverFake(com.reactnativenavigation.fakes.IconResolverFake) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Text(com.reactnativenavigation.options.params.Text) Java6Assertions.assertThat(org.assertj.core.api.Java6Assertions.assertThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Colour(com.reactnativenavigation.options.params.Colour) ButtonBar(com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar) Mockito.spy(org.mockito.Mockito.spy) MenuItem(android.view.MenuItem) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock) NullText(com.reactnativenavigation.options.params.NullText) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Bool(com.reactnativenavigation.options.params.Bool) ButtonOptions(com.reactnativenavigation.options.ButtonOptions) BaseTest(com.reactnativenavigation.BaseTest) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) Number(com.reactnativenavigation.options.params.Number) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.verify(org.mockito.Mockito.verify) Color(android.graphics.Color) IconResolverFake(com.reactnativenavigation.fakes.IconResolverFake) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) TestUtils(com.reactnativenavigation.TestUtils) Activity(android.app.Activity) ImageLoaderMock(com.reactnativenavigation.mocks.ImageLoaderMock) ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ButtonController(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController) ButtonPresenter(com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter) Activity(android.app.Activity) TitleBarButtonCreatorMock(com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)

Aggregations

ButtonController (com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController)4 ButtonPresenter (com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonPresenter)4 Activity (android.app.Activity)2 IconResolverFake (com.reactnativenavigation.fakes.IconResolverFake)2 TitleBarButtonCreatorMock (com.reactnativenavigation.mocks.TitleBarButtonCreatorMock)2 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)2 ButtonBar (com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar)2 Color (android.graphics.Color)1 MenuItem (android.view.MenuItem)1 BaseTest (com.reactnativenavigation.BaseTest)1 TestUtils (com.reactnativenavigation.TestUtils)1 ImageLoaderMock (com.reactnativenavigation.mocks.ImageLoaderMock)1 Bool (com.reactnativenavigation.options.params.Bool)1 Colour (com.reactnativenavigation.options.params.Colour)1 NullText (com.reactnativenavigation.options.params.NullText)1 Number (com.reactnativenavigation.options.params.Number)1 Text (com.reactnativenavigation.options.params.Text)1 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)1 IconResolver (com.reactnativenavigation.viewcontrollers.stack.topbar.button.IconResolver)1 Java6Assertions.assertThat (org.assertj.core.api.Java6Assertions.assertThat)1