diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index a3b05f6868..8a97c6ba5b 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.HomeAppIconMenuItem; 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 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { 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 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @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 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { 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 954af3d61d..eb7f05bd1e 100644 --- a/tests/tapl/com/android/launcher3/tapl/Workspace.java +++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java @@ -394,6 +394,7 @@ public final class Workspace extends Home { launcher, launchable, destSupplier, + /* isDecelerating= */ false, () -> launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LONG_CLICK_EVENT), /* expectDropEvents= */ null); } @@ -404,6 +405,17 @@ public final class Workspace extends Home { Supplier dest, Runnable expectLongClickEvents, @Nullable Runnable expectDropEvents) { + dragIconToWorkspace(launcher, launchable, dest, /* isDecelerating */ true, + expectLongClickEvents, expectDropEvents); + } + + static void dragIconToWorkspace( + LauncherInstrumentation launcher, + Launchable launchable, + Supplier 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 @@ public final class Workspace extends Home { // 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);