1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.quickstep; 17 18 import static org.junit.Assert.assertNotNull; 19 import static org.junit.Assert.assertTrue; 20 21 import android.content.Intent; 22 import android.platform.test.annotations.PlatinumTest; 23 24 import com.android.launcher3.tapl.Overview; 25 import com.android.launcher3.tapl.OverviewTask.OverviewTaskContainer; 26 import com.android.launcher3.tapl.OverviewTaskMenu; 27 import com.android.launcher3.ui.AbstractLauncherUiTest; 28 import com.android.launcher3.uioverrides.QuickstepLauncher; 29 import com.android.quickstep.util.SplitScreenTestUtils; 30 31 import org.junit.Test; 32 33 /** 34 * This test run in both Out of process (Oop) and in-process (Ipc). 35 * Tests the app Icon in overview. 36 */ 37 public class TaplOverviewIconTest extends AbstractLauncherUiTest<QuickstepLauncher> { 38 39 private static final String CALCULATOR_APP_PACKAGE = 40 resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR); 41 42 @PlatinumTest(focusArea = "launcher") 43 @Test testOverviewActionsMenu()44 public void testOverviewActionsMenu() { 45 startTestAppsWithCheck(); 46 47 OverviewTaskMenu menu = mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu(); 48 49 assertNotNull("Tapping App info menu item returned null", menu.tapAppInfoMenuItem()); 50 executeOnLauncher(launcher -> assertTrue( 51 "Launcher activity is the top activity; expecting another activity to be the top", 52 isInLaunchedApp(launcher))); 53 } 54 startTestAppsWithCheck()55 private void startTestAppsWithCheck() { 56 startTestApps(); 57 executeOnLauncher(launcher -> assertTrue( 58 "Launcher activity is the top activity; expecting another activity to be the top " 59 + "one", 60 isInLaunchedApp(launcher))); 61 } 62 startTestApps()63 private void startTestApps() { 64 startAppFast(getAppPackageName()); 65 startAppFast(CALCULATOR_APP_PACKAGE); 66 startTestActivity(2); 67 } 68 69 @Test testSplitTaskTapBothIconMenus()70 public void testSplitTaskTapBothIconMenus() { 71 Overview overview = SplitScreenTestUtils.createAndLaunchASplitPairInOverview(mLauncher); 72 73 OverviewTaskMenu taskMenu = overview.getCurrentTask().tapMenu(); 74 assertTrue("App info item not appearing in expanded task menu.", 75 taskMenu.hasMenuItem("App info")); 76 taskMenu.touchOutsideTaskMenuToDismiss(); 77 78 OverviewTaskMenu splitMenu = overview.getCurrentTask().tapMenu( 79 OverviewTaskContainer.SPLIT_BOTTOM_OR_RIGHT); 80 assertTrue("App info item not appearing in expanded split task's menu.", 81 splitMenu.hasMenuItem("App info")); 82 splitMenu.touchOutsideTaskMenuToDismiss(); 83 } 84 }