From 7bd93b16393573f15dadc8df39760cee1d3a29dc Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 25 Sep 2019 18:13:23 -0700 Subject: [PATCH] Reducing usage of magic constants in TAPL's widgets Bug: 123904290 Change-Id: I5f158eb06ab5d40825cc975e798296ab06fc1f1f --- tests/tapl/com/android/launcher3/tapl/Widgets.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 7d308afb99..af7d5d7cdc 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -48,7 +48,12 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { "want to fling forward in widgets")) { LauncherInstrumentation.log("Widgets.flingForward enter"); final UiObject2 widgetsContainer = verifyActiveContainer(); - mLauncher.scroll(widgetsContainer, Direction.DOWN, 1f, MARGINS, FLING_STEPS); + final int margin = widgetsContainer.getVisibleBounds().bottom - + mLauncher.getRealDisplaySize().y + + ResourceUtils.getNavbarSize( + ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources()); + mLauncher.scroll( + widgetsContainer, Direction.DOWN, 1f, new Rect(0, 0, 0, margin), FLING_STEPS); try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("flung forward")) { verifyActiveContainer(); }