use of butterknife.Unbinder in project butterknife by JakeWharton.
the class BindFloatTest method asFloat.
@Test
public void asFloat() {
Target target = new Target();
TypedValue value = new TypedValue();
context.getResources().getValue(R.dimen.twelve_point_two, value, true);
float expected = value.getFloat();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertThat(target.actual).isEqualTo(expected);
unbinder.unbind();
assertThat(target.actual).isEqualTo(expected);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnLongClickTest 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.clicks);
assertTrue(view1.performLongClick());
assertEquals(1, target.clicks);
target.returnValue = false;
assertFalse(view1.performLongClick());
assertEquals(2, target.clicks);
unbinder.unbind();
view1.performLongClick();
assertEquals(2, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnLongClickTest 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.clicks);
view1.performLongClick();
assertEquals(1, target.clicks);
view2.performLongClick();
assertEquals(2, target.clicks);
unbinder.unbind();
view1.performLongClick();
view2.performLongClick();
assertEquals(2, target.clicks);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemLongClickTest method returnVoid.
@UiThreadTest
@Test
public void returnVoid() {
View tree = ViewTree.create(TestSpinner.class, 1);
TestSpinner spinner = tree.findViewById(1);
ReturnVoid target = new ReturnVoid();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.clickedPosition);
assertTrue(spinner.performItemLongClick(0));
assertEquals(0, target.clickedPosition);
unbinder.unbind();
spinner.performItemLongClick(1);
assertEquals(0, target.clickedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemLongClickTest method optionalIdPresent.
@UiThreadTest
@Test
public void optionalIdPresent() {
View tree = ViewTree.create(TestSpinner.class, 1);
TestSpinner spinner = tree.findViewById(1);
OptionalId target = new OptionalId();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.clickedPosition);
spinner.performItemLongClick(0);
assertEquals(0, target.clickedPosition);
unbinder.unbind();
spinner.performItemLongClick(1);
assertEquals(0, target.clickedPosition);
}
Aggregations