Search in sources :

Example 21 with PartnerCustomizationLayout

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

the class FingerprintSuggestionActivityTest method testKeyguardSecure_shouldFinishWithFingerprintResultSkip.

@Test
public void testKeyguardSecure_shouldFinishWithFingerprintResultSkip() {
    getShadowKeyguardManager().setIsKeyguardSecure(true);
    mController.create().resume();
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    final Button cancelButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(cancelButton.getText().toString()).isEqualTo("Cancel");
    assertWithMessage("Cancel visible").that(cancelButton.getVisibility()).isEqualTo(View.VISIBLE);
    cancelButton.performClick();
    ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
    assertWithMessage("Is finishing").that(mActivity.isFinishing()).isTrue();
    assertWithMessage("Result code").that(shadowActivity.getResultCode()).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 22 with PartnerCustomizationLayout

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

the class SetupChooseLockPasswordTest method createActivity_skipButtonInIntroductionStage_shouldBeVisible.

@Test
public void createActivity_skipButtonInIntroductionStage_shouldBeVisible() {
    SetupChooseLockPassword activity = createSetupChooseLockPassword();
    final InputMethodManager inputMethodManager = activity.getSystemService(InputMethodManager.class);
    final ShadowInputMethodManager shadowImm = Shadows.shadowOf(inputMethodManager);
    final PartnerCustomizationLayout layout = activity.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();
    final AlertDialog chooserDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
    assertThat(chooserDialog).isNotNull();
    assertThat(shadowImm.isSoftInputVisible()).isFalse();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) ShadowInputMethodManager(org.robolectric.shadows.ShadowInputMethodManager) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) InputMethodManager(android.view.inputmethod.InputMethodManager) ShadowInputMethodManager(org.robolectric.shadows.ShadowInputMethodManager) Test(org.junit.Test)

Example 23 with PartnerCustomizationLayout

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

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)

Example 24 with PartnerCustomizationLayout

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

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

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

the class SetupChooseLockPasswordTest method createActivity_skipButtonInIntroductionStage_shouldBeVisible.

@Test
public void createActivity_skipButtonInIntroductionStage_shouldBeVisible() {
    SetupChooseLockPassword activity = createSetupChooseLockPassword();
    final PartnerCustomizationLayout layout = activity.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();
    final 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)

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