use of com.android.tools.idea.ui.properties.core.DoubleValueProperty in project android by JetBrains.
the class DoubleExpressionsTest method testGreaterThanValueExpression.
@Test
public void testGreaterThanValueExpression() {
BoolValueProperty result = new BoolValueProperty();
DoubleValueProperty lhs = new DoubleValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isGreaterThan(10.0));
assertThat(result.get()).isFalse();
lhs.set(10.0);
assertThat(result.get()).isFalse();
lhs.set(20.0);
assertThat(result.get()).isTrue();
}
use of com.android.tools.idea.ui.properties.core.DoubleValueProperty in project android by JetBrains.
the class DoubleExpressionsTest method testLessThanValueExpression.
@Test
public void testLessThanValueExpression() {
BoolValueProperty result = new BoolValueProperty();
DoubleValueProperty lhs = new DoubleValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isLessThan(10.0));
assertThat(result.get()).isTrue();
lhs.set(10.0);
assertThat(result.get()).isFalse();
lhs.set(20.0);
assertThat(result.get()).isFalse();
}
use of com.android.tools.idea.ui.properties.core.DoubleValueProperty in project android by JetBrains.
the class DoubleExpressionsTest method testIsEqualWithValueExpression.
@Test
public void testIsEqualWithValueExpression() {
BoolValueProperty result = new BoolValueProperty();
DoubleValueProperty lhs = new DoubleValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isEqualTo(10));
assertThat(result.get()).isFalse();
lhs.set(10.0);
assertThat(result.get()).isTrue();
lhs.set(20.0);
assertThat(result.get()).isFalse();
}
use of com.android.tools.idea.ui.properties.core.DoubleValueProperty in project android by JetBrains.
the class DoubleExpressionsTest method testSumExpression.
@Test
public void testSumExpression() {
DoubleValueProperty sum = new DoubleValueProperty();
DoubleValueProperty a = new DoubleValueProperty(1.0);
DoubleValueProperty b = new DoubleValueProperty(2.0);
DoubleValueProperty c = new DoubleValueProperty(3.0);
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(sum, new com.android.tools.idea.ui.properties.expressions.double_.SumExpression(a, b, c));
assertThat(sum.get()).isWithin(0.01).of(6.0);
a.set(10.0);
b.set(100.0);
c.set(1000.0);
assertThat(sum.get()).isWithin(0.01).of(1110.0);
c.set(1001.0);
assertThat(sum.get()).isWithin(0.01).of(1111.0);
}
use of com.android.tools.idea.ui.properties.core.DoubleValueProperty in project android by JetBrains.
the class DoubleExpressionsTest method testIsEqualExpression.
@Test
public void testIsEqualExpression() {
BoolValueProperty result = new BoolValueProperty();
DoubleValueProperty lhs = new DoubleValueProperty();
DoubleValueProperty rhs = new DoubleValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isEqualTo(rhs));
assertThat(result.get()).isTrue();
lhs.set(10.0);
assertThat(result.get()).isFalse();
rhs.set(10.0);
assertThat(result.get()).isTrue();
rhs.set(20.0);
assertThat(result.get()).isFalse();
}
Aggregations