Merge "Add getIconName to AppIcon" into tm-qpr-dev

This commit is contained in:
Ke-Yu Lu
2022-08-25 08:43:49 +00:00
committed by Android (Google) Code Review
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();
}
}