Merge "Add screen recording to drag to splitscreen taskbar tests to help with debugging." into tm-dev
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
index ba93975..1df9c02 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsTaskbar.java
@@ -26,6 +26,7 @@
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 @@
}
@Test
+ @ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchAppInSplitscreen() throws Exception {
getTaskbar().getAppIcon(TEST_APP_NAME).dragToSplitscreen(
@@ -92,6 +94,7 @@
}
@Test
+ @ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchShortcutInSplitscreen() throws Exception {
getTaskbar().getAppIcon(TEST_APP_NAME)
@@ -120,6 +123,7 @@
}
@Test
+ @ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchAppInSplitscreen_FromTaskbarAllApps() throws Exception {
getTaskbar().openAllApps()
@@ -128,6 +132,7 @@
}
@Test
+ @ScreenRecord // b/231615831
@PortraitLandscape
public void testLaunchShortcutInSplitscreen_FromTaskbarAllApps() throws Exception {
getTaskbar().openAllApps()
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 91ab1bd..33fea2d 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -66,20 +66,19 @@
"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);
diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
index face02a..046d36b 100644
--- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
+++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java
@@ -97,12 +97,16 @@
}
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 @@
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));
}
}
}