use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by Evolution-X.
the class NetworkRequestErrorDialogFragmentTest method display_shouldShowAbortDialog.
@Test
public void display_shouldShowAbortDialog() {
mFragment = spy(NetworkRequestErrorDialogFragment.newInstance());
Bundle bundle = new Bundle();
bundle.putSerializable(NetworkRequestErrorDialogFragment.DIALOG_TYPE, ERROR_DIALOG_TYPE.ABORT);
mFragment.setArguments(bundle);
mFragment.show(mActivity.getSupportFragmentManager(), null);
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
assertThat(alertDialog.isShowing()).isTrue();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(RuntimeEnvironment.application.getString(R.string.network_connection_errorstate_dialog_message)).isEqualTo(shadowAlertDialog.getMessage());
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by Spark-Rom.
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 packages_apps_Settings by Spark-Rom.
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 packages_apps_Settings by Spark-Rom.
the class DevelopmentSettingsDashboardFragmentTest method onSwitchChanged_turnOff_andOffloadIsNotDefaultValue_shouldShowWarningDialog.
@Test
@Config(shadows = ShadowDisableDevSettingsDialogFragment.class)
public void onSwitchChanged_turnOff_andOffloadIsNotDefaultValue_shouldShowWarningDialog() {
final BluetoothA2dpHwOffloadPreferenceController controller = mock(BluetoothA2dpHwOffloadPreferenceController.class);
when(mDashboard.getContext()).thenReturn(mContext);
when(mDashboard.getDevelopmentOptionsController(BluetoothA2dpHwOffloadPreferenceController.class)).thenReturn(controller);
when(controller.isDefaultValue()).thenReturn(false);
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mDashboard.onSwitchChanged(mSwitch, false);
AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_disable_a2dp_hw_offload_dialog_title));
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.bluetooth_disable_a2dp_hw_offload_dialog_message));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by Spark-Rom.
the class NetworkRequestErrorDialogFragmentTest method display_shouldShowTimeoutDialog.
@Test
public void display_shouldShowTimeoutDialog() {
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
assertThat(alertDialog.isShowing()).isTrue();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(RuntimeEnvironment.application.getString(R.string.network_connection_timeout_dialog_message)).isEqualTo(shadowAlertDialog.getMessage());
}
Aggregations