Esempio n. 1
0
  @Test
  public void shouldPutTheMessageIntoTheView() {
    String message = "This is only a test";
    shadow.callOnCreate(null);

    View dialogView = shadow.getView();
    assertThat(shadowOf(dialogView).innerText()).doesNotContain(message);
    dialog.setMessage(message);
    assertThat(shadowOf(shadow.getView()).innerText()).contains(message);
  }
Esempio n. 2
0
  @Ignore("ProgressDialog is kinda busted")
  @Test // todo 2.0-cleanup
  public void show_shouldCreateAProgressDialog() {
    Context context = new Activity();
    TestOnCancelListener cancelListener = new TestOnCancelListener();
    ProgressDialog progressDialog =
        ProgressDialog.show(context, "Title", "Message", true, true, cancelListener);
    ShadowProgressDialog shadowProgressDialog = shadowOf(progressDialog);
    assertThat(progressDialog.getContext()).isSameAs(context);
    assertThat(shadowProgressDialog.getMessage()).isEqualTo("Message");
    assertTrue(progressDialog.isIndeterminate());
    assertTrue(shadowProgressDialog.isCancelable());

    progressDialog.cancel();
    assertThat(cancelListener.onCancelDialogInterface).isSameAs((DialogInterface) progressDialog);
  }