Search in sources :

Example 6 with BoolValueProperty

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

the class DoubleExpressionsTest method testLessThanExpression.

@Test
public void testLessThanExpression() {
    BoolValueProperty result = new BoolValueProperty();
    DoubleValueProperty lhs = new DoubleValueProperty();
    DoubleValueProperty rhs = new DoubleValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThan(rhs));
    assertThat(result.get()).isFalse();
    rhs.set(10.0);
    assertThat(result.get()).isTrue();
    lhs.set(10.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 7 with BoolValueProperty

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

the class DoubleExpressionsTest method testLessThanEqualValueExpression.

@Test
public void testLessThanEqualValueExpression() {
    BoolValueProperty result = new BoolValueProperty();
    DoubleValueProperty lhs = new DoubleValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThanEqualTo(10.0));
    assertThat(result.get()).isTrue();
    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 8 with BoolValueProperty

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

the class IntExpressionsTest method testIsEqualWithValueExpression.

@Test
public void testIsEqualWithValueExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isEqualTo(10));
    assertThat(result.get()).isFalse();
    lhs.set(10);
    assertThat(result.get()).isTrue();
    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)

Example 9 with BoolValueProperty

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

the class DoubleExpressionsTest method testLessThanEqualExpression.

@Test
public void testLessThanEqualExpression() {
    BoolValueProperty result = new BoolValueProperty();
    DoubleValueProperty lhs = new DoubleValueProperty();
    DoubleValueProperty rhs = new DoubleValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isLessThanEqualTo(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()).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 10 with BoolValueProperty

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

the class IntExpressionsTest method testIsEqualExpression.

@Test
public void testIsEqualExpression() {
    BoolValueProperty result = new BoolValueProperty();
    IntValueProperty lhs = new IntValueProperty();
    IntValueProperty rhs = new IntValueProperty();
    BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
    bindings.bind(result, lhs.isEqualTo(rhs));
    assertThat(result.get()).isTrue();
    lhs.set(10);
    assertThat(result.get()).isFalse();
    rhs.set(10);
    assertThat(result.get()).isTrue();
    rhs.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