Loading tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java +15 −8 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import java.util.Map; /** Loading Loading @@ -98,7 +99,6 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { /** * Makes sure you can uninstall an app from the Workspace. * @throws Exception */ @Test @PortraitLandscape Loading @@ -116,7 +116,6 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { /** * Makes sure you can uninstall an app from AllApps. * @throws Exception */ @Test @PortraitLandscape Loading Loading @@ -145,15 +144,23 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { sb.append(p).append(", "); } Log.d(ICON_MISSING, "allGridPositions: " + sb); createShortcutIfNotExist(STORE_APP_NAME, gridPositions[0]); createShortcutIfNotExist(MAPS_APP_NAME, gridPositions[1]); installDummyAppAndWaitForUIUpdate(); try { createShortcutIfNotExist(DUMMY_APP_NAME, gridPositions[2]); installDummyAppAndWaitForUIUpdate(); final String[] appNameCandidates = {DUMMY_APP_NAME, MAPS_APP_NAME, STORE_APP_NAME}; // List of test apps trimmed down to the length of grid positions. final String[] appNames = Arrays.copyOfRange( appNameCandidates, 0, Math.min(gridPositions.length, appNameCandidates.length)); for (int i = 0; i < appNames.length; ++i) { createShortcutIfNotExist(appNames[i], gridPositions[i]); } Map<String, Point> initialPositions = mLauncher.getWorkspace().getWorkspaceIconsPositions(); assertThat(initialPositions.keySet()) .containsAtLeast(DUMMY_APP_NAME, MAPS_APP_NAME, STORE_APP_NAME); assertThat(initialPositions.keySet()).containsAtLeastElementsIn(appNames); mLauncher.getWorkspace().getWorkspaceAppIcon(DUMMY_APP_NAME).uninstall(); mLauncher.getWorkspace().verifyWorkspaceAppIconIsGone( Loading tests/src/com/android/launcher3/util/TestUtil.java +15 −7 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.launcher3.config.FeatureFlags.BooleanFlag; import com.android.launcher3.config.FeatureFlags.IntFlag; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.Workspace; import com.android.launcher3.util.rule.TestStabilityRule; import org.junit.Assert; Loading Loading @@ -133,6 +134,12 @@ public class TestUtil { */ public static Point[] getCornersAndCenterPositions(LauncherInstrumentation launcher) { final Point dimensions = launcher.getWorkspace().getIconGridDimensions(); if (TestStabilityRule.isPresubmit()) { // Return only center in presubmit to fit under the presubmit SLO. return new Point[]{ new Point(dimensions.x / 2, dimensions.y / 2) }; } else { return new Point[]{ new Point(0, 1), new Point(0, dimensions.y - 2), Loading @@ -141,6 +148,7 @@ public class TestUtil { new Point(dimensions.x / 2, dimensions.y / 2) }; } } /** * Utility class to override a boolean flag during test. Note that the returned SafeCloseable Loading Loading
tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java +15 −8 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import java.util.Map; /** Loading Loading @@ -98,7 +99,6 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { /** * Makes sure you can uninstall an app from the Workspace. * @throws Exception */ @Test @PortraitLandscape Loading @@ -116,7 +116,6 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { /** * Makes sure you can uninstall an app from AllApps. * @throws Exception */ @Test @PortraitLandscape Loading Loading @@ -145,15 +144,23 @@ public class TaplUninstallRemove extends AbstractLauncherUiTest { sb.append(p).append(", "); } Log.d(ICON_MISSING, "allGridPositions: " + sb); createShortcutIfNotExist(STORE_APP_NAME, gridPositions[0]); createShortcutIfNotExist(MAPS_APP_NAME, gridPositions[1]); installDummyAppAndWaitForUIUpdate(); try { createShortcutIfNotExist(DUMMY_APP_NAME, gridPositions[2]); installDummyAppAndWaitForUIUpdate(); final String[] appNameCandidates = {DUMMY_APP_NAME, MAPS_APP_NAME, STORE_APP_NAME}; // List of test apps trimmed down to the length of grid positions. final String[] appNames = Arrays.copyOfRange( appNameCandidates, 0, Math.min(gridPositions.length, appNameCandidates.length)); for (int i = 0; i < appNames.length; ++i) { createShortcutIfNotExist(appNames[i], gridPositions[i]); } Map<String, Point> initialPositions = mLauncher.getWorkspace().getWorkspaceIconsPositions(); assertThat(initialPositions.keySet()) .containsAtLeast(DUMMY_APP_NAME, MAPS_APP_NAME, STORE_APP_NAME); assertThat(initialPositions.keySet()).containsAtLeastElementsIn(appNames); mLauncher.getWorkspace().getWorkspaceAppIcon(DUMMY_APP_NAME).uninstall(); mLauncher.getWorkspace().verifyWorkspaceAppIconIsGone( Loading
tests/src/com/android/launcher3/util/TestUtil.java +15 −7 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.launcher3.config.FeatureFlags.BooleanFlag; import com.android.launcher3.config.FeatureFlags.IntFlag; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.tapl.Workspace; import com.android.launcher3.util.rule.TestStabilityRule; import org.junit.Assert; Loading Loading @@ -133,6 +134,12 @@ public class TestUtil { */ public static Point[] getCornersAndCenterPositions(LauncherInstrumentation launcher) { final Point dimensions = launcher.getWorkspace().getIconGridDimensions(); if (TestStabilityRule.isPresubmit()) { // Return only center in presubmit to fit under the presubmit SLO. return new Point[]{ new Point(dimensions.x / 2, dimensions.y / 2) }; } else { return new Point[]{ new Point(0, 1), new Point(0, dimensions.y - 2), Loading @@ -141,6 +148,7 @@ public class TestUtil { new Point(dimensions.x / 2, dimensions.y / 2) }; } } /** * Utility class to override a boolean flag during test. Note that the returned SafeCloseable Loading