From 53ae5d85a6cb056ffd191e6b382ebed3e2dd95c2 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Wed, 24 Nov 2021 08:54:25 -0800 Subject: [PATCH] Tapl Widgets: Don't use container width as gesture margin The test used margin that was equal to the width of the container when injecting a backward swipe. This means the swipe was injected at an x value of 0 in the View's local coordinates. When injecting such events into the system, the coordinates will undergo several transformations, at which point floating point precision errors could accumulate. This could result in the event being dispatched outside the boundary of the view. Change the injection margin so that the swipe is injected in the middle of the View instead of at its edge. Bug: 201777251 Bug: 207146693 Test: atest TaplTestsLauncher3 Change-Id: I4082c2845aef033a6fbe41070061866d6048e21d --- tests/tapl/com/android/launcher3/tapl/Widgets.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 6e7264ac0b..0bac2ca258 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -77,7 +77,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { mLauncher.scroll( widgetsContainer, Direction.UP, - new Rect(0, 0, mLauncher.getVisibleBounds(widgetsContainer).width(), 0), + new Rect(0, 0, mLauncher.getRightGestureMarginInContainer(widgetsContainer) + 1, + 0), FLING_STEPS, false); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung back")) { verifyActiveContainer();