comctl32/tests: Test status bar size grip behavior and bounds.

Signed-off-by: Waritnan Sookbuntherng <lion328@hotmail.co.th>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Waritnan Sookbuntherng 2018-12-10 09:52:09 +00:00 committed by Alexandre Julliard
parent d62ac319d2
commit d8428406c6
1 changed files with 126 additions and 0 deletions

View File

@ -586,6 +586,131 @@ static void test_notify(void)
ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n"); ok(g_got_contextmenu, "WM_RBUTTONUP did not activate the context menu!\n");
} }
static void test_sizegrip(void)
{
HWND hwndStatus;
LONG style;
RECT rc, rcClient;
POINT pt;
int width, r;
hwndStatus = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP,
0, 0, 100, 100, g_hMainWnd, NULL, NULL, NULL);
style = GetWindowLongPtrA(g_hMainWnd, GWL_STYLE);
width = GetSystemMetrics(SM_CXVSCROLL);
GetClientRect(hwndStatus, &rcClient);
pt.x = rcClient.right;
pt.y = rcClient.top;
ClientToScreen(hwndStatus, &pt);
rc.left = pt.x - width;
rc.right = pt.x;
rc.top = pt.y;
pt.y = rcClient.bottom;
ClientToScreen(hwndStatus, &pt);
rc.bottom = pt.y;
/* check bounds when not maximized */
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top));
todo_wine expect(HTBOTTOMRIGHT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left - 1, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top - 1));
todo_wine expect(HTBOTTOMRIGHT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom));
todo_wine expect(HTBOTTOMRIGHT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom));
todo_wine expect(HTBOTTOMRIGHT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom + 1));
todo_wine expect(HTBOTTOMRIGHT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom - 1));
expect(HTBOTTOMRIGHT, r);
/* not maximized and right-to-left */
SetWindowLongA(hwndStatus, GWL_EXSTYLE, WS_EX_LAYOUTRTL);
pt.x = rcClient.right;
ClientToScreen(hwndStatus, &pt);
rc.left = pt.x + width;
rc.right = pt.x;
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top));
todo_wine expect(HTBOTTOMLEFT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left + 1, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top - 1));
todo_wine expect(HTBOTTOMLEFT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom));
todo_wine expect(HTBOTTOMLEFT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom));
todo_wine expect(HTBOTTOMLEFT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom + 1));
todo_wine expect(HTBOTTOMLEFT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom - 1));
expect(HTBOTTOMLEFT, r);
/* maximize with left-to-right */
SetWindowLongA(g_hMainWnd, GWL_STYLE, style|WS_MAXIMIZE);
SetWindowLongA(hwndStatus, GWL_EXSTYLE, 0);
GetClientRect(hwndStatus, &rcClient);
pt.x = rcClient.right;
pt.y = rcClient.top;
ClientToScreen(hwndStatus, &pt);
rc.left = pt.x - width;
rc.right = pt.x;
rc.top = pt.y;
pt.y = rcClient.bottom;
ClientToScreen(hwndStatus, &pt);
rc.bottom = pt.y;
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left - 1, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top - 1));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom + 1));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom - 1));
todo_wine expect(HTCLIENT, r);
/* maximized with right-to-left */
SetWindowLongA(hwndStatus, GWL_EXSTYLE, WS_EX_LAYOUTRTL);
pt.x = rcClient.right;
ClientToScreen(hwndStatus, &pt);
rc.left = pt.x + width;
rc.right = pt.x;
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left + 1, rc.top));
expect(HTCLIENT, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.left, rc.top - 1));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right - 1, rc.bottom));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right, rc.bottom + 1));
expect(HTNOWHERE, r);
r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, MAKELPARAM(rc.right + 1, rc.bottom - 1));
todo_wine expect(HTCLIENT, r);
SetWindowLongA(g_hMainWnd, GWL_STYLE, style);
DestroyWindow(hwndStatus);
}
static void init_functions(void) static void init_functions(void)
{ {
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
@ -620,4 +745,5 @@ START_TEST(status)
test_status_ownerdraw(); test_status_ownerdraw();
test_gettext(); test_gettext();
test_notify(); test_notify();
test_sizegrip();
} }