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

Commit dbfb7f88 authored by Oleg Petsjonkin's avatar Oleg Petsjonkin Committed by Oleg Petšjonkin
Browse files

LocalDisplayAdapterTest - fixed issue with real DDC loading for fake display

Depending on device config file name it is possible that real DDC will be loaded and used in test for FakeDisplay. Introduced method to override/set DisplayDeviceConifg (loaded from mock resources) and used it in probelmatic tests
This fixed testDpiValues and testHdrSdrRatio_notifiesOnChange

Bug: b/284119555
Test: atest LocalDisplayAdapterTest on problematic devices
Change-Id: I67051b4c1a4662b216eb702d04a8a280ea200ec5
parent 54906d06
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        private void loadDisplayDeviceConfig() {
            // Load display device config
            final Context context = getOverlayContext();
            mDisplayDeviceConfig = DisplayDeviceConfig.create(context, mPhysicalDisplayId,
            mDisplayDeviceConfig = mInjector.createDisplayDeviceConfig(context, mPhysicalDisplayId,
                    mIsFirstDisplay);

            // Load brightness HWC quirk
@@ -1336,6 +1336,11 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        public SurfaceControlProxy getSurfaceControlProxy() {
            return new SurfaceControlProxy();
        }

        public DisplayDeviceConfig createDisplayDeviceConfig(Context context,
                long physicalDisplayId, boolean isFirstDisplay) {
            return DisplayDeviceConfig.create(context, physicalDisplayId, isFirstDisplay);
        }
    }

    public interface DisplayEventListener {
+11 −0
Original line number Diff line number Diff line
@@ -1257,6 +1257,17 @@ public class LocalDisplayAdapterTest {
        public LocalDisplayAdapter.SurfaceControlProxy getSurfaceControlProxy() {
            return mSurfaceControlProxy;
        }

        // Instead of using DisplayDeviceConfig.create(context, physicalDisplayId, isFirstDisplay)
        // we should use DisplayDeviceConfig.create(context, isFirstDisplay) for the test to ensure
        // that real device DisplayDeviceConfig is not loaded for FakeDisplay and we are getting
        // consistent behaviour. Please also note that context passed to this method, is
        // mMockContext and values will be loaded from mMockResources.
        @Override
        public DisplayDeviceConfig createDisplayDeviceConfig(Context context,
                long physicalDisplayId, boolean isFirstDisplay) {
            return DisplayDeviceConfig.create(context, isFirstDisplay);
        }
    }

    private class TestListener implements DisplayAdapter.Listener {