Ejemplo n.º 1
0
 @Test
 public void shouldCopyBitmap() {
   Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class);
   Bitmap bitmapCopy = bitmap.copy(Config.ARGB_8888, true);
   assertThat(shadowOf(bitmapCopy).getConfig()).isEqualTo(Config.ARGB_8888);
   assertThat(shadowOf(bitmapCopy).isMutable()).isTrue();
 }
Ejemplo n.º 2
0
  @Test
  public void startAndStopManagingCursorTracksCursors() throws Exception {
    TestActivity activity = new TestActivity();

    ShadowActivity shadow = shadowOf(activity);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(0);

    Cursor c = Shadow.newInstanceOf(SQLiteCursor.class);
    activity.startManagingCursor(c);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(1);
    assertThat(shadow.getManagedCursors().get(0)).isSameAs(c);

    activity.stopManagingCursor(c);

    assertThat(shadow.getManagedCursors()).isNotNull();
    assertThat(shadow.getManagedCursors().size()).isEqualTo(0);
  }
Ejemplo n.º 3
0
 private static Bitmap create(String name) {
   Bitmap bitmap = Shadow.newInstanceOf(Bitmap.class);
   shadowOf(bitmap).appendDescription(name);
   return bitmap;
 }
 @Implementation
 public void setOnRefreshListener(OnRefreshListener listener) {
   this.listener = listener;
   Shadow.directlyOn(realObject, SwipeRefreshLayout.class).setOnRefreshListener(listener);
 }
Ejemplo n.º 5
0
 @Implementation
 public void invalidateSelf() {
   wasInvalidated = true;
   Shadow.directlyOn(realDrawable, Drawable.class, "invalidateSelf");
 }
Ejemplo n.º 6
0
 @Implementation
 public void setAlpha(int alpha) {
   this.alpha = alpha;
   Shadow.directlyOn(realDrawable, Drawable.class).setAlpha(alpha);
 }