Search in sources :

Example 6 with ThemeColour

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

the class ButtonPresenterTest method applyColor_shouldChangeColor.

@Test
public void applyColor_shouldChangeColor() {
    MenuItem menuItem = addMenuButton();
    uut.applyOptions(titleBar, menuItem, buttonController::getView);
    ThemeColour color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
    uut.applyColor(titleBar, menuItem, color);
    assertThat(findButtonView().getCurrentTextColor()).isEqualTo(Color.RED);
}
Also used : MenuItem(android.view.MenuItem) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 7 with ThemeColour

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

the class ButtonPresenterTest method applyOptions_appliesColorOnButtonTextViewOnDarkMode.

@Test
public void applyOptions_appliesColorOnButtonTextViewOnDarkMode() {
    mockConfiguration.uiMode = Configuration.UI_MODE_NIGHT_NO;
    button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.BLACK));
    MenuItem menuItem = addButtonAndApplyOptions();
    assertThat(findButtonView().getCurrentTextColor()).isEqualTo(Color.RED);
    mockConfiguration.uiMode = Configuration.UI_MODE_NIGHT_YES;
    uut.applyOptions(titleBar, menuItem, buttonController::getView);
    assertThat(findButtonView().getCurrentTextColor()).isEqualTo(Color.BLACK);
}
Also used : MenuItem(android.view.MenuItem) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 8 with ThemeColour

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

the class ButtonSpanTest method createButton.

@NotNull
private ButtonOptions createButton() {
    ButtonOptions button = new ButtonOptions();
    button.color = new ThemeColour(new Colour(Color.RED));
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with ThemeColour

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

the class OptionsTest method clear_bottomTabsOptions.

@Test
public void clear_bottomTabsOptions() {
    Options uut = new Options();
    uut.bottomTabsOptions.backgroundColor = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
    uut.clearBottomTabsOptions();
    assertThat(uut.bottomTabsOptions.backgroundColor.hasValue()).isFalse();
}
Also used : ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 10 with ThemeColour

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

Aggregations

ThemeColour (com.reactnativenavigation.options.params.ThemeColour)18 Colour (com.reactnativenavigation.options.params.Colour)17 BaseTest (com.reactnativenavigation.BaseTest)13 Test (org.junit.Test)13 Text (com.reactnativenavigation.options.params.Text)8 MenuItem (android.view.MenuItem)7 Bool (com.reactnativenavigation.options.params.Bool)6 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)4 Drawable (android.graphics.drawable.Drawable)4 Options (com.reactnativenavigation.options.Options)4 DontApplyColour (com.reactnativenavigation.options.params.DontApplyColour)4 NullThemeColour (com.reactnativenavigation.options.params.NullThemeColour)4 IconBackgroundDrawable (com.reactnativenavigation.views.stack.topbar.titlebar.IconBackgroundDrawable)4 NullText (com.reactnativenavigation.options.params.NullText)3 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)2 IconBackgroundOptions (com.reactnativenavigation.options.IconBackgroundOptions)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Number (com.reactnativenavigation.options.params.Number)1 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)1 NotNull (org.jetbrains.annotations.NotNull)1