Search in sources :

Example 1 with IntProperty

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

the class ExpressionTest method testSimpleExpression.

@Test
public void testSimpleExpression() throws Exception {
    final IntProperty intValue = new IntValueProperty(13);
    final Expression<String> intToString = new Expression<String>(intValue) {

        @NotNull
        @Override
        public String get() {
            return intValue.get().toString();
        }
    };
    assertThat(intToString.get()).isEqualTo("13");
    intValue.set(-13);
    assertThat(intToString.get()).isEqualTo("-13");
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) IntProperty(com.android.tools.idea.ui.properties.core.IntProperty) StringExpression(com.android.tools.idea.ui.properties.expressions.string.StringExpression) Test(org.junit.Test)

Example 2 with IntProperty

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

the class OptionalExpressionsTest method testAsOptionalExpression.

@Test
public void testAsOptionalExpression() {
    IntProperty intProperty = new IntValueProperty(42);
    AsOptionalExpression<Integer> asOptionalExpr = new AsOptionalExpression<>(intProperty);
    assertThat(asOptionalExpr.get().get()).isEqualTo(42);
    intProperty.set(123);
    assertThat(asOptionalExpr.get().get()).isEqualTo(123);
}
Also used : IntValueProperty(com.android.tools.idea.ui.properties.core.IntValueProperty) IntProperty(com.android.tools.idea.ui.properties.core.IntProperty) Test(org.junit.Test)

Aggregations

IntProperty (com.android.tools.idea.ui.properties.core.IntProperty)2 IntValueProperty (com.android.tools.idea.ui.properties.core.IntValueProperty)2 Test (org.junit.Test)2 StringExpression (com.android.tools.idea.ui.properties.expressions.string.StringExpression)1