Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa5ae621 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias
Browse files

Add screen recording to drag to splitscreen taskbar tests to help with debugging.

Test: presubmit and local
Bug: 231615831
Change-Id: I87ea5eb30eaf9ec1f4f96572c78bc9daf976a589
parent 4608bd00
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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()
+3 −4
Original line number Diff line number Diff line
@@ -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);
+8 −5
Original line number Diff line number Diff line
@@ -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));
                    }
                }
            }