diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-01-13 21:22:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-01-13 21:22:04 +0000 |
commit | 3b9ffd2fb49da98d8b325404cb003d06894a6f6d (patch) | |
tree | 382638413b67dab33093709993e02c7ec201c1ad | |
parent | fa1986cf970c62bff50bfc2cb638bd8643c3adaf (diff) | |
parent | 581dcc5d6571a497020999900c0fdc7c46ff76b7 (diff) | |
download | cts-sparse-9489428-L17300000958413319.tar.gz |
Merge "Snap for 9481218 from 23b6ba697d870998963f061e4eafecbe06f4e775 to android11-tests-release" into android11-tests-releasesparse-9489428-L17300000958413319
-rw-r--r-- | tests/tests/widget/src/android/widget/cts/AbsListViewTest.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java index 3d5156a7459..0ef5578762f 100644 --- a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java +++ b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java @@ -1218,15 +1218,20 @@ public class AbsListViewTest { mActivityRule.getActivity().setContentView(listView); listView.setAdapter(mCountriesAdapter); }); - View row = listView.getChildAt(0); - Rect r = new Rect(); - r.set(0, listView.getHeight() - (row.getHeight() >> 1), - row.getWidth(), listView.getHeight() + (row.getHeight() >> 1)); + // Initialize the test scrolled down by half the height of the first child. + WidgetTestUtils.runOnMainAndDrawSync(mActivityRule, listView, () -> { + listView.scrollListBy(row.getHeight() / 2); + }); listView.resetIsOnScrollChangedCalled(); assertFalse(listView.isOnScrollChangedCalled()); + + // Scroll the first child back completely into view (back to the top of the AbsListView). + Rect r = new Rect(); + r.set(0, 0, row.getWidth(), row.getHeight()); listView.requestChildRectangleOnScreen(row, r, true); + assertTrue(listView.isOnScrollChangedCalled()); } |