Search in sources :

Example 1 with NavigationModeSwitch

use of com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsQuickstep method testOverviewActions.

/**
 * Smoke test for action buttons: Presses all the buttons and makes sure no crashes occur.
 */
@Test
@NavigationModeSwitch
@PortraitLandscape
public void testOverviewActions() throws Exception {
    // Experimenting for b/165029151:
    final Overview overview = mLauncher.pressHome().switchToOverview();
    if (overview.hasTasks())
        overview.dismissAllTasks();
    mLauncher.pressHome();
    // 
    startTestAppsWithCheck();
    OverviewActions actionsView = mLauncher.pressHome().switchToOverview().getOverviewActions();
    actionsView.clickAndDismissScreenshot();
    actionsView.clickAndDismissShare();
}
Also used : OverviewActions(com.android.launcher3.tapl.OverviewActions) Overview(com.android.launcher3.tapl.Overview) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Example 2 with NavigationModeSwitch

use of com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsQuickstep method testQuickSwitchFromApp.

@Test
@NavigationModeSwitch
@PortraitLandscape
public void testQuickSwitchFromApp() throws Exception {
    startTestActivity(2);
    startTestActivity(3);
    startTestActivity(4);
    Background background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    assertTrue("The first app we should have quick switched to is not running", isTestActivityRunning(3));
    background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) {
        // 3-button mode toggles between 2 apps, rather than going back further.
        assertTrue("Second quick switch should have returned to the first app.", isTestActivityRunning(4));
    } else {
        assertTrue("The second app we should have quick switched to is not running", isTestActivityRunning(2));
    }
    background = getAndAssertBackground();
    background.quickSwitchToPreviousAppSwipeLeft();
    assertTrue("The 2nd app we should have quick switched to is not running", isTestActivityRunning(3));
    getAndAssertBackground();
}
Also used : Background(com.android.launcher3.tapl.Background) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Example 3 with NavigationModeSwitch

use of com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch in project android_packages_apps_Launcher3 by AOSPA.

the class ViewInflationDuringSwipeUp method testSwipeUp_with_list_widgets.

@Test
@NavigationModeSwitch(mode = ZERO_BUTTON)
// until b/190729479 is fixed
@Suppress
public void testSwipeUp_with_list_widgets() {
    SimpleViewsFactory viewFactory = new SimpleViewsFactory();
    viewFactory.viewCount = 1;
    Bundle args = new Bundle();
    args.putBinder(EXTRA_VALUE, viewFactory.toBinder());
    TestCommandReceiver.callCommand(SET_LIST_VIEW_SERVICE_BINDER, null, args);
    try {
        executeSwipeUpTestWithWidget(widgetId -> {
            // Initialize widget
            RemoteViews views = createMainWidgetViews("List widget title");
            views.setRemoteAdapter(android.R.id.list, new Intent(getContext(), ListViewService.class));
            AppWidgetManager.getInstance(getContext()).updateAppWidget(widgetId, views);
            verifyWidget(viewFactory.getLabel(0));
        }, widgetId -> {
            // Update widget
            viewFactory.viewCount = 2;
            AppWidgetManager.getInstance(getContext()).notifyAppWidgetViewDataChanged(widgetId, android.R.id.list);
        }, viewFactory.getLabel(1));
    } finally {
        TestCommandReceiver.callCommand(SET_LIST_VIEW_SERVICE_BINDER, null, new Bundle());
    }
}
Also used : RemoteViews(android.widget.RemoteViews) ListViewService(com.android.launcher3.testcomponent.ListViewService) Bundle(android.os.Bundle) Intent(android.content.Intent) SimpleViewsFactory(com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch) Suppress(androidx.test.filters.Suppress)

Example 4 with NavigationModeSwitch

use of com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsQuickstep method testQuickSwitchFromApp.

@Test
@NavigationModeSwitch
@PortraitLandscape
public void testQuickSwitchFromApp() throws Exception {
    startTestActivity(2);
    startTestActivity(3);
    startTestActivity(4);
    Background background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    assertTrue("The first app we should have quick switched to is not running", isTestActivityRunning(3));
    background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) {
        // 3-button mode toggles between 2 apps, rather than going back further.
        assertTrue("Second quick switch should have returned to the first app.", isTestActivityRunning(4));
    } else {
        assertTrue("The second app we should have quick switched to is not running", isTestActivityRunning(2));
    }
    background = getAndAssertBackground();
    background.quickSwitchToPreviousAppSwipeLeft();
    assertTrue("The 2nd app we should have quick switched to is not running", isTestActivityRunning(3));
    background = getAndAssertBackground();
    background.switchToOverview();
}
Also used : Background(com.android.launcher3.tapl.Background) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Example 5 with NavigationModeSwitch

use of com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsQuickstep method testBackground.

@Test
@NavigationModeSwitch
@PortraitLandscape
public void testBackground() throws Exception {
    startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
    final Background background = getAndAssertBackground();
    assertNotNull("Background.switchToOverview() returned null", background.switchToOverview());
    assertTrue("Launcher internal state didn't switch to Overview", isInState(() -> LauncherState.OVERVIEW));
}
Also used : Background(com.android.launcher3.tapl.Background) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Aggregations

LargeTest (androidx.test.filters.LargeTest)26 NavigationModeSwitch (com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)26 Test (org.junit.Test)26 Background (com.android.launcher3.tapl.Background)14 Intent (android.content.Intent)6 Bundle (android.os.Bundle)6 RemoteViews (android.widget.RemoteViews)6 OverviewActions (com.android.launcher3.tapl.OverviewActions)6 ListViewService (com.android.launcher3.testcomponent.ListViewService)6 SimpleViewsFactory (com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory)6 Suppress (androidx.test.filters.Suppress)5 Overview (com.android.launcher3.tapl.Overview)5 ScreenRecord (com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord)4