use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnCheckedChangedTest method optionalIdPresent.
@UiThreadTest
@Test
public void optionalIdPresent() {
View tree = ViewTree.create(ToggleButton.class, 1);
View view1 = tree.findViewById(1);
OptionalId target = new OptionalId();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.clicks);
view1.performClick();
assertEquals(1, target.clicks);
unbinder.unbind();
view1.performClick();
assertEquals(1, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnCheckedChangedTest method multipleIds.
@UiThreadTest
@Test
public void multipleIds() {
View tree = ViewTree.create(ToggleButton.class, 1, 2);
View view1 = tree.findViewById(1);
View view2 = tree.findViewById(2);
MultipleIds target = new MultipleIds();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.clicks);
view1.performClick();
assertEquals(1, target.clicks);
view2.performClick();
assertEquals(2, target.clicks);
unbinder.unbind();
view1.performClick();
view2.performClick();
assertEquals(2, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnCheckedChangedTest method optionalIdAbsent.
@UiThreadTest
@Test
public void optionalIdAbsent() {
View tree = ViewTree.create(ToggleButton.class, 2);
View view2 = tree.findViewById(2);
OptionalId target = new OptionalId();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.clicks);
view2.performClick();
assertEquals(0, target.clicks);
unbinder.unbind();
view2.performClick();
assertEquals(0, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnCheckedChangedTest method multipleBindings.
@UiThreadTest
@Test
public void multipleBindings() {
// TODO
assumeFalse("Not implemented", BuildConfig.FLAVOR.equals("reflect"));
View tree = ViewTree.create(ToggleButton.class, 1);
View view1 = tree.findViewById(1);
MultipleBindings target = new MultipleBindings();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.clicks);
view1.performClick();
assertEquals(2, target.clicks);
unbinder.unbind();
view1.performClick();
assertEquals(2, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindColorTest method asColorStateList.
@Test
public void asColorStateList() {
ColorStateListTarget target = new ColorStateListTarget();
ColorStateList expected = context.getResources().getColorStateList(R.color.colors);
Unbinder unbinder = ButterKnife.bind(target, tree);
assertThat(target.actual.toString()).isEqualTo(expected.toString());
unbinder.unbind();
assertThat(target.actual.toString()).isEqualTo(expected.toString());
}
Aggregations