Skip to content
Snippets Groups Projects
Commit 088def85 authored by Manuel Krombholz's avatar Manuel Krombholz
Browse files

Fixed ControllingItemTest and Item.jrag

parent 12e187c8
No related branches found
No related tags found
2 merge requests!19dev to master,!8Partly resolves "Implement state copy in AST"
Pipeline #8788 passed
......@@ -137,9 +137,10 @@ aspect ItemHandling {
//--- setStateFromBoolean ---
public abstract void Item.setStateFromBoolean(boolean value);
public void ColorItem.setStateFromBoolean(boolean value) {
if (getState().getBrightness()==0) {
setBrightness(value ? 100 : 0);
if (getState()!=null && getState().getBrightness()!=0 && value) {
return;
}
setBrightness(value ? 100 : 0);
}
public void DateTimeItem.setStateFromBoolean(boolean value) {
// there is no good way here
......
......@@ -102,10 +102,10 @@ public class ControllingItemTest {
assertEquals("30,20,10", stringItem.getState());
assertEquals(TupleHSB.of(30, 20, 10), target.getState(), "Item was not controlled correctly");
// boolean true -> set brightness to full (100)
// boolean true -> brightness should still be 10 because it's already turned on
booleanItem.setState(true);
assertTrue(booleanItem.getState());
assertEquals(TupleHSB.of(30, 20, 100), target.getState(), "Item was not controlled correctly");
assertEquals(TupleHSB.of(30, 20, 10), target.getState(), "Item was not controlled correctly");
// color (33,33,33) -> set brightness to (33,33,33)
colorItem.setState(TupleHSB.of(33, 33, 33));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment