• 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 java.util.Locale
23 import org.junit.Rule
24 import org.junit.Test
25 import org.junit.runner.RunWith
26 import org.junit.runners.Parameterized
27 import platform.test.screenshot.DeviceEmulationSpec
28 
29 /** A screenshot test for Keyboard layout preview for Ansi physical layout. */
30 @RunWith(Parameterized::class)
31 class KeyboardLayoutPreviewAnsiScreenshotTest(emulationSpec: DeviceEmulationSpec) {
32     companion object {
33         @Parameterized.Parameters(name = "{0}")
34         @JvmStatic
35         fun getTestSpecs() = DeviceEmulationSpec.PhoneMinimal
36     }
37 
38     @get:Rule
39     val screenshotRule = InputScreenshotTestRule(
40             emulationSpec,
41             "frameworks/base/tests/InputScreenshotTest/assets"
42     )
43 
44     @Test
45     fun test() {
46         screenshotRule.screenshotTest("layout-preview-ansi") {
47             context: Context -> LayoutPreview.createLayoutPreview(
48                 context,
49                 KeyboardLayout(
50                     "descriptor",
51                     "layout",
52                     /* collection= */null,
53                     /* priority= */0,
54                     LocaleList(Locale.US),
55                     /* layoutType= */0,
56                     /* vid= */0,
57                     /* pid= */0
58                 )
59             )
60         }
61     }
62 }