Commit a2b7aafd authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32: Implemented GetWindowRgnBox with some tests.

parent eb32e9ec
......@@ -51,6 +51,7 @@ static BOOL (WINAPI *pGetLayeredWindowAttributes)(HWND,COLORREF*,BYTE*,DWORD*);
static BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
static int (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
static BOOL test_lbuttondown_flag;
static HWND hwndMessage;
......@@ -5529,6 +5530,48 @@ static void test_handles( HWND full_hwnd )
#endif
}
static void test_winregion(void)
{
HWND hwnd;
RECT r;
int ret;
HRGN hrgn;
if (!pGetWindowRgnBox)
{
win_skip("GetWindowRgnBox not supported\n");
return;
}
hwnd = CreateWindowExA(0, "static", NULL, WS_VISIBLE, 10, 10, 10, 10, NULL, 0, 0, NULL);
/* NULL prect */
SetLastError(0xdeadbeef);
ret = pGetWindowRgnBox(hwnd, NULL);
ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", GetLastError());
hrgn = CreateRectRgn(2, 3, 10, 15);
ok( hrgn != NULL, "Region creation failed\n");
if (hrgn)
{
SetWindowRgn(hwnd, hrgn, FALSE);
SetLastError(0xdeadbeef);
ret = pGetWindowRgnBox(hwnd, NULL);
ok( ret == ERROR, "Expected ERROR, got %d\n", ret);
ok( GetLastError() == 0xdeadbeef, "Expected , got %d\n", GetLastError());
r.left = r.top = r.right = r.bottom = 0;
ret = pGetWindowRgnBox(hwnd, &r);
ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret);
ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
"Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, r.top,
r.right, r.bottom);
DeleteObject(hrgn);
}
DestroyWindow(hwnd);
}
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
......@@ -5539,6 +5582,7 @@ START_TEST(win)
pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
if (!RegisterWindowClasses()) assert(0);
......@@ -5608,6 +5652,7 @@ START_TEST(win)
test_SetForegroundWindow(hwndMain);
test_shell_window();
test_handles( hwndMain );
test_winregion();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);
......
......@@ -385,7 +385,7 @@
@ stdcall GetWindowPlacement(long ptr)
@ stdcall GetWindowRect(long ptr)
@ stdcall GetWindowRgn(long long)
# @ stub GetWindowRgnBox
@ stdcall GetWindowRgnBox(long ptr)
@ stdcall GetWindowTextA(long ptr long)
@ stdcall GetWindowTextLengthA(long)
@ stdcall GetWindowTextLengthW(long)
......
......@@ -155,6 +155,26 @@ int WINAPI GetWindowRgn ( HWND hwnd, HRGN hrgn )
return nRet;
}
/***********************************************************************
* GetWindowRgnBox (USER32.@)
*/
int WINAPI GetWindowRgnBox( HWND hwnd, LPRECT prect )
{
int ret = ERROR;
HRGN hrgn;
if (!prect)
return ERROR;
if ((hrgn = CreateRectRgn(0, 0, 0, 0)))
{
if ((ret = GetWindowRgn( hwnd, hrgn )) != ERROR )
ret = GetRgnBox( hrgn, prect );
DeleteObject(hrgn);
}
return ret;
}
/***********************************************************************
* SetWindowRgn (USER32.@)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment