From: Piotr Caban Subject: Re: [PATCH 2/2] oleacc: Add Client_get_accFocus tests. Message-Id: Date: Fri, 17 Sep 2021 20:11:22 +0200 In-Reply-To: <20210917163724.3372582-2-cmcadams@codeweavers.com> References: <20210917163724.3372582-1-cmcadams@codeweavers.com> <20210917163724.3372582-2-cmcadams@codeweavers.com> On 9/17/21 6:37 PM, Connor McAdams wrote: > @@ -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"); typo: chld2 > + /* 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)); There's no need to check if V_DISPATCH(&v) != NULL. It's already done by earlier ok call. This test is also not checking what is actually returned. I don't know if it's important in this case but you can get the hwnd from dispatch (query for IOleWindow and call IOleWindow_GetWindow) and compare it with btn. Thanks, Piotr