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

Commit 95f2e958 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix launcher scroll distance for TAPL tests."

parents e36f32ec ee011768
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -74,6 +74,12 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
                response.putParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD, gridTaskRect);
                return response;
            }

            case TestProtocol.REQUEST_GET_OVERVIEW_PAGE_SPACING: {
                response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        mDeviceProfile.overviewPageSpacing);
                return response;
            }
        }

        return super.call(method, arg);
+1 −1
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ 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("TestActivity8")),
                mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity10")),
                        DEFAULT_UI_TIMEOUT));

        // Scroll the task offscreen as it is now first
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public final class TestProtocol {
            "get-focused-task-height-for-tablet";
    public static final String REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET =
            "get-grid-task-size-rect-for-tablet";
    public static final String REQUEST_GET_OVERVIEW_PAGE_SPACING = "get-overview-page-spacing";
    public static final String REQUEST_ENABLE_ROTATION = "enable_rotation";

    public static Long sForcePauseTimeout;
+2 −1
Original line number Diff line number Diff line
@@ -127,7 +127,8 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {

            OverviewTask task = getCurrentTask();
            mLauncher.assertNotNull("current task is null", task);
            mLauncher.scrollLeftByDistance(verifyActiveContainer(), task.getVisibleWidth());
            mLauncher.scrollLeftByDistance(verifyActiveContainer(),
                    task.getVisibleWidth() + mLauncher.getOverviewPageSpacing());

            try (LauncherInstrumentation.Closable c2 =
                         mLauncher.addContextLayer("scrolled task off screen")) {
+8 −5
Original line number Diff line number Diff line
@@ -342,6 +342,11 @@ public final class LauncherInstrumentation {
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD));
    }

    int getOverviewPageSpacing() {
        return getTestInfo(TestProtocol.REQUEST_GET_OVERVIEW_PAGE_SPACING)
                .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    float getExactScreenCenterX() {
        return getRealDisplaySize().x / 2f;
    }
@@ -1323,14 +1328,12 @@ public final class LauncherInstrumentation {
    void scrollLeftByDistance(UiObject2 container, int distance) {
        final Rect containerRect = getVisibleBounds(container);
        final int rightGestureMarginInContainer = getRightGestureMarginInContainer(container);
        final int leftGestureMargin = getTargetInsets().left + getEdgeSensitivityWidth();
        scroll(
                container,
                Direction.LEFT,
                new Rect(
                        0,
                        containerRect.width() - distance - rightGestureMarginInContainer,
                        0,
                        rightGestureMarginInContainer),
                new Rect(leftGestureMargin, 0,
                        containerRect.width() - distance - rightGestureMarginInContainer, 0),
                10,
                true);
    }