Piotr Caban : oleacc: Add Client_accLocation implementation.
Alexandre Julliard
julliard at winehq.org
Mon May 12 15:35:48 CDT 2014
Module: wine
Branch: master
Commit: 7a0fd9cfe2a79d2fe4d79695029483c4732c4100
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7a0fd9cfe2a79d2fe4d79695029483c4732c4100
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon May 12 12:53:39 2014 +0200
oleacc: Add Client_accLocation implementation.
---
dlls/oleacc/client.c | 26 ++++++++++++++++++++++++--
dlls/oleacc/tests/main.c | 26 +++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c
index b2c734a..8a48b36 100644
--- a/dlls/oleacc/client.c
+++ b/dlls/oleacc/client.c
@@ -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,
diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c
index 3fb23da..4f9ea98 100644
--- a/dlls/oleacc/tests/main.c
+++ b/dlls/oleacc/tests/main.c
@@ -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);
}
More information about the wine-cvs
mailing list