blob: 63018ec1d9e7e3ae313ac6fa9b52c3e167c61c2b [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.appToSplitScreen;
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.LargeTest;
24import androidx.test.runner.AndroidJUnit4;
Vishnu Nair8248b7c2018-08-01 10:13:36 -070025
26import org.junit.Before;
27import org.junit.Test;
28import org.junit.runner.RunWith;
29
30/**
31 * Test open app to split screen.
32 * To run this test: {@code atest FlickerTests:OpenAppToSplitScreenTest}
33 */
34@LargeTest
35@RunWith(AndroidJUnit4.class)
36public class OpenAppToSplitScreenTest extends FlickerTestBase {
37
38 public OpenAppToSplitScreenTest() {
39 this.testApp = new StandardAppHelper(InstrumentationRegistry.getInstrumentation(),
40 "com.android.server.wm.flicker.testapp", "SimpleApp");
41 }
42
43 @Before
44 public void runTransition() {
45 super.runTransition(appToSplitScreen(testApp, uiDevice).includeJankyRuns().build());
46 }
47
48 @Test
49 public void checkVisibility_navBarWindowIsAlwaysVisible() {
50 checkResults(result -> WmTraceSubject.assertThat(result)
51 .showsAboveAppWindow(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
52 }
53
54 @Test
55 public void checkVisibility_statusBarWindowIsAlwaysVisible() {
56 checkResults(result -> WmTraceSubject.assertThat(result)
57 .showsAboveAppWindow(STATUS_BAR_WINDOW_TITLE).forAllEntries());
58 }
59
60 @Test
61 public void checkVisibility_dividerWindowBecomesVisible() {
62 checkResults(result -> WmTraceSubject.assertThat(result)
63 .hidesAboveAppWindow(DOCKED_STACK_DIVIDER)
64 .then()
65 .showsAboveAppWindow(DOCKED_STACK_DIVIDER)
66 .forAllEntries());
67 }
68
69 @Test
70 public void checkCoveredRegion_noUncoveredRegions() {
71 checkResults(result ->
72 LayersTraceSubject.assertThat(result)
73 .coversRegion(getDisplayBounds()).forAllEntries());
74 }
75
76 @Test
77 public void checkVisibility_navBarLayerIsAlwaysVisible() {
78 checkResults(result -> LayersTraceSubject.assertThat(result)
79 .showsLayer(NAVIGATION_BAR_WINDOW_TITLE).forAllEntries());
80 }
81
82 @Test
83 public void checkVisibility_statusBarLayerIsAlwaysVisible() {
84 checkResults(result -> LayersTraceSubject.assertThat(result)
85 .showsLayer(STATUS_BAR_WINDOW_TITLE).forAllEntries());
86 }
87
88 @Test
89 public void checkVisibility_dividerLayerBecomesVisible() {
90 checkResults(result -> LayersTraceSubject.assertThat(result)
91 .hidesLayer(DOCKED_STACK_DIVIDER)
92 .then()
93 .showsLayer(DOCKED_STACK_DIVIDER)
94 .forAllEntries());
95 }
96}