Merge "Add drag icon to folder use case back" into tm-dev am: 517f26ae7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18408996
Change-Id: Ie2f98bde10bd9d7b1443272d611cc7ac840b67d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index a3b05f6..8a97c6b 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -48,7 +48,6 @@
import com.android.launcher3.tapl.Widgets;
import com.android.launcher3.tapl.Workspace;
import com.android.launcher3.util.TestUtil;
-import com.android.launcher3.util.rule.ScreenRecordRule;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.launcher3.widget.picker.WidgetsFullSheet;
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
@@ -70,9 +69,6 @@
private static final String STORE_APP_NAME = "Play Store";
private static final String GMAIL_APP_NAME = "Gmail";
- @Rule
- public ScreenRecordRule mScreenRecordRule = new ScreenRecordRule();
-
@Before
public void setUp() throws Exception {
super.setUp();
@@ -380,7 +376,6 @@
@Test
@PortraitLandscape
- @ScreenRecord
public void testDragToFolder() {
// TODO: add the use case to drag an icon to an existing folder. Currently it either fails
// on tablets or phones due to difference in resolution.
@@ -397,6 +392,15 @@
workspace.tryGetWorkspaceAppIcon(STORE_APP_NAME));
assertNull(GMAIL_APP_NAME + " should be moved to a folder.",
workspace.tryGetWorkspaceAppIcon(GMAIL_APP_NAME));
+
+ final HomeAppIcon mapIcon = createShortcutInCenterIfNotExist(MAPS_APP_NAME);
+ folderIcon = mapIcon.dragToIcon(folderIcon);
+ folder = folderIcon.open();
+ folder.getAppIcon(MAPS_APP_NAME);
+ workspace = folder.close();
+
+ assertNull(MAPS_APP_NAME + " should be moved to a folder.",
+ workspace.tryGetWorkspaceAppIcon(MAPS_APP_NAME));
}
@Test
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index 954af3d..eb7f05b 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -394,6 +394,7 @@
launcher,
launchable,
destSupplier,
+ /* isDecelerating= */ false,
() -> launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT),
/* expectDropEvents= */ null);
}
@@ -404,6 +405,17 @@
Supplier<Point> dest,
Runnable expectLongClickEvents,
@Nullable Runnable expectDropEvents) {
+ dragIconToWorkspace(launcher, launchable, dest, /* isDecelerating */ true,
+ expectLongClickEvents, expectDropEvents);
+ }
+
+ static void dragIconToWorkspace(
+ LauncherInstrumentation launcher,
+ Launchable launchable,
+ Supplier<Point> dest,
+ boolean isDecelerating,
+ Runnable expectLongClickEvents,
+ @Nullable Runnable expectDropEvents) {
try (LauncherInstrumentation.Closable ignored = launcher.addContextLayer(
"want to drag icon to workspace")) {
final long downTime = SystemClock.uptimeMillis();
@@ -430,7 +442,7 @@
// targetDest.x is now between 0 and displayX so we found the target page,
// we just have to put move the icon to the destination and drop it
- launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, true,
+ launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, isDecelerating,
downTime, SystemClock.uptimeMillis(), false,
LauncherInstrumentation.GestureScope.INSIDE);
dropDraggedIcon(launcher, targetDest, downTime, expectDropEvents);