Merge "Show 'screen lock options' on all lock screen types"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a63075f0eb
@@ -21,9 +21,12 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.robolectric.RuntimeEnvironment.application;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.UserHandle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.password.ChooseLockPattern.ChooseLockPatternFragment;
|
||||
import com.android.settings.password.ChooseLockPattern.IntentBuilder;
|
||||
@@ -40,6 +43,7 @@ import org.junit.runner.RunWith;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.Shadows;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.shadows.ShadowAlertDialog;
|
||||
import org.robolectric.shadows.ShadowPackageManager.ComponentState;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@@ -85,6 +89,19 @@ public class SetupChooseLockPatternTest {
|
||||
.isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void screenLockOptions_shouldBeVisible() {
|
||||
Button button = mActivity.findViewById(R.id.screen_lock_options);
|
||||
assertThat(button).isNotNull();
|
||||
assertThat(button.getVisibility()).isEqualTo(View.VISIBLE);
|
||||
|
||||
button.performClick();
|
||||
AlertDialog chooserDialog = ShadowAlertDialog.getLatestAlertDialog();
|
||||
assertThat(chooserDialog).isNotNull();
|
||||
int count = Shadows.shadowOf(chooserDialog).getAdapter().getCount();
|
||||
assertThat(count).named("List items shown").isEqualTo(3);
|
||||
}
|
||||
|
||||
private ChooseLockPatternFragment findFragment(Activity activity) {
|
||||
return (ChooseLockPatternFragment)
|
||||
activity.getFragmentManager().findFragmentById(R.id.main_content);
|
||||
|
@@ -135,11 +135,9 @@ public class SetupChooseLockPasswordTest {
|
||||
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")
|
||||
final Intent nextStartedActivity = shadowActivity.getNextStartedActivity();
|
||||
assertThat(nextStartedActivity).isNotNull();
|
||||
assertThat(nextStartedActivity.getStringExtra("foo")).named("Foo extra")
|
||||
.isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user