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

Commit 3e64f943 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Add splitFromOverviewForTablet test" into tm-qpr-dev

parents df1c1c84 86a844c9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ import androidx.annotation.Nullable;

import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.quickstep.SystemUiProxy;
@@ -171,6 +173,8 @@ public class SplitSelectStateController {
    public void launchTasks(int taskId1, @Nullable PendingIntent taskPendingIntent,
            @Nullable Intent fillInIntent, int taskId2, @StagePosition int stagePosition,
            Consumer<Boolean> callback, boolean freezeTaskList, float splitRatio) {
        TestLogging.recordEvent(
                TestProtocol.SEQUENCE_MAIN, "launchSplitTasks");
        // Assume initial task is for top/left part of screen
        final int[] taskIds = stagePosition == STAGE_POSITION_TOP_OR_LEFT
                ? new int[]{taskId1, taskId2}
+14 −0
Original line number Diff line number Diff line
@@ -179,6 +179,20 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
        actionsView.clickAndDismissScreenshot();
    }

    @Test
    @PortraitLandscape
    public void testSplitFromOverviewForTablet() {
        assumeTrue(mLauncher.isTablet());

        startTestActivity(2);
        startTestActivity(3);

        mLauncher.goHome().switchToOverview().getOverviewActions()
                .clickSplit()
                .getTestActivityTask(2)
                .open();
    }

    private int getCurrentOverviewPage(Launcher launcher) {
        return launcher.<RecentsView>getOverviewPanel().getCurrentPage();
    }
+12 −5
Original line number Diff line number Diff line
@@ -563,10 +563,13 @@ public abstract class AbstractLauncherUiTest {
                    break;
                }
                case OVERVIEW: {
                    checkLauncherStateInOverview(launcher, expectedContainerType, isStarted,
                            isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal),
                            ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL);
                    verifyOverviewState(launcher, expectedContainerType, isStarted, isResumed,
                            ordinal, TestProtocol.OVERVIEW_STATE_ORDINAL);
                    break;
                }
                case SPLIT_SCREEN_SELECT: {
                    verifyOverviewState(launcher, expectedContainerType, isStarted, isResumed,
                            ordinal, TestProtocol.OVERVIEW_SPLIT_SELECT_ORDINAL);
                    break;
                }
                case TASKBAR_ALL_APPS:
@@ -632,5 +635,9 @@ public abstract class AbstractLauncherUiTest {
        return homeAppIcon;
    }


    private void verifyOverviewState(Launcher launcher, ContainerType expectedContainerType,
            boolean isStarted, boolean isResumed, int ordinal, int expectedOrdinal) {
        checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed);
        assertEquals(TestProtocol.stateOrdinalToString(ordinal), ordinal, expectedOrdinal);
    }
}
+22 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3.tapl;
import android.graphics.Rect;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;
@@ -168,6 +169,27 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
        return new OverviewTask(mLauncher, widestTask, this);
    }

    /** Returns an overview task matching TestActivity {@param activityNumber}. */
    @NonNull
    public OverviewTask getTestActivityTask(int activityNumber) {
        final List<UiObject2> taskViews = getTasks();
        mLauncher.assertNotEquals("Unable to find a task", 0, taskViews.size());

        final String activityName = "TestActivity" + activityNumber;
        UiObject2 task = null;
        for (UiObject2 taskView : taskViews) {
            // TODO(b/239452415): Use equals instead of descEndsWith
            if (taskView.getParent().hasObject(By.descEndsWith(activityName))) {
                task = taskView;
                break;
            }
        }
        mLauncher.assertNotNull(
                "Unable to find a task with " + activityName + " from the task list", task);

        return new OverviewTask(mLauncher, task, this);
    }

    /**
     * Returns a list of all tasks fully visible in the tablet grid overview.
     */
+12 −3
Original line number Diff line number Diff line
@@ -121,8 +121,8 @@ public final class LauncherInstrumentation {
    // Types for launcher containers that the user is interacting with. "Background" is a
    // pseudo-container corresponding to inactive launcher covered by another app.
    public enum ContainerType {
        WORKSPACE, HOME_ALL_APPS, OVERVIEW, WIDGETS, FALLBACK_OVERVIEW, LAUNCHED_APP,
        TASKBAR_ALL_APPS
        WORKSPACE, HOME_ALL_APPS, OVERVIEW, SPLIT_SCREEN_SELECT, WIDGETS, FALLBACK_OVERVIEW,
        LAUNCHED_APP, TASKBAR_ALL_APPS
    }

    public enum NavigationModel {ZERO_BUTTON, THREE_BUTTON}
@@ -744,7 +744,8 @@ public final class LauncherInstrumentation {

                    return waitForLauncherObject(APPS_RES_ID);
                }
                case OVERVIEW: {
                case OVERVIEW:
                case SPLIT_SCREEN_SELECT: {
                    waitUntilLauncherObjectGone(APPS_RES_ID);
                    waitUntilLauncherObjectGone(WORKSPACE_RES_ID);
                    waitUntilLauncherObjectGone(WIDGETS_RES_ID);
@@ -1090,6 +1091,14 @@ public final class LauncherInstrumentation {
        return object;
    }

    @NonNull
    UiObject2 waitForSystemUiObject(BySelector selector) {
        final UiObject2 object = TestHelpers.wait(
                Until.findObject(selector), WAIT_TIME_MS);
        assertNotNull("Can't find a systemui object with selector: " + selector, object);
        return object;
    }

    @NonNull
    UiObject2 waitForNavigationUiObject(String resId) {
        String resPackage = getNavigationButtonResPackage();
Loading