Search in sources :

Example 1 with PartnerCustomizationLayout

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

the class FingerprintSuggestionActivityTest 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 cancelButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(cancelButton.getText().toString()).isEqualTo("Cancel");
    assertThat(cancelButton.getVisibility()).named("Cancel visible").isEqualTo(View.VISIBLE);
    cancelButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
    assertThat(mController.get().isFinishing()).named("Is finishing").isTrue();
    assertThat(shadowActivity.getResultCode()).named("Result code").isEqualTo(Activity.RESULT_CANCELED);
}
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 2 with PartnerCustomizationLayout

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

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

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

the class SetupChooseLockPatternTest method skipButton_shouldBeVisible_duringNonFingerprintFlow.

@Test
public void skipButton_shouldBeVisible_duringNonFingerprintFlow() {
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    final Button skipOrClearButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipOrClearButton).isNotNull();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
    skipOrClearButton.performClick();
    AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(chooserDialog).isNotNull();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Test(org.junit.Test)

Example 4 with PartnerCustomizationLayout

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

the class SetupChooseLockPatternTest method createActivity_enterPattern_clearButtonShouldBeShown.

@Test
public void createActivity_enterPattern_clearButtonShouldBeShown() {
    ChooseLockPatternFragment fragment = findFragment(mActivity);
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    final Button skipOrClearButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipOrClearButton.isEnabled()).isTrue();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
    assertThat(skipOrClearButton.getText()).isEqualTo(application.getString(R.string.skip_label));
    enterPattern();
    assertThat(skipOrClearButton.isEnabled()).isTrue();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
    assertThat(skipOrClearButton.getText()).isEqualTo(application.getString(R.string.lockpattern_retry_button_text));
}
Also used : ChooseLockPatternFragment(com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment) PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Test(org.junit.Test)

Example 5 with PartnerCustomizationLayout

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

the class SetupChooseLockPatternTest method clearButton_shouldBeVisible_duringRetryStage.

@Test
public void clearButton_shouldBeVisible_duringRetryStage() {
    enterPattern();
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    final Button skipOrClearButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
    assertThat(skipOrClearButton.isEnabled()).isTrue();
    skipOrClearButton.performClick();
    assertThat(findFragment(mActivity).mChosenPattern).isNull();
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Test(org.junit.Test)

Aggregations

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