Merge "Add getIconName to AppIcon" into tm-qpr-dev am: 9672e2e74f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19707039

Change-Id: Id31b524803f635aa2643f533dd1930789ebb6e18
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ke-Yu Lu
2022-08-25 09:05:05 +00:00
committed by Automerger Merge Worker
2 changed files with 19 additions and 0 deletions

View File

@@ -588,4 +588,16 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
public static String getAppPackageName() {
return getInstrumentation().getContext().getPackageName();
}
@Test
public void testGetAppIconName() {
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
HomeAppIcon icon = allApps.getAppIcon(APP_NAME);
assertEquals("Wrong app icon name.", icon.getIconName(), APP_NAME);
} finally {
allApps.unfreeze();
}
}
}

View File

@@ -18,6 +18,7 @@ package com.android.launcher3.tapl;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiObject2;
@@ -86,4 +87,10 @@ public abstract class AppIcon extends Launchable {
protected String launchableType() {
return "app icon";
}
/** Return the app name of a icon */
@NonNull
public String getIconName() {
return getObject().getText();
}
}