use of android.hardware.display.BrightnessConfiguration in project robolectric by robolectric.
the class ShadowDisplayManagerTest method getDefaultBrightnessConfiguration_setViaShadow_shouldReturnValueSet.
@Test
@Config(minSdk = P)
public void getDefaultBrightnessConfiguration_setViaShadow_shouldReturnValueSet() {
BrightnessConfiguration config = new BrightnessConfiguration.Builder(/* lux= */
new float[] { 0.0f, 5000.0f }, /* nits= */
new float[] { 2.0f, 400.0f }).build();
ShadowDisplayManager.setDefaultBrightnessConfiguration(config);
assertThat(instance.getDefaultBrightnessConfiguration()).isEqualTo(config);
}
use of android.hardware.display.BrightnessConfiguration in project robolectric by robolectric.
the class ShadowDisplayManagerTest method getBrightnessConfiguration_unset_shouldReturnDefault.
@Test
@Config(minSdk = P)
public void getBrightnessConfiguration_unset_shouldReturnDefault() {
BrightnessConfiguration config = new BrightnessConfiguration.Builder(/* lux= */
new float[] { 0.0f, 5000.0f }, /* nits= */
new float[] { 2.0f, 400.0f }).build();
ShadowDisplayManager.setDefaultBrightnessConfiguration(config);
assertThat(instance.getBrightnessConfiguration()).isEqualTo(config);
}
use of android.hardware.display.BrightnessConfiguration in project robolectric by robolectric.
the class ShadowDisplayManagerGlobal method setBrightnessConfigurationForUser.
@Implementation(minSdk = P)
@HiddenApi
protected void setBrightnessConfigurationForUser(Object configObject, int userId, String packageName) {
BrightnessConfiguration config = (BrightnessConfiguration) configObject;
brightnessConfiguration.put(userId, config);
}
use of android.hardware.display.BrightnessConfiguration in project robolectric by robolectric.
the class ShadowDisplayManagerGlobal method setDefaultBrightnessConfiguration.
void setDefaultBrightnessConfiguration(@Nullable Object configObject) {
BrightnessConfiguration config = (BrightnessConfiguration) configObject;
defaultBrightnessConfiguration = config;
}
use of android.hardware.display.BrightnessConfiguration in project robolectric by robolectric.
the class ShadowDisplayManagerTest method getBrightnessConfiguration_setToValue_shouldReturnValue.
@Test
@Config(minSdk = P)
public void getBrightnessConfiguration_setToValue_shouldReturnValue() {
BrightnessConfiguration defaultConfig = new BrightnessConfiguration.Builder(/* lux= */
new float[] { 0.0f, 5000.0f }, /* nits= */
new float[] { 2.0f, 400.0f }).build();
BrightnessConfiguration setConfig = new BrightnessConfiguration.Builder(/* lux= */
new float[] { 0.0f, 2500.0f, 6000.0f }, /* nits= */
new float[] { 10.0f, 300.0f, 450.0f }).build();
ShadowDisplayManager.setDefaultBrightnessConfiguration(defaultConfig);
instance.setBrightnessConfiguration(setConfig);
assertThat(instance.getBrightnessConfiguration()).isEqualTo(setConfig);
}
Aggregations