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

Commit 40c517af authored by Nataniel Borges's avatar Nataniel Borges
Browse files

New FlickerTests: Run split screen tests at 0 and 90 degrees

Test: atest ResizeSplitScreenTest
Change-Id: I44b0733f8abbb022f2a00072bbb398e6d29699c7
parent d051c3b7
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -209,15 +209,17 @@ class CommonTransitions {
                .repeat(ITERATIONS);
                .repeat(ITERATIONS);
    }
    }


    static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, IAppHelper testAppBottom,
    static TransitionBuilder resizeSplitScreen(IAppHelper testAppTop, ImeAppHelper testAppBottom,
            UiDevice device, Rational startRatio, Rational stopRatio) {
            UiDevice device, int beginRotation, Rational startRatio, Rational stopRatio) {
        String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_"
        String testTag = "resizeSplitScreen_" + testAppTop.getLauncherName() + "_"
                + testAppBottom.getLauncherName() + "_"
                + testAppBottom.getLauncherName() + "_"
                + startRatio.toString().replace("/", ":") + "_to_"
                + startRatio.toString().replace("/", ":") + "_to_"
                + stopRatio.toString().replace("/", ":");
                + stopRatio.toString().replace("/", ":") + "_"
                + rotationToString(beginRotation);
        return TransitionRunner.newBuilder()
        return TransitionRunner.newBuilder()
                .withTag(testTag)
                .withTag(testTag)
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBeforeAll(AutomationUtils::wakeUpAndGoToHomeScreen)
                .runBeforeAll(() -> setRotation(device, beginRotation))
                .runBeforeAll(() -> clearRecents(device))
                .runBeforeAll(() -> clearRecents(device))
                .runBefore(testAppBottom::open)
                .runBefore(testAppBottom::open)
                .runBefore(device::pressHome)
                .runBefore(device::pressHome)
@@ -229,6 +231,7 @@ class CommonTransitions {
                            By.res(device.getLauncherPackageName(), "snapshot"));
                            By.res(device.getLauncherPackageName(), "snapshot"));
                    snapshot.click();
                    snapshot.click();
                })
                })
                .runBefore(() -> testAppBottom.clickEditTextWidget(device))
                .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio))
                .runBefore(() -> AutomationUtils.resizeSplitScreen(device, startRatio))
                .run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio))
                .run(() -> AutomationUtils.resizeSplitScreen(device, stopRatio))
                .runAfter(() -> exitSplitScreen(device))
                .runAfter(() -> exitSplitScreen(device))
+4 −4
Original line number Original line Diff line number Diff line
@@ -113,10 +113,10 @@ public class DebugTest {
     */
     */
    @Test
    @Test
    public void resizeSplitScreen() {
    public void resizeSplitScreen() {
        IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
        ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
                "com.android.server.wm.flicker.testapp", "ImeApp");
        CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, Surface.ROTATION_0,
        CommonTransitions.resizeSplitScreen(testApp, bottomApp, uiDevice, new Rational(1, 3),
                new Rational(1, 3), new Rational(2, 3))
                new Rational(2, 3)).includeJankyRuns().recordEachRun().build().run();
                .includeJankyRuns().recordEachRun().build().run();
    }
    }


    // IME tests
    // IME tests
+22 −31
Original line number Original line Diff line number Diff line
@@ -24,13 +24,13 @@ import static com.android.server.wm.flicker.WindowUtils.getNavigationBarHeight;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;


import android.graphics.Rect;
import android.graphics.Rect;
import android.platform.helpers.IAppHelper;
import android.util.Rational;
import android.util.Rational;


import androidx.test.InstrumentationRegistry;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;

import com.android.server.wm.flicker.helpers.ImeAppHelper;


import org.junit.Before;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.FixMethodOrder;
@@ -38,57 +38,48 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.junit.runners.MethodSorters;
import org.junit.runners.Parameterized;


/**
/**
 * Test split screen resizing window transitions.
 * Test split screen resizing window transitions.
 * To run this test: {@code atest FlickerTests:ResizeSplitScreenTest}
 * To run this test: {@code atest FlickerTests:ResizeSplitScreenTest}
 */
 */
@LargeTest
@LargeTest
@RunWith(AndroidJUnit4.class)
@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@FlakyTest(bugId = 140856143)
@FlakyTest(bugId = 140854698)
@Ignore("Waiting bug feedback")
@Ignore("Waiting bug feedback")
public class ResizeSplitScreenTest extends FlickerTestBase {
public class ResizeSplitScreenTest extends NonRotationTestBase {

    private static String sSimpleActivity = "SimpleActivity";
    private static String sImeActivity = "ImeActivity";

    public ResizeSplitScreenTest(String beginRotationName, int beginRotation) {
        super(beginRotationName, beginRotation);


    public ResizeSplitScreenTest() {
        this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
        this.mTestApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
                "com.android.server.wm.flicker.testapp", "SimpleApp");
                "com.android.server.wm.flicker.testapp", "SimpleApp");
    }
    }


    @Before
    @Before
    public void runTransition() {
    public void runTransition() {
        IAppHelper bottomApp = new StandardAppHelper(InstrumentationRegistry
        ImeAppHelper bottomApp = new ImeAppHelper(InstrumentationRegistry.getInstrumentation());
                .getInstrumentation(),
        run(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, mBeginRotation,
                "com.android.server.wm.flicker.testapp", "ImeApp");
                new Rational(1, 3), new Rational(2, 3))
        super.runTransition(resizeSplitScreen(mTestApp, bottomApp, mUiDevice, new Rational(1, 3),
                .includeJankyRuns().build());
                new Rational(2, 3)).includeJankyRuns().build());
    }

    @Test
    public void checkVisibility_navBarLayerIsAlwaysVisible() {
        checkResults(result -> LayersTraceSubject.assertThat(result)
                .showsLayer(NAVIGATION_BAR_WINDOW_TITLE)
                .forAllEntries());
    }

    @Test
    public void checkVisibility_statusBarLayerIsAlwaysVisible() {
        checkResults(result -> LayersTraceSubject.assertThat(result)
                .showsLayer(STATUS_BAR_WINDOW_TITLE)
                .forAllEntries());
    }
    }


    @Test
    @Test
    public void checkVisibility_topAppLayerIsAlwaysVisible() {
    public void checkVisibility_topAppLayerIsAlwaysVisible() {
        checkResults(result -> LayersTraceSubject.assertThat(result)
        checkResults(result -> LayersTraceSubject.assertThat(result)
                .showsLayer("SimpleActivity")
                .showsLayer(sSimpleActivity)
                .forAllEntries());
                .forAllEntries());
    }
    }


    @Test
    @Test
    public void checkVisibility_bottomAppLayerIsAlwaysVisible() {
    public void checkVisibility_bottomAppLayerIsAlwaysVisible() {
        checkResults(result -> LayersTraceSubject.assertThat(result)
        checkResults(result -> LayersTraceSubject.assertThat(result)
                .showsLayer("ImeActivity")
                .showsLayer(sImeActivity)
                .forAllEntries());
                .forAllEntries());
    }
    }


@@ -149,11 +140,11 @@ public class ResizeSplitScreenTest extends FlickerTestBase {
                    displayBounds.bottom - getNavigationBarHeight());
                    displayBounds.bottom - getNavigationBarHeight());


            LayersTraceSubject.assertThat(result)
            LayersTraceSubject.assertThat(result)
                    .hasVisibleRegion("SimpleActivity", startingTopAppBounds)
                    .hasVisibleRegion(sSimpleActivity, startingTopAppBounds)
                    .atTheEnd();
                    .atTheEnd();


            LayersTraceSubject.assertThat(result)
            LayersTraceSubject.assertThat(result)
                    .hasVisibleRegion("ImeActivity", startingBottomAppBounds)
                    .hasVisibleRegion(sImeActivity, startingBottomAppBounds)
                    .atTheEnd();
                    .atTheEnd();
        });
        });
    }
    }
@@ -175,14 +166,14 @@ public class ResizeSplitScreenTest extends FlickerTestBase {
    @Test
    @Test
    public void checkVisibility_topAppWindowIsAlwaysVisible() {
    public void checkVisibility_topAppWindowIsAlwaysVisible() {
        checkResults(result -> WmTraceSubject.assertThat(result)
        checkResults(result -> WmTraceSubject.assertThat(result)
                .showsAppWindow("SimpleActivity")
                .showsAppWindow(sSimpleActivity)
                .forAllEntries());
                .forAllEntries());
    }
    }


    @Test
    @Test
    public void checkVisibility_bottomAppWindowIsAlwaysVisible() {
    public void checkVisibility_bottomAppWindowIsAlwaysVisible() {
        checkResults(result -> WmTraceSubject.assertThat(result)
        checkResults(result -> WmTraceSubject.assertThat(result)
                .showsAppWindow("ImeActivity")
                .showsAppWindow(sImeActivity)
                .forAllEntries());
                .forAllEntries());
    }
    }