Debian Codegraph @

tests/FlickerTests/src/com/android/server/wm/flicker/ime/CommonAssertions.kt

raw
1 /*
2 * Copyright (C) 2020 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 @file:JvmName("CommonAssertions")
18 package com.android.server.wm.flicker.ime
19
20 import com.android.server.wm.flicker.FlickerTestParameter
21 import com.android.server.wm.traces.common.FlickerComponentName
22
23 fun FlickerTestParameter.imeLayerBecomesVisible() {
24 assertLayers {
25 this.isInvisible(FlickerComponentName.IME)
26 .then()
27 .isVisible(FlickerComponentName.IME)
28 }
29 }
30
31 fun FlickerTestParameter.imeLayerBecomesInvisible() {
32 assertLayers {
33 this.isVisible(FlickerComponentName.IME)
34 .then()
35 .isInvisible(FlickerComponentName.IME)
36 }
37 }
38
39 fun FlickerTestParameter.imeWindowIsAlwaysVisible(rotatesScreen: Boolean = false) {
40 if (rotatesScreen) {
41 assertWm {
42 this.isNonAppWindowVisible(FlickerComponentName.IME)
43 .then()
44 .isNonAppWindowInvisible(FlickerComponentName.IME)
45 .then()
46 .isNonAppWindowVisible(FlickerComponentName.IME)
47 }
48 } else {
49 assertWm {
50 this.isNonAppWindowVisible(FlickerComponentName.IME)
51 }
52 }
53 }
54
55 fun FlickerTestParameter.imeWindowBecomesVisible() {
56 assertWm {
57 this.isNonAppWindowInvisible(FlickerComponentName.IME)
58 .then()
59 .isNonAppWindowVisible(FlickerComponentName.IME)
60 }
61 }
62
63 fun FlickerTestParameter.imeWindowBecomesInvisible() {
64 assertWm {
65 this.isNonAppWindowVisible(FlickerComponentName.IME)
66 .then()
67 .isNonAppWindowInvisible(FlickerComponentName.IME)
68 }
69 }