use of com.reactnativenavigation.options.params.ThemeColour in project react-native-navigation by wix.
the class ButtonPresenterTest method applyOptions_shouldChangeIconColorBackground.
@Test
public void applyOptions_shouldChangeIconColorBackground() {
IconBackgroundDrawable mockD = mock(IconBackgroundDrawable.class);
initUUt(ImageLoaderMock.mock(mockD));
button.enabled = new Bool(true);
button.icon = new Text("icon");
button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
IconBackgroundOptions iconBackground = new IconBackgroundOptions();
iconBackground.color = new ThemeColour(new Colour(Color.GREEN), new Colour(Color.GREEN));
button.iconBackground = iconBackground;
MenuItem menuItem = spy(addMenuButton());
uut.applyOptions(titleBar, menuItem, buttonController::getView);
Drawable icon = menuItem.getIcon();
assertThat(icon).isNotNull();
assertThat(icon).isInstanceOf(IconBackgroundDrawable.class);
IconBackgroundDrawable modifed = (IconBackgroundDrawable) icon;
verify(modifed.getWrappedDrawable()).setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
assertThat(modifed.getBackgroundColor()).isEqualTo(Color.GREEN);
}
use of com.reactnativenavigation.options.params.ThemeColour in project react-native-navigation by wix.
the class ButtonPresenterTest method applyOptions_appliesColorOnButtonTextView.
@Test
public void applyOptions_appliesColorOnButtonTextView() {
button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
addButtonAndApplyOptions();
assertThat(findButtonView().getCurrentTextColor()).isEqualTo(Color.RED);
}
use of com.reactnativenavigation.options.params.ThemeColour in project react-native-navigation by wix.
the class ButtonPresenterTest method applyOptions_shouldChangeIconColorTint.
@Test
public void applyOptions_shouldChangeIconColorTint() {
IconBackgroundDrawable mockD = mock(IconBackgroundDrawable.class);
initUUt(ImageLoaderMock.mock(mockD));
button.enabled = new Bool(true);
button.icon = new Text("icon");
button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
MenuItem menuItem = spy(addMenuButton());
uut.applyOptions(titleBar, menuItem, buttonController::getView);
Drawable icon = menuItem.getIcon();
assertThat(icon).isNotNull();
verify(icon).setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.SRC_IN));
}
use of com.reactnativenavigation.options.params.ThemeColour in project react-native-navigation by wix.
the class ButtonPresenterTest method applyOptions_shouldChangeIconDisabledColorBackground.
@Test
public void applyOptions_shouldChangeIconDisabledColorBackground() {
IconBackgroundDrawable mockD = mock(IconBackgroundDrawable.class);
initUUt(ImageLoaderMock.mock(mockD));
button.enabled = new Bool(false);
button.icon = new Text("icon");
button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
button.disabledColor = new ThemeColour(new Colour(Color.YELLOW), new Colour(Color.YELLOW));
IconBackgroundOptions iconBackground = new IconBackgroundOptions();
iconBackground.color = new ThemeColour(new Colour(Color.GREEN), new Colour(Color.GREEN));
iconBackground.disabledColor = new ThemeColour(new Colour(Color.CYAN), new Colour(Color.CYAN));
button.iconBackground = iconBackground;
MenuItem menuItem = spy(addMenuButton());
uut.applyOptions(titleBar, menuItem, buttonController::getView);
Drawable icon = menuItem.getIcon();
assertThat(icon).isNotNull();
assertThat(icon).isInstanceOf(IconBackgroundDrawable.class);
IconBackgroundDrawable modifed = (IconBackgroundDrawable) icon;
verify(modifed.getWrappedDrawable()).setColorFilter(new PorterDuffColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN));
assertThat(modifed.getBackgroundColor()).isEqualTo(Color.CYAN);
}
use of com.reactnativenavigation.options.params.ThemeColour in project react-native-navigation by wix.
the class ButtonPresenterTest method applyOptions_shouldChangeIconDisabledColorTint.
@Test
public void applyOptions_shouldChangeIconDisabledColorTint() {
IconBackgroundDrawable mockD = mock(IconBackgroundDrawable.class);
initUUt(ImageLoaderMock.mock(mockD));
button.enabled = new Bool(false);
button.icon = new Text("icon");
button.color = new ThemeColour(new Colour(Color.RED), new Colour(Color.RED));
button.disabledColor = new ThemeColour(new Colour(Color.YELLOW), new Colour(Color.YELLOW));
MenuItem menuItem = spy(addMenuButton());
uut.applyOptions(titleBar, menuItem, buttonController::getView);
Drawable icon = menuItem.getIcon();
assertThat(icon).isNotNull();
verify(icon).setColorFilter(new PorterDuffColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_IN));
}
Aggregations