Search in sources :

Example 36 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class OnTouchTest method optionalIdAbsent.

@UiThreadTest
@Test
public void optionalIdAbsent() {
    View tree = ViewTree.create(2);
    View view2 = tree.findViewById(2);
    OptionalId target = new OptionalId();
    Unbinder unbinder = ButterKnife.bind(target, tree);
    assertEquals(0, target.touches);
    performTouch(view2);
    assertEquals(0, target.touches);
    unbinder.unbind();
    performTouch(view2);
    assertEquals(0, target.touches);
}
Also used : Unbinder(butterknife.Unbinder) TextView(android.widget.TextView) View(android.view.View) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 37 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class OnTouchTest method returnVoid.

@UiThreadTest
@Test
public void returnVoid() {
    View tree = ViewTree.create(1);
    View view1 = tree.findViewById(1);
    ReturnVoid target = new ReturnVoid();
    Unbinder unbinder = ButterKnife.bind(target, tree);
    assertEquals(0, target.touches);
    assertTrue(performTouch(view1));
    assertEquals(1, target.touches);
    unbinder.unbind();
    performTouch(view1);
    assertEquals(1, target.touches);
}
Also used : Unbinder(butterknife.Unbinder) TextView(android.widget.TextView) View(android.view.View) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 38 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class OnTouchTest method optionalIdPresent.

@UiThreadTest
@Test
public void optionalIdPresent() {
    View tree = ViewTree.create(1);
    View view1 = tree.findViewById(1);
    OptionalId target = new OptionalId();
    Unbinder unbinder = ButterKnife.bind(target, tree);
    assertEquals(0, target.touches);
    performTouch(view1);
    assertEquals(1, target.touches);
    unbinder.unbind();
    performTouch(view1);
    assertEquals(1, target.touches);
}
Also used : Unbinder(butterknife.Unbinder) TextView(android.widget.TextView) View(android.view.View) Test(org.junit.Test) UiThreadTest(androidx.test.annotation.UiThreadTest) UiThreadTest(androidx.test.annotation.UiThreadTest)

Example 39 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class SimpleActivityTest method verifyContentViewBinding.

@Test
public void verifyContentViewBinding() {
    SimpleActivity activity = activityRule.getActivity();
    Unbinder unbinder = ButterKnife.bind(activity);
    verifySimpleActivityBound(activity);
    unbinder.unbind();
    verifySimpleActivityUnbound(activity);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

Example 40 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class UnbinderTest method verifyContentViewBinding.

@Test
public void verifyContentViewBinding() {
    FrameLayout frameLayout = new FrameLayout(context);
    Button button1 = new Button(context);
    button1.setId(android.R.id.button1);
    frameLayout.addView(button1);
    Button button2 = new Button(context);
    button2.setId(android.R.id.button2);
    frameLayout.addView(button2);
    Button button3 = new Button(context);
    button3.setId(android.R.id.button3);
    frameLayout.addView(button3);
    View content = new View(context);
    content.setId(android.R.id.content);
    frameLayout.addView(content);
    H h = new H(frameLayout);
    Unbinder unbinder = ButterKnife.bind(h, frameLayout);
    verifyHBound(h);
    unbinder.unbind();
    verifyHUnbound(h);
}
Also used : Unbinder(butterknife.Unbinder) Button(android.widget.Button) FrameLayout(android.widget.FrameLayout) View(android.view.View) Test(org.junit.Test)

Aggregations

Unbinder (butterknife.Unbinder)86 Test (org.junit.Test)70 View (android.view.View)55 UiThreadTest (androidx.test.annotation.UiThreadTest)31 TextView (android.widget.TextView)23 Bundle (android.os.Bundle)15 LayoutInflater (android.view.LayoutInflater)15 AdapterView (android.widget.AdapterView)15 BindView (butterknife.BindView)15 ButterKnife (butterknife.ButterKnife)15 ViewGroup (android.view.ViewGroup)14 R (com.simplecity.amp_library.R)10 List (java.util.List)10 Inject (javax.inject.Inject)9 Nullable (android.support.annotation.Nullable)8 MenuItem (android.view.MenuItem)8 Aesthetic (com.afollestad.aesthetic.Aesthetic)8 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)7 Rx.distinctToMainThread (com.afollestad.aesthetic.Rx.distinctToMainThread)6 Song (com.simplecity.amp_library.model.Song)6