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;
 }