Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/oleacc/tests/main.c | 47 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c index 97fc625ac8b..86abe17b2a5 100644 --- a/dlls/oleacc/tests/main.c +++ b/dlls/oleacc/tests/main.c @@ -920,7 +920,7 @@ static void test_default_client_accessible_object(void) IDispatch *disp; IOleWindow *ow; IEnumVARIANT *ev; - HWND chld, btn, hwnd, hwnd2; + HWND chld, chld2, btn, hwnd, hwnd2; HRESULT hr; VARIANT vid, v; BSTR str; @@ -939,6 +939,9 @@ static void test_default_client_accessible_object(void) btn = CreateWindowA("BUTTON", "btn &t &junk", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 50, 0, 50, 50, hwnd, NULL, NULL, NULL); ok(btn != NULL, "CreateWindow failed\n"); + chld2 = CreateWindowA("static", "static &t &junk", WS_CHILD | WS_VISIBLE, + 0, 0, 50, 50, chld, NULL, NULL, NULL); + ok(chld != NULL, "CreateWindow failed\n");
hr = CreateStdAccessibleObject(NULL, OBJID_CLIENT, &IID_IAccessible, (void**)&acc); ok(hr == E_FAIL, "got %x\n", hr); @@ -1013,6 +1016,44 @@ static void test_default_client_accessible_object(void) ok(hr == E_INVALIDARG, "get_accChild returned %x\n", hr); ok(disp == NULL, "disp = %p\n", disp);
+ /* Neither the parent nor any child windows have focus, VT_EMPTY. */ + hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_EMPTY, "V_VT(&v) = %d\n", V_VT(&v)); + + /* Set the focus to the parent window. */ + ShowWindow(hwnd, SW_SHOW); + SetFocus(hwnd); + hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_I4(&v) == CHILDID_SELF, "V_I4(&v) = %d\n", V_I4(&v)); + + /* Set focus to each child window. */ + SetFocus(btn); + hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(&v) = %p\n", V_DISPATCH(&v)); + if (!!V_DISPATCH(&v)) IDispatch_Release(V_DISPATCH(&v)); + + SetFocus(chld); + hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(&v) = %p\n", V_DISPATCH(&v)); + if (!!V_DISPATCH(&v)) IDispatch_Release(V_DISPATCH(&v)); + + /* Child of a child, still works on parent HWND. */ + SetFocus(chld2); + hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_DISPATCH, "V_VT(&v) = %d\n", V_VT(&v)); + ok(V_DISPATCH(&v) != NULL, "V_DISPATCH(&v) = %p\n", V_DISPATCH(&v)); + if (!!V_DISPATCH(&v)) IDispatch_Release(V_DISPATCH(&v)); + + ShowWindow(hwnd, SW_HIDE); + hr = IAccessible_QueryInterface(acc, &IID_IEnumVARIANT, (void**)&ev); ok(hr == S_OK, "got %x\n", hr);
@@ -1195,6 +1236,10 @@ static void test_default_client_accessible_object(void) ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v)); ok(V_I4(&v) == STATE_SYSTEM_INVISIBLE, "V_I4(&v) = %x\n", V_I4(&v));
+ hr = IAccessible_get_accFocus(acc, &v); + ok(hr == S_OK, "hr %#x\n", hr); + ok(V_VT(&v) == VT_EMPTY, "V_VT(&v) = %d\n", V_VT(&v)); + hr = IAccessible_accHitTest(acc, 200, 200, &v); ok(hr == S_OK, "got %x\n", hr); ok(V_VT(&v) == VT_I4, "V_VT(&v) = %d\n", V_VT(&v));