Merge "Tune dragToFolder test so that it works with the new nav bar height" into tm-dev
This commit is contained in:
@@ -48,11 +48,13 @@ import com.android.launcher3.tapl.HomeAppIconMenuItem;
|
|||||||
import com.android.launcher3.tapl.Widgets;
|
import com.android.launcher3.tapl.Widgets;
|
||||||
import com.android.launcher3.tapl.Workspace;
|
import com.android.launcher3.tapl.Workspace;
|
||||||
import com.android.launcher3.util.TestUtil;
|
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.util.rule.ScreenRecordRule.ScreenRecord;
|
||||||
import com.android.launcher3.widget.picker.WidgetsFullSheet;
|
import com.android.launcher3.widget.picker.WidgetsFullSheet;
|
||||||
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
|
import com.android.launcher3.widget.picker.WidgetsRecyclerView;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@@ -66,6 +68,10 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||||||
private static final String DUMMY_APP_NAME = "Aardwolf";
|
private static final String DUMMY_APP_NAME = "Aardwolf";
|
||||||
private static final String MAPS_APP_NAME = "Maps";
|
private static final String MAPS_APP_NAME = "Maps";
|
||||||
private static final String STORE_APP_NAME = "Play Store";
|
private static final String STORE_APP_NAME = "Play Store";
|
||||||
|
private static final String GMAIL_APP_NAME = "Gmail";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public ScreenRecordRule mScreenRecordRule = new ScreenRecordRule();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
@@ -374,28 +380,23 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PortraitLandscape
|
@PortraitLandscape
|
||||||
public void testDragToFolder() throws Exception {
|
@ScreenRecord
|
||||||
final HomeAppIcon playStoreIcon = createShortcutIfNotExist("Play Store", 0, 1);
|
public void testDragToFolder() {
|
||||||
final HomeAppIcon gmailIcon = createShortcutIfNotExist("Gmail", 1, 1);
|
// 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.
|
||||||
|
final HomeAppIcon playStoreIcon = createShortcutIfNotExist(STORE_APP_NAME, 0, 1);
|
||||||
|
final HomeAppIcon gmailIcon = createShortcutInCenterIfNotExist(GMAIL_APP_NAME);
|
||||||
|
|
||||||
FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon);
|
FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon);
|
||||||
|
|
||||||
Folder folder = folderIcon.open();
|
Folder folder = folderIcon.open();
|
||||||
folder.getAppIcon("Play Store");
|
folder.getAppIcon(STORE_APP_NAME);
|
||||||
folder.getAppIcon("Gmail");
|
folder.getAppIcon(GMAIL_APP_NAME);
|
||||||
Workspace workspace = folder.close();
|
Workspace workspace = folder.close();
|
||||||
|
|
||||||
assertNull("Gmail should be moved to a folder.",
|
assertNull(STORE_APP_NAME + " should be moved to a folder.",
|
||||||
workspace.tryGetWorkspaceAppIcon("Gmail"));
|
workspace.tryGetWorkspaceAppIcon(STORE_APP_NAME));
|
||||||
assertNull("Play Store should be moved to a folder.",
|
assertNull(GMAIL_APP_NAME + " should be moved to a folder.",
|
||||||
workspace.tryGetWorkspaceAppIcon("Play Store"));
|
workspace.tryGetWorkspaceAppIcon(GMAIL_APP_NAME));
|
||||||
|
|
||||||
final HomeAppIcon youTubeIcon = createShortcutInCenterIfNotExist("YouTube");
|
|
||||||
|
|
||||||
folderIcon = youTubeIcon.dragToIcon(folderIcon);
|
|
||||||
folder = folderIcon.open();
|
|
||||||
folder.getAppIcon("YouTube");
|
|
||||||
folder.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public abstract class Launchable {
|
|||||||
expectLongClickEvents);
|
expectLongClickEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return dragStartCenter;
|
return dragStartCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1552,11 +1552,11 @@ public final class LauncherInstrumentation {
|
|||||||
|
|
||||||
// vx0: initial speed at the x-dimension, set as twice the avg speed
|
// vx0: initial speed at the x-dimension, set as twice the avg speed
|
||||||
// dx: the constant deceleration at the x-dimension
|
// dx: the constant deceleration at the x-dimension
|
||||||
double vx0 = 2 * (to.x - from.x) / duration;
|
double vx0 = 2.0 * (to.x - from.x) / duration;
|
||||||
double dx = vx0 / duration;
|
double dx = vx0 / duration;
|
||||||
// vy0: initial speed at the y-dimension, set as twice the avg speed
|
// vy0: initial speed at the y-dimension, set as twice the avg speed
|
||||||
// dy: the constant deceleration at the y-dimension
|
// dy: the constant deceleration at the y-dimension
|
||||||
double vy0 = 2 * (to.y - from.y) / duration;
|
double vy0 = 2.0 * (to.y - from.y) / duration;
|
||||||
double dy = vy0 / duration;
|
double dy = vy0 / duration;
|
||||||
|
|
||||||
for (long i = 0; i < steps; ++i) {
|
for (long i = 0; i < steps; ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user