diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-04 20:22:57 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-04-04 20:22:57 +0000 |
commit | 52bad44b2d627ca02796195f6dbfc6b20c1fcbe6 (patch) | |
tree | 9a99edffc19f557c809b74f3bcee59222d278af3 | |
parent | b942b0fe6d49e8e4d88619d3895e389a888d7c14 (diff) | |
parent | 59d26d59e15064e0b5d95fa8d14f7c7cfc8ab2d3 (diff) | |
download | cts-sparse-9883162-L54400000960618573.tar.gz |
Merge "Snap for 9874748 from 945752576027d17000749f33f821a6ec545be989 to android11-tests-release" into android11-tests-releasesparse-9883162-L54400000960618573
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 416621310d5..00034c159e5 100644 --- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java +++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java @@ -865,7 +865,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; @@ -920,8 +921,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()); |