Search in sources :

Example 21 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindDimenTest method asInt.

@Test
public void asInt() {
    IntTarget target = new IntTarget();
    int expected = context.getResources().getDimensionPixelSize(R.dimen.twelve_point_two_dp);
    Unbinder unbinder = new BindDimenTest$IntTarget_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) Test(org.junit.Test)

Example 22 with Unbinder

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 = new BindFloatTest$Target_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) TypedValue(android.util.TypedValue) Test(org.junit.Test)

Example 23 with Unbinder

use of butterknife.Unbinder in project butterknife by JakeWharton.

the class BindStringTest method simpleInt.

@Test
public void simpleInt() {
    Target target = new Target();
    String expected = context.getString(R.string.hey);
    Unbinder unbinder = new BindStringTest$Target_ViewBinding(target, context);
    assertThat(target.actual).isEqualTo(expected);
    unbinder.unbind();
    assertThat(target.actual).isEqualTo(expected);
}
Also used : Unbinder(butterknife.Unbinder) BindString(butterknife.BindString) Test(org.junit.Test)

Aggregations

Unbinder (butterknife.Unbinder)23 Test (org.junit.Test)15 View (android.view.View)9 Bundle (android.os.Bundle)8 LayoutInflater (android.view.LayoutInflater)8 ViewGroup (android.view.ViewGroup)8 BindView (butterknife.BindView)8 ButterKnife (butterknife.ButterKnife)8 Nullable (android.support.annotation.Nullable)6 R (com.simplecity.amp_library.R)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 Aesthetic (com.afollestad.aesthetic.Aesthetic)5 List (java.util.List)5 RecyclerView (android.support.v7.widget.RecyclerView)4 Toolbar (android.support.v7.widget.Toolbar)4 MenuItem (android.view.MenuItem)4 TextView (android.widget.TextView)4 Rx.distinctToMainThread (com.afollestad.aesthetic.Rx.distinctToMainThread)4 ShuttleApplication (com.simplecity.amp_library.ShuttleApplication)4 Song (com.simplecity.amp_library.model.Song)4