Merge "Enable pressback tests" into tm-dev am: edb576fba8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/17501930 Change-Id: I6058ebc21dfe6c1ae22b0c3fe5fe90a04ae312a8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -32,7 +32,6 @@ import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.tapl.HomeAllApps;
|
||||
import com.android.launcher3.tapl.LaunchedAppState;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
|
||||
import com.android.launcher3.tapl.Overview;
|
||||
@@ -45,7 +44,6 @@ import com.android.quickstep.views.RecentsView;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -295,26 +293,16 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
getAndAssertLaunchedApp();
|
||||
}
|
||||
|
||||
// TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
|
||||
// after the bug resolved.
|
||||
@Ignore("b/205027405")
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
@ScreenRecord
|
||||
@NavigationModeSwitch
|
||||
public void testPressBack() throws Exception {
|
||||
mLauncher.getWorkspace().switchToAllApps();
|
||||
mLauncher.pressBack();
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
try {
|
||||
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
|
||||
} finally {
|
||||
allApps.unfreeze();
|
||||
}
|
||||
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
|
||||
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
|
||||
mLauncher.pressBack();
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Point;
|
||||
|
||||
import androidx.test.filters.LargeTest;
|
||||
@@ -50,7 +51,6 @@ import com.android.launcher3.widget.picker.WidgetsFullSheet;
|
||||
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -391,7 +391,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||
folder.close();
|
||||
}
|
||||
|
||||
@Ignore("b/205027405")
|
||||
@Test
|
||||
@PortraitLandscape
|
||||
public void testPressBack() throws Exception {
|
||||
@@ -400,14 +399,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
try {
|
||||
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
|
||||
} finally {
|
||||
allApps.unfreeze();
|
||||
}
|
||||
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
|
||||
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
|
||||
mLauncher.pressBack();
|
||||
mLauncher.getWorkspace();
|
||||
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
|
||||
|
||||
@@ -113,6 +113,7 @@ public final class LauncherInstrumentation {
|
||||
|
||||
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
|
||||
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
|
||||
static final Pattern EVENT_TOUCH_CANCEL_TIS = getTouchEventPatternTIS("ACTION_CANCEL");
|
||||
|
||||
static final Pattern EVENT_KEY_BACK_DOWN = getKeyEventPattern("ACTION_DOWN", "KEYCODE_BACK");
|
||||
static final Pattern EVENT_KEY_BACK_UP = getKeyEventPattern("ACTION_UP", "KEYCODE_BACK");
|
||||
@@ -135,6 +136,8 @@ public final class LauncherInstrumentation {
|
||||
public enum GestureScope {
|
||||
OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE,
|
||||
INSIDE_TO_OUTSIDE_WITHOUT_PILFER,
|
||||
INSIDE_TO_OUTSIDE_WITH_KEYCODE, // For gestures that will trigger a keycode from TIS.
|
||||
OUTSIDE_WITH_KEYCODE,
|
||||
}
|
||||
|
||||
// Base class for launcher containers.
|
||||
@@ -967,9 +970,11 @@ public final class LauncherInstrumentation {
|
||||
if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
|
||||
final Point displaySize = getRealDisplaySize();
|
||||
final GestureScope gestureScope =
|
||||
launcherVisible ? GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER
|
||||
: GestureScope.OUTSIDE_WITHOUT_PILFER;
|
||||
linearGesture(0, displaySize.y / 2, displaySize.x / 2, displaySize.y / 2,
|
||||
launcherVisible ? GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
|
||||
: GestureScope.OUTSIDE_WITH_KEYCODE;
|
||||
// TODO(b/225505986): change startY and endY back to displaySize.y / 2 once the
|
||||
// issue is solved.
|
||||
linearGesture(0, displaySize.y / 4, displaySize.x / 2, displaySize.y / 4,
|
||||
10, false, gestureScope);
|
||||
} else {
|
||||
waitForNavigationUiObject("back").click();
|
||||
@@ -1505,7 +1510,8 @@ public final class LauncherInstrumentation {
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) {
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE) {
|
||||
expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN);
|
||||
}
|
||||
if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) {
|
||||
@@ -1520,14 +1526,18 @@ public final class LauncherInstrumentation {
|
||||
expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS);
|
||||
}
|
||||
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) {
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
|
||||
&& gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE) {
|
||||
expectEvent(TestProtocol.SEQUENCE_MAIN,
|
||||
gestureScope == GestureScope.INSIDE
|
||||
|| gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER
|
||||
? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL);
|
||||
}
|
||||
if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) {
|
||||
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
|
||||
expectEvent(TestProtocol.SEQUENCE_TIS,
|
||||
gestureScope == GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
|
||||
|| gestureScope == GestureScope.OUTSIDE_WITH_KEYCODE
|
||||
? EVENT_TOUCH_CANCEL_TIS : EVENT_TOUCH_UP_TIS);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user