From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/tests/uiautomation.c | 19 +++++++++++++++++-- dlls/uiautomationcore/uia_client.c | 10 ++++++++++ dlls/uiautomationcore/uia_ids.c | 4 +++- 3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index 969ddec644e..c13fa835fb6 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -1119,6 +1119,7 @@ struct Provider_legacy_accessible_pattern_data { BOOL is_supported; int child_id; + DWORD role; };
static struct Provider @@ -2269,8 +2270,10 @@ static HRESULT WINAPI ProviderLegacyIAccessiblePattern_get_Description(ILegacyIA
static HRESULT WINAPI ProviderLegacyIAccessiblePattern_get_Role(ILegacyIAccessibleProvider *iface, DWORD *out_role) { - ok(0, "unexpected call\n"); - return E_NOTIMPL; + struct Provider *Provider = impl_from_ProviderLegacyIAccessiblePattern(iface); + + *out_role = Provider->legacy_acc_pattern_data.role; + return S_OK; }
static HRESULT WINAPI ProviderLegacyIAccessiblePattern_get_State(ILegacyIAccessibleProvider *iface, DWORD *out_state) @@ -5744,6 +5747,18 @@ static void test_UiaGetPropertyValue(void) VariantClear(&v); }
+ for (i = 0; i < 2; i++) + { + Provider.legacy_acc_pattern_data.role = i; + + hr = UiaGetPropertyValue(node, UIA_LegacyIAccessibleRolePropertyId, &v); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(V_VT(&v) == VT_I4, "Unexpected VT %d\n", V_VT(&v)); + ok(V_I4(&v) == i, "Unexpected I4 %#lx\n", V_I4(&v)); + ok_method_sequence(get_pattern_prop_seq, NULL); + VariantClear(&v); + } + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); initialize_provider(&Provider, ProviderOptions_ServerSideProvider, NULL, FALSE); diff --git a/dlls/uiautomationcore/uia_client.c b/dlls/uiautomationcore/uia_client.c index 95287179f92..92ff41e2c71 100644 --- a/dlls/uiautomationcore/uia_client.c +++ b/dlls/uiautomationcore/uia_client.c @@ -1581,6 +1581,16 @@ static HRESULT uia_provider_get_pattern_prop_val(struct uia_provider *prov, break; }
+ case UIA_LegacyIAccessibleRolePropertyId: + { + DWORD val; + + hr = ILegacyIAccessibleProvider_get_Role((ILegacyIAccessibleProvider *)pattern_prov, &val); + if (SUCCEEDED(hr)) + variant_init_i4(ret_val, val); + break; + } + default: break; } diff --git a/dlls/uiautomationcore/uia_ids.c b/dlls/uiautomationcore/uia_ids.c index 62f26de0982..d23ba14c333 100644 --- a/dlls/uiautomationcore/uia_ids.c +++ b/dlls/uiautomationcore/uia_ids.c @@ -219,7 +219,9 @@ static const struct uia_prop_info default_uia_properties[] = { { &IsDialog_Property_GUID, UIA_IsDialogPropertyId, PROP_TYPE_ELEM_PROP, UIAutomationType_Bool, }, { &IsTextPatternAvailable_Property_GUID, UIA_IsTextPatternAvailablePropertyId, }, - { &LegacyIAccessible_Role_Property_GUID, UIA_LegacyIAccessibleRolePropertyId, }, + { &LegacyIAccessible_Role_Property_GUID, UIA_LegacyIAccessibleRolePropertyId, + PROP_TYPE_PATTERN_PROP, UIAutomationType_Int, + UIA_LegacyIAccessiblePatternId, }, { &Selection2_ItemCount_Property_GUID, UIA_Selection2ItemCountPropertyId, }, { &TableItem_RowHeaderItems_Property_GUID, UIA_TableItemRowHeaderItemsPropertyId, }, { &Styles_ExtendedProperties_Property_GUID, UIA_StylesExtendedPropertiesPropertyId, },