uiautomationcore: Implement ILegacyIAccessibleProvider::get_Role for MSAA providers.

Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
This commit is contained in:
Connor McAdams 2023-02-14 16:17:09 -05:00 committed by Alexandre Julliard
parent 74f06be676
commit 6f2aa68e9f
2 changed files with 32 additions and 2 deletions

View file

@ -3556,6 +3556,9 @@ static void test_uia_prov_from_acc_properties(void)
for (i = 0; i < ARRAY_SIZE(msaa_role_uia_types); i++)
{
const struct msaa_role_uia_type *role = &msaa_role_uia_types[i];
ILegacyIAccessibleProvider *accprov;
DWORD role_val;
IUnknown *unk;
/*
* Roles get cached once a valid one is mapped, so create a new
@ -3588,6 +3591,22 @@ static void test_uia_prov_from_acc_properties(void)
if (!role->uia_control_type)
CHECK_CALLED(Accessible_get_accRole);
hr = IRawElementProviderSimple_GetPatternProvider(elprov, UIA_LegacyIAccessiblePatternId, &unk);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!unk, "unk == NULL\n");
hr = IUnknown_QueryInterface(unk, &IID_ILegacyIAccessibleProvider, (void **)&accprov);
IUnknown_Release(unk);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!accprov, "accprov == NULL\n");
SET_EXPECT(Accessible_get_accRole);
hr = ILegacyIAccessibleProvider_get_Role(accprov, &role_val);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(role_val == Accessible.role, "role_val != Accessible.role\n");
CHECK_CALLED(Accessible_get_accRole);
ILegacyIAccessibleProvider_Release(accprov);
IRawElementProviderSimple_Release(elprov);
ok(Accessible.ref == 1, "Unexpected refcnt %ld\n", Accessible.ref);
}

View file

@ -1066,8 +1066,19 @@ static HRESULT WINAPI msaa_acc_provider_get_Description(ILegacyIAccessibleProvid
static HRESULT WINAPI msaa_acc_provider_get_Role(ILegacyIAccessibleProvider *iface, DWORD *out_role)
{
FIXME("%p, %p: stub!\n", iface, out_role);
return E_NOTIMPL;
struct msaa_provider *msaa_prov = impl_from_msaa_acc_provider(iface);
HRESULT hr;
VARIANT v;
TRACE("%p, %p\n", iface, out_role);
*out_role = 0;
VariantInit(&v);
hr = IAccessible_get_accRole(msaa_prov->acc, msaa_prov->cid, &v);
if (SUCCEEDED(hr) && V_VT(&v) == VT_I4)
*out_role = V_I4(&v);
return S_OK;
}
static HRESULT WINAPI msaa_acc_provider_get_State(ILegacyIAccessibleProvider *iface, DWORD *out_state)