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

Commit 91d6b527 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Resize display to portrait for some wm unit tests

The precondition of the tests assume it run on a portrait display.

Bug: 295867717
Fix: 295867570
Test: RecentsAnimationControllerTest# \
      testWallpaperHasFixedRotationApplied
Change-Id: Idbc02465a821825b628ab4e4eb9ab7a282454041
parent 7b193950
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -353,6 +353,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {

    @Test
    public void testRecentViewInFixedPortraitWhenTopAppInLandscape() {
        makeDisplayPortrait(mDefaultDisplay);
        unblockDisplayRotation(mDefaultDisplay);
        mWm.setRecentsAnimationController(mController);

@@ -488,6 +489,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {

    @Test
    public void testWallpaperHasFixedRotationApplied() {
        makeDisplayPortrait(mDefaultDisplay);
        unblockDisplayRotation(mDefaultDisplay);
        mWm.setRecentsAnimationController(mController);

+1 −4
Original line number Diff line number Diff line
@@ -116,10 +116,7 @@ public class WallpaperControllerTests extends WindowTestsBase {
    public void testWallpaperSizeWithFixedTransform() {
        // No wallpaper
        final DisplayContent dc = mDisplayContent;
        if (dc.mBaseDisplayHeight <= dc.mBaseDisplayWidth) {
            // Make sure the display size is portrait.
            resizeDisplay(dc, 500, 1000);
        }
        makeDisplayPortrait(dc);

        // No wallpaper WSA Surface
        final WindowState wallpaperWindow = createWallpaperWindow(dc);
+7 −0
Original line number Diff line number Diff line
@@ -977,6 +977,13 @@ class WindowTestsBase extends SystemServiceTestsBase {
        displayContent.onRequestedOverrideConfigurationChanged(c);
    }

    /** Used for the tests that assume the display is portrait by default. */
    static void makeDisplayPortrait(DisplayContent displayContent) {
        if (displayContent.mBaseDisplayHeight <= displayContent.mBaseDisplayWidth) {
            resizeDisplay(displayContent, 500, 1000);
        }
    }

    // The window definition for UseTestDisplay#addWindows. The test can declare to add only
    // necessary windows, that avoids adding unnecessary overhead of unused windows.
    static final int W_NOTIFICATION_SHADE = TYPE_NOTIFICATION_SHADE;