Module: wine Branch: master Commit: e9e009b723e2fe7d1d38733d8909b53bb5b4d43f URL: https://gitlab.winehq.org/wine/wine/-/commit/e9e009b723e2fe7d1d38733d8909b53...
Author: Connor McAdams cmcadams@codeweavers.com Date: Thu Sep 21 10:50:35 2023 -0400
uiautomationcore: Implement IUIAutomationElement::get_CachedIsKeyboardFocusable.
Signed-off-by: Connor McAdams cmcadams@codeweavers.com
---
dlls/uiautomationcore/tests/uiautomation.c | 12 ++++++------ dlls/uiautomationcore/uia_com_client.c | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index b3f4d2517f5..6eb1f204dbb 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -13616,22 +13616,22 @@ static void test_Element_cache_methods(IUIAutomation *uia_iface)
/* Cached UIA_IsKeyboardFocusablePropertyId helper. */ hr = IUIAutomationElement_get_CachedIsKeyboardFocusable(element, NULL); - todo_wine ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
tmp_bool = 0xdeadbeef; hr = IUIAutomationElement_get_CachedIsKeyboardFocusable(element, &tmp_bool); - todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); ok(tmp_bool == 0xdeadbeef, "Unexpected tmp_bool %d\n", tmp_bool);
tmp_bool = 0xdeadbeef; hr = IUIAutomationElement_get_CachedIsKeyboardFocusable(element2, &tmp_bool); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(!tmp_bool, "tmp_bool != FALSE\n"); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!tmp_bool, "tmp_bool != FALSE\n");
tmp_bool = FALSE; hr = IUIAutomationElement_get_CachedIsKeyboardFocusable(element3, &tmp_bool); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(!!tmp_bool, "tmp_bool == FALSE\n"); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!tmp_bool, "tmp_bool == FALSE\n");
/* Cached UIA_NamePropertyId helper. */ hr = IUIAutomationElement_get_CachedName(element, NULL); diff --git a/dlls/uiautomationcore/uia_com_client.c b/dlls/uiautomationcore/uia_com_client.c index d949b3c0a92..d517b680bdd 100644 --- a/dlls/uiautomationcore/uia_com_client.c +++ b/dlls/uiautomationcore/uia_com_client.c @@ -2461,8 +2461,21 @@ static HRESULT WINAPI uia_element_get_CachedHasKeyboardFocus(IUIAutomationElemen
static HRESULT WINAPI uia_element_get_CachedIsKeyboardFocusable(IUIAutomationElement9 *iface, BOOL *ret_val) { - FIXME("%p: stub\n", iface); - return E_NOTIMPL; + struct uia_element *element = impl_from_IUIAutomationElement9(iface); + const int prop_id = UIA_IsKeyboardFocusablePropertyId; + struct uia_cache_property *cache_prop = NULL; + + TRACE("%p, %p\n", iface, ret_val); + + if (!ret_val) + return E_POINTER; + + if (!(cache_prop = bsearch(&prop_id, element->cached_props, element->cached_props_count, sizeof(*cache_prop), + uia_cached_property_id_compare))) + return E_INVALIDARG; + + *ret_val = ((V_VT(&cache_prop->prop_val) == VT_BOOL) && (V_BOOL(&cache_prop->prop_val) == VARIANT_TRUE)); + return S_OK; }
static HRESULT WINAPI uia_element_get_CachedIsEnabled(IUIAutomationElement9 *iface, BOOL *ret_val)