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

Commit 883b585b authored by Yunfan Chen's avatar Yunfan Chen Committed by Android (Google) Code Review
Browse files

Merge "Make test compatible with relative insets flags" into main

parents 6a6fa00f 6ae49f6a
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -315,14 +315,8 @@ public class WindowDecorationTests extends ShellTestCase {
                any(),
                eq(null) /* onDrawTransaction */);
        verify(mMockView).setTaskFocusState(true);
        verify(mMockWindowContainerTransaction).addInsetsSource(
                eq(taskInfo.token),
                any(),
                eq(0 /* index */),
                eq(WindowInsets.Type.captionBar()),
                eq(new Rect(100, 300, 400, 364)),
                any(),
                anyInt());
        verifyAddedInsets(1, taskInfo.token, 0 /* index */, WindowInsets.Type.captionBar(),
                new Rect(100, 300, 400, 364));

        if (Flags.enableFreeformBoxShadows()) {
            if (inSyncWithTransition) {
@@ -1281,6 +1275,18 @@ public class WindowDecorationTests extends ShellTestCase {
        }
    }

    private void verifyAddedInsets(int times, WindowContainerToken token, int index, int type,
            Rect attachedRect) {
        if (com.android.window.flags.Flags.relativeInsets()) {
            verify(mMockWindowContainerTransaction, times(times)).addInsetsSource(eq(token), any(),
                    eq(index), eq(type), eq(Insets.of(0, attachedRect.height(), 0, 0)), any(),
                    anyInt());
        } else {
            verify(mMockWindowContainerTransaction, times(times)).addInsetsSource(eq(token), any(),
                    eq(index), eq(type), eq(attachedRect), any(), anyInt());
        }
    }

    private static class TestView extends View implements TaskFocusStateConsumer {
        private TestView(Context context) {
            super(context);