Search in sources :

Example 1 with Number

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

the class OptionsTest method clear_topTabsOptions.

@Test
public void clear_topTabsOptions() {
    Options uut = new Options();
    uut.topTabs.fontSize = new Number(666);
    uut.clearTopTabsOptions();
    assertThat(uut.topTabs.fontSize.hasValue()).isFalse();
}
Also used : Number(com.reactnativenavigation.options.params.Number) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 2 with Number

use of com.reactnativenavigation.options.params.Number 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);
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) LayoutParams(android.view.ViewGroup.LayoutParams) Number(com.reactnativenavigation.options.params.Number) SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 3 with Number

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

the class SideMenuControllerTest method setLeftController_setHeightAndWidthWithOptions.

@Test
public void setLeftController_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);
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) LayoutParams(android.view.ViewGroup.LayoutParams) Number(com.reactnativenavigation.options.params.Number) SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 4 with Number

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

the class TopBarButtonControllerTest method setIconButton.

private void setIconButton(boolean enabled) {
    button.id = "btn1";
    button.icon = new Text("someIcon");
    button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
    button.component.name = new NullText();
    button.component.componentId = new NullText();
    button.enabled = new Bool(enabled);
    button.showAsAction = new Number(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
Also used : Number(com.reactnativenavigation.options.params.Number) Bool(com.reactnativenavigation.options.params.Bool) Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) NullText(com.reactnativenavigation.options.params.NullText) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour)

Example 5 with Number

use of com.reactnativenavigation.options.params.Number 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)

Aggregations

Number (com.reactnativenavigation.options.params.Number)6 BaseTest (com.reactnativenavigation.BaseTest)3 Options (com.reactnativenavigation.options.Options)3 Test (org.junit.Test)3 LayoutParams (android.view.ViewGroup.LayoutParams)2 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)2 SideMenuOptions (com.reactnativenavigation.options.SideMenuOptions)2 Text (com.reactnativenavigation.options.params.Text)2 CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)1 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)1 Bool (com.reactnativenavigation.options.params.Bool)1 Colour (com.reactnativenavigation.options.params.Colour)1 NullText (com.reactnativenavigation.options.params.NullText)1 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)1 BottomTabsPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter)1 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)1