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

Commit 86f908f8 authored by Ryan Lin's avatar Ryan Lin Committed by Automerger Merge Worker
Browse files

Merge "Fix rotation test faiulre on foldable devices" into sc-v2-dev am: 988a050f am: ad0f0359

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15674056

Change-Id: I1b18f0c9294422fdfefaaae518d14056b94d619d
parents fdd87b87 ad0f0359
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -250,7 +250,9 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
    @Test
    public void onOrientationChanged_enabled_updateDisplayRotationAndCenterStayAtSamePosition() {
        final Display display = Mockito.spy(mContext.getDisplay());
        when(display.getRotation()).thenReturn(Surface.ROTATION_90);
        final int currentRotation = display.getRotation();
        final int newRotation = (currentRotation + 1) % 4;
        when(display.getRotation()).thenReturn(newRotation);
        when(mContext.getDisplay()).thenReturn(display);
        mInstrumentation.runOnMainSync(() -> {
            mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
@@ -259,7 +261,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
        final PointF expectedCenter = new PointF(mWindowMagnificationController.getCenterY(),
                mWindowMagnificationController.getCenterX());
        final Rect windowBounds = new Rect(mWindowManager.getCurrentWindowMetrics().getBounds());
        // Rotate the window 90 degrees.
        // Rotate the window clockwise 90 degree.
        windowBounds.set(windowBounds.top, windowBounds.left, windowBounds.bottom,
                windowBounds.right);
        mWindowManager.setWindowBounds(windowBounds);
@@ -268,7 +270,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
            mWindowMagnificationController.onConfigurationChanged(ActivityInfo.CONFIG_ORIENTATION);
        });

        assertEquals(Surface.ROTATION_90, mWindowMagnificationController.mRotation);
        assertEquals(newRotation, mWindowMagnificationController.mRotation);
        final PointF actualCenter = new PointF(mWindowMagnificationController.getCenterX(),
                mWindowMagnificationController.getCenterY());
        assertEquals(expectedCenter, actualCenter);