use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestErrorDialogFragmentTest method clickNegativeButton_shouldCallReject.
@Test
public void clickNegativeButton_shouldCallReject() {
final NetworkRequestUserSelectionCallback rejectCallback = mock(NetworkRequestUserSelectionCallback.class);
mFragment.setRejectCallback(rejectCallback);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
negativeButton.performClick();
verify(rejectCallback, times(1)).reject();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestErrorDialogFragmentTest method clickNegativeButton_shouldCloseTheDialog.
@Test
public void clickNegativeButton_shouldCloseTheDialog() {
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog.isShowing()).isTrue();
Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
assertThat(negativeButton).isNotNull();
negativeButton.performClick();
assertThat(alertDialog.isShowing()).isFalse();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogFragmentTest method cancelDialog_callsReject.
@Test
public void cancelDialog_callsReject() {
// Assert
networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */
null);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final NetworkRequestUserSelectionCallback selectionCallback = mock(NetworkRequestUserSelectionCallback.class);
networkRequestDialogFragment.onUserSelectionCallbackRegistration(selectionCallback);
// Action
final Button button = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
button.performClick();
// Check
verify(selectionCallback, times(1)).reject();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogFragmentTest method display_shouldShowTheDialog.
@Test
public void display_shouldShowTheDialog() {
networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), null);
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
assertThat(alertDialog.isShowing()).isTrue();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NetworkRequestDialogFragmentTest method display_shouldShowTitleWithAppName.
@Test
public void display_shouldShowTitleWithAppName() {
networkRequestDialogFragment.show(mActivity.getSupportFragmentManager(), /* tag */
null);
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final String targetTitle = mContext.getString(R.string.network_connection_request_dialog_title, TEST_APP_NAME);
final TextView view = alertDialog.findViewById(R.id.network_request_title_text);
assertThat(view.getText()).isEqualTo(targetTitle);
}
Aggregations