use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemClickTest method optionalIdAbsent.
@UiThreadTest
@Test
public void optionalIdAbsent() {
View tree = ViewTree.create(TestSpinner.class, 2);
TestSpinner spinner = tree.findViewById(2);
OptionalId target = new OptionalId();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.clickedPosition);
spinner.performItemClick(0);
assertEquals(-1, target.clickedPosition);
unbinder.unbind();
spinner.performItemClick(0);
assertEquals(-1, target.clickedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemSelectedTest method multipleIdPermutation.
@UiThreadTest
@Test
public void multipleIdPermutation() {
View tree = ViewTree.create(TestSpinner.class, 1, 2, 3);
TestSpinner spinner1 = tree.findViewById(1);
TestSpinner spinner2 = tree.findViewById(2);
TestSpinner spinner3 = tree.findViewById(3);
MultipleIdPermutation target = new MultipleIdPermutation();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.selectedPosition);
spinner1.performSelection(0);
assertEquals(0, target.selectedPosition);
spinner1.clearSelection();
assertEquals(-1, target.selectedPosition);
spinner2.performSelection(0);
assertEquals(0, target.selectedPosition);
spinner2.clearSelection();
assertEquals(0, target.selectedPosition);
spinner3.performSelection(1);
assertEquals(0, target.selectedPosition);
spinner3.clearSelection();
assertEquals(-1, target.selectedPosition);
spinner1.performSelection(1);
unbinder.unbind();
spinner1.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner2.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner3.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner1.clearSelection();
assertEquals(1, target.selectedPosition);
spinner2.clearSelection();
assertEquals(1, target.selectedPosition);
spinner3.clearSelection();
assertEquals(1, target.selectedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemSelectedTest 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.selectedPosition);
spinner.performSelection(0);
assertEquals(0, target.selectedPosition);
spinner.clearSelection();
assertEquals(-1, target.selectedPosition);
spinner.performSelection(1);
unbinder.unbind();
spinner.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner.clearSelection();
assertEquals(1, target.selectedPosition);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemSelectedTest method multipleBindings.
@UiThreadTest
@Test
public void multipleBindings() {
View tree = ViewTree.create(TestSpinner.class, 1);
TestSpinner spinner = tree.findViewById(1);
MultipleBindings target = new MultipleBindings();
Unbinder unbinder = ButterKnife.bind(target, tree);
assertEquals(-1, target.selectedPosition1);
assertEquals(-1, target.selectedPosition2);
spinner.performSelection(0);
assertEquals(0, target.selectedPosition1);
assertEquals(0, target.selectedPosition2);
spinner.clearSelection();
assertEquals(-1, target.selectedPosition1);
assertEquals(-1, target.selectedPosition2);
spinner.performSelection(1);
unbinder.unbind();
spinner.performSelection(0);
assertEquals(1, target.selectedPosition1);
assertEquals(1, target.selectedPosition2);
spinner.clearSelection();
assertEquals(1, target.selectedPosition1);
assertEquals(1, target.selectedPosition2);
}
use of butterknife.Unbinder in project butterknife by JakeWharton.
the class OnItemSelectedTest 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.selectedPosition);
spinner.performSelection(0);
assertEquals(0, target.selectedPosition);
spinner.clearSelection();
assertEquals(-1, target.selectedPosition);
spinner.performSelection(1);
unbinder.unbind();
spinner.performSelection(0);
assertEquals(1, target.selectedPosition);
spinner.clearSelection();
assertEquals(1, target.selectedPosition);
}
Aggregations