Search in sources :

Example 21 with BoolValueProperty

use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.

the class BooleanExpressionsTest method testNotExpression.

@Test
public void testNotExpression() throws Exception {
    BoolValueProperty srcValue = new BoolValueProperty(true);
    BoolValueProperty destValue = new BoolValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(destValue, BooleanExpressions.not(srcValue));
    assertThat(srcValue.get()).isTrue();
    assertThat(destValue.get()).isFalse();
    srcValue.set(false);
    assertThat(srcValue.get()).isFalse();
    assertThat(destValue.get()).isTrue();
}
Also used : BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 22 with BoolValueProperty

use of com.android.tools.idea.ui.properties.core.BoolValueProperty 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();
}
Also used : DoubleValueProperty(com.android.tools.idea.ui.properties.core.DoubleValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 23 with BoolValueProperty

use of com.android.tools.idea.ui.properties.core.BoolValueProperty 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();
}
Also used : DoubleValueProperty(com.android.tools.idea.ui.properties.core.DoubleValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 24 with BoolValueProperty

use of com.android.tools.idea.ui.properties.core.BoolValueProperty 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();
}
Also used : DoubleValueProperty(com.android.tools.idea.ui.properties.core.DoubleValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Example 25 with BoolValueProperty

use of com.android.tools.idea.ui.properties.core.BoolValueProperty in project android by JetBrains.

the class IntExpressionsTest method testLessThanValueExpression.

@Test
public void testLessThanValueExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThan(10));
    assertThat(result.get()).isTrue();
    lhs.set(10);
    assertThat(result.get()).isFalse();
    lhs.set(20);
    assertThat(result.get()).isFalse();
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) BindingsManager(com.android.tools.idea.ui.properties.BindingsManager) BoolValueProperty(com.android.tools.idea.ui.properties.core.BoolValueProperty) Test(org.junit.Test)

Aggregations

BoolValueProperty (com.android.tools.idea.ui.properties.core.BoolValueProperty)29 Test (org.junit.Test)29 BindingsManager (com.android.tools.idea.ui.properties.BindingsManager)27 IntValueProperty (com.android.tools.idea.ui.properties.core.IntValueProperty)13 DoubleValueProperty (com.android.tools.idea.ui.properties.core.DoubleValueProperty)10 StringValueProperty (com.android.tools.idea.ui.properties.core.StringValueProperty)4