Loading src/com/android/launcher3/testing/TestInformationHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.util.ResourceBasedOverride; import com.android.launcher3.widget.WidgetsFullSheet; import java.util.concurrent.ExecutionException; import java.util.function.Function; Loading Loading @@ -92,6 +93,11 @@ public class TestInformationHandler implements ResourceBasedOverride { l -> l.getAppsView().getActiveRecyclerView().getCurrentScrollY()); } case TestProtocol.REQUEST_WIDGETS_SCROLL_Y: { return getLauncherUIProperty(Bundle::putInt, l -> WidgetsFullSheet.getWidgetsView(l).getCurrentScrollY()); } case TestProtocol.REQUEST_WINDOW_INSETS: { return getUIProperty(Bundle::putParcelable, a -> { WindowInsets insets = a.getWindow() Loading src/com/android/launcher3/testing/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ public final class TestProtocol { public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list"; public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags"; public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y"; public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y"; public static final String REQUEST_WINDOW_INSETS = "window-insets"; public static final String REQUEST_PID = "pid"; public static final String REQUEST_TOTAL_PSS_KB = "total_pss"; Loading tests/tapl/com/android/launcher3/tapl/Widgets.java +13 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; import com.android.launcher3.tapl.LauncherInstrumentation.GestureScope; import com.android.launcher3.testing.TestProtocol; import java.util.Collection; Loading Loading @@ -90,6 +91,12 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { return LauncherInstrumentation.ContainerType.WIDGETS; } private int getWidgetsScroll() { return mLauncher.getTestInfo( TestProtocol.REQUEST_WIDGETS_SCROLL_Y) .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); } public Widget getWidget(String labelText) { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer( Loading Loading @@ -136,7 +143,13 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { } mLauncher.assertTrue("Too many attempts", ++i <= 40); final int scroll = getWidgetsScroll(); mLauncher.scrollToLastVisibleRow(widgetsContainer, cells, 0); final int newScroll = getWidgetsScroll(); mLauncher.assertTrue( "Scrolled in a wrong direction in Widgets: from " + scroll + " to " + newScroll, newScroll >= scroll); mLauncher.assertTrue("Unable to scroll to the widget", newScroll != scroll); } } } Loading Loading
src/com/android/launcher3/testing/TestInformationHandler.java +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.util.ResourceBasedOverride; import com.android.launcher3.widget.WidgetsFullSheet; import java.util.concurrent.ExecutionException; import java.util.function.Function; Loading Loading @@ -92,6 +93,11 @@ public class TestInformationHandler implements ResourceBasedOverride { l -> l.getAppsView().getActiveRecyclerView().getCurrentScrollY()); } case TestProtocol.REQUEST_WIDGETS_SCROLL_Y: { return getLauncherUIProperty(Bundle::putInt, l -> WidgetsFullSheet.getWidgetsView(l).getCurrentScrollY()); } case TestProtocol.REQUEST_WINDOW_INSETS: { return getUIProperty(Bundle::putParcelable, a -> { WindowInsets insets = a.getWindow() Loading
src/com/android/launcher3/testing/TestProtocol.java +1 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ public final class TestProtocol { public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list"; public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags"; public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y"; public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y"; public static final String REQUEST_WINDOW_INSETS = "window-insets"; public static final String REQUEST_PID = "pid"; public static final String REQUEST_TOTAL_PSS_KB = "total_pss"; Loading
tests/tapl/com/android/launcher3/tapl/Widgets.java +13 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; import com.android.launcher3.tapl.LauncherInstrumentation.GestureScope; import com.android.launcher3.testing.TestProtocol; import java.util.Collection; Loading Loading @@ -90,6 +91,12 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { return LauncherInstrumentation.ContainerType.WIDGETS; } private int getWidgetsScroll() { return mLauncher.getTestInfo( TestProtocol.REQUEST_WIDGETS_SCROLL_Y) .getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); } public Widget getWidget(String labelText) { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer( Loading Loading @@ -136,7 +143,13 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { } mLauncher.assertTrue("Too many attempts", ++i <= 40); final int scroll = getWidgetsScroll(); mLauncher.scrollToLastVisibleRow(widgetsContainer, cells, 0); final int newScroll = getWidgetsScroll(); mLauncher.assertTrue( "Scrolled in a wrong direction in Widgets: from " + scroll + " to " + newScroll, newScroll >= scroll); mLauncher.assertTrue("Unable to scroll to the widget", newScroll != scroll); } } } Loading