Search in sources :

Example 26 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupFingerprintEnrollFindSensorTest method fingerprintEnroll_showsAlert_whenClickingSkip.

@Test
public void fingerprintEnroll_showsAlert_whenClickingSkip() {
    final Intent intent = new Intent().putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
    final SetupFingerprintEnrollFindSensor activity = Robolectric.buildActivity(SetupFingerprintEnrollFindSensor.class, intent).setup().get();
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
    final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(alertDialog).isNotNull();
    final ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
    final int titleRes = R.string.setup_fingerprint_enroll_skip_title;
    assertThat(application.getString(titleRes)).isEqualTo(shadowAlertDialog.getTitle());
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Intent(android.content.Intent) ShadowAlertDialogCompat(com.android.settings.testutils.shadow.ShadowAlertDialogCompat) Test(org.junit.Test)

Example 27 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupFingerprintEnrollIntroductionTest method testKeyguardNotSecure_shouldFinishWithSetupSkipDialogResultSkip.

@Test
public void testKeyguardNotSecure_shouldFinishWithSetupSkipDialogResultSkip() {
    getShadowKeyguardManager().setIsKeyguardSecure(false);
    mController.create().resume();
    PartnerCustomizationLayout layout = mController.get().findViewById(R.id.setup_wizard_layout);
    final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipButton.getVisibility()).named("Skip visible").isEqualTo(View.VISIBLE);
    skipButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
    assertThat(mController.get().isFinishing()).named("Is finishing").isTrue();
    assertThat(shadowActivity.getResultCode()).named("Result code").isEqualTo(SetupSkipDialog.RESULT_SKIP);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) ShadowActivity(org.robolectric.shadows.ShadowActivity) Test(org.junit.Test)

Example 28 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupFingerprintEnrollIntroductionTest method testKeyguardSecure_shouldFinishWithFingerprintResultSkip.

@Test
public void testKeyguardSecure_shouldFinishWithFingerprintResultSkip() {
    getShadowKeyguardManager().setIsKeyguardSecure(true);
    mController.create().resume();
    PartnerCustomizationLayout layout = mController.get().findViewById(R.id.setup_wizard_layout);
    final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipButton.getVisibility()).named("Skip visible").isEqualTo(View.VISIBLE);
    skipButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
    assertThat(mController.get().isFinishing()).named("Is finishing").isTrue();
    assertThat(shadowActivity.getResultCode()).named("Result code").isEqualTo(BiometricEnrollBase.RESULT_SKIP);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) ShadowActivity(org.robolectric.shadows.ShadowActivity) Test(org.junit.Test)

Example 29 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupFingerprintEnrollIntroductionTest method testCancelClicked_shouldSetIntentDataIfLockScreenAdded.

@Test
public void testCancelClicked_shouldSetIntentDataIfLockScreenAdded() {
    getShadowKeyguardManager().setIsKeyguardSecure(false);
    SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    getShadowKeyguardManager().setIsKeyguardSecure(true);
    skipButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(activity);
    assertThat(shadowActivity.getResultIntent()).isNotNull();
    assertThat(shadowActivity.getResultIntent().hasExtra(SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY)).isTrue();
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) ShadowActivity(org.robolectric.shadows.ShadowActivity) Test(org.junit.Test)

Example 30 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SetupFingerprintEnrollIntroductionTest method testLockPattern.

@Test
public void testLockPattern() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    mController.create().postCreate(null).resume();
    SetupFingerprintEnrollIntroduction activity = mController.get();
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(activity);
    IntentForResult startedActivity = shadowActivity.getNextStartedActivityForResult();
    assertThat(startedActivity).isNotNull();
    assertThat(startedActivity.intent.hasExtra(SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY)).isFalse();
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ShadowActivity(org.robolectric.shadows.ShadowActivity) IntentForResult(org.robolectric.shadows.ShadowActivity.IntentForResult) Test(org.junit.Test)

Aggregations

PartnerCustomizationLayout (com.google.android.setupcompat.PartnerCustomizationLayout)40 Test (org.junit.Test)39 Button (android.widget.Button)23 FooterBarMixin (com.google.android.setupcompat.template.FooterBarMixin)23 ShadowActivity (org.robolectric.shadows.ShadowActivity)12 MediumTest (androidx.test.filters.MediumTest)8 AlertDialog (androidx.appcompat.app.AlertDialog)6 Intent (android.content.Intent)5 Activity (android.app.Activity)3 ActivityResult (android.app.Instrumentation.ActivityResult)2 ComponentName (android.content.ComponentName)2 SmallTest (androidx.test.filters.SmallTest)2 ChooseLockPatternFragment (com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment)2 SetupChooseLockPasswordFragment (com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment)2 ShadowAlertDialogCompat (com.android.settings.testutils.shadow.ShadowAlertDialogCompat)2 ScrollToParentEditText (com.android.settings.widget.ScrollToParentEditText)2 IntentForResult (org.robolectric.shadows.ShadowActivity.IntentForResult)2 Fingerprint (android.hardware.fingerprint.Fingerprint)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 TextView (android.widget.TextView)1