use of com.android.tools.idea.ui.properties.core.StringValueProperty in project android by JetBrains.
the class BindingsManagerTest method releaseTwoWayWithOneArgDisconnectsAllMatchingBindings.
@Test
public void releaseTwoWayWithOneArgDisconnectsAllMatchingBindings() throws Exception {
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
StringValueProperty property1 = new StringValueProperty("First");
StringValueProperty property2 = new StringValueProperty("Second");
StringValueProperty property3 = new StringValueProperty("Third");
bindings.bindTwoWay(property1, property2);
bindings.bindTwoWay(property3, property2);
assertThat(property1.get()).isEqualTo("Second");
assertThat(property3.get()).isEqualTo("Second");
bindings.releaseTwoWay(property2);
property1.set("Property1");
assertThat(property2.get()).isEqualTo("Second");
property3.set("Property3");
assertThat(property2.get()).isEqualTo("Second");
}
use of com.android.tools.idea.ui.properties.core.StringValueProperty in project android by JetBrains.
the class ExpressionTest method expressionsNeedAtLeastOneObservable.
@Test(expected = IllegalArgumentException.class)
public void expressionsNeedAtLeastOneObservable() throws Exception {
final StringProperty value = new StringValueProperty();
Expression expr = new // This should be "new StringExpression(value)"
StringExpression() {
@NotNull
@Override
public String get() {
return value.get();
}
};
}
use of com.android.tools.idea.ui.properties.core.StringValueProperty in project android by JetBrains.
the class DomainToPackageExpressionTest method packageNameDeriverSantizesCompanyDomainKey.
@Test
public void packageNameDeriverSantizesCompanyDomainKey() {
StringProperty companyDomain = new StringValueProperty("sub.exa-mple.com");
StringProperty applicationName = new StringValueProperty("My&App");
Expression<String> computedPackageName = new DomainToPackageExpression(companyDomain, applicationName);
assertEquals("com.exa_mple.sub.myapp", computedPackageName.get());
companyDomain.set("#.badstartchar.com");
assertEquals("com.badstartchar.myapp", computedPackageName.get());
companyDomain.set("TEST.ALLCAPS.COM");
assertEquals("com.allcaps.test.myapp", computedPackageName.get());
applicationName.set("#My $AppLICATION");
assertEquals("com.allcaps.test.myapplication", computedPackageName.get());
}
use of com.android.tools.idea.ui.properties.core.StringValueProperty in project android by JetBrains.
the class BindingsManagerTest method releaseAllDisconnectsTwoWayBindings.
@Test
public void releaseAllDisconnectsTwoWayBindings() throws Exception {
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
StringValueProperty property1 = new StringValueProperty("First");
StringValueProperty property2 = new StringValueProperty("Second");
bindings.bindTwoWay(property1, property2);
assertThat(property1.get()).isEqualTo("Second");
bindings.releaseAll();
property1.set("Property1");
assertThat(property2.get()).isEqualTo("Second");
property2.set("Property2");
assertThat(property1.get()).isEqualTo("Property1");
}
use of com.android.tools.idea.ui.properties.core.StringValueProperty in project android by JetBrains.
the class BindingsManagerTest method releaseAllDisconnectsOneWayBindings.
@Test
public void releaseAllDisconnectsOneWayBindings() throws Exception {
BindingsManager bindings = new BindingsManager(INVOKE_IMMEDIATELY_STRATEGY);
StringValueProperty property1 = new StringValueProperty("A");
StringValueProperty property2 = new StringValueProperty("B");
bindings.bind(property1, property2);
assertThat(property1.get()).isEqualTo("B");
bindings.releaseAll();
property2.set("Property2");
assertThat(property1.get()).isEqualTo("B");
}
Aggregations