use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemClickTest method simple.
@UiThreadTest
@Test
public void simple() {
View tree = ViewTree.create(TestSpinner.class, 1);
TestSpinner spinner = tree.findViewById(1);
Simple target = new Simple();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.clickedPosition);
spinner.performItemClick(0);
assertEquals(0, target.clickedPosition);
unbinder.unbind();
spinner.performItemClick(1);
assertEquals(0, target.clickedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemSelectedTest method optionalIdAbsent.
@UiThreadTest
@Test
public void optionalIdAbsent() {
View tree = ViewTree.create(TestSpinner.class, 2);
TestSpinner spinner = tree.findViewById(2);
OptionalId target = new OptionalId();
target.selectedPosition = 1;
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(1, target.selectedPosition);
spinner.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner.clearSelection();
assertEquals(1, target.selectedPosition);
unbinder.unbind();
spinner.performSelection(1);
assertEquals(1, target.selectedPosition);
spinner.clearSelection();
assertEquals(1, target.selectedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnTouchTest method arguments.
@UiThreadTest
@Test
public void arguments() {
View tree = ViewTree.create(1, 2);
View view1 = tree.findViewById(1);
View view2 = tree.findViewById(2);
Arguments target = new Arguments();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.touches);
assertTrue(performTouch(view1));
assertEquals(1, target.touches);
assertTrue(performTouch(view2));
assertEquals(2, target.touches);
unbinder.unbind();
performTouch(view1);
assertEquals(2, target.touches);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnTouchTest method simple.
@UiThreadTest
@Test
public void simple() {
View tree = ViewTree.create(1);
View view1 = tree.findViewById(1);
Simple target = new Simple();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(0, target.touches);
assertTrue(performTouch(view1));
assertEquals(1, target.touches);
target.returnValue = false;
assertFalse(performTouch(view1));
assertEquals(2, target.touches);
unbinder.unbind();
performTouch(view1);
assertEquals(2, target.touches);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnTouchTest method multipleIds.
@UiThreadTest
@Test
public void multipleIds() {
View tree = ViewTree.create(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.touches);
performTouch(view1);
assertEquals(1, target.touches);
performTouch(view2);
assertEquals(2, target.touches);
unbinder.unbind();
performTouch(view1);
performTouch(view2);
assertEquals(2, target.touches);
}
Aggregations