Commit f6e90adc authored by Victor Fei's avatar Victor Fei Committed by Commit Bot

UIA: added UIA_IsDialogPropertyID to GetPropertyValue

Added UIA_IsDialogPropertyID to AxPlatformNodeWin::GetPropertyValue and
associated unittests.

Bug: 844149
Change-Id: Iebdc0a6227022bb27c355b799f40a9480d3ee7e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757887Reviewed-by: default avatarIan Prest <iapres@microsoft.com>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Ian Prest <iapres@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#688668}
parent 0ff4fa2c
...@@ -147,6 +147,16 @@ bool IsDocument(const ax::mojom::Role role) { ...@@ -147,6 +147,16 @@ bool IsDocument(const ax::mojom::Role role) {
} }
} }
bool IsDialog(const ax::mojom::Role role) {
switch (role) {
case ax::mojom::Role::kAlertDialog:
case ax::mojom::Role::kDialog:
return true;
default:
return false;
}
}
bool IsHeading(const ax::mojom::Role role) { bool IsHeading(const ax::mojom::Role role) {
switch (role) { switch (role) {
case ax::mojom::Role::kHeading: case ax::mojom::Role::kHeading:
......
...@@ -37,6 +37,9 @@ AX_EXPORT bool IsControl(const ax::mojom::Role role); ...@@ -37,6 +37,9 @@ AX_EXPORT bool IsControl(const ax::mojom::Role role);
// Returns true if the provided role belongs to a document. // Returns true if the provided role belongs to a document.
AX_EXPORT bool IsDocument(const ax::mojom::Role role); AX_EXPORT bool IsDocument(const ax::mojom::Role role);
// Returns true if the provided role represents a dialog.
AX_EXPORT bool IsDialog(const ax::mojom::Role role);
// Returns true if the provided role belongs to a heading. // Returns true if the provided role belongs to a heading.
AX_EXPORT bool IsHeading(const ax::mojom::Role role); AX_EXPORT bool IsHeading(const ax::mojom::Role role);
......
...@@ -3850,6 +3850,11 @@ IFACEMETHODIMP AXPlatformNodeWin::GetPropertyValue(PROPERTYID property_id, ...@@ -3850,6 +3850,11 @@ IFACEMETHODIMP AXPlatformNodeWin::GetPropertyValue(PROPERTYID property_id,
} }
break; break;
case UIA_IsDialogPropertyId:
result->vt = VT_BOOL;
result->boolVal = IsDialog(data.role) ? VARIANT_TRUE : VARIANT_FALSE;
break;
case UIA_IsKeyboardFocusablePropertyId: case UIA_IsKeyboardFocusablePropertyId:
result->vt = VT_BOOL; result->vt = VT_BOOL;
result->boolVal = result->boolVal =
......
...@@ -3684,6 +3684,30 @@ TEST_F(AXPlatformNodeWinTest, TestUIAGetPropertyValue_Histogram) { ...@@ -3684,6 +3684,30 @@ TEST_F(AXPlatformNodeWinTest, TestUIAGetPropertyValue_Histogram) {
} }
} }
TEST_F(AXPlatformNodeWinTest, UIAGetPropertyValueIsDialog) {
AXNodeData root;
root.id = 1;
root.role = ax::mojom::Role::kRootWebArea;
root.child_ids = {2, 3};
AXNodeData alert_dialog;
alert_dialog.id = 2;
alert_dialog.role = ax::mojom::Role::kAlertDialog;
AXNodeData dialog;
dialog.id = 3;
dialog.role = ax::mojom::Role::kDialog;
Init(root, alert_dialog, dialog);
EXPECT_UIA_BOOL_EQ(GetRootIRawElementProviderSimple(), UIA_IsDialogPropertyId,
false);
EXPECT_UIA_BOOL_EQ(GetIRawElementProviderSimpleFromChildIndex(0),
UIA_IsDialogPropertyId, true);
EXPECT_UIA_BOOL_EQ(GetIRawElementProviderSimpleFromChildIndex(1),
UIA_IsDialogPropertyId, true);
}
TEST_F(AXPlatformNodeWinTest, TestUIAGetControllerForPropertyId) { TEST_F(AXPlatformNodeWinTest, TestUIAGetControllerForPropertyId) {
AXNodeData root; AXNodeData root;
root.id = 1; root.id = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment