Merge "[Reduce Bright Colors] Use a switch preference" into sc-dev am: 9aff855052

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13719274

Change-Id: Ide66887df44b1ea331275a9766c7ac7ee7d5dfec
This commit is contained in:
Sally Yuen
2021-04-05 18:49:10 +00:00
committed by Automerger Merge Worker
3 changed files with 85 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.accessibility;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -31,7 +32,6 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class ReduceBrightColorsPreferenceControllerTest {
private static final String PREF_KEY = "rbc_preference";
private final Context mContext = ApplicationProvider.getApplicationContext();
private final ReduceBrightColorsPreferenceController mController =
new ReduceBrightColorsPreferenceController(mContext, PREF_KEY);
@@ -41,4 +41,18 @@ public class ReduceBrightColorsPreferenceControllerTest {
assertThat(mController.getSummary().toString().contains(
mContext.getText(R.string.reduce_bright_colors_preference_summary))).isTrue();
}
@Test
public void isChecked_reduceBrightColorsIsActivated_returnTrue() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED, 1);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void isChecked_reduceBrightColorsIsNotActivated_returnFalse() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED, 0);
assertThat(mController.isChecked()).isFalse();
}
}