Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d693e345 authored by Santos Cordon's avatar Santos Cordon
Browse files

Add even more display tests to presubmit.

Mostly just adding presubmit annotation, but has some test
fixes as well.

Bug: 178100879
Test: atest <each of the files in this CL>
Change-Id: I073c66a520a3fb1ab58c19e702db2edd23d1e3ae
parent e9c691d3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.hardware.display.DisplayManagerInternal.DisplayPowerRequest;
import android.os.Handler;
import android.platform.test.annotations.Presubmit;

import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
@@ -43,6 +44,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

@SmallTest
@Presubmit
@RunWith(AndroidJUnit4.class)
public class AutomaticBrightnessControllerTest {
    private static final float BRIGHTNESS_MIN_FLOAT = 0.0f;
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.hardware.display.BrightnessConfiguration;
import android.os.PowerManager;
import android.platform.test.annotations.Presubmit;
import android.util.MathUtils;
import android.util.Spline;

@@ -42,6 +43,7 @@ import org.junit.runner.RunWith;
import java.util.Arrays;

@SmallTest
@Presubmit
@RunWith(AndroidJUnit4.class)
public class BrightnessMappingStrategyTest {

+9 −1
Original line number Diff line number Diff line
@@ -41,12 +41,13 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.ContextWrapper;
import android.database.ContentObserver;
import android.hardware.display.DisplayManager;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.hardware.display.DisplayManager;
import android.os.Handler;
import android.os.Looper;
import android.platform.test.annotations.Presubmit;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.test.mock.MockContentResolver;
@@ -82,6 +83,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@SmallTest
@Presubmit
@RunWith(AndroidJUnit4.class)
public class DisplayModeDirectorTest {
    // The tolerance within which we consider something approximately equals.
@@ -588,6 +590,12 @@ public class DisplayModeDirectorTest {

    @Test
    public void testSensorRegistration() {
        // First, configure brightness zones or DMD won't register for sensor data.
        final FakeDeviceConfig config = mInjector.getDeviceConfig();
        config.setRefreshRateInHighZone(60);
        config.setHighDisplayBrightnessThresholds(new int[] { 255 });
        config.setHighAmbientBrightnessThresholds(new int[] { 8000 });

        DisplayModeDirector director =
                createDirectorFromRefreshRateArray(new float[] {60.f, 90.f}, 0);
        setPeakRefreshRate(90 /*fps*/);
+9 −0
Original line number Diff line number Diff line
@@ -20,17 +20,23 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import android.app.PropertyInvalidatedCache;
import android.graphics.Point;
import android.platform.test.annotations.Presubmit;
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.SurfaceControl;

import androidx.test.filters.SmallTest;

import org.junit.Before;
import org.junit.Test;

import java.io.InputStream;
import java.io.OutputStream;

@SmallTest
@Presubmit
public class LogicalDisplayTest {
    private static final int DISPLAY_ID = 0;
    private static final int LAYER_STACK = 0;
@@ -52,6 +58,9 @@ public class LogicalDisplayTest {
        mLogicalDisplay = new LogicalDisplay(DISPLAY_ID, LAYER_STACK, mDisplayDevice);
        when(mDisplayDevice.getDisplayDeviceInfoLocked()).thenReturn(displayDeviceInfo);

        // Disable binder caches in this process.
        PropertyInvalidatedCache.disableForTestMode();

        DisplayDeviceRepository repo = new DisplayDeviceRepository(
                new DisplayManagerService.SyncRoot(),
                new PersistentDataStore(new PersistentDataStore.Injector() {
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import android.hardware.display.BrightnessConfiguration;
import android.platform.test.annotations.Presubmit;
import android.util.Pair;

import androidx.test.filters.SmallTest;
@@ -40,6 +41,7 @@ import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

@SmallTest
@Presubmit
@RunWith(AndroidJUnit4.class)
public class PersistentDataStoreTest {
    private PersistentDataStore mDataStore;