Commit c31e5313 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement IUIAutomationElement::get_CurrentName.

parent 0b487338
......@@ -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);
......
......@@ -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)
......
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