Add hdi test suites -motion

Signed-off-by: wangchao582 <wangchao582@huawei.com>
This commit is contained in:
wangchao582 2023-11-09 10:45:37 +08:00
parent 81c3af6cd3
commit b46d8def49

View File

@ -120,11 +120,8 @@ HWTEST_F(HdfMotionTestAdditional, testHdiEnableMotion005, Function | MediumTest
ASSERT_NE(nullptr, g_motionInterface);
return;
}
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->EnableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_CLOSE_TO_EAR);
EXPECT_EQ(HDF_SUCCESS, ret);
}
int32_t ret = g_motionInterface->EnableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_WRIST_DOWN);
EXPECT_EQ(HDF_SUCCESS, ret);
}
/**
@ -139,8 +136,10 @@ HWTEST_F(HdfMotionTestAdditional, testHdiEnableMotion006, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->EnableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_MAX);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->EnableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_CLOSE_TO_EAR);
EXPECT_EQ(HDF_SUCCESS, ret);
}
}
/**
@ -155,8 +154,8 @@ HWTEST_F(HdfMotionTestAdditional, testHdiEnableMotion007, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->EnableMotion(0);
EXPECT_EQ(HDF_SUCCESS, ret);
int32_t ret = g_motionInterface->EnableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_MAX);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
}
/**
@ -171,6 +170,22 @@ HWTEST_F(HdfMotionTestAdditional, testHdiEnableMotion008, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->EnableMotion(0);
EXPECT_EQ(HDF_SUCCESS, ret);
}
/**
* @tc.number : SUB_Driver_Motion_Hdienablemotion_0900
* @tc.name : testHdiEnableMotion009
* @tc.desc : Testing the effectiveness of the EnableMotion function
*/
HWTEST_F(HdfMotionTestAdditional, testHdiEnableMotion009, Function | MediumTest | Level1)
{
if (g_motionInterface == nullptr) {
ASSERT_NE(nullptr, g_motionInterface);
return;
}
int32_t ret = g_motionInterface->EnableMotion(-1);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
}
@ -251,10 +266,8 @@ HWTEST_F(HdfMotionTestAdditional, testHdiDisableMotion005, Function | MediumTest
return;
}
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->DisableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_CLOSE_TO_EAR);
EXPECT_EQ(HDF_SUCCESS, ret);
}
int32_t ret = g_motionInterface->DisableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_WRIST_DOWN);
EXPECT_EQ(HDF_SUCCESS, ret);
}
/**
@ -269,8 +282,10 @@ HWTEST_F(HdfMotionTestAdditional, testHdiDisableMotion006, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->DisableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_MAX);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->DisableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_CLOSE_TO_EAR);
EXPECT_EQ(HDF_SUCCESS, ret);
}
}
/**
@ -285,8 +300,8 @@ HWTEST_F(HdfMotionTestAdditional, testHdiDisableMotion007, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->DisableMotion(0);
EXPECT_EQ(HDF_SUCCESS, ret);
int32_t ret = g_motionInterface->DisableMotion(OHOS::HDI::Motion::V1_1::HDF_MOTION_TYPE_MAX);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
}
/**
@ -301,6 +316,22 @@ HWTEST_F(HdfMotionTestAdditional, testHdiDisableMotion008, Function | MediumTest
return;
}
int32_t ret = g_motionInterface->DisableMotion(0);
EXPECT_EQ(HDF_SUCCESS, ret);
}
/**
* @tc.number : SUB_Driver_Motion_Hdidisablemotion_0900
* @tc.name : testHdiDisableMotion009
* @tc.desc : Testing the effectiveness of the DisableMotion function
*/
HWTEST_F(HdfMotionTestAdditional, testHdiDisableMotion009, Function | MediumTest | Level1)
{
if (g_motionInterface == nullptr) {
ASSERT_NE(nullptr, g_motionInterface);
return;
}
int32_t ret = g_motionInterface->DisableMotion(-1);
EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
}
@ -321,6 +352,46 @@ HWTEST_F(HdfMotionTestAdditional, testHdiRegister001, Function | MediumTest | Le
EXPECT_EQ(HDF_SUCCESS, ret);
}
/**
* @tc.number : SUB_Driver_Motion_Hdiregister_0200
* @tc.name : testHdiRegister002
* @tc.desc : Testing the effectiveness of the Register function
*/
HWTEST_F(HdfMotionTestAdditional, testHdiRegister002, Function | MediumTest | Level1)
{
if (g_motionInterface == nullptr) {
ASSERT_NE(nullptr, g_motionInterface);
return;
}
int32_t ret = g_motionInterface->Register(g_motionCallback);
EXPECT_EQ(HDF_SUCCESS, ret);
ret = g_motionInterface->Register(g_motionCallback);
EXPECT_EQ(HDF_FAILURE, ret);
}
/**
* @tc.number : SUB_Driver_Motion_Hdiregister_0300
* @tc.name : testHdiRegister003
* @tc.desc : Testing the effectiveness of the Register function
*/
HWTEST_F(HdfMotionTestAdditional, testHdiRegister003, Function | MediumTest | Level1)
{
if (g_motionInterface == nullptr) {
ASSERT_NE(nullptr, g_motionInterface);
return;
}
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->Register(g_motionCallback);
EXPECT_EQ(HDF_SUCCESS, ret);
ret = g_motionInterface->Unregister(g_motionCallback);
EXPECT_EQ(HDF_SUCCESS, ret);
}
}
/**
* @tc.number : SUB_Driver_Motion_Hdiunregister_0100
* @tc.name : testHdiUnregister001
@ -345,7 +416,7 @@ HWTEST_F(HdfMotionTestAdditional, testHdiUnregister001, Function | MediumTest |
* @tc.name : testHdiUnregister002
* @tc.desc : Testing the effectiveness of the Unregister function
*/
HWTEST_F(HdfMotionTestAdditional, testHdiUnregister002, Function | MediumTest | Level2)
HWTEST_F(HdfMotionTestAdditional, testHdiUnregister002, Function | MediumTest | Level1)
{
if (g_motionInterface == nullptr) {
ASSERT_NE(nullptr, g_motionInterface);
@ -374,11 +445,11 @@ HWTEST_F(HdfMotionTestAdditional, testHdiUnregister003, Function | MediumTest |
return;
}
for (size_t i = 0; i < 100; i++) {
for (size_t i = 0; i < 1000; i++) {
int32_t ret = g_motionInterface->Register(g_motionCallback);
EXPECT_EQ(HDF_SUCCESS, ret);
ret = g_motionInterface->Unregister(g_motionCallback);
EXPECT_EQ(HDF_SUCCESS, ret);
}
}
}