Merge "Removing flinging via UI Automator" into ub-launcher3-qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e1335c2359
@@ -22,6 +22,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.views.RecyclerViewFastScroller;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -171,4 +172,13 @@ public abstract class BaseRecyclerView extends RecyclerView {
|
||||
* <p>Override in each subclass of this base class.
|
||||
*/
|
||||
public void onFastScrollCompleted() {}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(int state) {
|
||||
super.onScrollStateChanged(state);
|
||||
|
||||
if (state == SCROLL_STATE_IDLE) {
|
||||
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -419,13 +419,4 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(int state) {
|
||||
super.onScrollStateChanged(state);
|
||||
|
||||
if (state == SCROLL_STATE_IDLE) {
|
||||
AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.launcher3.tapl;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.BySelector;
|
||||
@@ -31,7 +32,8 @@ import com.android.launcher3.ResourceUtils;
|
||||
* All widgets container.
|
||||
*/
|
||||
public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
private static final int FLING_SPEED = 1500;
|
||||
private static final Rect MARGINS = new Rect(100, 100, 100, 100);
|
||||
private static final int FLING_STEPS = 10;
|
||||
|
||||
Widgets(LauncherInstrumentation launcher) {
|
||||
super(launcher);
|
||||
@@ -46,11 +48,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
"want to fling forward in widgets")) {
|
||||
LauncherInstrumentation.log("Widgets.flingForward enter");
|
||||
final UiObject2 widgetsContainer = verifyActiveContainer();
|
||||
widgetsContainer.setGestureMargins(0, 0, 0,
|
||||
ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE,
|
||||
mLauncher.getResources()) + 1);
|
||||
widgetsContainer.fling(Direction.DOWN,
|
||||
(int) (FLING_SPEED * mLauncher.getDisplayDensity()));
|
||||
mLauncher.scroll(widgetsContainer, Direction.DOWN, 1f, MARGINS, FLING_STEPS);
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung forward")) {
|
||||
verifyActiveContainer();
|
||||
}
|
||||
@@ -66,10 +64,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
"want to fling backwards in widgets")) {
|
||||
LauncherInstrumentation.log("Widgets.flingBackward enter");
|
||||
final UiObject2 widgetsContainer = verifyActiveContainer();
|
||||
widgetsContainer.setGestureMargin(100);
|
||||
widgetsContainer.fling(Direction.UP,
|
||||
(int) (FLING_SPEED * mLauncher.getDisplayDensity()));
|
||||
mLauncher.waitForIdle();
|
||||
mLauncher.scroll(widgetsContainer, Direction.UP, 1f, MARGINS, FLING_STEPS);
|
||||
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung back")) {
|
||||
verifyActiveContainer();
|
||||
}
|
||||
@@ -101,7 +96,7 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer {
|
||||
return new Widget(mLauncher, widget);
|
||||
}
|
||||
if (++i > 40) fail("Too many attempts");
|
||||
widgetsContainer.scroll(Direction.DOWN, 1f);
|
||||
mLauncher.scroll(widgetsContainer, Direction.DOWN, 1f, MARGINS, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.SystemClock;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -40,6 +41,7 @@ public final class Workspace extends Home {
|
||||
private static final float FLING_SPEED =
|
||||
LauncherInstrumentation.isAvd() ? 1500.0F : 3500.0F;
|
||||
private static final int DRAG_DURACTION = 2000;
|
||||
private static final int FLING_STEPS = 10;
|
||||
private final UiObject2 mHotseat;
|
||||
|
||||
Workspace(LauncherInstrumentation launcher) {
|
||||
@@ -180,9 +182,9 @@ public final class Workspace extends Home {
|
||||
*/
|
||||
public void flingForward() {
|
||||
final UiObject2 workspace = verifyActiveContainer();
|
||||
workspace.setGestureMargins(0, 0, mLauncher.getEdgeSensitivityWidth(), 0);
|
||||
workspace.fling(Direction.RIGHT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
|
||||
mLauncher.waitForIdle();
|
||||
mLauncher.scroll(workspace, Direction.RIGHT, 1f,
|
||||
new Rect(0, 0, mLauncher.getEdgeSensitivityWidth(), 0),
|
||||
FLING_STEPS);
|
||||
verifyActiveContainer();
|
||||
}
|
||||
|
||||
@@ -192,9 +194,9 @@ public final class Workspace extends Home {
|
||||
*/
|
||||
public void flingBackward() {
|
||||
final UiObject2 workspace = verifyActiveContainer();
|
||||
workspace.setGestureMargins(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0);
|
||||
workspace.fling(Direction.LEFT, (int) (FLING_SPEED * mLauncher.getDisplayDensity()));
|
||||
mLauncher.waitForIdle();
|
||||
mLauncher.scroll(workspace, Direction.LEFT, 1f,
|
||||
new Rect(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0),
|
||||
FLING_STEPS);
|
||||
verifyActiveContainer();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user