summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-03 21:11:55 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-03 21:11:55 +0000
commit6d241ea9e73eb6d021797533d52f8dddfd6cad77 (patch)
tree8ab20230bb1fe9779183e99483063117a1efe741
parent9183fe27edf8b6d7649283304ca877ce1eb66831 (diff)
parent7c370af5005c444dfa41f172fa0b76cd7f0c2da4 (diff)
downloadcts-6d241ea9e73eb6d021797533d52f8dddfd6cad77.tar.gz
Merge "Merge "Allow Accessibility CTS to hover on the button within the touch delegate's bound, hover outside of the button on low pixel density devices." into android11-tests-dev am: 9457525760" into android12-tests-dev am: 7c370af500
Original change: https://android-review.googlesource.com/c/platform/cts/+/2510296 Change-Id: I45befd3558ea89c274085c5d93326fbdbc147fca Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--tests/accessibilityservice/res/values/dimens.xml21
-rw-r--r--tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java6
-rw-r--r--tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java3
3 files changed, 27 insertions, 3 deletions
diff --git a/tests/accessibilityservice/res/values/dimens.xml b/tests/accessibilityservice/res/values/dimens.xml
new file mode 100644
index 00000000000..a50549c55ed
--- /dev/null
+++ b/tests/accessibilityservice/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+ <dimen name="button_touchable_width_increment_amount">48dp</dimen>
+</resources> \ No newline at end of file
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
index 1b003e3cdbe..0621ac54d72 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
@@ -870,7 +870,8 @@ public class AccessibilityEndToEndTest {
final Button buttonWithTooltip = mActivity.findViewById(R.id.buttonWithTooltip);
final int[] buttonWithTooltipLocation = new int[2];
buttonWithTooltip.getLocationOnScreen(buttonWithTooltipLocation);
- final int touchableSize = 48;
+ final int touchableSize = resources.getDimensionPixelSize(
+ R.dimen.button_touchable_width_increment_amount);
final int hoverRight = buttonWithTooltipLocation[0] + touchableSize / 2;
final int hoverLeft = buttonLocation[0] + button.getWidth() + touchableSize / 2;
final int hoverMiddle = (hoverLeft + hoverRight) / 2;
@@ -925,8 +926,9 @@ public class AccessibilityEndToEndTest {
throws Throwable {
mActivity.waitForEnterAnimationComplete();
- final int touchableSize = 48;
final Resources resources = sInstrumentation.getTargetContext().getResources();
+ final int touchableSize = resources.getDimensionPixelSize(
+ R.dimen.button_touchable_width_increment_amount);
final String targetResourceName = resources.getResourceName(R.id.buttonDelegated);
final View textView = mActivity.findViewById(R.id.delegateText);
final Button target = mActivity.findViewById(R.id.buttonDelegated);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java
index 0e16b790e8c..7f2b95d48d3 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java
@@ -74,7 +74,8 @@ public class AccessibilityEndToEndActivity extends AccessibilityTestActivity {
ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(listAdapter);
- final int touchableSize = 48;
+ final int touchableSize = getResources().getDimensionPixelSize(
+ R.dimen.button_touchable_width_increment_amount);
Button button = findViewById(R.id.button);
Function<View, Rect> withTouchableAtRight = (v) -> new Rect(
v.getLeft(), 0, v.getRight() + touchableSize, v.getHeight());