use of org.eclipse.smarthome.core.library.types.HSBType in project smarthome by eclipse.
the class ColorItemTest method testSetStateWithPercentType.
@Test
public void testSetStateWithPercentType() {
ColorItem item = new ColorItem("test");
item.setState(new PercentType(50));
assertEquals(new HSBType(new DecimalType(0), new PercentType(0), new PercentType(50)), item.getState());
}
use of org.eclipse.smarthome.core.library.types.HSBType in project smarthome by eclipse.
the class NumberItemTest method setHSBType.
@Test
public void setHSBType() {
NumberItem item = new NumberItem("test");
State hsb = new HSBType("5,23,42");
item.setState(hsb);
assertEquals(hsb, item.getState());
}
use of org.eclipse.smarthome.core.library.types.HSBType in project smarthome by eclipse.
the class RollershutterItemTest method setState_stateHSB50_returnPercent50.
@Test
public void setState_stateHSB50_returnPercent50() {
// HSB supported because it is a sub-type of PercentType
RollershutterItem sut = new RollershutterItem("Test");
State state = new HSBType("5,23,42");
sut.setState(state);
assertEquals(new PercentType(42), sut.getState());
}
use of org.eclipse.smarthome.core.library.types.HSBType in project smarthome by eclipse.
the class SwitchItemTest method getAsHSBFromSwitch.
@Test
public void getAsHSBFromSwitch() {
SwitchItem item = new SwitchItem("Test");
item.setState(OnOffType.ON);
assertEquals(new HSBType("0,0,100"), item.getStateAs(HSBType.class));
item.setState(OnOffType.OFF);
assertEquals(new HSBType("0,0,0"), item.getStateAs(HSBType.class));
}
use of org.eclipse.smarthome.core.library.types.HSBType in project smarthome by eclipse.
the class TradfriColorTest method testFromCieKnownGood4.
@Test
public void testFromCieKnownGood4() {
TradfriColor color = new TradfriColor(11413, 31334, 181);
assertEquals(11413, (int) color.xyX);
assertEquals(31334, (int) color.xyY);
assertEquals(181, (int) color.brightness);
HSBType hsbType = color.getHSB();
assertNotNull(hsbType);
assertEquals(158, hsbType.getHue().intValue());
assertEquals(100, hsbType.getSaturation().intValue());
assertEquals(72, hsbType.getBrightness().intValue());
}
Aggregations