blob: 1d30df9750b24505b9479721af8120568105b4ad [file] [log] [blame]
Vishnu Nair8248b7c2018-08-01 10:13:36 -07001/*
2 * Copyright (C) 2018 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
17package com.android.server.wm.flicker;
18
19import static com.android.server.wm.flicker.CommonTransitions.splitScreenToLauncher;
20import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
21
Brett Chabot502ec7a2019-03-01 14:43:20 -080022import androidx.test.InstrumentationRegistry;
23import androidx.test.filters.FlakyTest;
24import androidx.test.filters.LargeTest;
25import androidx.test.runner.AndroidJUnit4;
Vishnu Nair8248b7c2018-08-01 10:13:36 -070026
27import org.junit.Before;
28import org.junit.Test;
29import org.junit.runner.RunWith;
30
31/**
32 * Test open app to split screen.
33 * To run this test: {@code atest FlickerTests:SplitScreenToLauncherTest}
34 */
35@LargeTest
36@RunWith(AndroidJUnit4.class)
37public class SplitScreenToLauncherTest extends FlickerTestBase {
38
39 public SplitScreenToLauncherTest() {
40 this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
41 "com.android.server.wm.flicker.testapp", "SimpleApp");
42 }
43
44 @Before
45 public void runTransition() {
46 super.runTransition(splitScreenToLauncher(testApp, uiDevice).includeJankyRuns().build());
47 }
48
49 @Test
50 public void checkCoveredRegion_noUncoveredRegions() {
51 checkResults(result ->
52 LayersTraceSubject.assertThat(result)
53 .coversRegion(getDisplayBounds()).forAllEntries());
54 }
55
56 @Test
57 public void checkVisibility_dividerLayerBecomesInVisible() {
58 checkResults(result -> LayersTraceSubject.assertThat(result)
59 .showsLayer(DOCKED_STACK_DIVIDER)
60 .then()
61 .hidesLayer(DOCKED_STACK_DIVIDER)
62 .forAllEntries());
63 }
64
65 @FlakyTest(bugId = 79686616)
66 @Test
67 public void checkVisibility_appLayerBecomesInVisible() {
68 checkResults(result -> LayersTraceSubject.assertThat(result)
69 .showsLayer(testApp.getPackage())
70 .then()
71 .hidesLayer(testApp.getPackage())
72 .forAllEntries());
73 }
74
75 @Test
76 public void checkVisibility_navBarWindowIsAlwaysVisible() {
77 checkResults(result -> WmTraceSubject.assertThat(result)
78 .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
79 }
80
81 @Test
82 public void checkVisibility_statusBarWindowIsAlwaysVisible() {
83 checkResults(result -> WmTraceSubject.assertThat(result)
84 .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
85 }
86
87 @Test
88 public void checkVisibility_dividerWindowBecomesInVisible() {
89 checkResults(result -> WmTraceSubject.assertThat(result)
90 .showsAboveAppWindow(DOCKED_STACK_DIVIDER)
91 .then()
92 .hidesAboveAppWindow(DOCKED_STACK_DIVIDER)
93 .forAllEntries());
94 }
95}