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

Commit a734bd8d authored by vadimt's avatar vadimt
Browse files

Improving TAPL diagnostics (contains changes in Launcher)

Bug: 128531133
Change-Id: Ice1ffecb39cf88afb546ceefdfca21abd879f35d
parent 09b91447
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -33,6 +33,27 @@ public final class TestProtocol {
    public static final int ALL_APPS_STATE_ORDINAL = 5;
    public static final int BACKGROUND_APP_STATE_ORDINAL = 6;

    public static String stateOrdinalToString(int ordinal) {
        switch (ordinal) {
            case NORMAL_STATE_ORDINAL:
                return "Normal";
            case SPRING_LOADED_STATE_ORDINAL:
                return "SpringLoaded";
            case OVERVIEW_STATE_ORDINAL:
                return "Overview";
            case OVERVIEW_PEEK_STATE_ORDINAL:
                return "OverviewPeek";
            case QUICK_SWITCH_STATE_ORDINAL:
                return "QuickSwitch";
            case ALL_APPS_STATE_ORDINAL:
                return "AllApps";
            case BACKGROUND_APP_STATE_ORDINAL:
                return "Background";
            default:
                return null;
        }
    }

    public static final String TEST_INFO_RESPONSE_FIELD = "response";
    public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT =
            "home-to-overview-swipe-height";
+10 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -225,6 +226,12 @@ public final class LauncherInstrumentation {
        }
    }

    private void assertEquals(String message, String expected, String actual) {
        if (!TextUtils.equals(expected, actual)) {
            fail(message + " expected: '" + expected + "' but was: '" + actual + "'");
        }
    }

    void assertNotEquals(String message, int unexpected, int actual) {
        if (unexpected == actual) {
            failEquals(message, actual);
@@ -544,8 +551,9 @@ public final class LauncherInstrumentation {
                event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
                "Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
                        + ", " + endX + ", " + endY);
        assertEquals("Swipe switched launcher to a wrong state",
                expectedState, parcel.getInt(TestProtocol.STATE_FIELD));
        assertEquals("Swipe switched launcher to a wrong state;",
                TestProtocol.stateOrdinalToString(expectedState),
                TestProtocol.stateOrdinalToString(parcel.getInt(TestProtocol.STATE_FIELD)));
    }

    void waitForIdle() {