• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 
17 package com.android.wm.shell.scenarios
18 
19 import android.app.Instrumentation
20 import android.tools.NavBar
21 import android.tools.Rotation
22 import android.tools.traces.parsers.WindowManagerStateHelper
23 import androidx.test.platform.app.InstrumentationRegistry
24 import androidx.test.uiautomator.UiDevice
25 import com.android.launcher3.tapl.LauncherInstrumentation
26 import com.android.server.wm.flicker.helpers.DesktopModeAppHelper
27 import com.android.server.wm.flicker.helpers.MotionEventHelper
28 import com.android.server.wm.flicker.helpers.SimpleAppHelper
29 import com.android.window.flags.Flags
30 import com.android.wm.shell.Utils
31 import org.junit.After
32 import org.junit.Assume
33 import org.junit.Before
34 import org.junit.Ignore
35 import org.junit.Rule
36 import org.junit.Test
37 
38 @Ignore("Test Base Class")
39 abstract class ResizeAppWithEdgeResize
40 constructor(
41     val inputMethod: MotionEventHelper.InputMethod,
42     val rotation: Rotation = Rotation.ROTATION_90
43 ) {
44     private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
45     private val tapl = LauncherInstrumentation()
46     private val wmHelper = WindowManagerStateHelper(instrumentation)
47     private val device = UiDevice.getInstance(instrumentation)
48     private val testApp = DesktopModeAppHelper(SimpleAppHelper(instrumentation))
49     private val motionEventHelper = MotionEventHelper(instrumentation, inputMethod)
50 
51     @Rule
52     @JvmField
53     val testSetupRule = Utils.testSetupRule(NavBar.MODE_GESTURAL, rotation)
54 
55     @Before
setupnull56     fun setup() {
57         Assume.assumeTrue(
58             Flags.enableDesktopWindowingMode()
59                     && Flags.enableWindowingEdgeDragResize() && tapl.isTablet
60         )
61         tapl.setEnableRotation(true)
62         tapl.setExpectedRotation(rotation.value)
63         testApp.enterDesktopMode(wmHelper, device)
64     }
65 
66     @Test
resizeAppWithEdgeResizeRightnull67     open fun resizeAppWithEdgeResizeRight() {
68         testApp.edgeResize(
69             wmHelper,
70             motionEventHelper,
71             DesktopModeAppHelper.Edges.RIGHT
72         )
73     }
74 
75     @After
teardownnull76     fun teardown() {
77         testApp.exit(wmHelper)
78     }
79 }
80