use of org.smarthomej.binding.dmx.internal.multiverse.DmxChannel in project addons by smarthomej.
the class FadeActionTest method checkWithFadingWithHold.
@Test
public void checkWithFadingWithHold() {
FadeAction fadeAction = new FadeAction(TEST_FADE_TIME, TEST_VALUE, TEST_HOLD_TIME);
DmxChannel testChannel = new DmxChannel(0, 1, 0);
testChannel.setValue(0);
long startTime = System.currentTimeMillis();
assertThat(fadeAction.getState(), is(ActionState.WAITING));
assertThat(fadeAction.getNewValue(testChannel, startTime), is(0));
assertThat(fadeAction.getState(), is(ActionState.RUNNING));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_FADE_TIME / 2), is(256 * TEST_VALUE / 2));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_FADE_TIME), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.RUNNING));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_FADE_TIME + TEST_HOLD_TIME / 2), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.RUNNING));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_FADE_TIME + TEST_HOLD_TIME), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.COMPLETED));
fadeAction.reset();
assertThat(fadeAction.getState(), is(ActionState.WAITING));
}
use of org.smarthomej.binding.dmx.internal.multiverse.DmxChannel in project addons by smarthomej.
the class FadeActionTest method checkWithoutFadingWithHold.
@Test
public void checkWithoutFadingWithHold() {
FadeAction fadeAction = new FadeAction(0, TEST_VALUE, TEST_HOLD_TIME);
DmxChannel testChannel = new DmxChannel(0, 1, 0);
testChannel.setValue(0);
long startTime = System.currentTimeMillis();
assertThat(fadeAction.getState(), is(ActionState.WAITING));
assertThat(fadeAction.getNewValue(testChannel, startTime), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.RUNNING));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_HOLD_TIME / 2), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.RUNNING));
assertThat(fadeAction.getNewValue(testChannel, startTime + TEST_HOLD_TIME), is(256 * TEST_VALUE));
assertThat(fadeAction.getState(), is(ActionState.COMPLETED));
fadeAction.reset();
assertThat(fadeAction.getState(), is(ActionState.WAITING));
}
Aggregations