use of com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment in project android_packages_apps_Settings by LineageOS.
the class SetupChooseLockPasswordTest method createActivity_clickDifferentOption_extrasShouldBePropagated.
@Test
public void createActivity_clickDifferentOption_extrasShouldBePropagated() {
Bundle bundle = new Bundle();
bundle.putString("foo", "bar");
Intent intent = new IntentBuilder(application).build();
intent.putExtra(ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, bundle);
intent = SetupChooseLockPassword.modifyIntentForSetup(application, intent);
intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, true);
SetupChooseLockPassword activity = Robolectric.buildActivity(SetupChooseLockPassword.class, intent).setup().get();
SetupChooseLockPasswordFragment fragment = (SetupChooseLockPasswordFragment) activity.getFragmentManager().findFragmentById(R.id.main_content);
fragment.onLockTypeSelected(ScreenLockType.PATTERN);
ShadowActivity shadowActivity = shadowOf(activity);
IntentForResult chooseLockIntent = shadowActivity.getNextStartedActivityForResult();
assertThat(chooseLockIntent).isNotNull();
assertThat(chooseLockIntent.requestCode).isEqualTo(SetupChooseLockPasswordFragment.REQUEST_SCREEN_LOCK_OPTIONS);
assertThat(chooseLockIntent.intent.getStringExtra("foo")).named("Foo extra").isEqualTo("bar");
}
use of com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment in project android_packages_apps_Settings by crdroidandroid.
the class SetupChooseLockPasswordTest method createActivity_clickDifferentOption_extrasShouldBePropagated.
@Test
public void createActivity_clickDifferentOption_extrasShouldBePropagated() {
Bundle bundle = new Bundle();
bundle.putString("foo", "bar");
Intent intent = new IntentBuilder(application).build();
intent.putExtra(ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, bundle);
intent = SetupChooseLockPassword.modifyIntentForSetup(application, intent);
intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, true);
SetupChooseLockPassword activity = Robolectric.buildActivity(SetupChooseLockPassword.class, intent).setup().get();
SetupChooseLockPasswordFragment fragment = (SetupChooseLockPasswordFragment) activity.getFragmentManager().findFragmentById(R.id.main_content);
fragment.onLockTypeSelected(ScreenLockType.PATTERN);
ShadowActivity shadowActivity = shadowOf(activity);
IntentForResult chooseLockIntent = shadowActivity.getNextStartedActivityForResult();
assertThat(chooseLockIntent).isNotNull();
assertThat(chooseLockIntent.requestCode).isEqualTo(SetupChooseLockPasswordFragment.REQUEST_SCREEN_LOCK_OPTIONS);
assertThat(chooseLockIntent.intent.getStringExtra("foo")).named("Foo extra").isEqualTo("bar");
}
use of com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupChooseLockPasswordTest method createActivity_clickDifferentOption_extrasShouldBePropagated.
@Test
public void createActivity_clickDifferentOption_extrasShouldBePropagated() {
Bundle bundle = new Bundle();
bundle.putString("foo", "bar");
Intent intent = new IntentBuilder(application).build();
intent.putExtra(ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, bundle);
intent = SetupChooseLockPassword.modifyIntentForSetup(application, intent);
intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, true);
SetupChooseLockPassword activity = ActivityController.of(new SetupChooseLockPassword(), intent).setup().get();
SetupChooseLockPasswordFragment fragment = (SetupChooseLockPasswordFragment) activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
fragment.onLockTypeSelected(ScreenLockType.PATTERN);
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
final Intent nextStartedActivity = shadowActivity.getNextStartedActivity();
assertThat(nextStartedActivity).isNotNull();
assertThat(nextStartedActivity.getBooleanExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, false)).isTrue();
assertThat(nextStartedActivity.getStringExtra("foo")).named("Foo extra").isEqualTo("bar");
}
use of com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment in project android_packages_apps_Settings by omnirom.
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));
}
Aggregations