Search in sources :

Example 1 with BrightnessConfiguration

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);
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 2 with BrightnessConfiguration

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);
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 3 with BrightnessConfiguration

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);
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration) HiddenApi(org.robolectric.annotation.HiddenApi) Implementation(org.robolectric.annotation.Implementation)

Example 4 with BrightnessConfiguration

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;
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration)

Example 5 with BrightnessConfiguration

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);
}
Also used : BrightnessConfiguration(android.hardware.display.BrightnessConfiguration) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

BrightnessConfiguration (android.hardware.display.BrightnessConfiguration)6 Test (org.junit.Test)4 Config (org.robolectric.annotation.Config)4 HiddenApi (org.robolectric.annotation.HiddenApi)1 Implementation (org.robolectric.annotation.Implementation)1