diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-04-03 20:57:08 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-04-03 20:57:08 +0000 |
commit | 7c370af5005c444dfa41f172fa0b76cd7f0c2da4 (patch) | |
tree | affe60af386b6d84e75724bd1e5379c5aa3d6784 | |
parent | c8b2a6745a6912870ef0a60e38df1c07557fa318 (diff) | |
parent | 5656b7411c60c77d5c734c6962e6d2c190530c8d (diff) | |
download | cts-7c370af5005c444dfa41f172fa0b76cd7f0c2da4.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
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()); |