!38488 无障碍属性配置group 为true的节点 的子节点如果level为yes,也可被hover 搜索到

Merge pull request !38488 from zhanghangkai/master
This commit is contained in:
openharmony_ci 2024-07-23 09:37:46 +00:00 committed by Gitee
commit b219b312d3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 124 additions and 86 deletions

View File

@ -117,12 +117,37 @@ AccessibilityHoverTestPath AccessibilityProperty::HoverTest(
AccessibilityHoverTestPath path;
CHECK_NULL_RETURN(root, path);
ACE_SCOPED_TRACE("AccessibilityHoverTest");
AccessibilityProperty::HoverTestRecursive(point, root, path, debugInfo);
bool ancestorGroupFlag = false;
auto accessibilityProperty = root->GetAccessibilityProperty<NG::AccessibilityProperty>();
if (accessibilityProperty != nullptr) {
ancestorGroupFlag = accessibilityProperty->IsAccessibilityGroup();
}
AccessibilityProperty::HoverTestRecursive(point, root, path, debugInfo, ancestorGroupFlag);
return path;
}
void GetHitTestModeStr(HitTestMode hitTestMode, std::string& testModeStr)
{
switch (hitTestMode) {
case HitTestMode::HTMDEFAULT:
testModeStr = "Default";
break;
case HitTestMode::HTMBLOCK:
testModeStr = "Block";
break;
case HitTestMode::HTMTRANSPARENT:
testModeStr = "Transparent";
break;
case HitTestMode::HTMNONE:
testModeStr = "None";
break;
default:
testModeStr = "Unsupported";
}
}
std::unique_ptr<JsonValue> AccessibilityProperty::CreateNodeSearchInfo(const RefPtr<FrameNode>& node,
const PointF& parentPoint)
const PointF& parentPoint, bool& ancestorGroupFlag)
{
auto nodeInfo = JsonUtil::Create();
nodeInfo->Put("id", node->GetAccessibilityId());
@ -131,9 +156,11 @@ std::unique_ptr<JsonValue> AccessibilityProperty::CreateNodeSearchInfo(const Ref
nodeInfo->Put("parent", node->GetParent()->GetAccessibilityId());
}
nodeInfo->Put("visible", node->IsVisible());
auto [shouldSearchSelf, shouldSearchChildren] = AccessibilityProperty::GetSearchStrategy(node);
auto [shouldSearchSelf, shouldSearchChildren, groupFlag]
= AccessibilityProperty::GetSearchStrategy(node, ancestorGroupFlag);
nodeInfo->Put("shouldSearchSelf", shouldSearchSelf);
nodeInfo->Put("shouldSearchChildren", shouldSearchChildren);
nodeInfo->Put("currentGroup", groupFlag);
auto renderContext = node->GetRenderContext();
auto rect = renderContext->GetPaintRectWithoutTransform();
@ -158,28 +185,14 @@ std::unique_ptr<JsonValue> AccessibilityProperty::CreateNodeSearchInfo(const Ref
}
std::string testModeStr = "";
switch (node->GetHitTestMode()) {
case HitTestMode::HTMDEFAULT:
testModeStr = "Default";
break;
case HitTestMode::HTMBLOCK:
testModeStr = "Block";
break;
case HitTestMode::HTMTRANSPARENT:
testModeStr = "Transparent";
break;
case HitTestMode::HTMNONE:
testModeStr = "None";
break;
default:
testModeStr = "Unsupported";
}
GetHitTestModeStr(node->GetHitTestMode(), testModeStr);
nodeInfo->Put("hitTestMode", testModeStr.c_str());
return nodeInfo;
}
bool AccessibilityProperty::ProcessHoverTestRecursive(const PointF& noOffsetPoint, const RefPtr<FrameNode>& node,
AccessibilityHoverTestPath& path, std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo, bool hitTarget)
AccessibilityHoverTestPath& path, std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo,
RecursiveParam recursiveParam)
{
auto property = node->GetAccessibilityProperty<NG::AccessibilityProperty>();
auto virtualNode = property->GetAccessibilityVirtualNode();
@ -187,7 +200,8 @@ bool AccessibilityProperty::ProcessHoverTestRecursive(const PointF& noOffsetPoin
auto frameNode = AceType::DynamicCast<FrameNode>(virtualNode);
CHECK_NULL_RETURN(frameNode, false);
if (AccessibilityProperty::HoverTestRecursive(noOffsetPoint, frameNode, path, debugInfo)) {
if (AccessibilityProperty::HoverTestRecursive(noOffsetPoint, frameNode, path, debugInfo,
recursiveParam.ancestorGroupFlag)) {
return true;
}
} else {
@ -197,19 +211,21 @@ bool AccessibilityProperty::ProcessHoverTestRecursive(const PointF& noOffsetPoin
if (child == nullptr) {
continue;
}
if (AccessibilityProperty::HoverTestRecursive(noOffsetPoint, child, path, debugInfo)) {
if (AccessibilityProperty::HoverTestRecursive(noOffsetPoint, child, path, debugInfo,
recursiveParam.ancestorGroupFlag)) {
return true;
}
}
}
return hitTarget;
return recursiveParam.hitTarget;
}
bool AccessibilityProperty::HoverTestRecursive(
const PointF& parentPoint,
const RefPtr<FrameNode>& node,
AccessibilityHoverTestPath& path,
std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo)
std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo,
bool& ancestorGroupFlag)
{
if (!node->IsAccessibilityVirtualNode()) {
if (!node->IsActive() || node->IsInternal()) {
@ -217,7 +233,7 @@ bool AccessibilityProperty::HoverTestRecursive(
}
}
if (debugInfo != nullptr) {
auto nodeInfo = CreateNodeSearchInfo(node, parentPoint);
auto nodeInfo = CreateNodeSearchInfo(node, parentPoint, ancestorGroupFlag);
debugInfo->trace.push_back(std::move(nodeInfo));
}
bool hitTarget = false;
@ -225,7 +241,8 @@ bool AccessibilityProperty::HoverTestRecursive(
return false;
}
auto [shouldSearchSelf, shouldSearchChildren] = AccessibilityProperty::GetSearchStrategy(node);
auto [shouldSearchSelf, shouldSearchChildren, currentGroupFlag]
= AccessibilityProperty::GetSearchStrategy(node, ancestorGroupFlag);
auto renderContext = node->GetRenderContext();
auto rect = renderContext->GetPaintRectWithoutTransform();
@ -243,7 +260,10 @@ bool AccessibilityProperty::HoverTestRecursive(
if (shouldSearchChildren) {
PointF noOffsetPoint = selfPoint - rect.GetOffset();
return ProcessHoverTestRecursive(noOffsetPoint, node, path, debugInfo, hitTarget);
RecursiveParam recursiveParam;
recursiveParam.hitTarget = hitTarget;
recursiveParam.ancestorGroupFlag = currentGroupFlag;
return ProcessHoverTestRecursive(noOffsetPoint, node, path, debugInfo, recursiveParam);
}
return hitTarget;
}
@ -264,20 +284,20 @@ void UpdateSearchStrategyByHitTestMode(HitTestMode hitTestMode, bool& shouldSear
}
}
std::pair<bool, bool> AccessibilityProperty::GetSearchStrategy(const RefPtr<FrameNode>& node)
std::tuple<bool, bool, bool> AccessibilityProperty::GetSearchStrategy(const RefPtr<FrameNode>& node,
bool& ancestorGroupFlag)
{
bool shouldSearchSelf = true;
bool shouldSearchChildren = true;
bool currentGroupFlag = false;
auto level = AccessibilityProperty::Level::AUTO;
do {
auto accessibilityProperty = node->GetAccessibilityProperty<NG::AccessibilityProperty>();
if (accessibilityProperty != nullptr) {
auto level = accessibilityProperty->GetAccessibilityLevel();
bool hasGroupOrVirtualNode = accessibilityProperty->IsAccessibilityGroup();
level = accessibilityProperty->GetAccessibilityLevel();
currentGroupFlag = accessibilityProperty->IsAccessibilityGroup();
bool hasAccessibilityText = accessibilityProperty->HasAccessibilityTextOrDescription();
if (level == AccessibilityProperty::Level::YES) {
if (hasGroupOrVirtualNode) {
shouldSearchChildren = false;
}
break;
} else if (level == AccessibilityProperty::Level::NO_HIDE_DESCENDANTS) {
shouldSearchSelf = false;
@ -288,10 +308,6 @@ std::pair<bool, bool> AccessibilityProperty::GetSearchStrategy(const RefPtr<Fram
shouldSearchSelf = false;
} else {
// shouldSearchSelf is true here
if (hasGroupOrVirtualNode) {
shouldSearchChildren = false;
break;
}
if (hasAccessibilityText) {
break;
}
@ -310,7 +326,15 @@ std::pair<bool, bool> AccessibilityProperty::GetSearchStrategy(const RefPtr<Fram
shouldSearchChildren = true;
}
} while (0);
return std::make_pair(shouldSearchSelf, shouldSearchChildren);
if (ancestorGroupFlag == true) {
if (level != AccessibilityProperty::Level::YES) {
shouldSearchSelf = false;
}
currentGroupFlag = true;
}
return std::make_tuple(shouldSearchSelf, shouldSearchChildren, currentGroupFlag);
}
static const std::set<std::string> TAGS_FOCUSABLE = {

View File

@ -652,13 +652,21 @@ private:
const PointF& parentPoint,
const RefPtr<FrameNode>& node,
AccessibilityHoverTestPath& path,
std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo
std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo,
bool& ancestorGroupFlag
);
static bool ProcessHoverTestRecursive(const PointF& noOffsetPoint, const RefPtr<FrameNode>& node,
AccessibilityHoverTestPath& path, std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo, bool hitTarget);
struct RecursiveParam {
bool hitTarget;
bool ancestorGroupFlag;
};
static std::unique_ptr<JsonValue> CreateNodeSearchInfo(const RefPtr<FrameNode>& node, const PointF& parentPoint);
static bool ProcessHoverTestRecursive(const PointF& noOffsetPoint, const RefPtr<FrameNode>& node,
AccessibilityHoverTestPath& path, std::unique_ptr<HoverTestDebugTraceInfo>& debugInfo,
RecursiveParam recursiveParam);
static std::unique_ptr<JsonValue> CreateNodeSearchInfo(const RefPtr<FrameNode>& node, const PointF& parentPoint,
bool& ancestorGroupFlag);
/*
* Get whether node and its children should be searched.
@ -666,7 +674,7 @@ private:
* second: children of node should be searched.
* param: {node} should be not-null
*/
static std::pair<bool, bool> GetSearchStrategy(const RefPtr<FrameNode>& node);
static std::tuple<bool, bool, bool> GetSearchStrategy(const RefPtr<FrameNode>& node, bool& ancestorGroupFlag);
void GetGroupTextRecursive(bool forceGetChildren, std::string& text) const;

View File

@ -437,17 +437,18 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest009, TestSize.Lev
HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest010, TestSize.Level1)
{
AccessibilityProperty accessibilityProperty;
bool ancestorGroupFlag = false;
auto root = FrameNode::CreateFrameNode(
V2::BUTTON_ETS_TAG, 12, AceType::MakeRefPtr<Pattern>(), true);
NG::PointF hoverPoint(0, 0);
auto result = accessibilityProperty.CreateNodeSearchInfo(root, hoverPoint);
auto result = accessibilityProperty.CreateNodeSearchInfo(root, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(root->IsRootNode());
auto subNode = FrameNode::GetOrCreateFrameNode(
V2::BUTTON_ETS_TAG, 1, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode);
EXPECT_FALSE(subNode->IsRootNode());
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint);
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result->Contains("parent"));
EXPECT_TRUE(result->Contains("visible"));
@ -456,7 +457,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest010, TestSize.Lev
EXPECT_TRUE(result->Contains("accessibilityLevel"));
root->SetHitTestMode(HitTestMode::HTMDEFAULT);
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint);
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result->Contains("hitTestMode"));
std::string value = result->GetString("hitTestMode");
EXPECT_EQ(value, "Default");
@ -465,7 +466,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest010, TestSize.Lev
V2::BUTTON_ETS_TAG, 2, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode1);
subNode1->SetHitTestMode(HitTestMode::HTMBLOCK);
auto result1 = accessibilityProperty.CreateNodeSearchInfo(subNode1, hoverPoint);
auto result1 = accessibilityProperty.CreateNodeSearchInfo(subNode1, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result1->Contains("hitTestMode"));
std::string value1 = result1->GetString("hitTestMode");
EXPECT_EQ(value1, "Block");
@ -474,7 +475,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest010, TestSize.Lev
V2::BUTTON_ETS_TAG, 3, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode2);
subNode2->SetHitTestMode(HitTestMode::HTMTRANSPARENT);
auto result2 = accessibilityProperty.CreateNodeSearchInfo(subNode2, hoverPoint);
auto result2 = accessibilityProperty.CreateNodeSearchInfo(subNode2, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result2->Contains("hitTestMode"));
std::string value2 = result2->GetString("hitTestMode");
EXPECT_EQ(value2, "Transparent");
@ -495,13 +496,15 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest011, TestSize.Lev
NG::PointF hoverPoint(0, 0);
auto debugInfo = std::make_unique<AccessibilityProperty::HoverTestDebugTraceInfo>();
bool ancestorGroupFlag = false;
root->SetActive(false);
auto result = accessibilityProperty.HoverTestRecursive(hoverPoint, root, path, debugInfo);
auto result = accessibilityProperty.HoverTestRecursive(hoverPoint, root, path, debugInfo, ancestorGroupFlag);
EXPECT_EQ(result, false);
root->SetActive(true);
root->SetInternal();
result = accessibilityProperty.HoverTestRecursive(hoverPoint, root, path, debugInfo);
result = accessibilityProperty.HoverTestRecursive(hoverPoint, root, path, debugInfo, ancestorGroupFlag);
EXPECT_EQ(result, false);
root->SetActive(true);
@ -516,50 +519,51 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest011, TestSize.Lev
HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest012, TestSize.Level1)
{
AccessibilityProperty accessibilityProperty;
bool ancestorGroupFlag = false;
auto frameNode = FrameNode::GetOrCreateFrameNode(
V2::BUTTON_ETS_TAG, 14, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
auto result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
auto result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
auto accessibilityPropertyNew = frameNode->GetAccessibilityProperty<NG::AccessibilityProperty>();
EXPECT_NE(accessibilityPropertyNew, nullptr);
auto levelBak = accessibilityPropertyNew->GetAccessibilityLevel();
accessibilityPropertyNew->SetAccessibilityLevel(AccessibilityProperty::Level::YES);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
bool hasGroupOrVirtualNodeBak = accessibilityPropertyNew->IsAccessibilityGroup();
accessibilityPropertyNew->SetAccessibilityGroup(true);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, true));
accessibilityPropertyNew->SetAccessibilityGroup(hasGroupOrVirtualNodeBak);
accessibilityPropertyNew->SetAccessibilityLevel(levelBak);
accessibilityPropertyNew->SetAccessibilityLevel(AccessibilityProperty::Level::NO_HIDE_DESCENDANTS);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(false, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(false, false, false));
accessibilityPropertyNew->SetAccessibilityLevel(levelBak);
hasGroupOrVirtualNodeBak = accessibilityPropertyNew->IsAccessibilityGroup();
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
accessibilityPropertyNew->SetAccessibilityGroup(true);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, true));
accessibilityPropertyNew->SetAccessibilityGroup(hasGroupOrVirtualNodeBak);
accessibilityPropertyNew->SetAccessibilityLevel(AccessibilityProperty::Level::NO);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(false, true));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(false, true, false));
accessibilityPropertyNew->SetAccessibilityLevel(AccessibilityProperty::Level::AUTO);
accessibilityPropertyNew->SetAccessibilityGroup(true);
bool hasGroupOrVirtualNode = accessibilityPropertyNew->IsAccessibilityGroup() ||
accessibilityPropertyNew->HasAccessibilityVirtualNode();
EXPECT_TRUE(hasGroupOrVirtualNode);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, true));
accessibilityPropertyNew->SetAccessibilityGroup(hasGroupOrVirtualNodeBak);
}
@ -913,17 +917,18 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest028, TestSize.Lev
HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest029, TestSize.Level1)
{
AccessibilityProperty accessibilityProperty;
bool ancestorGroupFlag = false;
auto root = FrameNode::CreateFrameNode(
V2::BUTTON_ETS_TAG, 12, AceType::MakeRefPtr<Pattern>(), true);
NG::PointF hoverPoint(0, 0);
auto result = accessibilityProperty.CreateNodeSearchInfo(root, hoverPoint);
auto result = accessibilityProperty.CreateNodeSearchInfo(root, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(root->IsRootNode());
auto subNode = FrameNode::GetOrCreateFrameNode(
V2::BUTTON_ETS_TAG, 1, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode);
EXPECT_FALSE(subNode->IsRootNode());
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint);
result = accessibilityProperty.CreateNodeSearchInfo(subNode, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result->Contains("parent"));
EXPECT_TRUE(result->Contains("visible"));
@ -935,7 +940,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest029, TestSize.Lev
V2::BUTTON_ETS_TAG, 4, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode3);
subNode3->SetHitTestMode(HitTestMode::HTMNONE);
auto result3 = accessibilityProperty.CreateNodeSearchInfo(subNode3, hoverPoint);
auto result3 = accessibilityProperty.CreateNodeSearchInfo(subNode3, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result3->Contains("hitTestMode"));
std::string value3 = result3->GetString("hitTestMode");
EXPECT_EQ(value3, "None");
@ -944,7 +949,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest029, TestSize.Lev
V2::BUTTON_ETS_TAG, 5, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
root->AddChild(subNode4);
subNode4->SetHitTestMode(HitTestMode::HTMTRANSPARENT_SELF);
auto result4 = accessibilityProperty.CreateNodeSearchInfo(subNode4, hoverPoint);
auto result4 = accessibilityProperty.CreateNodeSearchInfo(subNode4, hoverPoint, ancestorGroupFlag);
EXPECT_TRUE(result4->Contains("hitTestMode"));
std::string value4 = result4->GetString("hitTestMode");
EXPECT_EQ(value4, "Unsupported");
@ -958,6 +963,7 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest029, TestSize.Lev
HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest030, TestSize.Level1)
{
AccessibilityProperty accessibilityProperty;
bool ancestorGroupFlag = false;
auto frameNode = FrameNode::GetOrCreateFrameNode(
V2::BUTTON_ETS_TAG, 14, []() { return AceType::MakeRefPtr<ButtonPattern>(); });
@ -965,23 +971,23 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest030, TestSize.Lev
EXPECT_NE(accessibilityPropertyNew, nullptr);
auto levelBak = accessibilityPropertyNew->GetAccessibilityLevel();
accessibilityPropertyNew->SetAccessibilityLevel(AccessibilityProperty::Level::YES);
auto result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
auto result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
bool hasGroupOrVirtualNodeBak = accessibilityPropertyNew->IsAccessibilityGroup();
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
accessibilityPropertyNew->SetAccessibilityGroup(true);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, true));
accessibilityPropertyNew->SetAccessibilityGroup(hasGroupOrVirtualNodeBak);
accessibilityPropertyNew->SetAccessibilityText("test");
bool hasAccessibilityText = accessibilityPropertyNew->HasAccessibilityTextOrDescription();
EXPECT_TRUE(hasAccessibilityText);
result = accessibilityPropertyNew->GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, true));
result = accessibilityPropertyNew->GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, true, false));
accessibilityPropertyNew->SetAccessibilityLevel(levelBak);
frameNode->accessibilityProperty_ = nullptr;
@ -991,19 +997,19 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest030, TestSize.Lev
auto eventHub = frameNode->GetEventHub<EventHub>();
eventHub->SetEnabled(false);
EXPECT_FALSE(eventHub->IsEnabled());
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, false, false));
frameNode->SetHitTestMode(HitTestMode::HTMBLOCK);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, false, false));
frameNode->SetHitTestMode(HitTestMode::HTMTRANSPARENT);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(true, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(true, false, false));
frameNode->SetHitTestMode(HitTestMode::HTMNONE);
result = accessibilityProperty.GetSearchStrategy(frameNode);
EXPECT_EQ(result, std::make_pair(false, false));
result = accessibilityProperty.GetSearchStrategy(frameNode, ancestorGroupFlag);
EXPECT_EQ(result, std::make_tuple(false, false, false));
}
} // namespace OHOS::Ace::NG