提交部分DT测试用例

Signed-off-by: chris1017 <zhangyu841@h-partners.com>
This commit is contained in:
chris1017 2024-04-28 19:28:20 +08:00
parent 0d7c2781ee
commit a411aaa8f3

View File

@ -195,6 +195,47 @@ HWTEST_F(AccessibilityElementInfoTest, GetChildId_001, TestSize.Level1)
GTEST_LOG_(INFO) << "GetChildId_001 end";
}
/**
* @tc.number: GetChildId_002
* @tc.name: GetChildId
* @tc.desc: Test function GetChildId
*/
HWTEST_F(AccessibilityElementInfoTest, GetChildId_002, TestSize.Level1)
{
GTEST_LOG_(INFO) << "GetChildId_002 start";
elementInfo_->AddChild(1);
EXPECT_EQ(elementInfo_->GetChildId(0), 1);
GTEST_LOG_(INFO) << "GetChildId_002 end";
}
/**
* @tc.number: GetChildId_003
* @tc.name: GetChildId
* @tc.desc: Test function GetChildId
*/
HWTEST_F(AccessibilityElementInfoTest, GetChildId_003, TestSize.Level1)
{
GTEST_LOG_(INFO) << "GetChildId_003 start";
int64_t childId = 1;
int32_t index = 1;
elementInfo_->AddChild(childId);
EXPECT_EQ(elementInfo_->GetChildId(index), -1);
GTEST_LOG_(INFO) << "GetChildId_003 end";
}
/**
* @tc.number: GetChildId_004
* @tc.name: GetChildId
* @tc.desc: Test function GetChildId
*/
HWTEST_F(AccessibilityElementInfoTest, GetChildId_004, TestSize.Level1)
{
GTEST_LOG_(INFO) << "GetChildId_004 start";
EXPECT_EQ(elementInfo_->GetChildId(-1), -1);
GTEST_LOG_(INFO) << "GetChildId_004 end";
}
/**
* @tc.number: GetChildCount_001
* @tc.name: GetChildCount
@ -233,6 +274,23 @@ HWTEST_F(AccessibilityElementInfoTest, AddChild_001, TestSize.Level1)
GTEST_LOG_(INFO) << "AddChild_001 end";
}
/**
* @tc.number: AddChild_002
* @tc.name: AddChild
* @tc.desc: Test function AddChild
*/
HWTEST_F(AccessibilityElementInfoTest, AddChild_002, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AddChild_002 start";
elementInfo_->AddChild(1);
EXPECT_EQ(elementInfo_->GetChildCount(), 1);
EXPECT_EQ(static_cast<int>(elementInfo_->GetChildIds().size()), 1);
elementInfo_->AddChild(1);
EXPECT_EQ(elementInfo_->GetChildCount(), 1);
EXPECT_EQ(static_cast<int>(elementInfo_->GetChildIds().size()), 1);
GTEST_LOG_(INFO) << "AddChild_002 end";
}
/**
* @tc.number: RemoveChild_001
* @tc.name: RemoveChild
@ -245,6 +303,20 @@ HWTEST_F(AccessibilityElementInfoTest, RemoveChild_001, TestSize.Level1)
GTEST_LOG_(INFO) << "RemoveChild_001 end";
}
/**
* @tc.number: RemoveChild_002
* @tc.name: RemoveChild
* @tc.desc: Test function RemoveChild
*/
HWTEST_F(AccessibilityElementInfoTest, RemoveChild_002, TestSize.Level1)
{
GTEST_LOG_(INFO) << "RemoveChild_002 start";
elementInfo_->AddChild(1);
EXPECT_EQ(elementInfo_->GetChildCount(), 1);
EXPECT_TRUE(elementInfo_->RemoveChild(1));
GTEST_LOG_(INFO) << "RemoveChild_002 end";
}
/**
* @tc.number: GetActionList_001
* @tc.name: GetActionList
@ -303,6 +375,41 @@ HWTEST_F(AccessibilityElementInfoTest, DeleteAction_002, TestSize.Level1)
GTEST_LOG_(INFO) << "DeleteAction_002 end";
}
/**
* @tc.number: DeleteAction_003
* @tc.name: DeleteAction
* @tc.desc: Test function DeleteAction
*/
HWTEST_F(AccessibilityElementInfoTest, DeleteAction_003, TestSize.Level1)
{
GTEST_LOG_(INFO) << "DeleteAction_003 start";
AccessibleAction action = AccessibleAction(
ACCESSIBILITY_ACTION_FOCUS, std::string("accessibility_action_focus"));
AccessibleAction actionSelect = AccessibleAction(
ACCESSIBILITY_ACTION_SELECT, std::string("accessiblety_action_select"));
elementInfo_->AddAction(action);
EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1);
elementInfo_->DeleteAction(actionSelect);
EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1);
GTEST_LOG_(INFO) << "DeleteAction_003 end";
}
/**
* @tc.number: DeleteAction_004
* @tc.name: DeleteAction
* @tc.desc: Test function DeleteAction
*/
HWTEST_F(AccessibilityElementInfoTest, DeleteAction_004, TestSize.Level1)
{
GTEST_LOG_(INFO) << "DeleteAction_004 start";
ActionType actionType = ActionType::ACCESSIBILITY_ACTION_FOCUS;
AccessibleAction action = AccessibleAction(actionType, std::string("accessibility_aciton_foucus"));
elementInfo_->AddAction(action);
EXPECT_EQ(static_cast<int>(elementInfo_->GetActionList().size()), 1);
EXPECT_TRUE(elementInfo_->DeleteAction(actionType));
GTEST_LOG_(INFO) << "DeleteAction_004 end";
}
/**
* @tc.number: DeleteAllActions_001
* @tc.name: DeleteAllActions