1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci#include <cstdint> 16094332d3Sopenharmony_ci#include <cstdio> 17094332d3Sopenharmony_ci#include <cstdlib> 18094332d3Sopenharmony_ci#include <fcntl.h> 19094332d3Sopenharmony_ci#include <gtest/gtest.h> 20094332d3Sopenharmony_ci#include <securec.h> 21094332d3Sopenharmony_ci#include <string> 22094332d3Sopenharmony_ci#include <unistd.h> 23094332d3Sopenharmony_ci#include "input_device_manager.h" 24094332d3Sopenharmony_ci#include "input_manager.h" 25094332d3Sopenharmony_ci#include "osal_time.h" 26094332d3Sopenharmony_ci#include "osal_mem.h" 27094332d3Sopenharmony_ci#include "input_uhdf_log.h" 28094332d3Sopenharmony_ci 29094332d3Sopenharmony_ciusing namespace testing::ext; 30094332d3Sopenharmony_ciusing namespace OHOS::Input; 31094332d3Sopenharmony_cistatic IInputInterface *g_inputInterface; 32094332d3Sopenharmony_cistatic InputEventCb g_callback; 33094332d3Sopenharmony_cistatic InputHostCb g_hotplugCb; 34094332d3Sopenharmony_cistatic int32_t g_touchIndex; 35094332d3Sopenharmony_cistatic uint32_t g_index = 1; 36094332d3Sopenharmony_cistatic int32_t g_fileDescriptorFirst = 3; 37094332d3Sopenharmony_cistatic int32_t g_fileDescriptorSecond = 4; 38094332d3Sopenharmony_cistatic uint32_t g_type = INDEV_TYPE_MOUSE; 39094332d3Sopenharmony_cistatic const int32_t KEEP_ALIVE_TIME_MS = 3000; 40094332d3Sopenharmony_cistatic const int32_t INVALID_INDEX = 15; 41094332d3Sopenharmony_cistatic const int32_t INVALID_INDEX1 = -1; 42094332d3Sopenharmony_cistatic const int32_t MAX_DEVICES = 32; 43094332d3Sopenharmony_cistatic const int32_t TEST_RESULT_LEN = 32; 44094332d3Sopenharmony_cistatic const int32_t TEST_TYPE = 2; 45094332d3Sopenharmony_cistatic const int32_t TEST_LEN1 = 10; 46094332d3Sopenharmony_cistatic const int32_t TEST_LEN2 = -1; 47094332d3Sopenharmony_cistatic const int32_t VALUE_NULL = 0; 48094332d3Sopenharmony_cistatic const int32_t VALUE_DEFAULT = 1; 49094332d3Sopenharmony_cistatic const uint32_t INIT_DEFAULT_VALUE = 255; 50094332d3Sopenharmony_cistatic const uint32_t STATUS = INPUT_DEVICE_STATUS_CLOSED; 51094332d3Sopenharmony_cistatic const string NODE_PATH = "dev/input/"; 52094332d3Sopenharmony_cistatic const size_t COUNT = 1; 53094332d3Sopenharmony_cistatic const size_t INVALID_DEV_INDEX = 33; 54094332d3Sopenharmony_ci 55094332d3Sopenharmony_ci 56094332d3Sopenharmony_ciclass HdiInputTest : public testing::Test { 57094332d3Sopenharmony_cipublic: 58094332d3Sopenharmony_ci static void SetUpTestCase(); 59094332d3Sopenharmony_ci static void TearDownTestCase(); 60094332d3Sopenharmony_ci void SetUp(); 61094332d3Sopenharmony_ci void TearDown(); 62094332d3Sopenharmony_ci}; 63094332d3Sopenharmony_ci 64094332d3Sopenharmony_civoid HdiInputTest::SetUpTestCase() 65094332d3Sopenharmony_ci{ 66094332d3Sopenharmony_ci int32_t ret = GetInputInterface(&g_inputInterface); 67094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 68094332d3Sopenharmony_ci printf("%s: get input hdi failed, ret %d\n", __func__, ret); 69094332d3Sopenharmony_ci } 70094332d3Sopenharmony_ci} 71094332d3Sopenharmony_ci 72094332d3Sopenharmony_civoid HdiInputTest::TearDownTestCase() 73094332d3Sopenharmony_ci{ 74094332d3Sopenharmony_ci ReleaseInputInterface(&g_inputInterface); 75094332d3Sopenharmony_ci} 76094332d3Sopenharmony_ci 77094332d3Sopenharmony_civoid HdiInputTest::SetUp() 78094332d3Sopenharmony_ci{ 79094332d3Sopenharmony_ci} 80094332d3Sopenharmony_ci 81094332d3Sopenharmony_civoid HdiInputTest::TearDown() 82094332d3Sopenharmony_ci{ 83094332d3Sopenharmony_ci} 84094332d3Sopenharmony_ci 85094332d3Sopenharmony_ci#define INPUT_CHECK_NULL_POINTER(pointer, ret) do { \ 86094332d3Sopenharmony_ci if ((pointer) == nullptr) { \ 87094332d3Sopenharmony_ci printf("%s: null pointer", __func__); \ 88094332d3Sopenharmony_ci ASSERT_EQ ((ret), INPUT_SUCCESS); \ 89094332d3Sopenharmony_ci } \ 90094332d3Sopenharmony_ci} while (0) 91094332d3Sopenharmony_ci 92094332d3Sopenharmony_cistatic void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex) 93094332d3Sopenharmony_ci{ 94094332d3Sopenharmony_ci if (pkgs == nullptr) { 95094332d3Sopenharmony_ci printf("%s: pkgs is null\n", __func__); 96094332d3Sopenharmony_ci return; 97094332d3Sopenharmony_ci } 98094332d3Sopenharmony_ci for (uint32_t i = 0; i < count; i++) { 99094332d3Sopenharmony_ci printf("device action Index: %u devIndex: %u type: %u code: %u value %d\n", 100094332d3Sopenharmony_ci i, devIndex, pkgs[i]->type, pkgs[i]->code, pkgs[i]->value); 101094332d3Sopenharmony_ci } 102094332d3Sopenharmony_ci} 103094332d3Sopenharmony_ci 104094332d3Sopenharmony_cistatic void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg) 105094332d3Sopenharmony_ci{ 106094332d3Sopenharmony_ci if (msg == nullptr) { 107094332d3Sopenharmony_ci printf("%s: msg is null\n", __func__); 108094332d3Sopenharmony_ci return; 109094332d3Sopenharmony_ci } 110094332d3Sopenharmony_ci printf("%s: device hotplug action devIndex: %u devType: %u status: %u\n", __func__, 111094332d3Sopenharmony_ci msg->devIndex, msg->devType, msg->status); 112094332d3Sopenharmony_ci if (msg->status == INPUT_DEVICE_STATUS_OPENED) { 113094332d3Sopenharmony_ci EXPECT_EQ(g_inputInterface->iInputManager->OpenInputDevice(msg->devIndex), INPUT_SUCCESS); 114094332d3Sopenharmony_ci } else if (msg->status == INPUT_DEVICE_STATUS_CLOSED) { 115094332d3Sopenharmony_ci EXPECT_EQ(g_inputInterface->iInputManager->CloseInputDevice(msg->devIndex), INPUT_SUCCESS); 116094332d3Sopenharmony_ci } else { 117094332d3Sopenharmony_ci // do nothing 118094332d3Sopenharmony_ci } 119094332d3Sopenharmony_ci} 120094332d3Sopenharmony_ci 121094332d3Sopenharmony_ci/** 122094332d3Sopenharmony_ci * @tc.name: ScanInputDevice001 123094332d3Sopenharmony_ci * @tc.desc: scan input device test 124094332d3Sopenharmony_ci * @tc.type: FUNC 125094332d3Sopenharmony_ci * @tc.require: AR000F867R 126094332d3Sopenharmony_ci */ 127094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, ScanInputDevice001, TestSize.Level1) 128094332d3Sopenharmony_ci{ 129094332d3Sopenharmony_ci InputDevDesc sta[MAX_DEVICES]; 130094332d3Sopenharmony_ci if (memset_s(sta, MAX_DEVICES * sizeof(InputDevDesc), 0, MAX_DEVICES * sizeof(InputDevDesc)) != EOK) { 131094332d3Sopenharmony_ci printf("%s: memset_s failed\n", __func__); 132094332d3Sopenharmony_ci return; 133094332d3Sopenharmony_ci } 134094332d3Sopenharmony_ci printf("%s: [Input] ScanInputDevice001 enter %d\n", __func__, __LINE__); 135094332d3Sopenharmony_ci int32_t ret; 136094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 137094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 138094332d3Sopenharmony_ci ret = g_inputInterface->iInputManager->ScanInputDevice(sta, sizeof(sta) / sizeof(InputDevDesc)); 139094332d3Sopenharmony_ci if (ret == INPUT_SUCCESS) { 140094332d3Sopenharmony_ci printf("%s: ScanInputDevice result: %d, %d, %d, %d\n", 141094332d3Sopenharmony_ci __func__, sta[0].devType, sta[0].devIndex, sta[1].devType, sta[1].devIndex); 142094332d3Sopenharmony_ci } 143094332d3Sopenharmony_ci for (int32_t i = 1; i < MAX_DEVICES; i++) { 144094332d3Sopenharmony_ci if (sta[i].devIndex == 0) { 145094332d3Sopenharmony_ci break; 146094332d3Sopenharmony_ci } 147094332d3Sopenharmony_ci if (sta[i].devType == INDEV_TYPE_TOUCH) { 148094332d3Sopenharmony_ci g_touchIndex = sta[i].devIndex; 149094332d3Sopenharmony_ci } 150094332d3Sopenharmony_ci } 151094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 152094332d3Sopenharmony_ci} 153094332d3Sopenharmony_ci 154094332d3Sopenharmony_ci/** 155094332d3Sopenharmony_ci * @tc.name: OpenInputDevice001 156094332d3Sopenharmony_ci * @tc.desc: open input device test 157094332d3Sopenharmony_ci * @tc.type: FUNC 158094332d3Sopenharmony_ci * @tc.require: AR000F867R 159094332d3Sopenharmony_ci */ 160094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, OpenInputDev001, TestSize.Level1) 161094332d3Sopenharmony_ci{ 162094332d3Sopenharmony_ci printf("%s: [Input] OpenInputDev001 enter %d\n", __func__, __LINE__); 163094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 164094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 165094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(VALUE_DEFAULT); 166094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 167094332d3Sopenharmony_ci printf("%s: open device1 failed, ret %d\n", __func__, ret); 168094332d3Sopenharmony_ci } 169094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 170094332d3Sopenharmony_ci} 171094332d3Sopenharmony_ci 172094332d3Sopenharmony_ci/** 173094332d3Sopenharmony_ci * @tc.name: OpenInputDevice002 174094332d3Sopenharmony_ci * @tc.desc: open input device test 175094332d3Sopenharmony_ci * @tc.type: FUNC 176094332d3Sopenharmony_ci * @tc.require: AR000F867R 177094332d3Sopenharmony_ci */ 178094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, OpenInputDevice002, TestSize.Level1) 179094332d3Sopenharmony_ci{ 180094332d3Sopenharmony_ci printf("%s: [Input] OpenInputDev002 enter %d\n", __func__, __LINE__); 181094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 182094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 183094332d3Sopenharmony_ci /* Device "15" is used for testing nonexistent device node */ 184094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(INVALID_INDEX); 185094332d3Sopenharmony_ci if (ret != HDF_SUCCESS) { 186094332d3Sopenharmony_ci printf("%s: device %d dose not exist, can't open it, ret %d\n", __func__, INVALID_INDEX, ret); 187094332d3Sopenharmony_ci } 188094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 189094332d3Sopenharmony_ci} 190094332d3Sopenharmony_ci 191094332d3Sopenharmony_ci 192094332d3Sopenharmony_ci/** 193094332d3Sopenharmony_ci * @tc.name: OpenInputDevice003 194094332d3Sopenharmony_ci * @tc.desc: open input device test 195094332d3Sopenharmony_ci * @tc.type: FUNC 196094332d3Sopenharmony_ci * @tc.require: AR000F867R 197094332d3Sopenharmony_ci */ 198094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, OpenInputDevice003, TestSize.Level1) 199094332d3Sopenharmony_ci{ 200094332d3Sopenharmony_ci printf("%s: [Input] OpenInputDev003 enter %d\n", __func__, __LINE__); 201094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 202094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 203094332d3Sopenharmony_ci /* Device "-1" is used for testing nonexistent device node */ 204094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(INVALID_INDEX1); 205094332d3Sopenharmony_ci if (ret != HDF_SUCCESS) { 206094332d3Sopenharmony_ci printf("%s: device %d dose not exist, can't open it, ret %d\n", __func__, INVALID_INDEX1, ret); 207094332d3Sopenharmony_ci } 208094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 209094332d3Sopenharmony_ci} 210094332d3Sopenharmony_ci 211094332d3Sopenharmony_ci/** 212094332d3Sopenharmony_ci * @tc.name: CloseInputDevice001 213094332d3Sopenharmony_ci * @tc.desc: close input device test 214094332d3Sopenharmony_ci * @tc.type: FUNC 215094332d3Sopenharmony_ci * @tc.require: AR000F867T, AR000F8QNL 216094332d3Sopenharmony_ci */ 217094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, CloseInputDevice001, TestSize.Level1) 218094332d3Sopenharmony_ci{ 219094332d3Sopenharmony_ci printf("%s: [Input] CloseInputDev001 enter %d\n", __func__, __LINE__); 220094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 221094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 222094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(VALUE_DEFAULT); 223094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 224094332d3Sopenharmony_ci printf("%s: close device %d failed, ret %d\n", __func__, g_touchIndex, ret); 225094332d3Sopenharmony_ci } 226094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 227094332d3Sopenharmony_ci} 228094332d3Sopenharmony_ci 229094332d3Sopenharmony_ci/** 230094332d3Sopenharmony_ci * @tc.name: CloseInputDevice002 231094332d3Sopenharmony_ci * @tc.desc: close input device test 232094332d3Sopenharmony_ci * @tc.type: FUNC 233094332d3Sopenharmony_ci * @tc.require: AR000F867T 234094332d3Sopenharmony_ci */ 235094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, CloseInputDevice002, TestSize.Level1) 236094332d3Sopenharmony_ci{ 237094332d3Sopenharmony_ci printf("%s: [Input] CloseInputDev002 enter %d\n", __func__, __LINE__); 238094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 239094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 240094332d3Sopenharmony_ci /* Device "15" is used for testing nonexistent device node */ 241094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(INVALID_INDEX); 242094332d3Sopenharmony_ci if (ret == INPUT_FAILURE) { 243094332d3Sopenharmony_ci printf("%s: device %d doesn't exist, can't close it, ret %d\n", __func__, INVALID_INDEX, ret); 244094332d3Sopenharmony_ci } 245094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 246094332d3Sopenharmony_ci} 247094332d3Sopenharmony_ci 248094332d3Sopenharmony_ci/** 249094332d3Sopenharmony_ci * @tc.name: CloseInputDevice003 250094332d3Sopenharmony_ci * @tc.desc: close input device test 251094332d3Sopenharmony_ci * @tc.type: FUNC 252094332d3Sopenharmony_ci * @tc.require: AR000F867T 253094332d3Sopenharmony_ci */ 254094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, CloseInputDevice003, TestSize.Level1) 255094332d3Sopenharmony_ci{ 256094332d3Sopenharmony_ci printf("%s: [Input] CloseInputDev002 enter %d\n", __func__, __LINE__); 257094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 258094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 259094332d3Sopenharmony_ci /* Device "-1" is used for testing nonexistent device node */ 260094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->CloseInputDevice(INVALID_INDEX1); 261094332d3Sopenharmony_ci if (ret == INPUT_FAILURE) { 262094332d3Sopenharmony_ci printf("%s: device %d doesn't exist, can't close it, ret %d\n", __func__, INVALID_INDEX1, ret); 263094332d3Sopenharmony_ci } 264094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 265094332d3Sopenharmony_ci} 266094332d3Sopenharmony_ci 267094332d3Sopenharmony_ci/** 268094332d3Sopenharmony_ci * @tc.name: GetInputDevice001 269094332d3Sopenharmony_ci * @tc.desc: get input device info test 270094332d3Sopenharmony_ci * @tc.type: FUNC 271094332d3Sopenharmony_ci * @tc.require: AR000F867S 272094332d3Sopenharmony_ci */ 273094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetInputDevice001, TestSize.Level1) 274094332d3Sopenharmony_ci{ 275094332d3Sopenharmony_ci printf("%s: [Input] GetInputDevice001 enter %d\n", __func__, __LINE__); 276094332d3Sopenharmony_ci InputDeviceInfo *dev = nullptr; 277094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 278094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 279094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->GetInputDevice(g_touchIndex, &dev); 280094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 281094332d3Sopenharmony_ci printf("%s: get device %d failed, ret %d\n", __func__, g_touchIndex, ret); 282094332d3Sopenharmony_ci } 283094332d3Sopenharmony_ci printf("GetInputDevice001 %s: devIndex = %u, devType = %u\n", __func__, dev->devIndex, dev->devType); 284094332d3Sopenharmony_ci printf("GetInputDevice001: chipInfo = %s, vendorName = %s, chipName = %s, devName = %s\n", 285094332d3Sopenharmony_ci dev->chipInfo, dev->vendorName, dev->chipName, dev->attrSet.devName); 286094332d3Sopenharmony_ci printf("GetInputDevice001: busType = %u, vendor = %u, product = %u, version = %u\n", 287094332d3Sopenharmony_ci dev->attrSet.id.busType, dev->attrSet.id.vendor, dev->attrSet.id.product, dev->attrSet.id.version); 288094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 289094332d3Sopenharmony_ci} 290094332d3Sopenharmony_ci 291094332d3Sopenharmony_ci/** 292094332d3Sopenharmony_ci * @tc.name: GetInputDevice002 293094332d3Sopenharmony_ci * @tc.desc: get input device info test 294094332d3Sopenharmony_ci * @tc.type: FUNC 295094332d3Sopenharmony_ci * @tc.require: AR000F867S 296094332d3Sopenharmony_ci */ 297094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetInputDevice002, TestSize.Level1) 298094332d3Sopenharmony_ci{ 299094332d3Sopenharmony_ci printf("%s: [Input] GetInputDevice002 enter %d\n", __func__, __LINE__); 300094332d3Sopenharmony_ci InputDeviceInfo *dev = nullptr; 301094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 302094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 303094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->GetInputDevice(INVALID_INDEX1, &dev); 304094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 305094332d3Sopenharmony_ci printf("%s: get device %d failed, ret %d\n", __func__, INVALID_INDEX1, ret); 306094332d3Sopenharmony_ci } 307094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 308094332d3Sopenharmony_ci} 309094332d3Sopenharmony_ci 310094332d3Sopenharmony_ci/** 311094332d3Sopenharmony_ci * @tc.name: GetInputDevice003 312094332d3Sopenharmony_ci * @tc.desc: get input device info test 313094332d3Sopenharmony_ci * @tc.type: FUNC 314094332d3Sopenharmony_ci * @tc.require: AR000F867S 315094332d3Sopenharmony_ci */ 316094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetInputDevice003, TestSize.Level1) 317094332d3Sopenharmony_ci{ 318094332d3Sopenharmony_ci printf("%s: [Input] GetInputDevice003 enter %d\n", __func__, __LINE__); 319094332d3Sopenharmony_ci InputDeviceInfo *dev = nullptr; 320094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 321094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 322094332d3Sopenharmony_ci int32_t ret = g_inputInterface->iInputManager->GetInputDevice(INVALID_INDEX, &dev); 323094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 324094332d3Sopenharmony_ci printf("%s: get device %d failed, ret %d\n", __func__, INVALID_INDEX, ret); 325094332d3Sopenharmony_ci } 326094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 327094332d3Sopenharmony_ci} 328094332d3Sopenharmony_ci 329094332d3Sopenharmony_ci/** 330094332d3Sopenharmony_ci * @tc.name: GetInputDeviceList001 331094332d3Sopenharmony_ci * @tc.desc: get input device list info test 332094332d3Sopenharmony_ci * @tc.type: FUNC 333094332d3Sopenharmony_ci * @tc.require: AR000F8680 334094332d3Sopenharmony_ci */ 335094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetInputDeviceList001, TestSize.Level1) 336094332d3Sopenharmony_ci{ 337094332d3Sopenharmony_ci printf("%s: [Input] GetInputDeviceList001 enter\n", __func__); 338094332d3Sopenharmony_ci int32_t ret; 339094332d3Sopenharmony_ci uint32_t num = 0; 340094332d3Sopenharmony_ci InputDeviceInfo *dev = nullptr; 341094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 342094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 343094332d3Sopenharmony_ci ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, &dev, MAX_INPUT_DEV_NUM); 344094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 345094332d3Sopenharmony_ci printf("%s: get device list failed, ret %d\n", __func__, ret); 346094332d3Sopenharmony_ci } 347094332d3Sopenharmony_ci /* num <= MAX_INPUT_DEV_NUM return true */ 348094332d3Sopenharmony_ci ASSERT_LE(num, MAX_INPUT_DEV_NUM); 349094332d3Sopenharmony_ci for (uint32_t i = 0; i < num; i++) { 350094332d3Sopenharmony_ci printf("%s: num = %u, device[%u]'s info is:\n", __func__, num, i); 351094332d3Sopenharmony_ci printf("%s: index = %u, devType = %u\n", __func__, (dev + i)->devIndex, (dev + i)->devType); 352094332d3Sopenharmony_ci printf("%s: chipInfo = %s, vendorName = %s, chipName = %s, devName = %s\n", 353094332d3Sopenharmony_ci __func__, (dev + i)->chipInfo, (dev + i)->vendorName, (dev + i)->chipName, (dev + i)->attrSet.devName); 354094332d3Sopenharmony_ci } 355094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 356094332d3Sopenharmony_ci} 357094332d3Sopenharmony_ci 358094332d3Sopenharmony_ci/** 359094332d3Sopenharmony_ci * @tc.name: RegisterCallbackAndReportData001 360094332d3Sopenharmony_ci * @tc.desc: get input device chip info test 361094332d3Sopenharmony_ci * @tc.type: FUNC 362094332d3Sopenharmony_ci * @tc.require: AR000F8682, AR000F8QNL 363094332d3Sopenharmony_ci */ 364094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RegisterCallbackAndReportData001, TestSize.Level1) 365094332d3Sopenharmony_ci{ 366094332d3Sopenharmony_ci printf("%s: [Input] RegisterCallbackAndReportData001 enter\n", __func__); 367094332d3Sopenharmony_ci int32_t ret; 368094332d3Sopenharmony_ci g_callback.EventPkgCallback = ReportEventPkgCallback; 369094332d3Sopenharmony_ci g_hotplugCb.HotPlugCallback = ReportHotPlugEventPkgCallback; 370094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 371094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 372094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 373094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->RegisterReportCallback(g_touchIndex, &g_callback); 374094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 375094332d3Sopenharmony_ci printf("%s: register callback failed for device %d, ret %d\n", __func__, g_touchIndex, ret); 376094332d3Sopenharmony_ci } 377094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 378094332d3Sopenharmony_ci ret = g_inputInterface->iInputManager->OpenInputDevice(VALUE_DEFAULT); 379094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 380094332d3Sopenharmony_ci printf("%s: wait 3s for testing, pls touch the panel now\n", __func__); 381094332d3Sopenharmony_ci printf("%s: The event data is as following:\n", __func__); 382094332d3Sopenharmony_ci OsalMSleep(KEEP_ALIVE_TIME_MS); 383094332d3Sopenharmony_ci} 384094332d3Sopenharmony_ci 385094332d3Sopenharmony_ci/** 386094332d3Sopenharmony_ci * @tc.name: RegisterReportCallback001 387094332d3Sopenharmony_ci * @tc.desc: register report callback fail 388094332d3Sopenharmony_ci * @tc.type: FUNC 389094332d3Sopenharmony_ci * @tc.require: AR000F8682, AR000F8QNL 390094332d3Sopenharmony_ci */ 391094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RegisterReportCallback001, TestSize.Level1) 392094332d3Sopenharmony_ci{ 393094332d3Sopenharmony_ci printf("%s: [Input] RegisterReportCallback001 enter\n", __func__); 394094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 395094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 396094332d3Sopenharmony_ci int32_t ret; 397094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->RegisterReportCallback(0, nullptr); 398094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 399094332d3Sopenharmony_ci printf("%s: register report callback failed, ret %d\n", __func__, ret); 400094332d3Sopenharmony_ci } 401094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 402094332d3Sopenharmony_ci} 403094332d3Sopenharmony_ci 404094332d3Sopenharmony_ci/** 405094332d3Sopenharmony_ci * @tc.name: UnregisterReportCallback001 406094332d3Sopenharmony_ci * @tc.desc: get input device chip info test 407094332d3Sopenharmony_ci * @tc.type: FUNC 408094332d3Sopenharmony_ci * @tc.require: SR000F867Q 409094332d3Sopenharmony_ci */ 410094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, UnregisterReportCallback001, TestSize.Level1) 411094332d3Sopenharmony_ci{ 412094332d3Sopenharmony_ci printf("%s: [Input] UnregisterReportCallback001 enter\n", __func__); 413094332d3Sopenharmony_ci int32_t ret; 414094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 415094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 416094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR); 417094332d3Sopenharmony_ci 418094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->UnregisterReportCallback(g_touchIndex); 419094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 420094332d3Sopenharmony_ci printf("%s: unregister callback failed for device %d, ret %d\n", __func__, g_touchIndex, ret); 421094332d3Sopenharmony_ci } 422094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 423094332d3Sopenharmony_ci ret = g_inputInterface->iInputManager->CloseInputDevice(VALUE_DEFAULT); 424094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 425094332d3Sopenharmony_ci printf("%s: close device %d failed, ret %d\n", __func__, g_touchIndex, ret); 426094332d3Sopenharmony_ci } 427094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 428094332d3Sopenharmony_ci} 429094332d3Sopenharmony_ci 430094332d3Sopenharmony_ci/** 431094332d3Sopenharmony_ci * @tc.name: UnRegisterReportCallback001 432094332d3Sopenharmony_ci * @tc.desc: unregister report callback fail 433094332d3Sopenharmony_ci * @tc.type: FUNC 434094332d3Sopenharmony_ci * @tc.require: AR000F8682, AR000F8QNL 435094332d3Sopenharmony_ci */ 436094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, UnRegisterReportCallback001, TestSize.Level1) 437094332d3Sopenharmony_ci{ 438094332d3Sopenharmony_ci printf("%s: [Input] UnRegisterReportCallback001 enter\n", __func__); 439094332d3Sopenharmony_ci int32_t ret; 440094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 441094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 442094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->UnregisterReportCallback(INVALID_DEV_INDEX); 443094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 444094332d3Sopenharmony_ci printf("%s: unregister report callback failed, ret %d\n", __func__, ret); 445094332d3Sopenharmony_ci } 446094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 447094332d3Sopenharmony_ci} 448094332d3Sopenharmony_ci 449094332d3Sopenharmony_ci 450094332d3Sopenharmony_ci/** 451094332d3Sopenharmony_ci * @tc.name: FindIndexFromFd 452094332d3Sopenharmony_ci * @tc.desc: find index from fd test 453094332d3Sopenharmony_ci * @tc.type: FUNC 454094332d3Sopenharmony_ci * @tc.require: SR000F867Q 455094332d3Sopenharmony_ci */ 456094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, FindIndexFromFd001, TestSize.Level1) 457094332d3Sopenharmony_ci{ 458094332d3Sopenharmony_ci printf("%s: [Input] FindIndexFromFd001 enter\n", __func__); 459094332d3Sopenharmony_ci int32_t ret; 460094332d3Sopenharmony_ci InputDeviceManager InputDeviceManagerTest; 461094332d3Sopenharmony_ci int32_t fd = VALUE_NULL; 462094332d3Sopenharmony_ci uint32_t index = VALUE_NULL; 463094332d3Sopenharmony_ci ret = InputDeviceManagerTest.FindIndexFromFd(fd, &index); 464094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 465094332d3Sopenharmony_ci printf("%s: find index from fd failed, ret %d\n", __func__, ret); 466094332d3Sopenharmony_ci } 467094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 468094332d3Sopenharmony_ci} 469094332d3Sopenharmony_ci 470094332d3Sopenharmony_ci/** 471094332d3Sopenharmony_ci * @tc.name: FindIndexFromDevName 472094332d3Sopenharmony_ci * @tc.desc: find index from device name test 473094332d3Sopenharmony_ci * @tc.type: FUNC 474094332d3Sopenharmony_ci * @tc.require: SR000F867Q 475094332d3Sopenharmony_ci */ 476094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, FindIndexFromDevName001, TestSize.Level1) 477094332d3Sopenharmony_ci{ 478094332d3Sopenharmony_ci printf("%s: [Input] FindIndexFromDevName001 enter\n", __func__); 479094332d3Sopenharmony_ci int32_t ret; 480094332d3Sopenharmony_ci InputDeviceManager InputDeviceManagerTest; 481094332d3Sopenharmony_ci string devName = "MOUSE1"; 482094332d3Sopenharmony_ci uint32_t index = VALUE_NULL; 483094332d3Sopenharmony_ci ret = InputDeviceManagerTest.FindIndexFromDevName(devName, &index); 484094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 485094332d3Sopenharmony_ci printf("%s: find index from device name failed, ret %d\n", __func__, ret); 486094332d3Sopenharmony_ci } 487094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 488094332d3Sopenharmony_ci} 489094332d3Sopenharmony_ci 490094332d3Sopenharmony_ci/** 491094332d3Sopenharmony_ci * @tc.name: SetPowerStatus 492094332d3Sopenharmony_ci * @tc.desc: set power status test 493094332d3Sopenharmony_ci * @tc.type: FUNC 494094332d3Sopenharmony_ci * @tc.require: SR000F867Q 495094332d3Sopenharmony_ci */ 496094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SetPowerStatus001, TestSize.Level1) 497094332d3Sopenharmony_ci{ 498094332d3Sopenharmony_ci printf("%s: [Input] SetPowerStatus001 enter\n", __func__); 499094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 500094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 501094332d3Sopenharmony_ci 502094332d3Sopenharmony_ci int32_t ret; 503094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 504094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->SetPowerStatus(g_touchIndex, status); 505094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 506094332d3Sopenharmony_ci printf("%s: set power status failed, ret %d\n", __func__, ret); 507094332d3Sopenharmony_ci } 508094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 509094332d3Sopenharmony_ci} 510094332d3Sopenharmony_ci 511094332d3Sopenharmony_ci/** 512094332d3Sopenharmony_ci * @tc.name: SetPowerStatus 513094332d3Sopenharmony_ci * @tc.desc: set power status test 514094332d3Sopenharmony_ci * @tc.type: FUNC 515094332d3Sopenharmony_ci * @tc.require: SR000F867Q 516094332d3Sopenharmony_ci */ 517094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SetPowerStatus002, TestSize.Level1) 518094332d3Sopenharmony_ci{ 519094332d3Sopenharmony_ci printf("%s: [Input] SetPowerStatus002 enter\n", __func__); 520094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 521094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 522094332d3Sopenharmony_ci 523094332d3Sopenharmony_ci int32_t ret; 524094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 525094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->SetPowerStatus(INVALID_INDEX, status); 526094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 527094332d3Sopenharmony_ci printf("%s: set power status failed, ret %d\n", __func__, ret); 528094332d3Sopenharmony_ci } 529094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 530094332d3Sopenharmony_ci} 531094332d3Sopenharmony_ci 532094332d3Sopenharmony_ci/** 533094332d3Sopenharmony_ci * @tc.name: SetPowerStatus 534094332d3Sopenharmony_ci * @tc.desc: set power status test 535094332d3Sopenharmony_ci * @tc.type: FUNC 536094332d3Sopenharmony_ci * @tc.require: SR000F867Q 537094332d3Sopenharmony_ci */ 538094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SetPowerStatus003, TestSize.Level1) 539094332d3Sopenharmony_ci{ 540094332d3Sopenharmony_ci printf("%s: [Input] SetPowerStatus003 enter\n", __func__); 541094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 542094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 543094332d3Sopenharmony_ci 544094332d3Sopenharmony_ci int32_t ret; 545094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 546094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->SetPowerStatus(INVALID_INDEX1, status); 547094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 548094332d3Sopenharmony_ci printf("%s: set power status failed, ret %d\n", __func__, ret); 549094332d3Sopenharmony_ci } 550094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 551094332d3Sopenharmony_ci} 552094332d3Sopenharmony_ci 553094332d3Sopenharmony_ci/** 554094332d3Sopenharmony_ci * @tc.name: GetPowerStatus 555094332d3Sopenharmony_ci * @tc.desc: get power status test 556094332d3Sopenharmony_ci * @tc.type: FUNC 557094332d3Sopenharmony_ci * @tc.require: SR000F867Q 558094332d3Sopenharmony_ci */ 559094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetPowerStatus001, TestSize.Level1) 560094332d3Sopenharmony_ci{ 561094332d3Sopenharmony_ci printf("%s: [Input] GetPowerStatus001 enter\n", __func__); 562094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 563094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 564094332d3Sopenharmony_ci 565094332d3Sopenharmony_ci int32_t ret; 566094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 567094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetPowerStatus(g_touchIndex, &status); 568094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 569094332d3Sopenharmony_ci printf("%s: get power status failed, ret %d\n", __func__, ret); 570094332d3Sopenharmony_ci } 571094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 572094332d3Sopenharmony_ci} 573094332d3Sopenharmony_ci 574094332d3Sopenharmony_ci/** 575094332d3Sopenharmony_ci * @tc.name: GetPowerStatus 576094332d3Sopenharmony_ci * @tc.desc: get power status test 577094332d3Sopenharmony_ci * @tc.type: FUNC 578094332d3Sopenharmony_ci * @tc.require: SR000F867Q 579094332d3Sopenharmony_ci */ 580094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetPowerStatus002, TestSize.Level1) 581094332d3Sopenharmony_ci{ 582094332d3Sopenharmony_ci printf("%s: [Input] GetPowerStatus002 enter\n", __func__); 583094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 584094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 585094332d3Sopenharmony_ci 586094332d3Sopenharmony_ci int32_t ret; 587094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 588094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetPowerStatus(INVALID_INDEX, &status); 589094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 590094332d3Sopenharmony_ci printf("%s: get power status failed, ret %d\n", __func__, ret); 591094332d3Sopenharmony_ci } 592094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 593094332d3Sopenharmony_ci} 594094332d3Sopenharmony_ci 595094332d3Sopenharmony_ci/** 596094332d3Sopenharmony_ci * @tc.name: GetPowerStatus 597094332d3Sopenharmony_ci * @tc.desc: get power status test 598094332d3Sopenharmony_ci * @tc.type: FUNC 599094332d3Sopenharmony_ci * @tc.require: SR000F867Q 600094332d3Sopenharmony_ci */ 601094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetPowerStatus003, TestSize.Level1) 602094332d3Sopenharmony_ci{ 603094332d3Sopenharmony_ci printf("%s: [Input] GetPowerStatus003 enter\n", __func__); 604094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 605094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 606094332d3Sopenharmony_ci 607094332d3Sopenharmony_ci int32_t ret; 608094332d3Sopenharmony_ci uint32_t status = VALUE_NULL; 609094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetPowerStatus(INVALID_INDEX1, &status); 610094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 611094332d3Sopenharmony_ci printf("%s: get power status failed, ret %d\n", __func__, ret); 612094332d3Sopenharmony_ci } 613094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 614094332d3Sopenharmony_ci} 615094332d3Sopenharmony_ci 616094332d3Sopenharmony_ci/** 617094332d3Sopenharmony_ci * @tc.name: GetDeviceType 618094332d3Sopenharmony_ci * @tc.desc: get device type test 619094332d3Sopenharmony_ci * @tc.type: FUNC 620094332d3Sopenharmony_ci * @tc.require: SR000F867Q 621094332d3Sopenharmony_ci */ 622094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetDeviceType001, TestSize.Level1) 623094332d3Sopenharmony_ci{ 624094332d3Sopenharmony_ci printf("%s: [Input] GetDeviceType001 enter\n", __func__); 625094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 626094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 627094332d3Sopenharmony_ci 628094332d3Sopenharmony_ci int32_t ret; 629094332d3Sopenharmony_ci uint32_t deviceType = INIT_DEFAULT_VALUE; 630094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetDeviceType(g_touchIndex, &deviceType); 631094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 632094332d3Sopenharmony_ci printf("%s: get device type failed, ret %d\n", __func__, ret); 633094332d3Sopenharmony_ci } 634094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 635094332d3Sopenharmony_ci} 636094332d3Sopenharmony_ci 637094332d3Sopenharmony_ci/** 638094332d3Sopenharmony_ci * @tc.name: GetDeviceType 639094332d3Sopenharmony_ci * @tc.desc: get device type test 640094332d3Sopenharmony_ci * @tc.type: FUNC 641094332d3Sopenharmony_ci * @tc.require: SR000F867Q 642094332d3Sopenharmony_ci */ 643094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetDeviceType002, TestSize.Level1) 644094332d3Sopenharmony_ci{ 645094332d3Sopenharmony_ci printf("%s: [Input] GetDeviceType002 enter\n", __func__); 646094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 647094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 648094332d3Sopenharmony_ci 649094332d3Sopenharmony_ci int32_t ret; 650094332d3Sopenharmony_ci uint32_t deviceType = INIT_DEFAULT_VALUE; 651094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetDeviceType(INVALID_INDEX, &deviceType); 652094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 653094332d3Sopenharmony_ci printf("%s: get device type failed, ret %d\n", __func__, ret); 654094332d3Sopenharmony_ci } 655094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 656094332d3Sopenharmony_ci} 657094332d3Sopenharmony_ci 658094332d3Sopenharmony_ci/** 659094332d3Sopenharmony_ci * @tc.name: GetDeviceType 660094332d3Sopenharmony_ci * @tc.desc: get device type test 661094332d3Sopenharmony_ci * @tc.type: FUNC 662094332d3Sopenharmony_ci * @tc.require: SR000F867Q 663094332d3Sopenharmony_ci */ 664094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetDeviceType003, TestSize.Level1) 665094332d3Sopenharmony_ci{ 666094332d3Sopenharmony_ci printf("%s: [Input] GetDeviceType003 enter\n", __func__); 667094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 668094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 669094332d3Sopenharmony_ci 670094332d3Sopenharmony_ci int32_t ret; 671094332d3Sopenharmony_ci uint32_t deviceType = INIT_DEFAULT_VALUE; 672094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetDeviceType(INVALID_INDEX1, &deviceType); 673094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 674094332d3Sopenharmony_ci printf("%s: get device type failed, ret %d\n", __func__, ret); 675094332d3Sopenharmony_ci } 676094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 677094332d3Sopenharmony_ci} 678094332d3Sopenharmony_ci 679094332d3Sopenharmony_ci/** 680094332d3Sopenharmony_ci * @tc.name: GetChipInfo 681094332d3Sopenharmony_ci * @tc.desc: get input device chip info test 682094332d3Sopenharmony_ci * @tc.type: FUNC 683094332d3Sopenharmony_ci * @tc.require: SR000F867Q 684094332d3Sopenharmony_ci */ 685094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipInfo001, TestSize.Level1) 686094332d3Sopenharmony_ci{ 687094332d3Sopenharmony_ci printf("%s: [Input] GetChipInfo001 enter\n", __func__); 688094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 689094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 690094332d3Sopenharmony_ci 691094332d3Sopenharmony_ci int32_t ret; 692094332d3Sopenharmony_ci char chipInfo[TEST_LEN1] = {0}; 693094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipInfo(g_touchIndex, chipInfo, TEST_LEN1); 694094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 695094332d3Sopenharmony_ci printf("%s: get chip info failed, ret %d\n", __func__, ret); 696094332d3Sopenharmony_ci } 697094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 698094332d3Sopenharmony_ci} 699094332d3Sopenharmony_ci 700094332d3Sopenharmony_ci/** 701094332d3Sopenharmony_ci * @tc.name: GetChipInfo 702094332d3Sopenharmony_ci * @tc.desc: get input device chip info test 703094332d3Sopenharmony_ci * @tc.type: FUNC 704094332d3Sopenharmony_ci * @tc.require: SR000F867Q 705094332d3Sopenharmony_ci */ 706094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipInfo002, TestSize.Level1) 707094332d3Sopenharmony_ci{ 708094332d3Sopenharmony_ci printf("%s: [Input] GetChipInfo002 enter\n", __func__); 709094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 710094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 711094332d3Sopenharmony_ci 712094332d3Sopenharmony_ci int32_t ret; 713094332d3Sopenharmony_ci char chipInfo[TEST_LEN1] = {0}; 714094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipInfo(INVALID_INDEX, chipInfo, TEST_LEN1); 715094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 716094332d3Sopenharmony_ci printf("%s: get chip info failed, ret %d\n", __func__, ret); 717094332d3Sopenharmony_ci } 718094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 719094332d3Sopenharmony_ci} 720094332d3Sopenharmony_ci 721094332d3Sopenharmony_ci/** 722094332d3Sopenharmony_ci * @tc.name: GetChipInfo 723094332d3Sopenharmony_ci * @tc.desc: get input device chip info test 724094332d3Sopenharmony_ci * @tc.type: FUNC 725094332d3Sopenharmony_ci * @tc.require: SR000F867Q 726094332d3Sopenharmony_ci */ 727094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipInfo003, TestSize.Level1) 728094332d3Sopenharmony_ci{ 729094332d3Sopenharmony_ci printf("%s: [Input] GetChipInfo003 enter\n", __func__); 730094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 731094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 732094332d3Sopenharmony_ci 733094332d3Sopenharmony_ci int32_t ret; 734094332d3Sopenharmony_ci char chipInfo[TEST_LEN1] = {0}; 735094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipInfo(g_touchIndex, chipInfo, TEST_LEN2); 736094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 737094332d3Sopenharmony_ci printf("%s: get device chip info failed, ret %d\n", __func__, ret); 738094332d3Sopenharmony_ci } 739094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 740094332d3Sopenharmony_ci} 741094332d3Sopenharmony_ci 742094332d3Sopenharmony_ci/** 743094332d3Sopenharmony_ci * @tc.name: GetVendorName 744094332d3Sopenharmony_ci * @tc.desc: get device vendor name test 745094332d3Sopenharmony_ci * @tc.type: FUNC 746094332d3Sopenharmony_ci * @tc.require: SR000F867Q 747094332d3Sopenharmony_ci */ 748094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetVendorName001, TestSize.Level1) 749094332d3Sopenharmony_ci{ 750094332d3Sopenharmony_ci printf("%s: [Input] GetVendorName001 enter\n", __func__); 751094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 752094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 753094332d3Sopenharmony_ci 754094332d3Sopenharmony_ci int32_t ret; 755094332d3Sopenharmony_ci char vendorName[TEST_LEN1] = {0}; 756094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetVendorName(g_touchIndex, vendorName, TEST_LEN1); 757094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 758094332d3Sopenharmony_ci HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret); 759094332d3Sopenharmony_ci } 760094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 761094332d3Sopenharmony_ci} 762094332d3Sopenharmony_ci 763094332d3Sopenharmony_ci/** 764094332d3Sopenharmony_ci * @tc.name: GetVendorName 765094332d3Sopenharmony_ci * @tc.desc: get device vendor name test 766094332d3Sopenharmony_ci * @tc.type: FUNC 767094332d3Sopenharmony_ci * @tc.require: SR000F867Q 768094332d3Sopenharmony_ci */ 769094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetVendorName002, TestSize.Level1) 770094332d3Sopenharmony_ci{ 771094332d3Sopenharmony_ci printf("%s: [Input] GetVendorName002 enter\n", __func__); 772094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 773094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 774094332d3Sopenharmony_ci 775094332d3Sopenharmony_ci int32_t ret; 776094332d3Sopenharmony_ci char vendorName[TEST_LEN1] = {0}; 777094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetVendorName(INVALID_INDEX, vendorName, TEST_LEN1); 778094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 779094332d3Sopenharmony_ci HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret); 780094332d3Sopenharmony_ci } 781094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 782094332d3Sopenharmony_ci} 783094332d3Sopenharmony_ci 784094332d3Sopenharmony_ci/** 785094332d3Sopenharmony_ci * @tc.name: GetVendorName 786094332d3Sopenharmony_ci * @tc.desc: get device vendor name test 787094332d3Sopenharmony_ci * @tc.type: FUNC 788094332d3Sopenharmony_ci * @tc.require: SR000F867Q 789094332d3Sopenharmony_ci */ 790094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetVendorName003, TestSize.Level1) 791094332d3Sopenharmony_ci{ 792094332d3Sopenharmony_ci printf("%s: [Input] GetVendorName003 enter\n", __func__); 793094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 794094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 795094332d3Sopenharmony_ci 796094332d3Sopenharmony_ci int32_t ret; 797094332d3Sopenharmony_ci char vendorName[TEST_LEN1] = {0}; 798094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetVendorName(g_touchIndex, vendorName, TEST_LEN2); 799094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 800094332d3Sopenharmony_ci HDF_LOGE("%s: get device vendor name failed, ret %d", __func__, ret); 801094332d3Sopenharmony_ci } 802094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 803094332d3Sopenharmony_ci} 804094332d3Sopenharmony_ci 805094332d3Sopenharmony_ci/** 806094332d3Sopenharmony_ci * @tc.name: GetChipName 807094332d3Sopenharmony_ci * @tc.desc: get device chip name test 808094332d3Sopenharmony_ci * @tc.type: FUNC 809094332d3Sopenharmony_ci * @tc.require: SR000F867Q 810094332d3Sopenharmony_ci */ 811094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipName001, TestSize.Level1) 812094332d3Sopenharmony_ci{ 813094332d3Sopenharmony_ci printf("%s: [Input] GetChipName001 enter\n", __func__); 814094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 815094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 816094332d3Sopenharmony_ci 817094332d3Sopenharmony_ci int32_t ret; 818094332d3Sopenharmony_ci char chipName[TEST_LEN1] = {0}; 819094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipName(g_touchIndex, chipName, TEST_LEN1); 820094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 821094332d3Sopenharmony_ci HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret); 822094332d3Sopenharmony_ci } 823094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 824094332d3Sopenharmony_ci} 825094332d3Sopenharmony_ci 826094332d3Sopenharmony_ci/** 827094332d3Sopenharmony_ci * @tc.name: GetChipName 828094332d3Sopenharmony_ci * @tc.desc: get device chip name test 829094332d3Sopenharmony_ci * @tc.type: FUNC 830094332d3Sopenharmony_ci * @tc.require: SR000F867Q 831094332d3Sopenharmony_ci */ 832094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipName002, TestSize.Level1) 833094332d3Sopenharmony_ci{ 834094332d3Sopenharmony_ci printf("%s: [Input] GetChipName002 enter\n", __func__); 835094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 836094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 837094332d3Sopenharmony_ci 838094332d3Sopenharmony_ci int32_t ret; 839094332d3Sopenharmony_ci char chipName[TEST_LEN1] = {0}; 840094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipName(INVALID_INDEX, chipName, TEST_LEN1); 841094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 842094332d3Sopenharmony_ci HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret); 843094332d3Sopenharmony_ci } 844094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 845094332d3Sopenharmony_ci} 846094332d3Sopenharmony_ci 847094332d3Sopenharmony_ci/** 848094332d3Sopenharmony_ci * @tc.name: GetChipName 849094332d3Sopenharmony_ci * @tc.desc: get device chip name test 850094332d3Sopenharmony_ci * @tc.type: FUNC 851094332d3Sopenharmony_ci * @tc.require: SR000F867Q 852094332d3Sopenharmony_ci */ 853094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetChipName003, TestSize.Level1) 854094332d3Sopenharmony_ci{ 855094332d3Sopenharmony_ci printf("%s: [Input] GetChipName003 enter\n", __func__); 856094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 857094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 858094332d3Sopenharmony_ci 859094332d3Sopenharmony_ci int32_t ret; 860094332d3Sopenharmony_ci char chipName[TEST_LEN1] = {0}; 861094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->GetChipName(g_touchIndex, chipName, TEST_LEN2); 862094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 863094332d3Sopenharmony_ci HDF_LOGE("%s: get device chip name failed, ret %d", __func__, ret); 864094332d3Sopenharmony_ci } 865094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 866094332d3Sopenharmony_ci} 867094332d3Sopenharmony_ci 868094332d3Sopenharmony_ci/** 869094332d3Sopenharmony_ci * @tc.name: SetGestureMode 870094332d3Sopenharmony_ci * @tc.desc: set device gestureMode test 871094332d3Sopenharmony_ci * @tc.type: FUNC 872094332d3Sopenharmony_ci * @tc.require: SR000F867Q 873094332d3Sopenharmony_ci */ 874094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SetGestureMode001, TestSize.Level1) 875094332d3Sopenharmony_ci{ 876094332d3Sopenharmony_ci printf("%s: [Input] SetGestureMode001 enter\n", __func__); 877094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 878094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 879094332d3Sopenharmony_ci 880094332d3Sopenharmony_ci int32_t ret; 881094332d3Sopenharmony_ci uint32_t gestureMode = VALUE_DEFAULT; 882094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->SetGestureMode(g_touchIndex, gestureMode); 883094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 884094332d3Sopenharmony_ci HDF_LOGE("%s: set device gestureMode failed, ret %d", __func__, ret); 885094332d3Sopenharmony_ci } 886094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 887094332d3Sopenharmony_ci} 888094332d3Sopenharmony_ci 889094332d3Sopenharmony_ci/** 890094332d3Sopenharmony_ci * @tc.name: SetGestureMode 891094332d3Sopenharmony_ci * @tc.desc: set device gestureMode test 892094332d3Sopenharmony_ci * @tc.type: FUNC 893094332d3Sopenharmony_ci * @tc.require: SR000F867Q 894094332d3Sopenharmony_ci */ 895094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SetGestureMode002, TestSize.Level1) 896094332d3Sopenharmony_ci{ 897094332d3Sopenharmony_ci printf("%s: [Input] SetGestureMode002 enter\n", __func__); 898094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 899094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 900094332d3Sopenharmony_ci 901094332d3Sopenharmony_ci int32_t ret; 902094332d3Sopenharmony_ci uint32_t gestureMode = VALUE_DEFAULT; 903094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->SetGestureMode(INVALID_INDEX, gestureMode); 904094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 905094332d3Sopenharmony_ci HDF_LOGE("%s: set device gestureMode failed, ret %d", __func__, ret); 906094332d3Sopenharmony_ci } 907094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 908094332d3Sopenharmony_ci} 909094332d3Sopenharmony_ci 910094332d3Sopenharmony_ci/** 911094332d3Sopenharmony_ci * @tc.name: RunCapacitanceTest 912094332d3Sopenharmony_ci * @tc.desc: run capacitance test test 913094332d3Sopenharmony_ci * @tc.type: FUNC 914094332d3Sopenharmony_ci * @tc.require: SR000F867Q 915094332d3Sopenharmony_ci */ 916094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RunCapacitanceTest001, TestSize.Level1) 917094332d3Sopenharmony_ci{ 918094332d3Sopenharmony_ci printf("%s: [Input] RunCapacitanceTest001 enter\n", __func__); 919094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 920094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 921094332d3Sopenharmony_ci 922094332d3Sopenharmony_ci int32_t ret; 923094332d3Sopenharmony_ci char result[TEST_RESULT_LEN] = {0}; 924094332d3Sopenharmony_ci uint32_t testType = TEST_TYPE; 925094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->RunCapacitanceTest(g_touchIndex, testType, result, TEST_RESULT_LEN); 926094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 927094332d3Sopenharmony_ci HDF_LOGE("%s: run capacitance test failed, ret %d", __func__, ret); 928094332d3Sopenharmony_ci } 929094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 930094332d3Sopenharmony_ci} 931094332d3Sopenharmony_ci 932094332d3Sopenharmony_ci/** 933094332d3Sopenharmony_ci * @tc.name: RunCapacitanceTest002 934094332d3Sopenharmony_ci * @tc.desc: run capacitance test test002 935094332d3Sopenharmony_ci * @tc.type: FUNC 936094332d3Sopenharmony_ci * @tc.require: SR000F867Q 937094332d3Sopenharmony_ci */ 938094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RunCapacitanceTest002, TestSize.Level1) 939094332d3Sopenharmony_ci{ 940094332d3Sopenharmony_ci printf("%s: [Input] RunCapacitanceTest002 enter\n", __func__); 941094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 942094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 943094332d3Sopenharmony_ci 944094332d3Sopenharmony_ci int32_t ret; 945094332d3Sopenharmony_ci char result[TEST_RESULT_LEN] = {0}; 946094332d3Sopenharmony_ci uint32_t testType = TEST_TYPE; 947094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->RunCapacitanceTest(g_touchIndex, testType, nullptr, TEST_RESULT_LEN); 948094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 949094332d3Sopenharmony_ci HDF_LOGE("%s: run capacitance test002 failed, ret %d", __func__, ret); 950094332d3Sopenharmony_ci } 951094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 952094332d3Sopenharmony_ci} 953094332d3Sopenharmony_ci 954094332d3Sopenharmony_ci/** 955094332d3Sopenharmony_ci * @tc.name: RunExtraCommand 956094332d3Sopenharmony_ci * @tc.desc: run extra command test 957094332d3Sopenharmony_ci * @tc.type: FUNC 958094332d3Sopenharmony_ci * @tc.require: SR000F867Q 959094332d3Sopenharmony_ci */ 960094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RunExtraCommand001, TestSize.Level1) 961094332d3Sopenharmony_ci{ 962094332d3Sopenharmony_ci printf("%s: [Input] RunExtraCommand001 enter\n", __func__); 963094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 964094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 965094332d3Sopenharmony_ci 966094332d3Sopenharmony_ci int32_t ret; 967094332d3Sopenharmony_ci InputExtraCmd extraCmd = {0}; 968094332d3Sopenharmony_ci extraCmd.cmdCode = "WakeUpMode"; 969094332d3Sopenharmony_ci extraCmd.cmdValue = "Enable"; 970094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->RunExtraCommand(g_touchIndex, &extraCmd); 971094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 972094332d3Sopenharmony_ci HDF_LOGE("%s: run extra command failed, ret %d", __func__, ret); 973094332d3Sopenharmony_ci } 974094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 975094332d3Sopenharmony_ci} 976094332d3Sopenharmony_ci 977094332d3Sopenharmony_ci/** 978094332d3Sopenharmony_ci * @tc.name: RunExtraCommand 979094332d3Sopenharmony_ci * @tc.desc: run extra command test 980094332d3Sopenharmony_ci * @tc.type: FUNC 981094332d3Sopenharmony_ci * @tc.require: SR000F867Q 982094332d3Sopenharmony_ci */ 983094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RunExtraCommand002, TestSize.Level1) 984094332d3Sopenharmony_ci{ 985094332d3Sopenharmony_ci printf("%s: [Input] RunExtraCommand002 enter\n", __func__); 986094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 987094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputController, INPUT_NULL_PTR); 988094332d3Sopenharmony_ci 989094332d3Sopenharmony_ci int32_t ret; 990094332d3Sopenharmony_ci InputExtraCmd extraCmd = {0}; 991094332d3Sopenharmony_ci extraCmd.cmdCode = "WakeUpMode"; 992094332d3Sopenharmony_ci extraCmd.cmdValue = "Enable"; 993094332d3Sopenharmony_ci ret = g_inputInterface->iInputController->RunExtraCommand(INVALID_INDEX, &extraCmd); 994094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 995094332d3Sopenharmony_ci HDF_LOGE("%s: run extra command failed, ret %d", __func__, ret); 996094332d3Sopenharmony_ci } 997094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 998094332d3Sopenharmony_ci} 999094332d3Sopenharmony_ci 1000094332d3Sopenharmony_ci/** 1001094332d3Sopenharmony_ci * @tc.name: RegisterHotPlugCallback 1002094332d3Sopenharmony_ci * @tc.desc: Register Hot Plug Callback 1003094332d3Sopenharmony_ci * @tc.type: FUNC 1004094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1005094332d3Sopenharmony_ci */ 1006094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, RegisterHotPlugCallback001, TestSize.Level1) 1007094332d3Sopenharmony_ci{ 1008094332d3Sopenharmony_ci printf("%s: [Input] RegisterHotPlugCallback001 enter\n", __func__); 1009094332d3Sopenharmony_ci int32_t ret; 1010094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 1011094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 1012094332d3Sopenharmony_ci 1013094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->RegisterHotPlugCallback(&g_hotplugCb); 1014094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 1015094332d3Sopenharmony_ci printf("%s: Register Hot Plug Callback failed, ret %d\n", __func__, ret); 1016094332d3Sopenharmony_ci } 1017094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 1018094332d3Sopenharmony_ci} 1019094332d3Sopenharmony_ci 1020094332d3Sopenharmony_ci/** 1021094332d3Sopenharmony_ci * @tc.name: UnregisterHotPlugCallback 1022094332d3Sopenharmony_ci * @tc.desc: Unregister Hot Plug Callback 1023094332d3Sopenharmony_ci * @tc.type: FUNC 1024094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1025094332d3Sopenharmony_ci */ 1026094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, UnregisterHotPlugCallback001, TestSize.Level1) 1027094332d3Sopenharmony_ci{ 1028094332d3Sopenharmony_ci printf("%s: [Input] UnregisterHotPlugCallback001 enter\n", __func__); 1029094332d3Sopenharmony_ci int32_t ret; 1030094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR); 1031094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR); 1032094332d3Sopenharmony_ci 1033094332d3Sopenharmony_ci ret = g_inputInterface->iInputReporter->UnregisterHotPlugCallback(); 1034094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 1035094332d3Sopenharmony_ci printf("%s: Unregister Hot Plug Callback failed, ret %d\n", __func__, ret); 1036094332d3Sopenharmony_ci } 1037094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 1038094332d3Sopenharmony_ci} 1039094332d3Sopenharmony_ci 1040094332d3Sopenharmony_ci/** 1041094332d3Sopenharmony_ci * @tc.name: SendHotPlugEvent 1042094332d3Sopenharmony_ci * @tc.desc: Send Hot Plug Event 1043094332d3Sopenharmony_ci * @tc.type: FUNC 1044094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1045094332d3Sopenharmony_ci */ 1046094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, SendHotPlugEvent001, TestSize.Level1) 1047094332d3Sopenharmony_ci{ 1048094332d3Sopenharmony_ci printf("%s: [Input] SendHotPlugEvent001 enter\n", __func__); 1049094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1050094332d3Sopenharmony_ci iInputDeviceManager.SendHotPlugEvent(g_type, g_index, STATUS); 1051094332d3Sopenharmony_ci} 1052094332d3Sopenharmony_ci 1053094332d3Sopenharmony_ci/** 1054094332d3Sopenharmony_ci * @tc.name: DoWithEventDeviceAdd 1055094332d3Sopenharmony_ci * @tc.desc: Do With Event Device Add 1056094332d3Sopenharmony_ci * @tc.type: FUNC 1057094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1058094332d3Sopenharmony_ci */ 1059094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, DoWithEventDeviceAdd001, TestSize.Level1) 1060094332d3Sopenharmony_ci{ 1061094332d3Sopenharmony_ci printf("%s: [Input] DoWithEventDeviceAdd001 enter\n", __func__); 1062094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1063094332d3Sopenharmony_ci iInputDeviceManager.DoWithEventDeviceAdd(g_fileDescriptorFirst, g_fileDescriptorSecond, NODE_PATH); 1064094332d3Sopenharmony_ci} 1065094332d3Sopenharmony_ci 1066094332d3Sopenharmony_ci/** 1067094332d3Sopenharmony_ci * @tc.name: DoWithEventDeviceDel 1068094332d3Sopenharmony_ci * @tc.desc: Do With Event Device Del 1069094332d3Sopenharmony_ci * @tc.type: FUNC 1070094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1071094332d3Sopenharmony_ci */ 1072094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, DoWithEventDeviceDel001, TestSize.Level1) 1073094332d3Sopenharmony_ci{ 1074094332d3Sopenharmony_ci printf("%s: [Input] DoWithEventDeviceDel001 enter\n", __func__); 1075094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1076094332d3Sopenharmony_ci iInputDeviceManager.DoWithEventDeviceDel(g_fileDescriptorFirst, g_index); 1077094332d3Sopenharmony_ci} 1078094332d3Sopenharmony_ci 1079094332d3Sopenharmony_ci/** 1080094332d3Sopenharmony_ci * @tc.name: ReportEventPkg001 1081094332d3Sopenharmony_ci * @tc.desc: Report Event Pkg 1082094332d3Sopenharmony_ci * @tc.type: FUNC 1083094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1084094332d3Sopenharmony_ci */ 1085094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, ReportEventPkg001, TestSize.Level1) 1086094332d3Sopenharmony_ci{ 1087094332d3Sopenharmony_ci printf("%s: [Input] ReportEventPkg001 enter\n", __func__); 1088094332d3Sopenharmony_ci InputEventPackage **evtPkg = (InputEventPackage **)OsalMemAlloc(sizeof(InputEventPackage *) * COUNT); 1089094332d3Sopenharmony_ci INPUT_CHECK_NULL_POINTER(evtPkg, INPUT_NULL_PTR); 1090094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1091094332d3Sopenharmony_ci iInputDeviceManager.ReportEventPkg(g_fileDescriptorFirst, evtPkg, COUNT); 1092094332d3Sopenharmony_ci} 1093094332d3Sopenharmony_ci 1094094332d3Sopenharmony_ci/** 1095094332d3Sopenharmony_ci * @tc.name: DoRead 1096094332d3Sopenharmony_ci * @tc.desc: Do Read 1097094332d3Sopenharmony_ci * @tc.type: FUNC 1098094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1099094332d3Sopenharmony_ci */ 1100094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, DoRead001, TestSize.Level1) 1101094332d3Sopenharmony_ci{ 1102094332d3Sopenharmony_ci printf("%s: [Input] DoRead001 enter\n", __func__); 1103094332d3Sopenharmony_ci struct input_event evtBuffer[EVENT_BUFFER_SIZE] {}; 1104094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1105094332d3Sopenharmony_ci iInputDeviceManager.DoRead(g_fileDescriptorFirst, evtBuffer, EVENT_BUFFER_SIZE); 1106094332d3Sopenharmony_ci} 1107094332d3Sopenharmony_ci 1108094332d3Sopenharmony_ci/** 1109094332d3Sopenharmony_ci * @tc.name: InotifyEventHandler 1110094332d3Sopenharmony_ci * @tc.desc: Inotify Event Handler 1111094332d3Sopenharmony_ci * @tc.type: FUNC 1112094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1113094332d3Sopenharmony_ci */ 1114094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, InotifyEventHandler001, TestSize.Level1) 1115094332d3Sopenharmony_ci{ 1116094332d3Sopenharmony_ci printf("%s: [Input] InotifyEventHandler001 enter\n", __func__); 1117094332d3Sopenharmony_ci int32_t ret; 1118094332d3Sopenharmony_ci struct input_event evtBuffer[EVENT_BUFFER_SIZE] {}; 1119094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1120094332d3Sopenharmony_ci ret = iInputDeviceManager.InotifyEventHandler(g_fileDescriptorFirst, g_fileDescriptorSecond); 1121094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 1122094332d3Sopenharmony_ci printf("%s: Inotify Event Handler failed, ret %d\n", __func__, ret); 1123094332d3Sopenharmony_ci } 1124094332d3Sopenharmony_ci EXPECT_EQ(ret, INPUT_SUCCESS); 1125094332d3Sopenharmony_ci} 1126094332d3Sopenharmony_ci 1127094332d3Sopenharmony_ci/** 1128094332d3Sopenharmony_ci * @tc.name: ScanDevice 1129094332d3Sopenharmony_ci * @tc.desc: Scan Device Fail 1130094332d3Sopenharmony_ci * @tc.type: FUNC 1131094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1132094332d3Sopenharmony_ci */ 1133094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, ScanDevice001, TestSize.Level1) 1134094332d3Sopenharmony_ci{ 1135094332d3Sopenharmony_ci printf("%s: [Input] ScanDevice001 enter\n", __func__); 1136094332d3Sopenharmony_ci int32_t ret; 1137094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1138094332d3Sopenharmony_ci ret = iInputDeviceManager.ScanDevice(nullptr, 0); 1139094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 1140094332d3Sopenharmony_ci printf("%s: Scan Device failed, ret %d\n", __func__, ret); 1141094332d3Sopenharmony_ci } 1142094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 1143094332d3Sopenharmony_ci} 1144094332d3Sopenharmony_ci 1145094332d3Sopenharmony_ci/** 1146094332d3Sopenharmony_ci * @tc.name: GetDeviceList 1147094332d3Sopenharmony_ci * @tc.desc: Get Device List Fail 1148094332d3Sopenharmony_ci * @tc.type: FUNC 1149094332d3Sopenharmony_ci * @tc.require: SR000F867Q 1150094332d3Sopenharmony_ci */ 1151094332d3Sopenharmony_ciHWTEST_F(HdiInputTest, GetDeviceList001, TestSize.Level1) 1152094332d3Sopenharmony_ci{ 1153094332d3Sopenharmony_ci printf("%s: [Input] GetDeviceList001 enter\n", __func__); 1154094332d3Sopenharmony_ci int32_t ret; 1155094332d3Sopenharmony_ci InputDeviceManager iInputDeviceManager; 1156094332d3Sopenharmony_ci ret = iInputDeviceManager.GetDeviceList(nullptr, nullptr, 0); 1157094332d3Sopenharmony_ci if (ret != INPUT_SUCCESS) { 1158094332d3Sopenharmony_ci printf("%s: Get Device List Failed, ret %d\n", __func__, ret); 1159094332d3Sopenharmony_ci } 1160094332d3Sopenharmony_ci EXPECT_NE(ret, INPUT_SUCCESS); 1161094332d3Sopenharmony_ci} 1162