Search in sources :

Example 16 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project android_packages_apps_Settings by omnirom.

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();
    assertWithMessage("Skip visible").that(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
    skipButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
    assertWithMessage("Is finishing").that(mController.get().isFinishing()).isTrue();
    assertWithMessage("Result code").that(shadowActivity.getResultCode()).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 17 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project android_packages_apps_Settings by omnirom.

the class SetupFingerprintEnrollIntroductionTest method testCancelClicked_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch.

@Test
public void testCancelClicked_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch() {
    getShadowKeyguardManager().setIsKeyguardSecure(true);
    SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    skipButton.performClick();
    assertThat(Shadows.shadowOf(activity).getResultIntent()).isNull();
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Test(org.junit.Test)

Example 18 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project android_packages_apps_Settings by omnirom.

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 19 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project android_packages_apps_Settings by omnirom.

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 20 with PartnerCustomizationLayout

use of com.google.android.setupcompat.PartnerCustomizationLayout in project android_packages_apps_Settings by omnirom.

the class FingerprintEnrollFindSensorTest method clickSkip_shouldReturnResultSkip.

@Test
public void clickSkip_shouldReturnResultSkip() {
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
    assertWithMessage("result code").that(shadowActivity.getResultCode()).isEqualTo(BiometricEnrollBase.RESULT_SKIP);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ShadowActivity(org.robolectric.shadows.ShadowActivity) 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