• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
<lambda>null2  * Copyright 2023 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.input.screenshot
18 
19 import android.content.Context
20 import android.hardware.input.KeyboardLayout
21 import android.os.LocaleList
22 import android.platform.test.flag.junit.SetFlagsRule
23 import com.android.hardware.input.Flags
24 import java.util.Locale
25 import org.junit.Rule
26 import org.junit.Test
27 import org.junit.rules.RuleChain
28 import org.junit.runner.RunWith
29 import platform.test.runner.parameterized.ParameterizedAndroidJunit4
30 import platform.test.runner.parameterized.Parameters
31 import platform.test.screenshot.DeviceEmulationSpec
32 
33 /** A screenshot test for Keyboard layout preview for Iso physical layout. */
34 @RunWith(ParameterizedAndroidJunit4::class)
35 class KeyboardLayoutPreviewIsoScreenshotTest(emulationSpec: DeviceEmulationSpec) {
36     companion object {
37         @Parameters(name = "{0}")
38         @JvmStatic
39         fun getTestSpecs() = DeviceEmulationSpec.PhoneAndTabletMinimal
40     }
41 
42     val setFlagsRule = SetFlagsRule()
43     val screenshotRule = InputScreenshotTestRule(
44             emulationSpec,
45             "frameworks/base/tests/InputScreenshotTest/assets"
46     )
47 
48     @get:Rule
49     val ruleChain = RuleChain.outerRule(screenshotRule).around(setFlagsRule)
50 
51     @Test
52     fun test() {
53         setFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_LAYOUT_PREVIEW_FLAG)
54         screenshotRule.screenshotTest("layout-preview") {
55             context: Context -> LayoutPreview.createLayoutPreview(context, null)
56         }
57     }
58 
59 }
60