diff --git a/test/unittest/vibrator/native/vibrator_agent_test.cpp b/test/unittest/vibrator/native/vibrator_agent_test.cpp index 28a012b191ce852f921c7dd9e81930c8fcace744..7b6f6f6b806ccca9ea9034ee7dceb9a8ff009e92 100644 --- a/test/unittest/vibrator/native/vibrator_agent_test.cpp +++ b/test/unittest/vibrator/native/vibrator_agent_test.cpp @@ -1291,8 +1291,19 @@ HWTEST_F(VibratorAgentTest, PlayPrimitiveEffect_005, TestSize.Level1) HWTEST_F(VibratorAgentTest, IsHdHapticSupported_001, TestSize.Level1) { MISC_HILOGI("IsHdHapticSupported_001 in"); - bool ret = IsHdHapticSupported(); - MISC_HILOGI("IsHdHapticSupported:%{public}s", ret ? "true" : "false"); + if (IsSupportVibratorCustom() && IsHdHapticSupported()) { + FileDescriptor fileDescriptor("/data/test/vibrator/coin_drop.json"); + MISC_HILOGD("Test fd:%{public}d", fileDescriptor.fd); + struct stat64 statbuf = { 0 }; + if (fstat64(fileDescriptor.fd, &statbuf) == 0) { + int32_t ret = PlayVibratorCustom(fileDescriptor.fd, 0, statbuf.st_size); + ASSERT_EQ(ret, 0); + } + std::this_thread::sleep_for(std::chrono::milliseconds(TIME_WAIT_FOR_OP)); + } else { + ASSERT_EQ(0, 0); + } + Cancel(); } } // namespace Sensors } // namespace OHOS