diff options
author | AOYAGI Takako <aoyagi.takako@jp.panasonic.com> | 2023-12-04 08:11:31 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-04 08:11:31 +0000 |
commit | 09811188dfd578b958a3f3a30d3c19ff070c7e94 (patch) | |
tree | b1292f66a79520c6019be27410c441687472c0aa | |
parent | af81f7588c744b51d59691dd15ddcbf565d98edc (diff) | |
parent | 33fc6eb2ee20f283b4ee94783614b5f01dab8da6 (diff) | |
download | cts-09811188dfd578b958a3f3a30d3c19ff070c7e94.tar.gz |
DO NOT MERGE: Fix the number of clicks in WindowInsetsBehaviorTests am: a049761f36 am: 33fc6eb2ee
Original change: https://android-review.googlesource.com/c/platform/cts/+/2845558
Change-Id: I86f734ce6e6e5f94ac9530a95e15574c9a5ba199
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java index 89390a6e761..1d60439b36d 100644 --- a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java +++ b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java @@ -92,6 +92,7 @@ public class WindowInsetsBehaviorTests { private static final String ARGUMENT_KEY_FORCE_ENABLE = "force_enable_gesture_navigation"; private static final String NAV_BAR_INTERACTION_MODE_RES_NAME = "config_navBarInteractionMode"; private static final int STEPS = 10; + private static final int INTERVAL_CLICKS = 300; // The minimum value of the system gesture exclusion limit is 200 dp. The value here should be // greater than that, so that we can test if the limit can be changed by DeviceConfig or not. @@ -405,11 +406,10 @@ public class WindowInsetsBehaviorTests { return 2; } - private int clickAllOfHorizontalSamplePoints(Rect viewBoundary, int y, + private int clickAllOfHorizontalSamplePoints(Rect viewBoundary, int y, double interval, Consumer<Point> callback) { final int theLeftestLine = viewBoundary.left + 1; final int theRightestLine = viewBoundary.right - 1; - final float interval = mDensityPerCm; int count = 0; for (int i = theLeftestLine; i < theRightestLine; i += interval) { @@ -430,14 +430,20 @@ public class WindowInsetsBehaviorTests { } private int clickAllOfSamplePoints(Rect viewBoundary, Consumer<Point> callback) { + if (viewBoundary.isEmpty()) { + return 0; + } final int theToppestLine = viewBoundary.top + 1; final int theBottomestLine = viewBoundary.bottom - 1; - final float interval = mDensityPerCm; + final int width = viewBoundary.width(); + final int height = viewBoundary.height(); + final double interval = height / Math.sqrt((double) height / width * INTERVAL_CLICKS); int count = 0; for (int i = theToppestLine; i < theBottomestLine; i += interval) { - count += clickAllOfHorizontalSamplePoints(viewBoundary, i, callback); + count += clickAllOfHorizontalSamplePoints(viewBoundary, i, interval, callback); } - count += clickAllOfHorizontalSamplePoints(viewBoundary, theBottomestLine, callback); + count += clickAllOfHorizontalSamplePoints( + viewBoundary, theBottomestLine, interval, callback); return count; } |