user32: add a test for window width and height fixup when width or height exceed a short storage or are negative.

Dmitry Timoshkov dmitry at codeweavers.com
Tue Nov 21 22:28:29 CST 2006


"Pierre d'Herbemont" <pdherbemont at free.fr> wrote:

> This is a test for the CreateWindow call to see what is done with width 
> or height that exceed the size of a short storage, or are negative. 
> Hence we could decide if the fixup should be moved in user32 from 
> winex11.drv.
> 
> This test is passing under Wine, but I didn't test with real Windows, so 
> I guess I better monitor:
> http://test.winehq.org/data

Under XP SP2 with your test case I get:

win.c:3725: Test failed: expected rect.right 65535 != 65539
win.c:3726: Test failed: expected rect.bottom 65535 != 65539

I'm attaching a more comprehensive test which passes for me under XP SP2.

-- 
Dmitry.
-------------- next part --------------
--- cvs/hq/wine/dlls/user32/tests/win.c	Thu Nov 16 14:02:18 2006
+++ wine/dlls/user32/tests/win.c	Wed Nov 22 04:26:55 2006
@@ -3696,6 +3696,7 @@ static void test_CreateWindow(void)
 {
     HWND hwnd, parent;
     HMENU hmenu;
+    RECT rect;
 
 #define expect_menu(window, menu) \
     SetLastError(0xdeadbeef); \
@@ -3715,6 +3716,75 @@ static void test_CreateWindow(void)
     SetLastError(0xdeadbeef);
     ok(IsMenu(hmenu), "IsMenu error %d\n", GetLastError());
 
+    /* Test the window extents fixup */
+    /* without WS_VISIBLE */
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP,
+                          65537, 65537, 65539, 65539, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 131076, "expected rect.right 131076 != %d\n", rect.right);
+    ok(rect.bottom == 131076, "expected rect.bottom 131076 != %d\n", rect.bottom);
+    ok(rect.left == 65537, "expected rect.right 65537 != %d\n", rect.right);
+    ok(rect.top == 65537, "expected rect.bottom 65537 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP,
+                          0, 0, -10, -10, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 0, "expected rect.right 0 != %d\n", rect.right);
+    ok(rect.bottom == 0, "expected rect.bottom 0 != %d\n", rect.bottom);
+    ok(rect.left == 0, "expected rect.left 0 != %d\n", rect.right);
+    ok(rect.top == 0, "expected rect.top 0 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP,
+                          65537, 65537, -10, -10, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 65537, "expected rect.right 65537 != %d\n", rect.right);
+    ok(rect.bottom == 65537, "expected rect.bottom 65537 != %d\n", rect.bottom);
+    ok(rect.left == 65537, "expected rect.left 65537 != %d\n", rect.right);
+    ok(rect.top == 65537, "expected rect.top 65537 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
+    /* with WS_VISIBLE */
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP | WS_VISIBLE,
+                          65537, 65537, 65539, 65539, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 131076, "expected rect.right 131076 != %d\n", rect.right);
+    ok(rect.bottom == 131076, "expected rect.bottom 131076 != %d\n", rect.bottom);
+    ok(rect.left == 65537, "expected rect.left 65537 != %d\n", rect.right);
+    ok(rect.top == 65537, "expected rect.top 65537 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP | WS_VISIBLE,
+                          0, 0, -10, -10, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 0, "expected rect.right 0 != %d\n", rect.right);
+    ok(rect.bottom == 0, "expected rect.bottom 0 != %d\n", rect.bottom);
+    ok(rect.left == 0, "expected rect.left 0 != %d\n", rect.right);
+    ok(rect.top == 0, "expected rect.top 0 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(0, "static", NULL, WS_POPUP | WS_VISIBLE,
+                          65537, 65537, -10, -10, parent, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 65537, "expected rect.right 65537 != %d\n", rect.right);
+    ok(rect.bottom == 65537, "expected rect.bottom 65537 != %d\n", rect.bottom);
+    ok(rect.left == 65537, "expected rect.right 65537 != %d\n", rect.right);
+    ok(rect.top == 65537, "expected rect.bottom 65537 != %d\n", rect.bottom);
+    DestroyWindow(hwnd);
+
     /* WS_CHILD */
     SetLastError(0xdeadbeef);
     hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,


More information about the wine-devel mailing list