Module: wine Branch: master Commit: d8428406c629672387bad5a00e8f779fc86bf7b7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d8428406c629672387bad5a00...
Author: Waritnan Sookbuntherng lion328@hotmail.co.th Date: Mon Dec 10 09:52:09 2018 +0000
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
---
dlls/comctl32/tests/status.c | 126 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+)
diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c index d78bd20..00db9f6 100644 --- a/dlls/comctl32/tests/status.c +++ b/dlls/comctl32/tests/status.c @@ -586,6 +586,131 @@ static void test_notify(void) 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) { HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); @@ -620,4 +745,5 @@ START_TEST(status) test_status_ownerdraw(); test_gettext(); test_notify(); + test_sizegrip(); }