Use ColorDisplayManager
Bug: 111215474 Test: make RunSettingsRoboTests -j100 Change-Id: I78bb44a1c4824f2b5223ca0d58ad224b96591d9a
This commit is contained in:
@@ -3,17 +3,14 @@ package com.android.settings.display;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.ComponentName;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
import com.android.internal.app.ColorDisplayController;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Settings.NightDisplaySuggestionActivity;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
@@ -25,16 +22,8 @@ import org.robolectric.annotation.Config;
|
||||
})
|
||||
public class NightDisplayPreferenceControllerTest {
|
||||
|
||||
private NightDisplayPreferenceController mPreferenceController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mPreferenceController = new NightDisplayPreferenceController(RuntimeEnvironment.application);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mPreferenceController = null;
|
||||
SettingsShadowResources.reset();
|
||||
}
|
||||
|
||||
@@ -43,9 +32,7 @@ public class NightDisplayPreferenceControllerTest {
|
||||
final Application context = RuntimeEnvironment.application;
|
||||
Secure.putInt(context.getContentResolver(),
|
||||
Secure.NIGHT_DISPLAY_AUTO_MODE, ColorDisplayController.AUTO_MODE_DISABLED);
|
||||
final ComponentName componentName =
|
||||
new ComponentName(context, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mPreferenceController.isSuggestionComplete(context)).isFalse();
|
||||
assertThat(NightDisplayPreferenceController.isSuggestionComplete(context)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,9 +40,7 @@ public class NightDisplayPreferenceControllerTest {
|
||||
final Application context = RuntimeEnvironment.application;
|
||||
Secure.putInt(context.getContentResolver(),
|
||||
Secure.NIGHT_DISPLAY_AUTO_MODE, ColorDisplayController.AUTO_MODE_CUSTOM);
|
||||
final ComponentName componentName =
|
||||
new ComponentName(context, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
assertThat(NightDisplayPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,9 +48,7 @@ public class NightDisplayPreferenceControllerTest {
|
||||
final Application context = RuntimeEnvironment.application;
|
||||
Secure.putInt(context.getContentResolver(),
|
||||
Secure.NIGHT_DISPLAY_AUTO_MODE, ColorDisplayController.AUTO_MODE_TWILIGHT);
|
||||
final ComponentName componentName =
|
||||
new ComponentName(context, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
assertThat(NightDisplayPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -74,9 +57,6 @@ public class NightDisplayPreferenceControllerTest {
|
||||
Secure.putInt(context.getContentResolver(),
|
||||
Secure.NIGHT_DISPLAY_AUTO_MODE, ColorDisplayController.AUTO_MODE_DISABLED);
|
||||
SettingsShadowResources.overrideResource(R.bool.config_night_light_suggestion_enabled, false);
|
||||
|
||||
final ComponentName componentName =
|
||||
new ComponentName(context, NightDisplaySuggestionActivity.class);
|
||||
assertThat(mPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
assertThat(NightDisplayPreferenceController.isSuggestionComplete(context)).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user