Camera lift preference now saves correctly
Bug: 37751057 Test: manual + make RunSettingsRoboTests Fixed issue where camera lift preference was saving the opposite value of what it was supposed to. Added test to cover saving of value on preference change. Change-Id: I2d2c454eb478afb7f73519f9f05c9a9a1933938b
This commit is contained in:
@@ -100,4 +100,26 @@ public class CameraLiftTriggerPreferenceControllerTest {
|
||||
|
||||
assertThat(mController.isSwitchPrefEnabled()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnablePreference_shouldSetSetting() {
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
mController = new CameraLiftTriggerPreferenceController(context, null,
|
||||
KEY_CAMERA_LIFT_TRIGGER);
|
||||
mController.onPreferenceChange(null, true);
|
||||
|
||||
assertThat(Settings.Secure.getInt(context.getContentResolver(),
|
||||
CAMERA_LIFT_TRIGGER_ENABLED, 0)).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisablePreference_shouldClearSetting() {
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
mController = new CameraLiftTriggerPreferenceController(context, null,
|
||||
KEY_CAMERA_LIFT_TRIGGER);
|
||||
mController.onPreferenceChange(null, false);
|
||||
|
||||
assertThat(Settings.Secure.getInt(context.getContentResolver(),
|
||||
CAMERA_LIFT_TRIGGER_ENABLED, 1)).isEqualTo(0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user