1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

uiautomationcore: Implement IUIAutomationElement::get_CurrentName.

Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
This commit is contained in:
Connor McAdams 2023-02-03 09:36:10 -05:00 committed by Alexandre Julliard
parent 0b487338f3
commit c31e531318
2 changed files with 35 additions and 2 deletions

View file

@ -9796,6 +9796,7 @@ static void test_Element_GetPropertyValue(IUIAutomation *uia_iface)
IUIAutomationElement *element;
int i, prop_id, tmp_int;
IUnknown *unk_ns;
BSTR tmp_bstr;
HRESULT hr;
VARIANT v;
@ -9885,6 +9886,25 @@ static void test_Element_GetPropertyValue(IUIAutomation *uia_iface)
set_provider_prop_override(&Provider, NULL, 0);
ok_method_sequence(get_prop_seq, NULL);
/*
* IUIAutomationElement_get_CurrentName tests.
*/
tmp_bstr = NULL;
hr = IUIAutomationElement_get_CurrentName(element, &tmp_bstr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(tmp_bstr, uia_bstr_prop_str), "Unexpected BSTR %s\n", wine_dbgstr_w(tmp_bstr));
SysFreeString(tmp_bstr);
ok_method_sequence(get_prop_seq, NULL);
tmp_bstr = NULL;
Provider.ret_invalid_prop_type = TRUE;
hr = IUIAutomationElement_get_CurrentName(element, &tmp_bstr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(tmp_bstr, L""), "Unexpected BSTR %s\n", wine_dbgstr_w(tmp_bstr));
SysFreeString(tmp_bstr);
Provider.ret_invalid_prop_type = FALSE;
ok_method_sequence(get_prop_invalid_type_seq, NULL);
IUIAutomationElement_Release(element);
ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref);

View file

@ -269,8 +269,21 @@ static HRESULT WINAPI uia_element_get_CurrentLocalizedControlType(IUIAutomationE
static HRESULT WINAPI uia_element_get_CurrentName(IUIAutomationElement9 *iface, BSTR *ret_val)
{
FIXME("%p: stub\n", iface);
return E_NOTIMPL;
struct uia_element *element = impl_from_IUIAutomationElement9(iface);
HRESULT hr;
VARIANT v;
TRACE("%p, %p\n", iface, ret_val);
VariantInit(&v);
hr = UiaGetPropertyValue(element->node, UIA_NamePropertyId, &v);
if (SUCCEEDED(hr) && V_VT(&v) == VT_BSTR && V_BSTR(&v))
*ret_val = SysAllocString(V_BSTR(&v));
else
*ret_val = SysAllocString(L"");
VariantClear(&v);
return hr;
}
static HRESULT WINAPI uia_element_get_CurrentAcceleratorKey(IUIAutomationElement9 *iface, BSTR *ret_val)