Add drag icon to folder use case back
Test: presubmit Fixes: 232417717 Change-Id: Idca54eb8b1fec10e8c9d7e5cb338e179b733850b
This commit is contained in:
parent
160b18ab57
commit
3438c92334
|
@ -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
|
||||
|
|
|
@ -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<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 @@ 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…
Reference in New Issue