• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 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 
17 package android.hardware.input.cts.tests;
18 
19 import static org.junit.Assume.assumeTrue;
20 import static org.junit.Assume.assumeFalse;
21 
22 import android.hardware.cts.R;
23 
24 import androidx.test.ext.junit.runners.AndroidJUnit4;
25 import androidx.test.filters.SmallTest;
26 
27 import com.android.cts.kernelinfo.KernelInfo;
28 
29 import org.junit.Test;
30 import org.junit.runner.RunWith;
31 
32 @SmallTest
33 @RunWith(AndroidJUnit4.class)
34 public class SonyDualshock4ProBluetoothTest extends InputHidTestCase {
35 
36     // Simulates the behavior of PlayStation DualShock4 Pro gamepad (model CUH-ZCT2U)
SonyDualshock4ProBluetoothTest()37     public SonyDualshock4ProBluetoothTest() {
38         super(R.raw.sony_dualshock4pro_bluetooth_register);
39     }
40 
41     @Test
testAllKeys()42     public void testAllKeys() {
43         testInputEvents(R.raw.sony_dualshock4_bluetooth_keyeventtests);
44     }
45 
46     @Test
testAllMotions()47     public void testAllMotions() {
48         assumeFalse("b/337286136 - Broken since kernel 6.2 from driver changes",
49                 KernelInfo.isKernelVersionGreaterThan("6.2"));
50         testInputEvents(R.raw.sony_dualshock4_bluetooth_motioneventtests);
51     }
52 
53     @Test
testVibrator()54     public void testVibrator() throws Exception {
55         assumeFalse("b/337286136 - Broken since kernel 6.2 from driver changes",
56                 KernelInfo.isKernelVersionGreaterThan("6.2"));
57         assumeTrue(KernelInfo.isKernelVersionGreaterThan("4.19"));
58         testInputVibratorEvents(R.raw.sony_dualshock4_bluetooth_vibratortests);
59     }
60 
61 }
62