Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/oleacc/tests/main.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c index 5823b4336ba..b81d7d61288 100644 --- a/dlls/oleacc/tests/main.c +++ b/dlls/oleacc/tests/main.c @@ -1698,6 +1698,23 @@ static void test_AccessibleChildren(IAccessible *acc) ok(V_VT(children+2) == VT_EMPTY, "V_VT(children+2) = %d\n", V_VT(children+2)); }
+static DWORD WINAPI acc_focus_test_thread(LPVOID lpParameter) +{ + IAccessible *acc = (IAccessible *)lpParameter; + VARIANT vid, v; + HRESULT hr; + + V_VT(&vid) = VT_I4; + V_I4(&vid) = CHILDID_SELF; + hr = IAccessible_get_accState(acc, vid, &v); + ok(hr == S_OK, "got %x\n", hr); + ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_I4(&v) == (STATE_SYSTEM_FOCUSABLE|STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_FOCUSED), + "V_I4(&v) = %x\n", V_I4(&v)); + + return 0; +} + static void test_default_client_accessible_object(void) { IAccessible *acc; @@ -1712,6 +1729,7 @@ static void test_default_client_accessible_object(void) RECT rect; LONG l, left, top, width, height; ULONG fetched; + HANDLE hthread;
hwnd = CreateWindowA("oleacc_test", "wnd &t &junk", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL, NULL, NULL, NULL); @@ -1745,7 +1763,6 @@ static void test_default_client_accessible_object(void)
IAccessible_Release(acc);
- /* Test the button */ hr = CreateStdAccessibleObject(btn, OBJID_CLIENT, &IID_IAccessible, (void**)&acc); ok(hr == S_OK, "got %x\n", hr); @@ -1764,7 +1781,6 @@ static void test_default_client_accessible_object(void)
IAccessible_Release(acc);
- /* Now we can test and destroy the top-level window */ hr = CreateStdAccessibleObject(hwnd, OBJID_CLIENT, &IID_IAccessible, (void**)&acc); ok(hr == S_OK, "got %x\n", hr); @@ -1870,6 +1886,21 @@ static void test_default_client_accessible_object(void) ok(V_I4(&v) == (STATE_SYSTEM_FOCUSABLE|STATE_SYSTEM_INVISIBLE), "V_I4(&v) = %x\n", V_I4(&v));
+ /* + * Test that STATE_SYSTEM_FOCUSED works, and is specific to the UI Thread + * of the HWND the IAccessible represents. + */ + SetFocus(hwnd); + hr = IAccessible_get_accState(acc, vid, &v); + ok(hr == S_OK, "got %x\n", hr); + ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_I4(&v) == (STATE_SYSTEM_FOCUSABLE|STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_FOCUSED), + "V_I4(&v) = %x\n", V_I4(&v)); + + hthread = CreateThread(NULL, 0, acc_focus_test_thread, (void *)acc, 0, NULL); + ok(!WaitForSingleObject(hthread, 10000), "Focus thread failed to return!\n"); + CloseHandle(hthread); + str = (void*)0xdeadbeef; hr = IAccessible_get_accHelp(acc, vid, &str); ok(hr == S_FALSE, "got %x\n", hr);