oleacc: Add Client_accLocation implementation.

This commit is contained in:
Piotr Caban 2014-05-12 12:53:39 +02:00 committed by Alexandre Julliard
parent a709e3f98d
commit 7a0fd9cfe2
2 changed files with 49 additions and 3 deletions

View File

@ -326,9 +326,31 @@ static HRESULT WINAPI Client_accLocation(IAccessible *iface, LONG *pxLeft,
LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
{
Client *This = impl_from_Client(iface);
FIXME("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
RECT rect;
POINT pt;
TRACE("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
pcxWidth, pcyHeight, debugstr_variant(&varID));
return E_NOTIMPL;
*pxLeft = *pyTop = *pcxWidth = *pcyHeight = 0;
if(convert_child_id(&varID) != CHILDID_SELF)
return E_INVALIDARG;
if(!GetClientRect(This->hwnd, &rect))
return S_OK;
pt.x = rect.left,
pt.y = rect.top;
MapWindowPoints(This->hwnd, NULL, &pt, 1);
*pxLeft = pt.x;
*pyTop = pt.y;
pt.x = rect.right;
pt.y = rect.bottom;
MapWindowPoints(This->hwnd, NULL, &pt, 1);
*pcxWidth = pt.x - *pxLeft;
*pcyHeight = pt.y - *pyTop;
return S_OK;
}
static HRESULT WINAPI Client_accNavigate(IAccessible *iface,

View File

@ -319,7 +319,8 @@ static void test_default_client_accessible_object(void)
VARIANT vid, v;
BSTR str;
POINT pt;
LONG l;
RECT rect;
LONG l, left, top, width, height;
hwnd = CreateWindowA("oleacc_test", "test &t &junk", WS_OVERLAPPEDWINDOW,
0, 0, 100, 100, NULL, NULL, NULL, NULL);
@ -435,6 +436,22 @@ static void test_default_client_accessible_object(void)
ok(disp != NULL, "disp == NULL\n");
IDispatch_Release(disp);
ok(GetClientRect(hwnd, &rect), "GetClientRect failed\n");
pt.x = rect.left;
pt.y = rect.top;
MapWindowPoints(hwnd, NULL, &pt, 1);
rect.left = pt.x;
rect.top = pt.y;
pt.x = rect.right;
pt.y = rect.bottom;
MapWindowPoints(hwnd, NULL, &pt, 1);
hr = IAccessible_accLocation(acc, &left, &top, &width, &height, vid);
ok(hr == S_OK, "got %x\n", hr);
ok(left == rect.left, "left = %d, expected %d\n", left, rect.left);
ok(top == rect.top, "top = %d, expected %d\n", top, rect.top);
ok(width == pt.x-rect.left, "width = %d, expected %d\n", width, pt.x-rect.left);
ok(height == pt.y-rect.top, "height = %d, expected %d\n", height, pt.y-rect.top);
DestroyWindow(hwnd);
hr = IAccessible_get_accChildCount(acc, &l);
@ -467,6 +484,13 @@ static void test_default_client_accessible_object(void)
ok(hr == E_FAIL, "got %x\n", hr);
ok(disp == NULL, "disp = %p\n", disp);
hr = IAccessible_accLocation(acc, &left, &top, &width, &height, vid);
ok(hr == S_OK, "got %x\n", hr);
ok(left == 0, "left = %d\n", left);
ok(top == 0, "top = %d\n", top);
ok(width == 0, "width = %d\n", width);
ok(height == 0, "height = %d\n", height);
IAccessible_Release(acc);
}