Search in sources :

Example 6 with PartnerCustomizationLayout

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

the class SetupChooseLockPasswordTest method createActivity_inputPasswordInConfirmStage_clearButtonShouldBeShown.

@Test
public void createActivity_inputPasswordInConfirmStage_clearButtonShouldBeShown() {
    SetupChooseLockPassword activity = createSetupChooseLockPassword();
    SetupChooseLockPasswordFragment fragment = (SetupChooseLockPasswordFragment) activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
    ScrollToParentEditText passwordEntry = activity.findViewById(R.id.password_entry);
    passwordEntry.setText("");
    fragment.updateStage(Stage.NeedToConfirm);
    final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    final Button skipOrClearButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
    assertThat(skipOrClearButton.isEnabled()).isTrue();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.GONE);
    passwordEntry.setText("1234");
    fragment.updateUi();
    assertThat(skipOrClearButton.getVisibility()).isEqualTo(View.VISIBLE);
    assertThat(skipOrClearButton.getText()).isEqualTo(application.getString(R.string.lockpassword_clear_label));
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ScrollToParentEditText(com.android.settings.widget.ScrollToParentEditText) Button(android.widget.Button) SetupChooseLockPasswordFragment(com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment) FooterBarMixin(com.google.android.setupcompat.template.FooterBarMixin) Test(org.junit.Test)

Example 7 with PartnerCustomizationLayout

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

the class FingerprintEnrollFinishTest method clickAddAnother_shouldPropagateResults.

@Test
public void clickAddAnother_shouldPropagateResults() {
    final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
    intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_OK, null));
    PartnerCustomizationLayout layout = mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
    intended(hasComponent(enrollingComponent));
    assertTrue(mActivityRule.getActivity().isFinishing());
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ComponentName(android.content.ComponentName) ActivityResult(android.app.Instrumentation.ActivityResult) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 8 with PartnerCustomizationLayout

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

the class ChooseLockPasswordTest method clearIsNotShown_when_activityLaunchedInitially.

@Test
public void clearIsNotShown_when_activityLaunchedInitially() {
    final Activity activity = mInstrumentation.startActivitySync(new Intent(mContext, ChooseLockPassword.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    final PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    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 9 with PartnerCustomizationLayout

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

the class FingerprintEnrollFinishTest method clickAddAnother_shouldLaunchEnrolling.

@Test
public void clickAddAnother_shouldLaunchEnrolling() {
    final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
    intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_CANCELED, null));
    PartnerCustomizationLayout layout = mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
    intended(hasComponent(enrollingComponent));
    assertFalse(mActivityRule.getActivity().isFinishing());
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ComponentName(android.content.ComponentName) ActivityResult(android.app.Instrumentation.ActivityResult) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 10 with PartnerCustomizationLayout

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

the class SetupChooseLockPasswordAppTest method clearIsNotShown_when_activityLaunchedInitially.

@Test
public void clearIsNotShown_when_activityLaunchedInitially() {
    SetupChooseLockPassword activity = mActivityTestRule.launchActivity(null);
    PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
    assertThat(layout.getMixin(FooterBarMixin.class).getSecondaryButtonView().getText()).isEqualTo(mContext.getString(R.string.lockpassword_clear_label));
}
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