use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.
the class DmxColorItemTest method canBeSetWith0PercentType.
@Test
public void canBeSetWith0PercentType() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
item.processCommand(service, new PercentType(0));
Mockito.verify(service).setChannelValue(3, 0);
Mockito.verify(service).setChannelValue(4, 0);
Mockito.verify(service).setChannelValue(5, 0);
}
use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.
the class DmxColorItemTest method decreasesWhenDecreaseCommandReceived.
@Test
@Override
public void decreasesWhenDecreaseCommandReceived() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
HSBType hsb = new HSBType(new DecimalType(150), new PercentType(50), new PercentType(50));
item.processCommand(service, hsb);
Mockito.verify(service, Mockito.times(1)).setChannelValue(3, 65);
Mockito.verify(service, Mockito.times(1)).setChannelValue(4, 129);
Mockito.verify(service, Mockito.times(1)).setChannelValue(5, 97);
item.processCommand(service, IncreaseDecreaseType.DECREASE);
Mockito.verify(service, Mockito.times(1)).setChannelValue(3, 57);
Mockito.verify(service, Mockito.times(1)).setChannelValue(4, 116);
Mockito.verify(service, Mockito.times(1)).setChannelValue(5, 87);
}
use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.
the class DmxColorItemTest method increasesWhenIncreaseCommandReceived.
@Test
@Override
public void increasesWhenIncreaseCommandReceived() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
HSBType hsb = new HSBType(new DecimalType(150), new PercentType(50), new PercentType(50));
item.processCommand(service, hsb);
Mockito.verify(service, Mockito.times(1)).setChannelValue(3, 65);
Mockito.verify(service, Mockito.times(1)).setChannelValue(4, 129);
Mockito.verify(service, Mockito.times(1)).setChannelValue(5, 97);
item.processCommand(service, IncreaseDecreaseType.INCREASE);
Mockito.verify(service, Mockito.times(1)).setChannelValue(3, 70);
Mockito.verify(service, Mockito.times(1)).setChannelValue(4, 140);
Mockito.verify(service, Mockito.times(1)).setChannelValue(5, 106);
}
use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.
the class DmxDimmerItemTest method decreasesWhenDecreaseCommandReceived.
@Test
public void decreasesWhenDecreaseCommandReceived() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
Mockito.when(service.getChannelValue(3)).thenReturn(95);
Mockito.when(service.getChannelValue(4)).thenReturn(3);
item.processCommand(service, IncreaseDecreaseType.DECREASE);
Mockito.verify(service).decreaseChannel(3, DmxDimmerItem.DIMMER_STEP_SIZE);
Mockito.verify(service).decreaseChannel(4, DmxDimmerItem.DIMMER_STEP_SIZE);
}
use of org.openhab.binding.dmx.DmxService in project openhab1-addons by openhab.
the class DmxDimmerItemTest method canBeSetWithPercentType.
@Test
public void canBeSetWithPercentType() throws BindingConfigParseException {
DmxItem item = getValidInstance();
DmxService service = Mockito.mock(DmxService.class);
Mockito.when(service.getChannelValue(3)).thenReturn(0);
Mockito.when(service.getChannelValue(4)).thenReturn(155);
item.processCommand(service, new PercentType(0));
Mockito.verify(service).setChannelValue(3, DmxChannel.DMX_MAX_VALUE);
Mockito.verify(service).setChannelValue(3, PercentType.ZERO);
Mockito.verify(service).setChannelValue(4, DmxChannel.DMX_MAX_VALUE);
Mockito.verify(service).setChannelValue(4, PercentType.ZERO);
}
Aggregations