use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.
the class IntExpressionsTest method testLessThanExpression.
@Test
public void testLessThanExpression() {
BoolValueProperty result = new BoolValueProperty();
IntValueProperty lhs = new IntValueProperty();
IntValueProperty rhs = new IntValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isLessThan(rhs));
assertThat(result.get()).isFalse();
rhs.set(10);
assertThat(result.get()).isTrue();
lhs.set(10);
assertThat(result.get()).isFalse();
}
use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.
the class IntExpressionsTest method testGreaterThanExpression.
@Test
public void testGreaterThanExpression() {
BoolValueProperty result = new BoolValueProperty();
IntValueProperty lhs = new IntValueProperty();
IntValueProperty rhs = new IntValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(result, lhs.isGreaterThan(rhs));
assertThat(result.get()).isFalse();
lhs.set(10);
assertThat(result.get()).isTrue();
rhs.set(10);
assertThat(result.get()).isFalse();
}
use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.
the class StringExpressionsTest method testFormatStringExpression.
@Test
public void testFormatStringExpression() throws Exception {
IntValueProperty arg1 = new IntValueProperty(42);
BoolValueProperty arg2 = new BoolValueProperty(true);
StringValueProperty destValue = new StringValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(destValue, new FormatExpression("The answer is %1$s. Hitchhiker reference? %2$s", arg1, arg2));
assertThat(destValue.get()).isEqualTo("The answer is 42. Hitchhiker reference? true");
arg1.set(2);
arg2.set(false);
assertThat(destValue.get()).isEqualTo("The answer is 2. Hitchhiker reference? false");
}
use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.
the class BooleanExpressionsTest method testIsEmptyStringExpression.
@Test
public void testIsEmptyStringExpression() throws Exception {
StringValueProperty srcValue = new StringValueProperty();
BoolValueProperty destValue = new BoolValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(destValue, srcValue.isEmpty());
assertThat(destValue.get()).isTrue();
srcValue.set("Not Empty");
assertThat(destValue.get()).isFalse();
srcValue.set(" ");
assertThat(destValue.get()).isFalse();
srcValue.set("");
assertThat(destValue.get()).isTrue();
}
use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.
the class BooleanExpressionsTest method testIsEqualToExpression.
@Test
public void testIsEqualToExpression() throws Exception {
StringValueProperty srcValue = new StringValueProperty("Initial Value");
BoolValueProperty destValue = new BoolValueProperty();
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
bindings.bind(destValue, srcValue.isEqualTo("Modified Value"));
assertThat(destValue.get()).isFalse();
srcValue.set("Modified Value");
assertThat(destValue.get()).isTrue();
srcValue.set("Final Value");
assertThat(destValue.get()).isFalse();
}
Aggregations