Unifying constant app names used in Tests
Bug: 298234173
Test: No-op changes, all test should pass
Change-Id: I3cd4854b150d827393bff6eada7aa9a9201dadaa
diff --git a/tests/Android.bp b/tests/Android.bp
index da447b3..89d62e6 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -53,6 +53,7 @@
"src/com/android/launcher3/ui/widget/TaplWidgetPickerTest.java",
"src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java",
"src/com/android/launcher3/util/LauncherLayoutBuilder.java",
+ "src/com/android/launcher3/util/TestConstants.java",
"src/com/android/launcher3/util/TestUtil.java",
"src/com/android/launcher3/util/Wait.java",
"src/com/android/launcher3/util/WidgetUtils.java",
diff --git a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
index 85cf52e..0f5d85b 100644
--- a/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
+++ b/tests/src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java
@@ -15,7 +15,7 @@
*/
package com.android.launcher3.appiconmenu;
-import static com.android.launcher3.ui.TaplTestsLauncher3.APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
import static org.junit.Assert.assertEquals;
@@ -64,7 +64,7 @@
final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
- final AppIconMenu menu = allApps.getAppIcon(APP_NAME).openDeepShortcutMenu();
+ final AppIconMenu menu = allApps.getAppIcon(TEST_APP_NAME).openDeepShortcutMenu();
executeOnLauncher(
launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu",
@@ -89,9 +89,9 @@
final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
+ allApps.getAppIcon(TEST_APP_NAME).dragToWorkspace(false, false);
final AppIconMenu menu = mLauncher.getWorkspace().getWorkspaceAppIcon(
- APP_NAME).openDeepShortcutMenu();
+ TEST_APP_NAME).openDeepShortcutMenu();
executeOnLauncher(
launcher -> assertTrue("Launcher internal state didn't switch to Showing Menu",
diff --git a/tests/src/com/android/launcher3/dragging/TaplDragTest.java b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
index c652b98..7ec7826 100644
--- a/tests/src/com/android/launcher3/dragging/TaplDragTest.java
+++ b/tests/src/com/android/launcher3/dragging/TaplDragTest.java
@@ -15,10 +15,10 @@
*/
package com.android.launcher3.dragging;
-import static com.android.launcher3.ui.TaplTestsLauncher3.APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.GMAIL_APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.MAPS_APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.STORE_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.STORE_APP_NAME;
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
import static org.junit.Assert.assertEquals;
@@ -118,7 +118,7 @@
allApps.freeze();
try {
final HomeAppIconMenuItem menuItem = allApps
- .getAppIcon(APP_NAME)
+ .getAppIcon(TEST_APP_NAME)
.openDeepShortcutMenu()
.getMenuItem(0);
final String actualShortcutName = menuItem.getText();
@@ -147,7 +147,7 @@
final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
- allApps.getAppIcon(APP_NAME)
+ allApps.getAppIcon(TEST_APP_NAME)
.openDeepShortcutMenu()
.getMenuItem(0)
.dragToWorkspace(target.x, target.y);
@@ -194,8 +194,8 @@
final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
- mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
+ allApps.getAppIcon(TEST_APP_NAME).dragToWorkspace(false, false);
+ mLauncher.getWorkspace().getWorkspaceAppIcon(TEST_APP_NAME).launch(getAppPackageName());
} finally {
allApps.unfreeze();
}
@@ -222,7 +222,7 @@
final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
- allApps.getAppIcon(APP_NAME).dragToWorkspace(target.x, target.y);
+ allApps.getAppIcon(TEST_APP_NAME).dragToWorkspace(target.x, target.y);
} finally {
allApps.unfreeze();
}
@@ -235,7 +235,7 @@
}
// test to move a shortcut to other cell.
- final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(APP_NAME);
+ final HomeAppIcon launcherTestAppIcon = createShortcutInCenterIfNotExist(TEST_APP_NAME);
for (Point target : targets) {
startTime = SystemClock.uptimeMillis();
launcherTestAppIcon.dragToWorkspace(target.x, target.y);
diff --git a/tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java b/tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java
index 5b87a05..7027e85 100644
--- a/tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java
+++ b/tests/src/com/android/launcher3/dragging/TaplUninstallRemove.java
@@ -16,11 +16,12 @@
package com.android.launcher3.dragging;
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
-import static com.android.launcher3.ui.TaplTestsLauncher3.APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.DUMMY_APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.MAPS_APP_NAME;
-import static com.android.launcher3.ui.TaplTestsLauncher3.STORE_APP_NAME;
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
+import static com.android.launcher3.util.TestConstants.AppNames.DUMMY_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.STORE_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
import static com.google.common.truth.Truth.assertThat;
@@ -62,7 +63,7 @@
@Test
@PortraitLandscape
public void testDeleteFromWorkspace() {
- for (String appName : new String[]{"Gmail", "Play Store", APP_NAME}) {
+ for (String appName : new String[]{GMAIL_APP_NAME, STORE_APP_NAME, TEST_APP_NAME}) {
final HomeAppIcon homeAppIcon = createShortcutInCenterIfNotExist(appName);
Workspace workspace = mLauncher.getWorkspace().deleteAppIcon(homeAppIcon);
workspace.verifyWorkspaceAppIconIsGone(
@@ -174,9 +175,9 @@
mLauncher.getWorkspace()
.deleteAppIcon(mLauncher.getWorkspace().getHotseatAppIcon(0))
.switchToAllApps()
- .getAppIcon(APP_NAME)
+ .getAppIcon(TEST_APP_NAME)
.dragToHotseat(0);
mLauncher.getWorkspace().deleteAppIcon(
- mLauncher.getWorkspace().getHotseatAppIcon(APP_NAME));
+ mLauncher.getWorkspace().getHotseatAppIcon(TEST_APP_NAME));
}
}
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 799ef5b..f2cbd92 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -23,7 +23,6 @@
import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import org.junit.Before;
import org.junit.Test;
@@ -32,11 +31,6 @@
@LargeTest
@RunWith(AndroidJUnit4.class)
public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
- public static final String APP_NAME = "LauncherTestApp";
- public static final String DUMMY_APP_NAME = "Aardwolf";
- public static final String MAPS_APP_NAME = "Maps";
- public static final String STORE_APP_NAME = "Play Store";
- public static final String GMAIL_APP_NAME = "Gmail";
@Before
public void setUp() throws Exception {
diff --git a/tests/src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java b/tests/src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java
index d8ae99c..d776f21 100644
--- a/tests/src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java
+++ b/tests/src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java
@@ -16,6 +16,7 @@
package com.android.launcher3.ui.workspace;
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
+import static com.android.launcher3.util.TestConstants.AppNames.CHROME_APP_NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -85,7 +86,8 @@
isWorkspaceScrollable(launcher)));
assertEquals("Initial workspace doesn't have the correct page", workspace.pagesPerScreen(),
workspace.getPageCount());
- workspace.verifyWorkspaceAppIconIsGone("Chrome app was found on empty workspace", "Chrome");
+ workspace.verifyWorkspaceAppIconIsGone("Chrome app was found on empty workspace",
+ CHROME_APP_NAME);
workspace.ensureWorkspaceIsScrollable();
executeOnLauncher(
@@ -96,7 +98,7 @@
launcher -> assertTrue("ensureScrollable didn't make workspace scrollable",
isWorkspaceScrollable(launcher)));
assertNotNull("ensureScrollable didn't add Chrome app",
- workspace.getWorkspaceAppIcon("Chrome"));
+ workspace.getWorkspaceAppIcon(CHROME_APP_NAME));
// Test flinging workspace.
workspace.flingBackward();
@@ -112,7 +114,7 @@
assertTrue("Launcher internal state is not Home", isInState(() -> LauncherState.NORMAL));
// Test starting a workspace app.
- final HomeAppIcon app = workspace.getWorkspaceAppIcon("Chrome");
+ final HomeAppIcon app = workspace.getWorkspaceAppIcon(CHROME_APP_NAME);
assertNotNull("No Chrome app in workspace", app);
}
diff --git a/tests/src/com/android/launcher3/ui/workspace/ThemeIconsTest.java b/tests/src/com/android/launcher3/ui/workspace/ThemeIconsTest.java
index 8e5e9cc..34c7707 100644
--- a/tests/src/com/android/launcher3/ui/workspace/ThemeIconsTest.java
+++ b/tests/src/com/android/launcher3/ui/workspace/ThemeIconsTest.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.ui.workspace;
+import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -51,7 +53,6 @@
public class ThemeIconsTest extends AbstractLauncherUiTest {
private static final String APP_NAME = "IconThemedActivity";
- private static final String SHORTCUT_APP_NAME = "LauncherTestApp";
private static final String SHORTCUT_NAME = "Shortcut 1";
@Test
@@ -81,7 +82,7 @@
allApps.freeze();
try {
- HomeAppIcon icon = allApps.getAppIcon(SHORTCUT_APP_NAME);
+ HomeAppIcon icon = allApps.getAppIcon(TEST_APP_NAME);
HomeAppIconMenuItem shortcutItem =
(HomeAppIconMenuItem) icon.openDeepShortcutMenu().getMenuItem(SHORTCUT_NAME);
shortcutItem.dragToWorkspace(false, false);
@@ -118,7 +119,7 @@
allApps.freeze();
try {
- HomeAppIcon icon = allApps.getAppIcon(SHORTCUT_APP_NAME);
+ HomeAppIcon icon = allApps.getAppIcon(TEST_APP_NAME);
HomeAppIconMenuItem shortcutItem =
(HomeAppIconMenuItem) icon.openDeepShortcutMenu().getMenuItem(SHORTCUT_NAME);
shortcutItem.dragToWorkspace(false, false);
diff --git a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
index 62a8179..36b4654 100644
--- a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
+++ b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
@@ -16,6 +16,11 @@
package com.android.launcher3.ui.workspace;
+import static com.android.launcher3.util.TestConstants.AppNames.CHROME_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.MESSAGES_APP_NAME;
+import static com.android.launcher3.util.TestConstants.AppNames.STORE_APP_NAME;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -76,7 +81,7 @@
executeOnLauncher(launcher -> {
launcher.enableHotseatEdu(false);
assertPagesExist(launcher, 0, 1);
- assertItemsOnPage(launcher, 0, "Play Store", "Maps");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME, MAPS_APP_NAME);
assertPageEmpty(launcher, 1);
});
}
@@ -94,12 +99,12 @@
public void testDragIconToRightPanel() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 1);
+ workspace.dragIcon(workspace.getHotseatAppIcon(CHROME_APP_NAME), 1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
- assertItemsOnPage(launcher, 0, "Maps", "Play Store");
- assertItemsOnPage(launcher, 1, "Chrome");
+ assertItemsOnPage(launcher, 0, MAPS_APP_NAME, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 1, CHROME_APP_NAME);
});
}
@@ -108,52 +113,52 @@
public void testSinglePageDragIconWhenMultiplePageScrollingIsPossible() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 2);
+ workspace.dragIcon(workspace.getHotseatAppIcon(CHROME_APP_NAME), 2);
workspace.flingBackward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Chrome");
- assertItemsOnPage(launcher, 3, "Maps");
+ assertItemsOnPage(launcher, 2, CHROME_APP_NAME);
+ assertItemsOnPage(launcher, 3, MAPS_APP_NAME);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Chrome");
+ assertItemsOnPage(launcher, 2, CHROME_APP_NAME);
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
- assertItemsOnPage(launcher, 5, "Maps");
+ assertItemsOnPage(launcher, 5, MAPS_APP_NAME);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), -1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Chrome");
- assertItemsOnPage(launcher, 3, "Maps");
+ assertItemsOnPage(launcher, 2, CHROME_APP_NAME);
+ assertItemsOnPage(launcher, 3, MAPS_APP_NAME);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), -1);
workspace.flingForward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Chrome"), -2);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(CHROME_APP_NAME), -2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
- assertItemsOnPage(launcher, 0, "Chrome", "Play Store");
- assertItemsOnPage(launcher, 1, "Maps");
+ assertItemsOnPage(launcher, 0, CHROME_APP_NAME, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 1, MAPS_APP_NAME);
});
}
@@ -162,13 +167,13 @@
public void testDragIconToPage2() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Maps");
+ assertItemsOnPage(launcher, 2, MAPS_APP_NAME);
assertPageEmpty(launcher, 3);
});
}
@@ -179,14 +184,14 @@
Workspace workspace = mLauncher.getWorkspace();
// b/299522368 sometimes the phone app is not present in the hotseat.
- workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 3);
+ workspace.dragIcon(workspace.getHotseatAppIcon(CHROME_APP_NAME), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store", "Maps");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME, MAPS_APP_NAME);
assertPageEmpty(launcher, 1);
assertPageEmpty(launcher, 2);
- assertItemsOnPage(launcher, 3, "Chrome");
+ assertItemsOnPage(launcher, 3, CHROME_APP_NAME);
});
}
@@ -195,44 +200,44 @@
public void testMultiplePageDragIcon() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getHotseatAppIcon("Messages"), 2);
+ workspace.dragIcon(workspace.getHotseatAppIcon(MESSAGES_APP_NAME), 2);
workspace.flingBackward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 5);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 5);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Messages");
+ assertItemsOnPage(launcher, 2, MESSAGES_APP_NAME);
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
- assertItemsOnPage(launcher, 5, "Maps");
+ assertItemsOnPage(launcher, 5, MAPS_APP_NAME);
});
workspace.flingBackward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Messages"), 4);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MESSAGES_APP_NAME), 4);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5, 6, 7);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
assertPageEmpty(launcher, 4);
- assertItemsOnPage(launcher, 5, "Maps");
- assertItemsOnPage(launcher, 6, "Messages");
+ assertItemsOnPage(launcher, 5, MAPS_APP_NAME);
+ assertItemsOnPage(launcher, 6, MESSAGES_APP_NAME);
assertPageEmpty(launcher, 7);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Messages"), -3);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MESSAGES_APP_NAME), -3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5);
- assertItemsOnPage(launcher, 0, "Play Store");
- assertItemsOnPage(launcher, 1, "Messages");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 1, MESSAGES_APP_NAME);
assertPageEmpty(launcher, 4);
- assertItemsOnPage(launcher, 5, "Maps");
+ assertItemsOnPage(launcher, 5, MAPS_APP_NAME);
});
}
@@ -241,38 +246,38 @@
public void testEmptyPageDoesNotGetRemovedIfPagePairIsNotEmpty() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 3);
- workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 0);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 3);
+ workspace.dragIcon(workspace.getHotseatAppIcon(CHROME_APP_NAME), 0);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Chrome");
- assertItemsOnPage(launcher, 3, "Maps");
+ assertItemsOnPage(launcher, 2, CHROME_APP_NAME);
+ assertItemsOnPage(launcher, 3, MAPS_APP_NAME);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), -1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), -1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
- assertItemsOnPage(launcher, 1, "Maps");
- assertItemsOnPage(launcher, 2, "Chrome");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 1, MAPS_APP_NAME);
+ assertItemsOnPage(launcher, 2, CHROME_APP_NAME);
assertPageEmpty(launcher, 3);
});
// Move Chrome to the right panel as well, to make sure pages are not deleted whichever
// page is the empty one
workspace.flingForward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Chrome"), 1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(CHROME_APP_NAME), 1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Play Store");
- assertItemsOnPage(launcher, 1, "Maps");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 1, MAPS_APP_NAME);
assertPageEmpty(launcher, 2);
- assertItemsOnPage(launcher, 3, "Chrome");
+ assertItemsOnPage(launcher, 3, CHROME_APP_NAME);
});
}
@@ -281,25 +286,25 @@
public void testEmptyPagesGetRemovedIfBothPagesAreEmpty() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Play Store"), 2);
- workspace.dragIcon(workspace.getHotseatAppIcon("Chrome"), 1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(STORE_APP_NAME), 2);
+ workspace.dragIcon(workspace.getHotseatAppIcon(CHROME_APP_NAME), 1);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3);
- assertItemsOnPage(launcher, 0, "Maps");
+ assertItemsOnPage(launcher, 0, MAPS_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Play Store");
- assertItemsOnPage(launcher, 3, "Chrome");
+ assertItemsOnPage(launcher, 2, STORE_APP_NAME);
+ assertItemsOnPage(launcher, 3, CHROME_APP_NAME);
});
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Chrome"), -1);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(CHROME_APP_NAME), -1);
workspace.flingForward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Play Store"), -2);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(STORE_APP_NAME), -2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1);
- assertItemsOnPage(launcher, 0, "Play Store", "Maps");
- assertItemsOnPage(launcher, 1, "Chrome");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME, MAPS_APP_NAME);
+ assertItemsOnPage(launcher, 1, CHROME_APP_NAME);
});
}
@@ -308,28 +313,28 @@
public void testMiddleEmptyPagesGetRemoved() {
Workspace workspace = mLauncher.getWorkspace();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
- workspace.dragIcon(workspace.getHotseatAppIcon("Messages"), 3);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 2);
+ workspace.dragIcon(workspace.getHotseatAppIcon(MESSAGES_APP_NAME), 3);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 2, 3, 4, 5);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 2, "Maps");
+ assertItemsOnPage(launcher, 2, MAPS_APP_NAME);
assertPageEmpty(launcher, 3);
assertPageEmpty(launcher, 4);
- assertItemsOnPage(launcher, 5, "Messages");
+ assertItemsOnPage(launcher, 5, MESSAGES_APP_NAME);
});
workspace.flingBackward();
- workspace.dragIcon(workspace.getWorkspaceAppIcon("Maps"), 2);
+ workspace.dragIcon(workspace.getWorkspaceAppIcon(MAPS_APP_NAME), 2);
executeOnLauncher(launcher -> {
assertPagesExist(launcher, 0, 1, 4, 5);
- assertItemsOnPage(launcher, 0, "Play Store");
+ assertItemsOnPage(launcher, 0, STORE_APP_NAME);
assertPageEmpty(launcher, 1);
- assertItemsOnPage(launcher, 4, "Maps");
- assertItemsOnPage(launcher, 5, "Messages");
+ assertItemsOnPage(launcher, 4, MAPS_APP_NAME);
+ assertItemsOnPage(launcher, 5, MESSAGES_APP_NAME);
});
}
diff --git a/tests/src/com/android/launcher3/util/TestConstants.java b/tests/src/com/android/launcher3/util/TestConstants.java
new file mode 100644
index 0000000..6f3c63a
--- /dev/null
+++ b/tests/src/com/android/launcher3/util/TestConstants.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package com.android.launcher3.util;
+
+public class TestConstants {
+ public static class AppNames {
+
+ public static final String TEST_APP_NAME = "LauncherTestApp";
+ public static final String DUMMY_APP_NAME = "Aardwolf";
+ public static final String MAPS_APP_NAME = "Maps";
+ public static final String STORE_APP_NAME = "Play Store";
+ public static final String GMAIL_APP_NAME = "Gmail";
+ public static final String CHROME_APP_NAME = "Chrome";
+ public static final String MESSAGES_APP_NAME = "Messages";
+ }
+}