新增接口DT用例

修复无障碍框架偶现SearchElementInfosByAccessibilityId接口超时

Signed-off-by: taojuncun <taojuncun@huawei.com>
This commit is contained in:
taojuncun 2024-04-01 17:09:29 +08:00
parent dd28efefc2
commit 9f0f817374
3 changed files with 23 additions and 8 deletions

View File

@ -79,7 +79,7 @@ void AccessibilityElementOperatorCallbackProxy::SetSearchElementInfoByAccessibil
int32_t leftSize = static_cast<int32_t>(infos.size());
int32_t time = 0;
int32_t index = 0;
while (leftSize > 0) {
while (leftSize >= 0) {
MessageParcel data;
MessageParcel reply;
MessageOption type = MessageOption::TF_SYNC;
@ -257,4 +257,4 @@ void AccessibilityElementOperatorCallbackProxy::SetExecuteActionResult(const boo
}
}
} // namespace Accessibility
} // namespace OHOS
} // namespace OHOS

View File

@ -194,10 +194,6 @@ RetError AccessibleAbilityChannelClient::SearchElementInfosByAccessibilityId(int
return ret;
}
if (elementId == AccessibilityElementInfo::ROOT_PARENT_ID) {
elementOperator->SetSearchElementInfoByAccessibilityIdResult(elementInfos, requestId);
return RET_OK;
}
std::future_status wait = promiseFuture.wait_for(std::chrono::milliseconds(TIME_OUT_OPERATOR));
if (wait != std::future_status::ready) {
HILOG_ERROR("SearchElementInfosByAccessibilityId Failed to wait result");
@ -347,4 +343,4 @@ RetError AccessibleAbilityChannelClient::SetTargetBundleName(const std::vector<s
}
}
} // namespace Accessibility
} // namespace OHOS
} // namespace OHOS

View File

@ -462,6 +462,25 @@ HWTEST_F(AccessibilityEventInfoUnitTest, AddContent_001, TestSize.Level1)
GTEST_LOG_(INFO) << "AddContent_001 end";
}
/**
* @tc.number: SetElementInfo_001
* @tc.name: SetElementInfo
* @tc.desc: Test function SetElement&GetElement
*/
HWTEST_F(AccessibilityEventInfoUnitTest, SetElementInfo_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "SetElementInfo_001 start";
int accessibilityId = 1;
AccessibilityElementInfo elementInfo;
std::shared_ptr<AccessibilityEventInfo> eventInfo =
std::make_shared<AccessibilityEventInfo>(1, WINDOW_UPDATE_FOCUSED);
elementInfo.SetAccessibilityId(accessibilityId);
ASSERT_TRUE(eventInfo);
eventInfo->SetElementInfo(elementInfo);
EXPECT_EQ(eventInfo->GetElementInfo().GetAccessibilityId(), accessibilityId);
GTEST_LOG_(INFO) << "SetElementInfo_001 end";
}
/**
* @tc.number: AccessibilityEventInfo_001
* @tc.name: AccessibilityEventInfo
@ -478,4 +497,4 @@ HWTEST_F(AccessibilityEventInfoUnitTest, AccessibilityEventInfo_001, TestSize.Le
GTEST_LOG_(INFO) << "AccessibilityEventInfo_001 end";
}
} // namespace Accessibility
} // namespace OHOS
} // namespace OHOS