Merge "[Settings] Make scribe setting default_on and secure" into udc-dev
This commit is contained in:
@@ -286,8 +286,8 @@ public class StylusDevicesControllerTest {
|
||||
|
||||
@Test
|
||||
public void handwritingPreference_checkedWhenFlagTrue() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
@@ -297,8 +297,8 @@ public class StylusDevicesControllerTest {
|
||||
|
||||
@Test
|
||||
public void handwritingPreference_uncheckedWhenFlagFalse() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
@@ -308,22 +308,22 @@ public class StylusDevicesControllerTest {
|
||||
|
||||
@Test
|
||||
public void handwritingPreference_updatesFlagOnClick() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
|
||||
handwritingPref.performClick();
|
||||
|
||||
assertThat(handwritingPref.isChecked()).isEqualTo(true);
|
||||
assertThat(Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, -1)).isEqualTo(1);
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, -1)).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handwritingPreference_startsHandwritingSettingsOnClickIfChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 0);
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
|
||||
@@ -335,8 +335,8 @@ public class StylusDevicesControllerTest {
|
||||
|
||||
@Test
|
||||
public void handwritingPreference_doesNotStartHandwritingSettingsOnClickIfNotChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
|
||||
@@ -350,8 +350,8 @@ public class StylusDevicesControllerTest {
|
||||
public void handwritingPreference_doesNotStartHandwritingSettingsIfNoIntent() {
|
||||
when(mInputMethodInfo.createStylusHandwritingSettingsActivityIntent())
|
||||
.thenReturn(null);
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, 1);
|
||||
showScreen(mController);
|
||||
SwitchPreference handwritingPref = (SwitchPreference) mPreferenceContainer.getPreference(1);
|
||||
|
||||
|
@@ -63,8 +63,8 @@ public class StylusHandwritingPreferenceControllerTest {
|
||||
public void onPreferenceChange_settingEnabled_stylusHandwritingShouldBeOn() {
|
||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
|
||||
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
|
||||
}
|
||||
@@ -73,16 +73,16 @@ public class StylusHandwritingPreferenceControllerTest {
|
||||
public void onPreferenceChange_settingEnabled_stylusHandwritingShouldBeOff() {
|
||||
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
|
||||
final int mode = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
|
||||
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_OFF);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_OFF);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(false);
|
||||
@@ -90,22 +90,11 @@ public class StylusHandwritingPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void updateState_settingEnabled_preferenceShouldBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_ON);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_ON);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
|
||||
mController.onDeveloperOptionsSwitchDisabled();
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
|
||||
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
verify(mPreference).setChecked(false);
|
||||
verify(mPreference).setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user