Loading tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +9 −5 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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(); Loading Loading @@ -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. Loading @@ -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 Loading tests/tapl/com/android/launcher3/tapl/Workspace.java +13 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -404,6 +405,17 @@ public final class Workspace extends Home { 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(); Loading @@ -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); Loading Loading
tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +9 −5 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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(); Loading Loading @@ -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. Loading @@ -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 Loading
tests/tapl/com/android/launcher3/tapl/Workspace.java +13 −1 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -404,6 +405,17 @@ public final class Workspace extends Home { 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(); Loading @@ -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); Loading