Пример #1
0
  @Test
  public void testPlaceholderDrawableIsSet() {
    Drawable expected = new ColorDrawable(Color.RED);

    MockTarget target = new MockTarget();

    harness.placeholderDrawable = expected;
    harness.target = target;
    GenericRequest request = harness.getRequest();
    request.begin();

    assertEquals(expected, target.currentPlaceholder);
  }
Пример #2
0
  @Test
  public void testErrorDrawableIsSetOnLoadFailed() {
    Drawable expected = new ColorDrawable(Color.RED);

    MockTarget target = new MockTarget();

    harness.errorDrawable = expected;
    harness.target = target;
    GenericRequest request = harness.getRequest();

    request.onException(null);

    assertEquals(expected, target.currentPlaceholder);
  }
Пример #3
0
  @Test
  public void setTestPlaceholderDrawableSetOnNullModel() {
    Drawable placeholder = new ColorDrawable(Color.RED);

    MockTarget target = new MockTarget();

    harness.placeholderDrawable = placeholder;
    harness.target = target;
    harness.model = null;
    GenericRequest request = harness.getRequest();

    request.begin();

    assertEquals(placeholder, target.currentPlaceholder);
  }
Пример #4
0
  @Test
  public void testPlaceholderResourceIsSet() {
    final int expectedId = 12345;
    Drawable expected = new ColorDrawable(Color.RED);

    Context context = mockContextToReturn(expectedId, expected);
    MockTarget target = new MockTarget();

    harness.context = context;
    harness.placeholderResourceId = expectedId;
    harness.target = target;
    GenericRequest request = harness.getRequest();
    request.begin();

    assertEquals(expected, target.currentPlaceholder);
  }