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

Commit 86b92aef authored by ryanlwlin's avatar ryanlwlin
Browse files

Fix WindowMagnificationControllerTest failure on foldable targets

In foldables, the bottom valure of system gestureinset is 0.
We fix it with a test windowinset.

Bug: 196931900
Test: atest WindowMagnificationControllerTest
      use forrest to run WindowMagnificationControllerTest
Change-Id: Iaa58de87a89bf47edd9ac9beb52afa5b3cf006e7
parent cc2f80f5
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
    public void deleteWindowMagnification_enableAtTheBottom_overlapFlagIsFalse() {
        final WindowManager wm = mContext.getSystemService(WindowManager.class);
        final Rect bounds = wm.getCurrentWindowMetrics().getBounds();
        setSystemGestureInsets();

        mInstrumentation.runOnMainSync(() -> {
            mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
@@ -463,10 +464,7 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
    @Test
    public void moveWindowMagnificationToTheBottom_enabledWithGestureInset_overlapFlagIsTrue() {
        final Rect bounds = mWindowManager.getCurrentWindowMetrics().getBounds();
        final WindowInsets testInsets = new WindowInsets.Builder()
                .setInsets(systemGestures(), Insets.of(0, 0, 0, 10))
                .build();
        mWindowManager.setWindowInsets(testInsets);
        setSystemGestureInsets();
        mInstrumentation.runOnMainSync(() -> {
            mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
                    Float.NaN);
@@ -492,4 +490,11 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
    private boolean hasMagnificationOverlapFlag() {
        return (mSysUiState.getFlags() & SYSUI_STATE_MAGNIFICATION_OVERLAP) != 0;
    }

    private void setSystemGestureInsets() {
        final WindowInsets testInsets = new WindowInsets.Builder()
                .setInsets(systemGestures(), Insets.of(0, 0, 0, 10))
                .build();
        mWindowManager.setWindowInsets(testInsets);
    }
}