Commit 973d00db authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement UiaRemoveEvent.

parent 407ce9a1
......@@ -13807,7 +13807,7 @@ static DWORD WINAPI uia_add_event_test_thread(LPVOID param)
CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = UiaRemoveEvent(data->event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref);
todo_wine ok(Provider2.last_call_tid == data->exp_thread_id ||
......@@ -13855,7 +13855,18 @@ static void test_UiaAddEvent_args(HUIANODE node)
ok(!!event, "event == NULL\n");
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
}
static void test_UiaRemoveEvent_args(HUIANODE node)
{
HRESULT hr;
hr = UiaRemoveEvent(NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = UiaRemoveEvent((HUIAEVENT)node);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
}
static void test_UiaAddEvent(void)
......@@ -13896,6 +13907,7 @@ static void test_UiaAddEvent(void)
/* Test valid function input arguments. */
test_UiaAddEvent_args(node);
test_UiaRemoveEvent_args(node);
/*
* Raise event without any registered event handlers.
......@@ -13933,10 +13945,9 @@ static void test_UiaAddEvent(void)
ok_method_sequence(event_seq3, "event_seq3");
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
if (SUCCEEDED(hr))
ok_method_sequence(event_seq4, "event_seq4");
ok_method_sequence(event_seq4, "event_seq4");
/*
* Register an event on the same node again, except this time we have a
......@@ -13985,10 +13996,9 @@ static void test_UiaAddEvent(void)
method_sequences_enabled = TRUE;
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
if (SUCCEEDED(hr))
ok_method_sequence(event_seq4, "event_seq4");
ok_method_sequence(event_seq4, "event_seq4");
/* Create an event with TreeScope_Children. */
hr = UiaAddEvent(node, UIA_AutomationFocusChangedEventId, uia_event_callback, TreeScope_Children, NULL, 0, &cache_req,
......@@ -14034,7 +14044,7 @@ static void test_UiaAddEvent(void)
set_provider_prop_override(&Provider_child, NULL, 0);
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
/* Create an event with TreeScope_Descendants. */
......@@ -14054,7 +14064,7 @@ static void test_UiaAddEvent(void)
todo_wine CHECK_CALLED(uia_event_callback);
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
CoUninitialize();
......@@ -14122,12 +14132,11 @@ static void test_UiaAddEvent(void)
method_sequences_enabled = TRUE;
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
ok(Provider_child.ref == 1, "Unexpected refcnt %ld\n", Provider_child.ref);
ok(Provider_child2.ref == 1, "Unexpected refcnt %ld\n", Provider_child2.ref);
if (SUCCEEDED(hr))
ok_method_sequence(event_seq6, "event_seq6");
ok_method_sequence(event_seq6, "event_seq6");
UiaNodeRelease(node);
ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref);
......@@ -14204,7 +14213,7 @@ static void test_UiaAddEvent(void)
todo_wine CHECK_CALLED(uia_event_callback);
hr = UiaRemoveEvent(event);
todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
UiaNodeRelease(node);
method_sequences_enabled = TRUE;
......
......@@ -3514,15 +3514,6 @@ exit:
}
/***********************************************************************
* UiaRemoveEvent (uiautomationcore.@)
*/
HRESULT WINAPI UiaRemoveEvent(HUIAEVENT huiaevent)
{
FIXME("(%p): stub\n", huiaevent);
return E_NOTIMPL;
}
/***********************************************************************
* UiaEventAddWindow (uiautomationcore.@)
*/
HRESULT WINAPI UiaEventAddWindow(HUIAEVENT huiaevent, HWND hwnd)
......
......@@ -84,6 +84,14 @@ static const IWineUiaEventVtbl uia_event_vtbl = {
uia_event_Release,
};
static struct uia_event *unsafe_impl_from_IWineUiaEvent(IWineUiaEvent *iface)
{
if (!iface || (iface->lpVtbl != &uia_event_vtbl))
return NULL;
return CONTAINING_RECORD(iface, struct uia_event, IWineUiaEvent_iface);
}
static HRESULT create_uia_event(struct uia_event **out_event, int event_id, int scope, UiaEventCallback *cback,
SAFEARRAY *runtime_id)
{
......@@ -146,3 +154,19 @@ HRESULT WINAPI UiaAddEvent(HUIANODE huianode, EVENTID event_id, UiaEventCallback
return S_OK;
}
/***********************************************************************
* UiaRemoveEvent (uiautomationcore.@)
*/
HRESULT WINAPI UiaRemoveEvent(HUIAEVENT huiaevent)
{
struct uia_event *event = unsafe_impl_from_IWineUiaEvent((IWineUiaEvent *)huiaevent);
TRACE("(%p)\n", event);
if (!event)
return E_INVALIDARG;
IWineUiaEvent_Release(&event->IWineUiaEvent_iface);
return S_OK;
}
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