Search in sources :

Example 31 with PartnerCustomizationLayout

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

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);
    assertThat(shadowActivity.getResultCode()).named("result code").isEqualTo(BiometricEnrollBase.RESULT_SKIP);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ShadowActivity(org.robolectric.shadows.ShadowActivity) Test(org.junit.Test)

Example 32 with PartnerCustomizationLayout

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

the class FingerprintEnrollIntroductionTest method testMaxFingerprint_shouldShowErrorMessage.

public void testMaxFingerprint_shouldShowErrorMessage() {
    final int max = mContext.getResources().getInteger(com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
    doReturn(generateFingerprintList(max)).when(mFingerprintManager).getEnrolledFingerprints(anyInt());
    getInstrumentation().runOnMainSync(() -> {
        getInstrumentation().callActivityOnCreate(mActivity, null);
        getInstrumentation().callActivityOnResume(mActivity);
    });
    final TextView errorTextView = (TextView) mActivity.findViewById(R.id.error_text);
    assertNotNull(errorTextView.getText().toString());
    PartnerCustomizationLayout layout = mActivity.findViewById(R.id.setup_wizard_layout);
    final Button nextButton = layout.getMixin(FooterBarMixin.class).getPrimaryButtonView();
    assertEquals(View.GONE, nextButton.getVisibility());
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Button(android.widget.Button) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) TextView(android.widget.TextView) Fingerprint(android.hardware.fingerprint.Fingerprint)

Example 33 with PartnerCustomizationLayout

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

the class ChooseLockPasswordTest method clearIsShown_when_somethingEnteredToConfirm.

@Test
public void clearIsShown_when_somethingEnteredToConfirm() {
    final Activity activity = mInstrumentation.startActivitySync(new Intent(mContext, ChooseLockPassword.class));
    final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    onView(withId(R.id.password_entry)).perform(ViewActions.typeText("1234")).perform(pressKey(KeyEvent.KEYCODE_ENTER)).perform(ViewActions.typeText("1"));
    // clear should be present if text field contains content
    assertThat(layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().getText()).isEqualTo(mContext.getString(R.string.lockpassword_clear_label));
    assertThat(layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().getVisibility()).isEqualTo(View.VISIBLE);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Activity(android.app.Activity) Intent(android.content.Intent) Test(org.junit.Test)

Example 34 with PartnerCustomizationLayout

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

the class ChooseLockPasswordTest method clearIsNotShown_when_nothingEntered.

@Test
public void clearIsNotShown_when_nothingEntered() {
    final Activity activity = mInstrumentation.startActivitySync(new Intent(mContext, ChooseLockPassword.class));
    final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    onView(withId(R.id.password_entry)).perform(ViewActions.typeText("1234")).perform(pressKey(KeyEvent.KEYCODE_ENTER));
    assertThat(layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().getVisibility()).isEqualTo(View.GONE);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) Activity(android.app.Activity) Intent(android.content.Intent) Test(org.junit.Test)

Example 35 with PartnerCustomizationLayout

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

the class SetupChooseLockPasswordAppTest method clearIsNotShown_when_nothingEntered.

@Test
public void clearIsNotShown_when_nothingEntered() throws Throwable {
    SetupChooseLockPassword activity = mActivityTestRule.launchActivity(null);
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    onView(withId(R.id.password_entry)).perform(ViewActions.typeText("1234")).perform(pressKey(KeyEvent.KEYCODE_ENTER));
    assertThat(layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().getVisibility()).isEqualTo(View.GONE);
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) MediumTest(androidx.test.filters.MediumTest) 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