use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ListWithEntrySummaryPreferenceTest method onSaveAndRestoreInstanceState_resumePreference_shouldNotChangeEntries.
@Test
public void onSaveAndRestoreInstanceState_resumePreference_shouldNotChangeEntries() {
setEntries_customEntries_shouldUpdateEntries();
final Parcelable parcelable = mPreference.onSaveInstanceState();
ListWithEntrySummaryPreference preference = new ListWithEntrySummaryPreference(mContext, null);
preference.setEntries(mDefaultEntries);
preference.setEntryValues(mDefaultEntryValues);
preference.setEntrySummaries(mDefaultEntrySummaries);
preference.onRestoreInstanceState(parcelable);
AlertDialog dialog = showDialog(preference);
ListAdapter adapter = dialog.getListView().getAdapter();
int len = mCustomEntries.length;
assertThat(adapter.getCount()).isEqualTo(len);
for (int i = 0; i < len; i++) {
TextView title = adapter.getView(i, null, null).findViewById(R.id.title);
TextView summary = adapter.getView(i, null, null).findViewById(R.id.summary);
assertThat(title.getText()).isEqualTo(mCustomEntries[i]);
assertThat(summary.getText()).isEqualTo(mCustomEntrySummaries[i]);
}
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ListWithEntrySummaryPreferenceTest method initialize_defaultEntries_shouldDisplayDefalutEntries.
@Test
public void initialize_defaultEntries_shouldDisplayDefalutEntries() {
AlertDialog dialog = showDialog(mPreference);
ListAdapter adapter = dialog.getListView().getAdapter();
int len = mDefaultEntries.length;
assertThat(adapter.getCount()).isEqualTo(len);
for (int i = 0; i < len; i++) {
TextView title = adapter.getView(i, null, null).findViewById(R.id.title);
TextView summary = adapter.getView(i, null, null).findViewById(R.id.summary);
assertThat(title.getText()).isEqualTo(mDefaultEntries[i]);
assertThat(summary.getText()).isEqualTo(mDefaultEntrySummaries[i]);
}
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogActivityTest method launchActivity_shouldShowNetworkRequestDialog.
@Test
public void launchActivity_shouldShowNetworkRequestDialog() {
Robolectric.setupActivity(NetworkRequestDialogActivity.class);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog.isShowing()).isTrue();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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());
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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());
}
Aggregations