blob: a81fa8e6d123a2caf478a6bc0ecca3c11f5d90f9 [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.editTextSetFocus;
20import static com.android.server.wm.flicker.WindowUtils.getDisplayBounds;
21
Brett Chabot502ec7a2019-03-01 14:43:20 -080022import androidx.test.filters.LargeTest;
23import androidx.test.runner.AndroidJUnit4;
Vishnu Nair8248b7c2018-08-01 10:13:36 -070024
25import org.junit.Before;
26import org.junit.Test;
27import org.junit.runner.RunWith;
28
29/**
30 * Test IME window opening transitions.
31 * To run this test: {@code atest FlickerTests:OpenImeWindowTest}
32 */
33@LargeTest
34@RunWith(AndroidJUnit4.class)
35public class OpenImeWindowTest extends FlickerTestBase {
36
37 private static final String IME_WINDOW_TITLE = "InputMethod";
38
39 @Before
40 public void runTransition() {
41 super.runTransition(editTextSetFocus(uiDevice)
42 .includeJankyRuns().build());
43 }
44
45 @Test
46 public void checkVisibility_imeWindowBecomesVisible() {
47 checkResults(result -> WmTraceSubject.assertThat(result)
48 .hidesImeWindow(IME_WINDOW_TITLE)
49 .then()
50 .showsImeWindow(IME_WINDOW_TITLE)
51 .forAllEntries());
52 }
53
54 @Test
55 public void checkVisibility_imeLayerBecomesVisible() {
56 checkResults(result -> LayersTraceSubject.assertThat(result)
57 .hidesLayer(IME_WINDOW_TITLE)
58 .then()
59 .showsLayer(IME_WINDOW_TITLE)
60 .forAllEntries());
61 }
62
63 @Test
64 public void checkCoveredRegion_noUncoveredRegions() {
65 checkResults(result -> LayersTraceSubject.assertThat(result).coversRegion(
66 getDisplayBounds()).forAllEntries());
67 }
68}