Java 类org.robolectric.shadows.ShadowProgressDialog 实例源码

项目:grocery-reminder    文件:GroceryStoresActivityTest.java   
@Test
public void whenStoresAreLoadedThenAProgressDialogIsDisplayed() {
    ShadowCursorWrapper wrapper = createCursorWithDefaultReminder();

    GroceryStoreManagerInterface groceryStoreManagerMock = getTestReminderModule().getGroceryStoreManager();
    when(groceryStoreManagerMock.getCurrentLocation()).thenReturn(new Location(LocationManager.PASSIVE_PROVIDER));

    CursorLoader cursorLoader = (CursorLoader)activity.onCreateLoader(0, null);
    activity.onLoadFinished(cursorLoader, wrapper);

    ProgressDialog progressDialog = (ProgressDialog)ShadowProgressDialog.getLatestDialog();
    assertTrue(progressDialog.isShowing());
    assertTrue(progressDialog.isIndeterminate());
    ShadowProgressDialog shadowProgressDialog = Shadows.shadowOf(progressDialog);
    assertEquals(activity.getString(R.string.loading_stores_dialog_title), shadowProgressDialog.getTitle());
    assertTrue(shadowProgressDialog.isCancelable());
}
项目:grocery-reminder    文件:GroceryStoresActivityTest.java   
@Test
@Ignore
//FIXME This works in production.  Something is going wrong in robolectric
public void givenStoresExistWhenTheCursorLoaderIsFinishedThenTheProgressDialogIsDismissed() {
    ShadowCursorWrapper wrapper = createCursorWithDefaultReminder();

    GroceryStoreManagerInterface groceryStoreManagerMock = getTestReminderModule().getGroceryStoreManager();
    when(groceryStoreManagerMock.getCurrentLocation()).thenReturn(null);

    CursorLoader cursorLoader = (CursorLoader)activity.onCreateLoader(0, null);
    activity.onLoadFinished(cursorLoader, wrapper);
    ProgressDialog progressDialog = (ProgressDialog)ShadowProgressDialog.getLatestDialog();
    assertFalse(progressDialog.isShowing());
}
项目:bcg    文件:Assert.java   
public static void assertProgressDialogIsShown(@StringRes int title) {
    ProgressDialog alert = (ProgressDialog) ShadowProgressDialog.getLatestAlertDialog();
    ShadowProgressDialog shadowProgressDialog = shadowOf(alert);
    assertThat(shadowProgressDialog.getTitle().toString(), equalTo(getString(title)));
}
项目:marvel    文件:Assert.java   
public static void assertProgressDialogIsShown(@StringRes int title) {
    ProgressDialog alert = (ProgressDialog) ShadowProgressDialog.getLatestAlertDialog();
    ShadowProgressDialog shadowProgressDialog = shadowOf(alert);
    assertThat(shadowProgressDialog.getTitle().toString(), equalTo(getString(title)));
}
项目:quandoo    文件:Assert.java   
public static void assertProgressDialogIsShown(@StringRes int title) {
    ProgressDialog alert = (ProgressDialog) ShadowProgressDialog.getLatestAlertDialog();
    ShadowProgressDialog shadowProgressDialog = shadowOf(alert);
    assertThat(shadowProgressDialog.getTitle().toString(), equalTo(getString(title)));
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowProgressDialog shadowOf(ProgressDialog instance) {
  return (ShadowProgressDialog) shadowOf_(instance);
}