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

Commit 9ba49c33 authored by Ang Li's avatar Ang Li Committed by Android (Google) Code Review
Browse files

Merge "Add unit test for WallpaperService.Engine#getRenderingSurfaceControl" into main

parents 61cd26fb a04567dc
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.service.wallpaper;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import androidx.test.filters.SmallTest;
@@ -98,4 +99,22 @@ public class WallpaperServiceTest {

        engine.notifyColorsChanged();
    }

    @Test
    public void testGetRenderingSurfaceControl() {
        WallpaperService service = new WallpaperService() {
            @Override
            public Engine onCreateEngine() {
                return new Engine();
            }
        };
        WallpaperService.Engine engine = service.onCreateEngine();

        // Before the engine's surface is created and updated, this field is expected to be null.
        // A full integration test would be required to verify the non-null case, as creating a
        // real SurfaceControl requires significant setup. This unit test verifies the getter's
        // basic functionality and initial state.
        assertNull("getRenderingSurfaceControl should return null before surface creation",
                engine.getRenderingSurfaceControl());
    }
}