Search in sources :

Example 46 with AlertDialog

use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupSkipDialogTest method dialogMessage_whenSkipPatternSetupForFingerprint_shouldShownCorrectly.

@Test
public void dialogMessage_whenSkipPatternSetupForFingerprint_shouldShownCorrectly() {
    SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, true, false, true, false);
    setupSkipDialog.show(mActivity.getSupportFragmentManager());
    AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(alertDialog).isNotNull();
    ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
    assertThat(mActivity.getString(R.string.lock_screen_pattern_skip_title)).isEqualTo(shadowAlertDialog.getTitle());
    assertThat(getSkipDialogMessage(true)).isEqualTo(shadowAlertDialog.getMessage());
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 47 with AlertDialog

use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupSkipDialogTest method dialogMessage_whenSkipPatternSetupForFace_shouldShownCorrectly.

@Test
public void dialogMessage_whenSkipPatternSetupForFace_shouldShownCorrectly() {
    SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, true, false, false, true);
    setupSkipDialog.show(mActivity.getSupportFragmentManager());
    AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(alertDialog).isNotNull();
    ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
    assertThat(mActivity.getString(R.string.lock_screen_pattern_skip_title)).isEqualTo(shadowAlertDialog.getTitle());
    assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 48 with AlertDialog

use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupSkipDialogTest method dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly.

@Test
public void dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly() {
    SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, false, true, false, true);
    setupSkipDialog.show(mActivity.getSupportFragmentManager());
    AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(alertDialog).isNotNull();
    ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
    assertThat(mActivity.getString(R.string.lock_screen_password_skip_title)).isEqualTo(shadowAlertDialog.getTitle());
    assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 49 with AlertDialog

use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class NetworkRequestDialogFragmentTest method onUserSelectionCallbackRegistration_onClick_shouldCallSelect.

@Test
public void onUserSelectionCallbackRegistration_onClick_shouldCallSelect() {
    // Assert.
    final int indexClickItem = 3;
    List<AccessPoint> accessPointList = createAccessPointList();
    AccessPoint clickedAccessPoint = accessPointList.get(indexClickItem);
    clickedAccessPoint.generateOpenNetworkConfig();
    when(networkRequestDialogFragment.getAccessPointList()).thenReturn(accessPointList);
    NetworkRequestUserSelectionCallback selectionCallback = mock(NetworkRequestUserSelectionCallback.class);
    AlertDialog dialog = mock(AlertDialog.class);
    networkRequestDialogFragment.onUserSelectionCallbackRegistration(selectionCallback);
    // Act.
    networkRequestDialogFragment.onClick(dialog, indexClickItem);
    // Check.
    verify(selectionCallback, times(1)).select(clickedAccessPoint.getConfig());
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) NetworkRequestUserSelectionCallback(android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback) AccessPoint(com.android.settingslib.wifi.AccessPoint) AccessPoint(com.android.settingslib.wifi.AccessPoint) Test(org.junit.Test)

Example 50 with AlertDialog

use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ListWithEntrySummaryPreferenceTest method setEntries_customEntries_shouldUpdateEntries.

@Test
public void setEntries_customEntries_shouldUpdateEntries() {
    mPreference.setEntries(mCustomEntries);
    mPreference.setEntryValues(mCustomEntryValues);
    mPreference.setEntrySummaries(mCustomEntrySummaries);
    AlertDialog dialog = showDialog(mPreference);
    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]);
    }
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) TextView(android.widget.TextView) ListAdapter(android.widget.ListAdapter) Test(org.junit.Test)

Aggregations

AlertDialog (androidx.appcompat.app.AlertDialog)256 Test (org.junit.Test)89 View (android.view.View)48 DialogInterface (android.content.DialogInterface)40 Button (android.widget.Button)39 TextView (android.widget.TextView)39 Intent (android.content.Intent)30 ShadowAlertDialogCompat (com.android.settings.testutils.shadow.ShadowAlertDialogCompat)30 NonNull (androidx.annotation.NonNull)27 Context (android.content.Context)26 Bundle (android.os.Bundle)20 SuppressLint (android.annotation.SuppressLint)17 EditText (android.widget.EditText)17 ArrayList (java.util.ArrayList)17 MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)14 List (java.util.List)12 Activity (android.app.Activity)11 Uri (android.net.Uri)11 LayoutInflater (android.view.LayoutInflater)11 ListView (android.widget.ListView)10