use of com.reactnativenavigation.options.SideMenuOptions 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.SideMenuOptions 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.SideMenuOptions 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);
}
use of com.reactnativenavigation.options.SideMenuOptions in project react-native-navigation by wix.
the class SideMenuControllerTest method setLeftController_matchesParentByDefault.
@Test
public void setLeftController_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, "left", new Options());
uut.setLeftController(componentViewController);
LayoutParams params = componentViewController.getView().getLayoutParams();
assertThat(params.width).isEqualTo(MATCH_PARENT);
assertThat(params.height).isEqualTo(MATCH_PARENT);
}
use of com.reactnativenavigation.options.SideMenuOptions in project react-native-navigation by wix.
the class SideMenuControllerTest method closeDrawerAndAssertVisibility.
private void closeDrawerAndAssertVisibility(ViewController<?> side, Functions.FuncR1<ViewController<?>, SideMenuOptions> opt) {
Options options = new Options();
(side == left ? options.sideMenuRootOptions.left : options.sideMenuRootOptions.right).visible = new Bool(false);
uut.mergeOptions(options);
assertThat(uut.getView().isDrawerOpen(getGravity(side))).isFalse();
assertThat(opt.run(side).visible.isTrue()).isFalse();
}
Aggregations