1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <cstdint>
17 #include <cstdio>
18 #include <cstdlib>
19 #include <string>
20 #include <unistd.h>
21 #include <fcntl.h>
22 #include <gtest/gtest.h>
23 #include <securec.h>
24 #include "osal_time.h"
25 #include "hdf_log.h"
26 #include "input_manager.h"
27 #include "hdi_input_test.h"
28
29 using namespace testing::ext;
30
31 IInputInterface *g_inputInterface;
32 InputEventCb g_callback;
33 InputHostCb g_hotplugCb;
34 bool g_HasDev = false;
35 InputDevDesc g_allDev[MAX_DEVICES];
36
37 static void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg);
38 static void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex);
39 static void CloseOnlineDev();
40 static void OpenOnlineDev();
41
42 class HdiInputTest : public testing::Test {
43 public:
44 static void SetUpTestCase();
45 static void TearDownTestCase();
46 void SetUp();
47 void TearDown();
48 };
49
SetUpTestCase()50 void HdiInputTest::SetUpTestCase()
51 {
52 int32_t ret;
53 ret = memset_s(g_allDev, MAX_DEVICES * sizeof(InputDevDesc), 0, MAX_DEVICES * sizeof(InputDevDesc));
54 if (ret != 0) {
55 HDF_LOGE("memset failed.\n");
56 return;
57 }
58 ret = GetInputInterface(&g_inputInterface);
59 if (ret != INPUT_SUCCESS) {
60 HDF_LOGE("%s: get input hdi failed, ret %d \n", __func__, ret);
61 }
62
63 g_callback.EventPkgCallback = ReportEventPkgCallback;
64 g_hotplugCb.HotPlugCallback = ReportHotPlugEventPkgCallback;
65 ret = g_inputInterface->iInputManager->ScanInputDevice(g_allDev, MAX_DEVICES);
66 if (ret) {
67 HDF_LOGE("%s: scan device failed, ret %d \n", __func__, ret);
68 }
69 if (g_allDev[0].devIndex == 1){
70 g_HasDev = true;
71 printf("%s: scan deviceIndex:%d,devType:%d. \n", __func__, g_allDev[0].devIndex, g_allDev[0].devType);
72 }
73 for (int32_t i = 1; i < MAX_DEVICES; i++) {
74 if (g_allDev[i].devIndex == 0) {
75 break;
76 }
77 printf("%s: scan deviceIndex:%d,devType:%d. \n", __func__, g_allDev[i].devIndex, g_allDev[i].devType);
78 g_HasDev = true;
79 }
80 }
81
TearDownTestCase()82 void HdiInputTest::TearDownTestCase()
83 {
84 ReleaseInputInterface(g_inputInterface);
85 }
86
SetUp()87 void HdiInputTest::SetUp()
88 {
89 }
90
TearDown()91 void HdiInputTest::TearDown()
92 {
93 }
94
ReportEventPkgCallback(const InputEventPackage ** pkgs,uint32_t count,uint32_t devIndex)95 static void ReportEventPkgCallback(const InputEventPackage **pkgs, uint32_t count, uint32_t devIndex)
96 {
97 if (pkgs == nullptr) {
98 return;
99 }
100 for (int32_t i = 0; i < count; i++) {
101 printf("%s: pkgs[%d] = 0x%x, 0x%x, %d\n", __func__, i, pkgs[i]->type, pkgs[i]->code, pkgs[i]->value);
102 EXPECT_GE(pkgs[i]->type, 0);
103 EXPECT_GE(pkgs[i]->code, 0);
104 EXPECT_GE(pkgs[i]->value, 0);
105 }
106 }
107
ReportHotPlugEventPkgCallback(const InputHotPlugEvent * msg)108 static void ReportHotPlugEventPkgCallback(const InputHotPlugEvent *msg)
109 {
110 int32_t ret;
111 if (msg == nullptr) {
112 return;
113 }
114 HDF_LOGI("%s: status =%d devId=%d type =%d \n", __func__, msg->status, msg->devIndex, msg->devType);
115 EXPECT_GE(msg->status, 0);
116 EXPECT_GE(msg->devIndex, 0);
117 EXPECT_GE(msg->devType, 0);
118
119 if (msg->status == 0) {
120 ret = g_inputInterface->iInputManager->OpenInputDevice(msg->devIndex);
121 if (ret) {
122 HDF_LOGE("%s: open device[%u] failed, ret %d \n", __func__, msg->devIndex, ret);
123 }
124
125 ret = g_inputInterface->iInputReporter->RegisterReportCallback(msg->devIndex, &g_callback);
126 if (ret) {
127 HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, msg->devIndex, ret);
128 }
129 } else {
130 ret = g_inputInterface->iInputReporter->UnregisterReportCallback(msg->devIndex);
131 if (ret) {
132 HDF_LOGE("%s: unregister callback failed, ret %d \n", __func__, ret);
133 }
134
135 ret = g_inputInterface->iInputManager->CloseInputDevice(msg->devIndex);
136 if (ret) {
137 HDF_LOGE("%s: close device failed, ret %d \n", __func__, ret);
138 }
139 }
140 }
141
OpenOnlineDev()142 static void OpenOnlineDev()
143 {
144 for (int32_t i = 0; i < MAX_DEVICES; i++) {
145 if (g_allDev[i].devIndex == 0) {
146 break;
147 }
148 int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(g_allDev[i].devIndex);
149 if (ret) {
150 HDF_LOGE("%s: open device[%d] failed, ret %d \n", __func__, g_allDev[i].devIndex, ret);
151 }
152 ASSERT_EQ(ret, INPUT_SUCCESS);
153
154 ret = g_inputInterface->iInputReporter->RegisterReportCallback(g_allDev[i].devIndex, &g_callback);
155 if (ret) {
156 HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, g_allDev[i].devIndex, ret);
157 }
158 ASSERT_EQ(ret, INPUT_SUCCESS);
159 }
160 }
161
CloseOnlineDev()162 static void CloseOnlineDev()
163 {
164 for (int32_t i = 0; i < MAX_DEVICES; i++) {
165 if (g_allDev[i].devIndex == 0) {
166 break;
167 }
168 int32_t ret = g_inputInterface->iInputReporter->UnregisterReportCallback(g_allDev[i].devIndex);
169 if (ret) {
170 HDF_LOGE("%s: register callback failed for device[%d], ret %d \n", __func__, g_allDev[i].devIndex, ret);
171 }
172 ASSERT_EQ(ret, INPUT_SUCCESS);
173
174 ret = g_inputInterface->iInputManager->CloseInputDevice(g_allDev[i].devIndex);
175 if (ret) {
176 HDF_LOGE("%s: close device[%d] failed, ret %d \n", __func__, g_allDev[i].devIndex, ret);
177 }
178 ASSERT_EQ(ret, INPUT_SUCCESS);
179 }
180 }
181
182 /**
183 * @tc.number: SUB_DriverSystem_HdiInput_0010
184 * @tc.name: open input device test
185 * @tc.desc: [C- SOFTWARE -0010]
186 * @tc.size: Medium
187 * @tc.level: level 0
188 */
189 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0010, Function | MediumTest | Level1)
190 {
191 HDF_LOGI("%s: [Input] RegisterCallbackAndReportData001 enter \n", __func__);
192 int32_t ret;
193
194 INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
195 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
196
197 ret = g_inputInterface->iInputManager->ScanInputDevice(g_allDev, sizeof(g_allDev)/sizeof(InputDevDesc));
198 EXPECT_EQ(ret, INPUT_SUCCESS);
199 }
200
201 /**
202 * @tc.number: SUB_DriverSystem_HdiInput_0020
203 * @tc.name: open input device test
204 * @tc.desc: [C- SOFTWARE -0010]
205 * @tc.size: Medium
206 * @tc.level: level 0
207 */
208 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0020, Function | MediumTest | Level3)
209 {
210 HDF_LOGI("%s: [Input] HotPlugCallback Testcase enter\n", __func__);
211
212 INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
213 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputReporter, INPUT_NULL_PTR);
214 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
215
216 int32_t ret = g_inputInterface->iInputReporter->RegisterHotPlugCallback(&g_hotplugCb);
217 if (ret) {
218 HDF_LOGE("%s: register hotplug callback failed for device manager, ret %d\n", __func__, ret);
219 }
220 ASSERT_EQ(ret, INPUT_SUCCESS);
221
222 OpenOnlineDev();
223
224 printf("%s: wait 5s for testing, pls hotplug now\n", __func__);
225 printf("%s: The event data is as following:\n", __func__);
226 OsalMSleep(KEEP_ALIVE_TIME_MS);
227
228 CloseOnlineDev();
229
230 ret = g_inputInterface->iInputReporter->UnregisterHotPlugCallback();
231 if (ret) {
232 HDF_LOGE("%s: unregister hotplug callback failed for device manager, ret %d\n", __func__, ret);
233 }
234 EXPECT_EQ(ret, INPUT_SUCCESS);
235 }
236
237 /**
238 * @tc.number: SUB_DriverSystem_HdiInput_0030
239 * @tc.name: open input device test
240 * @tc.desc: [C- SOFTWARE -0010]
241 * @tc.size: Medium
242 * @tc.level: level 0
243 */
244 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0030, Function | MediumTest | Level0)
245 {
246 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
247 ASSERT_EQ(g_HasDev, true);
248 INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
249 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
250 int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
251 ASSERT_EQ(ret, INPUT_SUCCESS);
252 ret = g_inputInterface->iInputManager->CloseInputDevice(TOUCH_INDEX);
253 ASSERT_EQ(ret, INPUT_SUCCESS);
254 }
255 int32_t ret = INPUT_SUCCESS;
256 EXPECT_EQ(ret, INPUT_SUCCESS);
257
258 }
259
260 /**
261 * @tc.number: SUB_DriverSystem_HdiInput_0040
262 * @tc.name: open input device error test
263 * @tc.desc: [C- SOFTWARE -0010]
264 * @tc.size: Medium
265 * @tc.level: level 0
266 */
267 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0040, Function | MediumTest | Level0)
268 {
269 ASSERT_EQ(g_HasDev, true);
270 INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
271 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
272 /* Device "0" is used for testing nonexistent device node */
273 int32_t ret = g_inputInterface->iInputManager->OpenInputDevice(0);
274 EXPECT_NE(ret, INPUT_SUCCESS);
275 /* Device "5" is used for testing nonexistent device node */
276 ret = g_inputInterface->iInputManager->OpenInputDevice(INVALID_INDEX);
277 EXPECT_NE(ret, INPUT_SUCCESS);
278 }
279
280 /**
281 * @tc.number: SUB_DriverSystem_HdiInput_0050
282 * @tc.name: close input device test
283 * @tc.desc: [C- SOFTWARE -0010]
284 * @tc.size: Medium
285 */
286 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0050, Function | MediumTest | Level0)
287 {
288 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
289 ASSERT_EQ(g_HasDev, true);
290 int32_t ret = 0;
291 g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
292 EXPECT_EQ(ret, INPUT_SUCCESS);
293 ret = g_inputInterface->iInputManager->CloseInputDevice(TOUCH_INDEX);
294 EXPECT_EQ(ret, INPUT_SUCCESS);
295 }
296 int32_t ret = INPUT_SUCCESS;
297 EXPECT_EQ(ret, INPUT_SUCCESS);
298 }
299 /**
300 * @tc.number: SUB_DriverSystem_HdiInput_0060
301 * @tc.name: close input device error test
302 * @tc.desc: [C- SOFTWARE -0010]
303 * @tc.size: Medium
304 * @tc.level: level 0
305 */
306 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0060, Function | MediumTest | Level0)
307 {
308 ASSERT_EQ(g_HasDev, true);
309 int32_t ret = 0;
310 ret = g_inputInterface->iInputManager->CloseInputDevice(0);
311 EXPECT_NE(ret, INPUT_SUCCESS);
312 ret = g_inputInterface->iInputManager->CloseInputDevice(INVALID_INDEX);
313 EXPECT_NE(ret, INPUT_SUCCESS);
314 }
315
316 /**
317 * @tc.number: SUB_DriverSystem_HdiInput_0070
318 * @tc.name: get input device id info test
319 * @tc.desc: [C- SOFTWARE -0010]
320 * @tc.size: Medium
321 * @tc.level: level 0
322 */
323 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0070, Function | MediumTest | Level0)
324 {
325 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
326 ASSERT_EQ(g_HasDev, true);
327 int32_t ret = 0;
328 InputDeviceInfo *dev = nullptr;
329 INPUT_CHECK_NULL_POINTER(g_inputInterface, INPUT_NULL_PTR);
330 INPUT_CHECK_NULL_POINTER(g_inputInterface->iInputManager, INPUT_NULL_PTR);
331
332 ret = g_inputInterface->iInputManager->OpenInputDevice(TOUCH_INDEX);
333 if (ret) {
334 HDF_LOGE("%s: open device1 failed, ret %d\n", __func__, ret);
335 }
336 ASSERT_EQ(ret, INPUT_SUCCESS);
337 ret = g_inputInterface->iInputManager->GetInputDevice(TOUCH_INDEX, &dev);
338 EXPECT_EQ(ret, INPUT_SUCCESS);
339 EXPECT_EQ((uint32_t)TOUCH_INDEX, dev->devIndex);
340 HDF_LOGI("devindex = %u, devType = %u\n", dev->devIndex, dev->devType);
341 HDF_LOGI("chipInfo = %s, VendorName = %s,chipName = %s\n", dev->chipInfo, dev->vendorName, dev->chipName);
342 }
343 int32_t ret = INPUT_SUCCESS;
344 EXPECT_EQ(ret, INPUT_SUCCESS);
345 }
346
347 /**
348 * @tc.number: SUB_DriverSystem_HdiInput_0080
349 * @tc.name: get input device id error test
350 * @tc.desc: [C- SOFTWARE -0010]
351 * @tc.size: Medium
352 * @tc.level: level 0
353 */
354 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0080, Function | MediumTest | Level0)
355 {
356 ASSERT_EQ(g_HasDev, true);
357 int32_t ret = 0;
358 InputDeviceInfo *dev = nullptr;
359
360 ret = g_inputInterface->iInputManager->GetInputDevice(TOUCH_INDEX, nullptr);
361 EXPECT_NE(ret, INPUT_SUCCESS);
362 ret = g_inputInterface->iInputManager->GetInputDevice(0, &dev);
363 EXPECT_NE(ret, INPUT_SUCCESS);
364 ret = g_inputInterface->iInputManager->GetInputDevice(INVALID_INDEX, &dev);
365 EXPECT_NE(ret, INPUT_SUCCESS);
366 ret = g_inputInterface->iInputManager->GetInputDevice(MAX_INPUT_DEV_NUM, &dev);
367 EXPECT_NE(ret, INPUT_SUCCESS);
368 }
369
370 /**
371 * @tc.number: SUB_DriverSystem_HdiInput_0090
372 * @tc.name: get input device list info test
373 * @tc.desc: [C- SOFTWARE -0010]
374 * @tc.size: Medium
375 * @tc.level: level 0
376 */
377 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0090, Function | MediumTest | Level0)
378 {
379 ASSERT_EQ(g_HasDev, true);
380 int32_t ret;
381 uint32_t num = 0;
382 InputDeviceInfo *dev[MAX_INPUT_DEV_NUM] = {0};
383
384 ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, dev, MAX_INPUT_DEV_NUM);
385 EXPECT_EQ(ret, INPUT_SUCCESS);
386 ASSERT_LE(num, (uint32_t)MAX_INPUT_DEV_NUM);
387 for (uint32_t i = 0; i < num; i++) {
388 HDF_LOGI("num = %u,device[%d]'s info is :\n", num, i);
389 HDF_LOGI("index = %u, devType = %u\n", dev[i]->devIndex, dev[i]->devType);
390 HDF_LOGI("chipInfo = %s, VendorName = %s,chipName = %s\n", dev[i]->chipInfo, dev[i]->vendorName,
391 dev[i]->chipName);
392 EXPECT_LE(0, dev[i]->devType);
393 }
394 }
395 /**
396 * @tc.number: SUB_DriverSystem_HdiInput_0100
397 * @tc.name: get input device list info error test
398 * @tc.desc: [C- SOFTWARE -0010]
399 * @tc.size: Medium
400 * @tc.level: level 0
401 */
402 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0100, Function | MediumTest | Level0)
403 {
404 ASSERT_EQ(g_HasDev, true);
405 int32_t ret;
406 uint32_t num = 0;
407 InputDeviceInfo *dev[MAX_INPUT_DEV_NUM] = {0};
408
409 ret = g_inputInterface->iInputManager->GetInputDeviceList(nullptr, dev, MAX_INPUT_DEV_NUM);
410 EXPECT_NE(ret, INPUT_SUCCESS);
411 ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, nullptr, MAX_INPUT_DEV_NUM);
412 EXPECT_NE(ret, INPUT_SUCCESS);
413 ret = g_inputInterface->iInputManager->GetInputDeviceList(&num, dev, 0);
414 EXPECT_NE(ret, INPUT_SUCCESS);
415 }
416
417 /**
418 * @tc.number: SUB_DriverSystem_HdiInput_0110
419 * @tc.name: get input device type test
420 * @tc.desc: [C- SOFTWARE -0010]
421 * @tc.size: Medium
422 * @tc.level: level 0
423 */
424 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0110, Function | MediumTest | Level0)
425 {
426 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
427 ASSERT_EQ(g_HasDev, true);
428 int32_t ret;
429 uint32_t devType = INIT_DEFAULT_VALUE;
430
431 ret = g_inputInterface->iInputController->GetDeviceType(TOUCH_INDEX, &devType);
432 EXPECT_EQ(ret, INPUT_SUCCESS);
433 EXPECT_EQ(devType, INDEV_TYPE_TOUCH);
434 }
435 int32_t ret = INPUT_SUCCESS;
436 EXPECT_EQ(ret, INPUT_SUCCESS);
437 }
438 /**
439 * @tc.number: SUB_DriverSystem_HdiInput_0120
440 * @tc.name: get input device type error test
441 * @tc.desc: [C- SOFTWARE -0010]
442 * @tc.size: Medium
443 * @tc.level: level 0
444 */
445 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0120, Function | MediumTest | Level0)
446 {
447 ASSERT_EQ(g_HasDev, true);
448 int32_t ret;
449 uint32_t devType = INIT_DEFAULT_VALUE;
450
451 ret = g_inputInterface->iInputController->GetDeviceType(TOUCH_INDEX, nullptr);
452 EXPECT_NE(ret, INPUT_SUCCESS);
453 ret = g_inputInterface->iInputController->GetDeviceType(0, &devType);
454 EXPECT_NE(ret, INPUT_SUCCESS);
455 ret = g_inputInterface->iInputController->GetDeviceType(MAX_INPUT_DEV_NUM, &devType);
456 EXPECT_NE(ret, INPUT_SUCCESS);
457 }
458
459 /**
460 * @tc.number: SUB_DriverSystem_HdiInput_0130
461 * @tc.name: get input device chip info test
462 * @tc.desc: [C- SOFTWARE -0010]
463 * @tc.size: Medium
464 * @tc.level: level 0
465 */
466 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0130, Function | MediumTest | Level0)
467 {
468 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
469 ASSERT_EQ(g_HasDev, true);
470 int32_t ret;
471 char chipInfo[CHIP_INFO_LEN] = {0};
472
473 ret = g_inputInterface->iInputController->GetChipInfo(TOUCH_INDEX, chipInfo, CHIP_INFO_LEN);
474 ASSERT_EQ(ret, INPUT_SUCCESS);
475 HDF_LOGI("device's chip info is %s\n", chipInfo);
476 }
477 int32_t ret = INPUT_SUCCESS;
478 EXPECT_EQ(ret, INPUT_SUCCESS);
479 }
480 /**
481 * @tc.number: SUB_DriverSystem_HdiInput_0140
482 * @tc.name: get input device chip info error test
483 * @tc.desc: [C- SOFTWARE -0010]
484 * @tc.size: Medium
485 * @tc.level: level 0
486 */
487 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0140, Function | MediumTest | Level0)
488 {
489 ASSERT_EQ(g_HasDev, true);
490 int32_t ret;
491 char chipInfo[CHIP_INFO_LEN] = {0};
492
493 ret = g_inputInterface->iInputController->GetChipInfo(0, chipInfo, CHIP_INFO_LEN);
494 EXPECT_NE(ret, INPUT_SUCCESS);
495 ret = g_inputInterface->iInputController->GetChipInfo(MAX_INPUT_DEV_NUM, chipInfo, CHIP_INFO_LEN);
496 EXPECT_NE(ret, INPUT_SUCCESS);
497 ret = g_inputInterface->iInputController->GetChipInfo(TOUCH_INDEX, nullptr, CHIP_INFO_LEN);
498 EXPECT_NE(ret, INPUT_SUCCESS);
499 ret = g_inputInterface->iInputController->GetChipInfo(TOUCH_INDEX, chipInfo, CHIP_INFO_LEN - 1);
500 EXPECT_NE(ret, INPUT_SUCCESS);
501 }
502
503 /**
504 * @tc.number: SUB_DriverSystem_HdiInput_0150
505 * @tc.name: get input device info test
506 * @tc.desc: [C- SOFTWARE -0010]
507 * @tc.size: Medium
508 * @tc.level: level 0
509 */
510 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0150, Function | MediumTest | Level0)
511 {
512 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
513 ASSERT_EQ(g_HasDev, true);
514 int32_t ret;
515 char chipInfo[CHIP_INFO_LEN] = {0};
516 InputDeviceInfo *dev =NULL;
517 ret = g_inputInterface->iInputManager->GetInputDevice(TOUCH_INDEX, &dev);
518 EXPECT_EQ(ret, INPUT_SUCCESS);
519 ret = g_inputInterface->iInputController->GetChipInfo(TOUCH_INDEX, chipInfo, CHIP_INFO_LEN);
520 EXPECT_EQ(ret, INPUT_SUCCESS);
521 HDF_LOGI("device1's chip info is %s? chipInfo = %s\n", chipInfo, dev->chipInfo);
522 }
523 int32_t ret = INPUT_SUCCESS;
524 EXPECT_EQ(ret, INPUT_SUCCESS);
525 }
526 /**
527 * @tc.number: SUB_DriverSystem_HdiInput_0160
528 * @tc.name: set device power status test-INPUT_LOW_POWER
529 * @tc.desc: [C- SOFTWARE -0010]
530 * @tc.size: Medium
531 * @tc.level: level 0
532 */
533 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0160, Function | MediumTest | Level0)
534 {
535 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
536 ASSERT_EQ(g_HasDev, true);
537 int32_t ret;
538 uint32_t setStatus = INPUT_LOW_POWER;
539 uint32_t getStatus = 0;
540
541 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
542 EXPECT_EQ(ret, INPUT_SUCCESS);
543 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
544 EXPECT_EQ(ret, INPUT_SUCCESS);
545 ASSERT_EQ(setStatus, getStatus);
546 }
547 int32_t ret = INPUT_SUCCESS;
548 EXPECT_EQ(ret, INPUT_SUCCESS);
549 }
550 /**
551 * @tc.number: SUB_DriverSystem_HdiInput_0161
552 * @tc.name: set device power status test-INPUT_SUSPEND
553 * @tc.desc: [C- SOFTWARE -0010]
554 * @tc.size: Medium
555 * @tc.level: level 0
556 */
557 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0161, Function | MediumTest | Level0)
558 {
559 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
560 ASSERT_EQ(g_HasDev, true);
561 int32_t ret;
562 uint32_t setStatus = INPUT_SUSPEND;
563 uint32_t getStatus = 0;
564
565 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
566 EXPECT_EQ(ret, INPUT_SUCCESS);
567 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
568 EXPECT_EQ(ret, INPUT_SUCCESS);
569 ASSERT_EQ(setStatus, getStatus);
570 }
571 int32_t ret = INPUT_SUCCESS;
572 EXPECT_EQ(ret, INPUT_SUCCESS);
573 }
574
575 /**
576 * @tc.number: SUB_DriverSystem_HdiInput_0162
577 * @tc.name: set device power status test-INPUT_RESUME
578 * @tc.desc: [C- SOFTWARE -0010]
579 * @tc.size: Medium
580 * @tc.level: level 0
581 */
582 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0162, Function | MediumTest | Level0)
583 {
584 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
585 ASSERT_EQ(g_HasDev, true);
586 int32_t ret;
587 uint32_t setStatus = INPUT_RESUME;
588 uint32_t getStatus = 0;
589
590 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
591 EXPECT_EQ(ret, INPUT_SUCCESS);
592 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
593 EXPECT_EQ(ret, INPUT_SUCCESS);
594 ASSERT_EQ(setStatus, getStatus);
595 }
596 int32_t ret = INPUT_SUCCESS;
597 EXPECT_EQ(ret, INPUT_SUCCESS);
598 }
599 /**
600 * @tc.number: SUB_DriverSystem_HdiInput_0170
601 * @tc.name: set device poewr status error test
602 * @tc.desc: [C- SOFTWARE -0010]
603 * @tc.size: Medium
604 * @tc.level: level 0
605 */
606 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0170, Function | MediumTest | Level0)
607 {
608 ASSERT_EQ(g_HasDev, true);
609 int32_t ret;
610 uint32_t setStatus = INPUT_LOW_POWER;
611
612 ret = g_inputInterface->iInputController->SetPowerStatus(0, setStatus);
613 EXPECT_NE(ret, INPUT_SUCCESS);
614 ret = g_inputInterface->iInputController->SetPowerStatus(MAX_INPUT_DEV_NUM, setStatus);
615 EXPECT_NE(ret, INPUT_SUCCESS);
616 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, INPUT_POWER_STATUS_UNKNOWN);
617 EXPECT_NE(ret, INPUT_SUCCESS);
618 }
619
620 /**
621 * @tc.number: SUB_DriverSystem_HdiInput_0180-INPUT_RESUME
622 * @tc.name: get device poewr status test
623 * @tc.desc: [C- SOFTWARE -0010]
624 * @tc.size: Medium
625 * @tc.level: level 0
626 */
627 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0180, Function | MediumTest | Level0)
628 {
629 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
630 ASSERT_EQ(g_HasDev, true);
631 int32_t ret;
632 uint32_t setStatus = INPUT_RESUME;
633 uint32_t getStatus = 0;
634
635 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
636 EXPECT_EQ(ret, INPUT_SUCCESS);
637 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
638 EXPECT_EQ(ret, INPUT_SUCCESS);
639 ASSERT_EQ(setStatus, getStatus);
640 }
641 int32_t ret = INPUT_SUCCESS;
642 EXPECT_EQ(ret, INPUT_SUCCESS);
643 }
644
645 /**
646 * @tc.number: SUB_DriverSystem_HdiInput_0181
647 * @tc.name: get device poewr status test-INPUT_SUSPEND
648 * @tc.desc: [C- SOFTWARE -0010]
649 * @tc.size: Medium
650 * @tc.level: level 0
651 */
652 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0181, Function | MediumTest | Level0)
653 {
654 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
655 ASSERT_EQ(g_HasDev, true);
656 int32_t ret;
657 uint32_t setStatus = INPUT_SUSPEND;
658 uint32_t getStatus = 0;
659
660 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
661 EXPECT_EQ(ret, INPUT_SUCCESS);
662 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
663 EXPECT_EQ(ret, INPUT_SUCCESS);
664 ASSERT_EQ(setStatus, getStatus);
665 }
666 int32_t ret = INPUT_SUCCESS;
667 EXPECT_EQ(ret, INPUT_SUCCESS);
668 }
669
670 /**
671 * @tc.number: SUB_DriverSystem_HdiInput_0182
672 * @tc.name: get device poewr status test-INPUT_LOW_POWER
673 * @tc.desc: [C- SOFTWARE -0010]
674 * @tc.size: Medium
675 * @tc.level: level 0
676 */
677 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0182, Function | MediumTest | Level0)
678 {
679 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
680 ASSERT_EQ(g_HasDev, true);
681 int32_t ret;
682 uint32_t setStatus = INPUT_LOW_POWER;
683 uint32_t getStatus = 0;
684
685 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
686 EXPECT_EQ(ret, INPUT_SUCCESS);
687 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
688 EXPECT_EQ(ret, INPUT_SUCCESS);
689 ASSERT_EQ(setStatus, getStatus);
690 }
691 int32_t ret = INPUT_SUCCESS;
692 EXPECT_EQ(ret, INPUT_SUCCESS);
693 }
694
695 /**
696 * @tc.number: SUB_DriverSystem_HdiInput_0183
697 * @tc.name: get device poewr status test-INPUT_POWER_STATUS_UNKNOWN
698 * @tc.desc: [C- SOFTWARE -0010]
699 * @tc.size: Medium
700 * @tc.level: level 0
701 */
702 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0183, Function | MediumTest | Level0)
703 {
704 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
705 ASSERT_EQ(g_HasDev, true);
706 int32_t ret;
707 uint32_t setStatus = INPUT_POWER_STATUS_UNKNOWN;
708 uint32_t getStatus = 0;
709
710 ret = g_inputInterface->iInputController->SetPowerStatus(TOUCH_INDEX, setStatus);
711 EXPECT_NE(ret, INPUT_SUCCESS);
712 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, &getStatus);
713 EXPECT_EQ(ret, INPUT_SUCCESS);
714 ASSERT_NE(setStatus, getStatus);
715 }
716 int32_t ret = INPUT_SUCCESS;
717 EXPECT_EQ(ret, INPUT_SUCCESS);
718 }
719
720 /**
721 * @tc.number: SUB_DriverSystem_HdiInput_0190
722 * @tc.name: get device poewr status error test
723 * @tc.desc: [C- SOFTWARE -0010]
724 * @tc.size: Medium
725 * @tc.level: level 0
726 */
727 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0190, Function | MediumTest | Level0)
728 {
729 ASSERT_EQ(g_HasDev, true);
730 int32_t ret;
731 uint32_t getStatus = 0;
732
733 ret = g_inputInterface->iInputController->GetPowerStatus(0, &getStatus);
734 EXPECT_NE(ret, INPUT_SUCCESS);
735 ret = g_inputInterface->iInputController->GetPowerStatus(TOUCH_INDEX, nullptr);
736 EXPECT_NE(ret, INPUT_SUCCESS);
737 ret = g_inputInterface->iInputController->GetPowerStatus(MAX_INPUT_DEV_NUM, &getStatus);
738 EXPECT_NE(ret, INPUT_SUCCESS);
739 }
740
741 /**
742 * @tc.number: SUB_DriverSystem_HdiInput_0200
743 * @tc.name: get device vendor name test
744 * @tc.desc: [C- SOFTWARE -0010]
745 * @tc.size: Medium
746 * @tc.level: level 0
747 */
748 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0200, Function | MediumTest | Level0)
749 {
750 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
751 ASSERT_EQ(g_HasDev, true);
752 int32_t ret;
753 char vendorName[VENDOR_NAME_LEN] = {0};
754
755 ret = g_inputInterface->iInputController->GetVendorName(TOUCH_INDEX, vendorName, VENDOR_NAME_LEN);
756 EXPECT_EQ(ret, INPUT_SUCCESS);
757 HDF_LOGI("device1's vendor name is %s:\n", vendorName);
758 }
759 int32_t ret = INPUT_SUCCESS;
760 EXPECT_EQ(ret, INPUT_SUCCESS);
761 }
762
763 /**
764 * @tc.number: SUB_DriverSystem_HdiInput_0210
765 * @tc.name: get device vendor name error test
766 * @tc.desc: [C- SOFTWARE -0010]
767 * @tc.size: Medium
768 * @tc.level: level 0
769 */
770 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0210, Function | MediumTest | Level0)
771 {
772 ASSERT_EQ(g_HasDev, true);
773 int32_t ret;
774 char vendorName[VENDOR_NAME_LEN] = {0};
775
776 ret = g_inputInterface->iInputController->GetVendorName(MAX_INPUT_DEV_NUM, vendorName, VENDOR_NAME_LEN);
777 EXPECT_NE(ret, INPUT_SUCCESS);
778 ret = g_inputInterface->iInputController->GetVendorName(0, vendorName, VENDOR_NAME_LEN);
779 EXPECT_NE(ret, INPUT_SUCCESS);
780 ret = g_inputInterface->iInputController->GetVendorName(TOUCH_INDEX, nullptr, VENDOR_NAME_LEN);
781 EXPECT_NE(ret, INPUT_SUCCESS);
782 ret = g_inputInterface->iInputController->GetVendorName(TOUCH_INDEX, vendorName, VENDOR_NAME_LEN - 1);
783 EXPECT_NE(ret, INPUT_SUCCESS);
784 }
785
786
787 /**
788 * @tc.number: SUB_DriverSystem_HdiInput_0220
789 * @tc.name: get device chip name test
790 * @tc.desc: [C- SOFTWARE -0010]
791 * @tc.size: Medium
792 * @tc.level: level 0
793 */
794 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0220, Function | MediumTest | Level0)
795 {
796 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
797 ASSERT_EQ(g_HasDev, true);
798 int32_t ret;
799 char chipName[CHIP_NAME_LEN] = {0};
800
801 ret = g_inputInterface->iInputController->GetChipName(TOUCH_INDEX, chipName, CHIP_NAME_LEN);
802 EXPECT_EQ(ret, INPUT_SUCCESS);
803 HDF_LOGI("device1's vendor name is %s:\n", chipName);
804 }
805 int32_t ret = INPUT_SUCCESS;
806 EXPECT_EQ(ret, INPUT_SUCCESS);
807 }
808 /**
809 * @tc.number: SUB_DriverSystem_HdiInput_0230
810 * @tc.name: get device chip name error test
811 * @tc.desc: [C- SOFTWARE -0010]
812 * @tc.size: Medium
813 * @tc.level: level 0
814 */
815 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0230, Function | MediumTest | Level0)
816 {
817 ASSERT_EQ(g_HasDev, true);
818 int32_t ret;
819 char chipName[CHIP_NAME_LEN] = {0};
820
821 ret = g_inputInterface->iInputController->GetChipName(MAX_INPUT_DEV_NUM, chipName, CHIP_NAME_LEN);
822 EXPECT_NE(ret, INPUT_SUCCESS);
823 ret = g_inputInterface->iInputController->GetChipName(0, chipName, CHIP_NAME_LEN);
824 EXPECT_NE(ret, INPUT_SUCCESS);
825 ret = g_inputInterface->iInputController->GetChipName(TOUCH_INDEX, nullptr, CHIP_NAME_LEN);
826 EXPECT_NE(ret, INPUT_SUCCESS);
827 ret = g_inputInterface->iInputController->GetChipName(TOUCH_INDEX, chipName, CHIP_NAME_LEN - 1);
828 EXPECT_NE(ret, INPUT_SUCCESS);
829 }
830
831 /**
832 * @tc.number: SUB_DriverSystem_HdiInput_0240
833 * @tc.name: set device gesture mode test
834 * @tc.desc: [C- SOFTWARE -0010]
835 * @tc.size: Medium
836 * @tc.level: level 0
837 */
838 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0240, Function | MediumTest | Level0)
839 {
840 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
841 ASSERT_EQ(g_HasDev, true);
842 int32_t ret;
843 uint32_t gestureMode = 1;
844
845 ret = g_inputInterface->iInputController->SetGestureMode(TOUCH_INDEX, gestureMode);
846 EXPECT_EQ(ret, INPUT_SUCCESS);
847 }
848 int32_t ret = INPUT_SUCCESS;
849 EXPECT_EQ(ret, INPUT_SUCCESS);
850 }
851
852 /**
853 * @tc.number: SUB_DriverSystem_HdiInput_0250
854 * @tc.name: set device gesture mode error test
855 * @tc.desc: [C- SOFTWARE -0010]
856 * @tc.size: Medium
857 * @tc.level: level 0
858 */
859 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0250, Function | MediumTest | Level0)
860 {
861 ASSERT_EQ(g_HasDev, true);
862 int32_t ret;
863 uint32_t gestureMode = 1;
864
865 ret = g_inputInterface->iInputController->SetGestureMode(0, gestureMode);
866 EXPECT_NE(ret, INPUT_SUCCESS);
867 ret = g_inputInterface->iInputController->SetGestureMode(MAX_INPUT_DEV_NUM, gestureMode);
868 EXPECT_NE(ret, INPUT_SUCCESS);
869 }
870
871 /**
872 * @tc.number: SUB_DriverSystem_HdiInput_0260
873 * @tc.name: Run Capacitance test-BASE_TEST
874 * @tc.desc: [C- SOFTWARE -0010]
875 * @tc.size: Medium
876 * @tc.level: level 0
877 */
878 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0260, Function | MediumTest | Level0)
879 {
880 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
881 ASSERT_EQ(g_HasDev, true);
882 int32_t ret;
883 uint32_t testType = BASE_TEST;
884 char result[MAX_INPUT_DEV_NUM] = {0};
885
886 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
887 EXPECT_EQ(ret, INPUT_SUCCESS);
888 }
889 int32_t ret = INPUT_SUCCESS;
890 EXPECT_EQ(ret, INPUT_SUCCESS);
891 }
892
893 /**
894 * @tc.number: SUB_DriverSystem_HdiInput_0261
895 * @tc.name: Run Capacitance test-FULL_TEST
896 * @tc.desc: [C- SOFTWARE -0010]
897 * @tc.size: Medium
898 * @tc.level: level 0
899 */
900 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0261, Function | MediumTest | Level0)
901 {
902 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
903 ASSERT_EQ(g_HasDev, true);
904 int32_t ret;
905 uint32_t testType = FULL_TEST;
906 char result[MAX_INPUT_DEV_NUM] = {0};
907
908 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
909 EXPECT_EQ(ret, INPUT_SUCCESS);
910 }
911 int32_t ret = INPUT_SUCCESS;
912 EXPECT_EQ(ret, INPUT_SUCCESS);
913 }
914
915 /**
916 * @tc.number: SUB_DriverSystem_HdiInput_0262
917 * @tc.name: Run Capacitance test-MMI_TEST
918 * @tc.desc: [C- SOFTWARE -0010]
919 * @tc.size: Medium
920 * @tc.level: level 0
921 */
922 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0262, Function | MediumTest | Level0)
923 {
924 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
925 ASSERT_EQ(g_HasDev, true);
926 int32_t ret;
927 uint32_t testType = MMI_TEST;
928 char result[MAX_INPUT_DEV_NUM] = {0};
929
930 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
931 EXPECT_EQ(ret, INPUT_SUCCESS);
932 }
933 int32_t ret = INPUT_SUCCESS;
934 EXPECT_EQ(ret, INPUT_SUCCESS);
935 }
936
937 /**
938 * @tc.number: SUB_DriverSystem_HdiInput_0263
939 * @tc.name: Run Capacitance test-RUNNING_TEST
940 * @tc.desc: [C- SOFTWARE -0010]
941 * @tc.size: Medium
942 * @tc.level: level 0
943 */
944 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0263, Function | MediumTest | Level0)
945 {
946 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
947 ASSERT_EQ(g_HasDev, true);
948 int32_t ret;
949 uint32_t testType = RUNNING_TEST;
950 char result[MAX_INPUT_DEV_NUM] = {0};
951
952 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
953 EXPECT_EQ(ret, INPUT_SUCCESS);
954 }
955 int32_t ret = INPUT_SUCCESS;
956 EXPECT_EQ(ret, INPUT_SUCCESS);
957 }
958
959 /**
960 * @tc.number: SUB_DriverSystem_HdiInput_0264
961 * @tc.name: Run Capacitance test-TEST_TYPE_UNKNOWN
962 * @tc.desc: [C- SOFTWARE -0010]
963 * @tc.size: Medium
964 * @tc.level: level 0
965 */
966 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0264, Function | MediumTest | Level0)
967 {
968 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
969 ASSERT_EQ(g_HasDev, true);
970 int32_t ret;
971 uint32_t testType = TEST_TYPE_UNKNOWN;
972 char result[MAX_INPUT_DEV_NUM] = {0};
973
974 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, result, MAX_INPUT_DEV_NUM);
975 EXPECT_NE(ret, INPUT_SUCCESS);
976 }
977 int32_t ret = INPUT_SUCCESS;
978 EXPECT_EQ(ret, INPUT_SUCCESS);
979 }
980
981 /**
982 * @tc.number: SUB_DriverSystem_HdiInput_0270
983 * @tc.name: Run Capacitance error test-MMI_TEST
984 * @tc.desc: [C- SOFTWARE -0010]
985 * @tc.size: Medium
986 * @tc.level: level 0
987 */
988 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0270, Function | MediumTest | Level0)
989 {
990 ASSERT_EQ(g_HasDev, true);
991 int32_t ret;
992 uint32_t testType = MMI_TEST;
993 char result[MAX_INPUT_DEV_NUM] = {0};
994
995 ret = g_inputInterface->iInputController->RunCapacitanceTest(0, testType, result, MAX_INPUT_DEV_NUM);
996 EXPECT_NE(ret, INPUT_SUCCESS);
997 ret = g_inputInterface->iInputController->RunCapacitanceTest(MAX_INPUT_DEV_NUM, testType, result,
998 MAX_INPUT_DEV_NUM);
999 EXPECT_NE(ret, INPUT_SUCCESS);
1000 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, TEST_TYPE_UNKNOWN, result,
1001 MAX_INPUT_DEV_NUM);
1002 EXPECT_NE(ret, INPUT_SUCCESS);
1003 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, nullptr, MAX_INPUT_DEV_NUM);
1004 EXPECT_NE(ret, INPUT_SUCCESS);
1005 }
1006 /**
1007 * @tc.number: SUB_DriverSystem_HdiInput_0271
1008 * @tc.name: Run Capacitance error test-BASE_TEST
1009 * @tc.desc: [C- SOFTWARE -0010]
1010 * @tc.size: Medium
1011 * @tc.level: level 0
1012 */
1013 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0271, Function | MediumTest | Level0)
1014 {
1015 ASSERT_EQ(g_HasDev, true);
1016 int32_t ret;
1017 uint32_t testType = BASE_TEST;
1018 char result[MAX_INPUT_DEV_NUM] = {0};
1019
1020 ret = g_inputInterface->iInputController->RunCapacitanceTest(0, testType, result, MAX_INPUT_DEV_NUM);
1021 EXPECT_NE(ret, INPUT_SUCCESS);
1022 ret = g_inputInterface->iInputController->RunCapacitanceTest(MAX_INPUT_DEV_NUM, testType, result,
1023 MAX_INPUT_DEV_NUM);
1024 EXPECT_NE(ret, INPUT_SUCCESS);
1025 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, TEST_TYPE_UNKNOWN, result,
1026 MAX_INPUT_DEV_NUM);
1027 EXPECT_NE(ret, INPUT_SUCCESS);
1028 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, nullptr, MAX_INPUT_DEV_NUM);
1029 EXPECT_NE(ret, INPUT_SUCCESS);
1030 }
1031
1032 /**
1033 * @tc.number: SUB_DriverSystem_HdiInput_0272
1034 * @tc.name: Run Capacitance error test-FULL_TEST
1035 * @tc.desc: [C- SOFTWARE -0010]
1036 * @tc.size: Medium
1037 * @tc.level: level 0
1038 */
1039 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0272, Function | MediumTest | Level0)
1040 {
1041 ASSERT_EQ(g_HasDev, true);
1042 int32_t ret;
1043 uint32_t testType = FULL_TEST;
1044 char result[MAX_INPUT_DEV_NUM] = {0};
1045
1046 ret = g_inputInterface->iInputController->RunCapacitanceTest(0, testType, result, MAX_INPUT_DEV_NUM);
1047 EXPECT_NE(ret, INPUT_SUCCESS);
1048 ret = g_inputInterface->iInputController->RunCapacitanceTest(MAX_INPUT_DEV_NUM, testType, result,
1049 MAX_INPUT_DEV_NUM);
1050 EXPECT_NE(ret, INPUT_SUCCESS);
1051 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, TEST_TYPE_UNKNOWN, result,
1052 MAX_INPUT_DEV_NUM);
1053 EXPECT_NE(ret, INPUT_SUCCESS);
1054 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, nullptr, MAX_INPUT_DEV_NUM);
1055 EXPECT_NE(ret, INPUT_SUCCESS);
1056 }
1057
1058 /**
1059 * @tc.number: SUB_DriverSystem_HdiInput_0273
1060 * @tc.name: Run Capacitance error test-RUNNING_TEST
1061 * @tc.desc: [C- SOFTWARE -0010]
1062 * @tc.size: Medium
1063 * @tc.level: level 0
1064 */
1065 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0273, Function | MediumTest | Level0)
1066 {
1067 ASSERT_EQ(g_HasDev, true);
1068 int32_t ret;
1069 uint32_t testType = RUNNING_TEST;
1070 char result[MAX_INPUT_DEV_NUM] = {0};
1071
1072 ret = g_inputInterface->iInputController->RunCapacitanceTest(0, testType, result, MAX_INPUT_DEV_NUM);
1073 EXPECT_NE(ret, INPUT_SUCCESS);
1074 ret = g_inputInterface->iInputController->RunCapacitanceTest(MAX_INPUT_DEV_NUM, testType, result,
1075 MAX_INPUT_DEV_NUM);
1076 EXPECT_NE(ret, INPUT_SUCCESS);
1077 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, TEST_TYPE_UNKNOWN, result,
1078 MAX_INPUT_DEV_NUM);
1079 EXPECT_NE(ret, INPUT_SUCCESS);
1080 ret = g_inputInterface->iInputController->RunCapacitanceTest(TOUCH_INDEX, testType, nullptr, MAX_INPUT_DEV_NUM);
1081 EXPECT_NE(ret, INPUT_SUCCESS);
1082 }
1083 /**
1084 * @tc.number: SUB_DriverSystem_HdiInput_0280
1085 * @tc.name: Run Extra Command test
1086 * @tc.desc: [C- SOFTWARE -0010]
1087 * @tc.size: Medium
1088 * @tc.level: level 0
1089 */
1090 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0280, Function | MediumTest | Level0)
1091 {
1092 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
1093 ASSERT_EQ(g_HasDev, true);
1094 int32_t ret;
1095 InputExtraCmd extraCmd = {0};
1096 extraCmd.cmdCode = "WakeUpMode";
1097 extraCmd.cmdValue = "Enable";
1098
1099 ret = g_inputInterface->iInputController->RunExtraCommand(TOUCH_INDEX, &extraCmd);
1100 EXPECT_EQ(ret, INPUT_SUCCESS);
1101 }
1102 int32_t ret = INPUT_SUCCESS;
1103 EXPECT_EQ(ret, INPUT_SUCCESS);
1104 }
1105
1106 /**
1107 * @tc.number: SUB_DriverSystem_HdiInput_0290
1108 * @tc.name: Run Extra Command error test
1109 * @tc.desc: [C- SOFTWARE -0010]
1110 * @tc.size: Medium
1111 * @tc.level: level 0
1112 */
1113 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0290, Function | MediumTest | Level0)
1114 {
1115 ASSERT_EQ(g_HasDev, true);
1116 int32_t ret;
1117 InputExtraCmd extraCmd = {0};
1118 extraCmd.cmdCode = "WakeUpMode";
1119 extraCmd.cmdValue = "Enable";
1120
1121 ret = g_inputInterface->iInputController->RunExtraCommand(MAX_INPUT_DEV_NUM, &extraCmd);
1122 EXPECT_NE(ret, INPUT_SUCCESS);
1123 ret = g_inputInterface->iInputController->RunExtraCommand(0, &extraCmd);
1124 EXPECT_NE(ret, INPUT_SUCCESS);
1125 ret = g_inputInterface->iInputController->RunExtraCommand(TOUCH_INDEX, nullptr);
1126 EXPECT_NE(ret, INPUT_SUCCESS);
1127 }
1128
1129 /**
1130 * @tc.number: SUB_DriverSystem_HdiInput_0300
1131 * @tc.name: Register Report Callback test
1132 * @tc.desc: [C- SOFTWARE -0010]
1133 * @tc.size: Medium
1134 * @tc.level: level 0
1135 */
1136 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0300, Function | MediumTest | Level0)
1137 {
1138 ASSERT_EQ(g_HasDev, true);
1139 int32_t ret;
1140 g_callback.EventPkgCallback = ReportEventPkgCallback;
1141 ret = g_inputInterface->iInputReporter->RegisterReportCallback(0, &g_callback);
1142 EXPECT_NE(ret, INPUT_SUCCESS);
1143 ret = g_inputInterface->iInputReporter->RegisterReportCallback(MAX_INPUT_DEV_NUM, &g_callback);
1144 EXPECT_NE(ret, INPUT_SUCCESS);
1145 ret = g_inputInterface->iInputReporter->RegisterReportCallback(TOUCH_INDEX, nullptr);
1146 EXPECT_NE(ret, INPUT_SUCCESS);
1147 }
1148
1149 /**
1150 * @tc.number: SUB_DriverSystem_HdiInput_0310
1151 * @tc.name: Register Report Callback test
1152 * @tc.desc: [C- SOFTWARE -0010]
1153 * @tc.size: Medium
1154 * @tc.level: level 0
1155 */
1156 HWTEST_F(HdiInputTest, SUB_DriverSystem_HdiInput_0310, Function | MediumTest | Level0)
1157 {
1158 if (g_allDev[0].devType == INDEV_TYPE_TOUCH) {
1159 ASSERT_EQ(g_HasDev, true);
1160 int32_t ret;
1161 g_callback.EventPkgCallback = ReportEventPkgCallback;
1162
1163 ret = g_inputInterface->iInputReporter->RegisterReportCallback(TOUCH_INDEX, &g_callback);
1164 EXPECT_EQ(ret, INPUT_SUCCESS);
1165 printf("wait 5 for testing, pls touch the panel now\n");
1166 printf("the event data is as following:\n");
1167 OsalMSleep(KEEP_ALIVE_TIME_MS);
1168 ret = g_inputInterface->iInputReporter->UnregisterReportCallback(TOUCH_INDEX);
1169 EXPECT_EQ(ret, INPUT_SUCCESS);
1170 }
1171 int32_t ret = INPUT_SUCCESS;
1172 EXPECT_EQ(ret, INPUT_SUCCESS);
1173 }