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

Commit 3029b831 authored by Alex Chau's avatar Alex Chau
Browse files

Update Tapl tests for enable_grid_only_overview

- Add "task" as id for TaskView, and use it instead of "snapshot" when creating OverviewTask, so that for split tasks are caputred as a whole in getCurrentTask and getTasks
- Fix getCurrentTask() to correctly get the top-right tasks in grid only overview. It'll first get the widest task, and then top, and then rightmost task
- Fix scrollLeftByDistance() to correctly account for leftGestureMargin to make sure it scroll by distance provided
- Fix scrollCurrentTaskOffScreen() to actually scroll the task off screen
- Fix createAndLaunchASplitPair() to use Task menu instead of Overview actions for grid only overview
- Skip testOverviewActions() in grid only overview, where Overview actions isn't available
- Fix testOverivewForTablet to expect the correct task in grid only overview; also disabled part of a test due to an animation bug in Overview
- Fix dismissBySwipingUp() to swipe from bottom of task, which is required to effectively dismiss top row tasks
- Also fixed OverviewTask to correctly get objects in FallbackOverview

Bug: 283246928
Test: presubmit
Flag: None
Change-Id: I5dd39b1779ea02738556f921169dbe38aa4cba8c
parent 9623aaa4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:id="@+id/task"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:id="@+id/task"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="true"
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto"
    android:id="@+id/task"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public class TaplOverviewIconTest extends AbstractLauncherUiTest {
        startTestActivity(2);
        startTestActivity(3);

        if (mLauncher.isTablet()) {
        if (mLauncher.isTablet() && !mLauncher.isGridOnlyOverviewEnabled()) {
            mLauncher.goHome().switchToOverview().getOverviewActions()
                    .clickSplit()
                    .getTestActivityTask(2)
+16 −11
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
    @PortraitLandscape
    @PlatinumTest(focusArea = "launcher")
    public void testOverviewActions() throws Exception {
        assumeFalse("Skipping Overview Actions tests for grid only overview",
                mLauncher.isTablet() && mLauncher.isGridOnlyOverviewEnabled());
        // Experimenting for b/165029151:
        final Overview overview = mLauncher.goHome().switchToOverview();
        if (overview.hasTasks()) overview.dismissAllTasks();
@@ -377,7 +379,9 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
        // Test opening the task.
        overview.getCurrentTask().open();
        assertTrue("Test activity didn't open from Overview",
                mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity10")),
                mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text(
                                mLauncher.isGridOnlyOverviewEnabled() ? "TestActivity12"
                                        : "TestActivity13")),
                        DEFAULT_UI_TIMEOUT));

        // Scroll the task offscreen as it is now first
@@ -398,16 +402,17 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
                (Math.abs(getTopRowTaskCountForTablet(launcher) - getBottomRowTaskCountForTablet(
                        launcher)) <= 1)));

        // Test dismissing more tasks.
        assertTrue("Launcher internal state didn't remain in Overview",
                isInState(() -> LauncherState.OVERVIEW));
        overview.getCurrentTask().dismiss();
        assertTrue("Launcher internal state didn't remain in Overview",
                isInState(() -> LauncherState.OVERVIEW));
        overview.getCurrentTask().dismiss();
        executeOnLauncher(launcher -> assertTrue("Grid did not rebalance after multiple dismissals",
                (Math.abs(getTopRowTaskCountForTablet(launcher) - getBottomRowTaskCountForTablet(
                        launcher)) <= 1)));
        // TODO(b/308841019): Re-enable after fixing Overview jank when dismiss
//        // Test dismissing more tasks.
//        assertTrue("Launcher internal state didn't remain in Overview",
//                isInState(() -> LauncherState.OVERVIEW));
//        overview.getCurrentTask().dismiss();
//        assertTrue("Launcher internal state didn't remain in Overview",
//                isInState(() -> LauncherState.OVERVIEW));
//        overview.getCurrentTask().dismiss();
//        executeOnLauncher(launcher -> assertTrue("Grid did not rebalance after multiple dismissals",
//                (Math.abs(getTopRowTaskCountForTablet(launcher) - getBottomRowTaskCountForTablet(
//                        launcher)) <= 1)));

        // Test dismissing all tasks.
        mLauncher.goHome().switchToOverview().dismissAllTasks();
Loading