Search in sources :

Example 21 with ShadowAlertDialogCompat

use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project android_packages_apps_Settings by omnirom.

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?");
}
Also used : BatteryTipDialogFragment(com.android.settings.fuelgauge.batterytip.BatteryTipDialogFragment) AlertDialog(androidx.appcompat.app.AlertDialog) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 22 with ShadowAlertDialogCompat

use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project android_packages_apps_Settings by omnirom.

the class RestrictedAppDetailsTest method createDialogFragment_toUnrestrict_createUnrestrictDialog.

@Test
public void createDialogFragment_toUnrestrict_createUnrestrictDialog() {
    final BatteryTipDialogFragment dialogFragment = mRestrictedAppDetails.createDialogFragment(mAppInfo, false);
    FragmentController.setupFragment(dialogFragment, FragmentActivity.class, 0, /* containerViewId */
    null);
    final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
    assertThat(shadowDialog.getTitle()).isEqualTo("Remove restriction?");
}
Also used : BatteryTipDialogFragment(com.android.settings.fuelgauge.batterytip.BatteryTipDialogFragment) AlertDialog(androidx.appcompat.app.AlertDialog) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 23 with ShadowAlertDialogCompat

use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project android_packages_apps_Settings by omnirom.

the class SetupSkipDialogTest method dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly.

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

Example 24 with ShadowAlertDialogCompat

use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project android_packages_apps_Settings by omnirom.

the class SetupSkipDialogTest method dialogMessage_whenSkipPatternSetupForBiometrics_shouldShownCorrectly.

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

Example 25 with ShadowAlertDialogCompat

use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project android_packages_apps_Settings by omnirom.

the class SetupSkipDialogTest method dialogMessage_whenSkipPinSetupForBiometrics_shouldShownCorrectly.

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

Aggregations

AlertDialog (androidx.appcompat.app.AlertDialog)460 ShadowAlertDialogCompat (com.android.settings.testutils.shadow.ShadowAlertDialogCompat)460 Test (org.junit.Test)460 BatteryTipDialogFragment (com.android.settings.fuelgauge.batterytip.BatteryTipDialogFragment)26 Intent (android.content.Intent)13 Bundle (android.os.Bundle)13 RestrictAppTip (com.android.settings.fuelgauge.batterytip.tips.RestrictAppTip)13 OnLockTypeSelectedListener (com.android.settings.password.ChooseLockTypeDialogFragment.OnLockTypeSelectedListener)13 PartnerCustomizationLayout (com.google.android.setupcompat.PartnerCustomizationLayout)13 ArrayList (java.util.ArrayList)13 Config (org.robolectric.annotation.Config)13