Merge "Add screen recording to drag to splitscreen taskbar tests to help with debugging." into tm-dev am: 467f30dbb7

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

Change-Id: I547601f2ba018fd3d91ecf46644deaa5c83f8a87
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Schneider Victor-tulias
2022-05-25 21:24:37 +00:00
committed by Automerger Merge Worker
3 changed files with 16 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.launcher3.tapl.Taskbar;
import com.android.launcher3.ui.TaplTestsLauncher3;
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import org.junit.After;
import org.junit.Assume;
@@ -85,6 +86,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest {
}
@Test
@ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchAppInSplitscreen() throws Exception {
getTaskbar().getAppIcon(TEST_APP_NAME).dragToSplitscreen(
@@ -92,6 +94,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest {
}
@Test
@ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchShortcutInSplitscreen() throws Exception {
getTaskbar().getAppIcon(TEST_APP_NAME)
@@ -120,6 +123,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest {
}
@Test
@ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchAppInSplitscreen_FromTaskbarAllApps() throws Exception {
getTaskbar().openAllApps()
@@ -128,6 +132,7 @@ public class TaplTestsTaskbar extends AbstractQuickStepTest {
}
@Test
@ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchShortcutInSplitscreen_FromTaskbarAllApps() throws Exception {
getTaskbar().openAllApps()

View File

@@ -66,20 +66,19 @@ public abstract class Launchable {
"want to launch an app from " + launchableType())) {
LauncherInstrumentation.log("Launchable.launch before click "
+ mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
final String label = mObject.getText();
mLauncher.clickLauncherObject(mObject);
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("clicked")) {
expectActivityStartEvents();
return assertAppLaunched(label, selector);
return assertAppLaunched(selector);
}
}
}
protected LaunchedAppState assertAppLaunched(String label, BySelector selector) {
protected LaunchedAppState assertAppLaunched(BySelector selector) {
mLauncher.assertTrue(
"App didn't start: " + label + " (" + selector + ")",
"App didn't start: (" + selector + ")",
mLauncher.getDevice().wait(Until.hasObject(selector),
LauncherInstrumentation.WAIT_TIME_MS));
return new LaunchedAppState(mLauncher);

View File

@@ -97,12 +97,16 @@ public final class LaunchedAppState extends Background {
}
static void dragToSplitscreen(
LauncherInstrumentation launcher, Launchable launchable, String expectedNewPackageName,
LauncherInstrumentation launcher,
Launchable launchable,
String expectedNewPackageName,
String expectedExistingPackageName) {
try (LauncherInstrumentation.Closable c1 = launcher.addContextLayer(
"want to drag taskbar item to splitscreen")) {
final Point displaySize = launcher.getRealDisplaySize();
final Point endPoint = new Point(displaySize.x / 4, 3 * displaySize.y / 4);
// Drag to the center of the top-left quadrant of the screen, this point will work in
// both portrait and landscape.
final Point endPoint = new Point(displaySize.x / 4, displaySize.y / 4);
final long downTime = SystemClock.uptimeMillis();
// Use mObject before starting drag since the system drag and drop moves the original
// view.
@@ -142,9 +146,8 @@ public final class LaunchedAppState extends Background {
try (LauncherInstrumentation.Closable c4 = launcher.addContextLayer(
"dropped item")) {
launchable.assertAppLaunched(itemLabel, By.pkg(expectedNewPackageName));
launchable.assertAppLaunched(
itemLabel, By.pkg(expectedExistingPackageName));
launchable.assertAppLaunched(By.pkg(expectedNewPackageName));
launchable.assertAppLaunched(By.pkg(expectedExistingPackageName));
}
}
}