summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAOYAGI Takako <aoyagi.takako@jp.panasonic.com>2023-12-04 07:20:27 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-12-04 07:20:27 +0000
commit33fc6eb2ee20f283b4ee94783614b5f01dab8da6 (patch)
tree27e2fb42625a545d272dfa8047f7ee329f75b774
parent0e3b7ab41389590b01194829b07244d0f14e3766 (diff)
parenta049761f36da8298017264a4941ab135ed56efbc (diff)
downloadcts-33fc6eb2ee20f283b4ee94783614b5f01dab8da6.tar.gz
DO NOT MERGE: Fix the number of clicks in WindowInsetsBehaviorTests am: a049761f36
Original change: https://android-review.googlesource.com/c/platform/cts/+/2845558 Change-Id: I123a7b0a381e69f14fede160c9aa094c00965d5e 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.java16
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;
}