use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InstantAppButtonDialogFragmentTest method onCreateDialog_clearAppDialog_shouldShowClearAppDataConfirmation.
@Test
public void onCreateDialog_clearAppDialog_shouldShowClearAppDataConfirmation() {
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
final ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.clear_instant_app_confirmation));
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.clear_instant_app_data));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mContext.getString(R.string.clear_instant_app_data));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mContext.getString(R.string.cancel));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ButtonActionDialogFragmentTest method testOnCreateDialog_forceStopDialog.
@Test
public void testOnCreateDialog_forceStopDialog() {
ButtonActionDialogFragment fragment = ButtonActionDialogFragment.newInstance(FORCE_STOP_ID);
FragmentController.setupFragment(fragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mShadowContext.getString(R.string.force_stop_dlg_text));
assertThat(shadowDialog.getTitle()).isEqualTo(mShadowContext.getString(R.string.force_stop_dlg_title));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mShadowContext.getString(R.string.dlg_ok));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mShadowContext.getString(R.string.dlg_cancel));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ButtonActionDialogFragmentTest method testOnCreateDialog_disableDialog.
@Test
public void testOnCreateDialog_disableDialog() {
ButtonActionDialogFragment fragment = ButtonActionDialogFragment.newInstance(DISABLE_ID);
FragmentController.setupFragment(fragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_text));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_positive));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mShadowContext.getString(R.string.dlg_cancel));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ButtonActionDialogFragmentTest method testOnCreateDialog_specialDisableDialog.
@Test
public void testOnCreateDialog_specialDisableDialog() {
ButtonActionDialogFragment fragment = ButtonActionDialogFragment.newInstance(SPECIAL_DISABLE_ID);
FragmentController.setupFragment(fragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_text));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_positive));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mShadowContext.getString(R.string.dlg_cancel));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RestrictedAppDetailsTest method createDialogFragment_toRestrict_createRestrictDialog.
@Test
public void createDialogFragment_toRestrict_createRestrictDialog() {
final BatteryTipDialogFragment dialogFragment = mRestrictedAppDetails.createDialogFragment(mAppInfo, true);
FragmentController.setupFragment(dialogFragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getTitle()).isEqualTo("Restrict app?");
}
Aggregations