use of androidx.appcompat.app.AlertDialog 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 androidx.appcompat.app.AlertDialog 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 androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RemoteDeviceNameDialogFragmentTest method deviceNameDisplayIsCorrect.
@Test
public void deviceNameDisplayIsCorrect() {
String deviceName = "ABC Corp Headphones";
AlertDialog dialog = startDialog(deviceName);
EditText editText = dialog.findViewById(R.id.edittext);
assertThat(editText.getText().toString()).isEqualTo(deviceName);
// Make sure that the "rename" button isn't enabled since the text hasn't changed yet, but
// the "cancel" button should be enabled.
Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
assertThat(positiveButton.isEnabled()).isFalse();
Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
assertThat(negativeButton.isEnabled()).isTrue();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PrivateVolumeForgetTest method OnClickListener_shouldCallForget.
@Test
public void OnClickListener_shouldCallForget() {
assertThat(ShadowStorageManager.isForgetCalled()).isFalse();
final Button confirm = mFragment.getView().findViewById(R.id.confirm);
confirm.performClick();
final ForgetConfirmFragment confirmFragment = (ForgetConfirmFragment) mActivity.getSupportFragmentManager().findFragmentByTag(PrivateVolumeForget.TAG_FORGET_CONFIRM);
assertThat(confirmFragment).isNotNull();
final AlertDialog dialog = (AlertDialog) confirmFragment.getDialog();
final Button forget = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
forget.performClick();
assertThat(ShadowStorageManager.isForgetCalled()).isTrue();
}
use of androidx.appcompat.app.AlertDialog 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