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

Commit ee011768 authored by Pat Manning's avatar Pat Manning
Browse files

Fix launcher scroll distance for TAPL tests.

Test is passing correctly but for the wrong reasons. If we attempted to use a different distance it would have failed.

Bug: 197630182
Test: manual
Change-Id: Ib275b89c86cdb9f75d40b9d25c8c498098b543b7
parent 3688cdfd
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);
    }