Search in sources :

Example 21 with Text

use of com.reactnativenavigation.options.params.Text in project react-native-navigation by wix.

the class ParentControllerTest method beforeEach.

@Override
public void beforeEach() {
    super.beforeEach();
    activity = newActivity();
    childRegistry = new ChildControllersRegistry();
    children = new ArrayList<>();
    Options initialOptions = new Options();
    initialOptions.topBar.title.text = new Text(INITIAL_TITLE);
    presenter = spy(new Presenter(activity, new Options()));
    uut = spy(new ParentController<ViewGroup>(activity, childRegistry, "uut", presenter, initialOptions) {

        @Override
        public ViewController<?> getCurrentChild() {
            return children.get(0);
        }

        @NonNull
        @Override
        public ViewGroup createView() {
            FrameLayout layout = new FrameLayout(activity);
            for (ViewController<?> child : children) {
                child.setParentController(this);
                layout.addView(child.getView());
            }
            return layout;
        }

        @Override
        public void sendOnNavigationButtonPressed(String buttonId) {
        }

        @NonNull
        @Override
        public Collection<ViewController<?>> getChildControllers() {
            return children;
        }
    });
}
Also used : Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) FrameLayout(android.widget.FrameLayout) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry) Text(com.reactnativenavigation.options.params.Text)

Example 22 with Text

use of com.reactnativenavigation.options.params.Text in project react-native-navigation by wix.

the class TopTabsViewControllerTest method createOptions.

@NonNull
private ArrayList<Options> createOptions() {
    ArrayList<Options> result = new ArrayList<>();
    for (int i = 0; i < SIZE; i++) {
        final Options options = new Options();
        options.topTabOptions.title = new Text("Tab " + i);
        options.topBar.title.text = new Text(createTabTopBarTitle(i));
        result.add(options);
    }
    return result;
}
Also used : Options(com.reactnativenavigation.options.Options) ArrayList(java.util.ArrayList) Text(com.reactnativenavigation.options.params.Text) NonNull(androidx.annotation.NonNull)

Example 23 with Text

use of com.reactnativenavigation.options.params.Text in project react-native-navigation by wix.

the class ButtonPresenterTest method createButton.

private ButtonOptions createButton() {
    ButtonOptions b = new ButtonOptions();
    b.id = "btn1";
    b.text = new Text(BTN_TEXT);
    b.showAsAction = new Number(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return b;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) Number(com.reactnativenavigation.options.params.Number) Text(com.reactnativenavigation.options.params.Text)

Example 24 with Text

use of com.reactnativenavigation.options.params.Text in project react-native-navigation by wix.

the class OptionsTest method clear_topBarOptions.

@Test
public void clear_topBarOptions() {
    Options uut = new Options();
    uut.topBar.title.text = new Text("some title");
    uut.clearTopBarOptions();
    assertThat(uut.topBar.title.text.hasValue()).isFalse();
}
Also used : Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 25 with Text

use of com.reactnativenavigation.options.params.Text in project react-native-navigation by wix.

the class FloatingActionButtonTest method getOptionsWithFabActions.

@NonNull
private Options getOptionsWithFabActions() {
    Options options = new Options();
    FabOptions fabOptions = new FabOptions();
    fabOptions.id = new Text("FAB");
    for (int i = 0; i < CHILD_FAB_COUNT; i++) {
        FabOptions childOptions = new FabOptions();
        childOptions.id = new Text("fab" + i);
        fabOptions.actionsArray.add(childOptions);
    }
    options.fabOptions = fabOptions;
    return options;
}
Also used : FabOptions(com.reactnativenavigation.options.FabOptions) Options(com.reactnativenavigation.options.Options) FabOptions(com.reactnativenavigation.options.FabOptions) Text(com.reactnativenavigation.options.params.Text) NonNull(androidx.annotation.NonNull)

Aggregations

Text (com.reactnativenavigation.options.params.Text)34 BaseTest (com.reactnativenavigation.BaseTest)16 Test (org.junit.Test)16 Options (com.reactnativenavigation.options.Options)14 Colour (com.reactnativenavigation.options.params.Colour)8 NullText (com.reactnativenavigation.options.params.NullText)8 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)8 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)6 Bool (com.reactnativenavigation.options.params.Bool)6 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)4 Drawable (android.graphics.drawable.Drawable)4 MenuItem (android.view.MenuItem)4 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)4 IconBackgroundDrawable (com.reactnativenavigation.views.stack.topbar.titlebar.IconBackgroundDrawable)4 NonNull (androidx.annotation.NonNull)3 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)3 ComponentOptions (com.reactnativenavigation.options.ComponentOptions)3 NullThemeColour (com.reactnativenavigation.options.params.NullThemeColour)3 FabOptions (com.reactnativenavigation.options.FabOptions)2 IconBackgroundOptions (com.reactnativenavigation.options.IconBackgroundOptions)2