[PATCH v2 1/3] comctl32/tests: Test statusbar size grip behavior.

Waritnan Sookbuntherng lion328 at hotmail.co.th
Sun Nov 11 13:07:29 CST 2018


Signed-off-by: Waritnan Sookbuntherng <lion328 at hotmail.co.th>
---
 dlls/comctl32/tests/status.c | 57 ++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/dlls/comctl32/tests/status.c b/dlls/comctl32/tests/status.c
index d78bd20262..483b227a3e 100644
--- a/dlls/comctl32/tests/status.c
+++ b/dlls/comctl32/tests/status.c
@@ -586,6 +586,62 @@ 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;
+    int r;
+    LONG oldstyle;
+    RECT rc;
+    POINT pt;
+    LPARAM lParam;
+
+    hwndStatus = CreateWindowA(SUBCLASS_NAME, "", WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP,
+      0, 0, 100, 100, g_hMainWnd, NULL, NULL, NULL);
+
+    GetClientRect(hwndStatus, &rc);
+
+    /* get bottom right of the window */
+    pt.x = rc.right;
+    pt.y = rc.bottom;
+    ClientToScreen(hwndStatus, &pt);
+    lParam = MAKELPARAM(pt.x, pt.y);
+
+    /* check size grip on bottom right */
+    r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, lParam);
+    ok(r == HTBOTTOMRIGHT, "expected HTBOTTOMRIGHT from WM_NCHITTEST, got %d\n", r);
+
+    /* maximize the main window */
+    oldstyle = GetWindowLongPtrA(g_hMainWnd, GWL_STYLE);
+    SetWindowLongA(g_hMainWnd, GWL_STYLE, oldstyle|WS_MAXIMIZE);
+
+    /* check size grip again */
+    r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, lParam);
+    ok(r != HTBOTTOMRIGHT, "WM_NCHITTEST returned HTBOTTOMRIGHT\n");
+
+    /* set WS_EX_LAYOUTRTL which move size grip to the left */
+    SetWindowLongA(hwndStatus, GWL_EXSTYLE, WS_EX_LAYOUTRTL);
+
+    /* check size grip on bottom left */
+    r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, lParam);
+    ok(r != HTBOTTOMLEFT, "WM_NCHITTEST returned HTBOTTOMLEFT\n");
+
+    /* unset WS_MAXIMIZE */
+    SetWindowLongA(g_hMainWnd, GWL_STYLE, oldstyle & ~WS_MAXIMIZE);
+
+    /* get new bottom left point */
+    pt.x = rc.right;
+    pt.y = rc.bottom;
+    ClientToScreen(hwndStatus, &pt);
+    lParam = MAKELPARAM(pt.x, pt.y);
+
+    /* check size grip again */
+    r = SendMessageA(hwndStatus, WM_NCHITTEST, 0, lParam);
+    ok(r == HTBOTTOMLEFT, "expected HTBOTTOMLEFT from WM_NCHITTEST, got %d\n", r);
+
+    SetWindowLongA(g_hMainWnd, GWL_STYLE, oldstyle);
+    DestroyWindow(hwndStatus);
+}
+
 static void init_functions(void)
 {
     HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
@@ -620,4 +676,5 @@ START_TEST(status)
     test_status_ownerdraw();
     test_gettext();
     test_notify();
+    test_sizegrip();
 }
-- 
2.19.1




More information about the wine-devel mailing list