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

Pierre d'Herbemont pdherbemont at free.fr
Tue Nov 21 16:24:28 CST 2006


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

Is that the best way to go?

Pierre.
---
  dlls/user32/tests/win.c |   20 ++++++++++++++++++++
  1 files changed, 20 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 81e8ba4..3bb642e 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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,25 @@ static void test_CreateWindow(void)
     SetLastError(0xdeadbeef);
     ok(IsMenu(hmenu), "IsMenu error %d\n", GetLastError());
 
+    /* Test the width and height fixup */
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
+                           0, 0, 65539, 65539, parent, (HMENU)1, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 65535, "expected rect.right %d != %d\n", 65535, rect.right);
+    ok(rect.bottom == 65535, "expected rect.bottom %d != %d\n", 65535, rect.bottom);
+    DestroyWindow(hwnd);
+
+    SetLastError(0xdeadbeef);
+    hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,
+                           0, 0, -10, -10, parent, (HMENU)1, 0, NULL);
+    ok(hwnd != 0, "CreateWindowEx error %d\n", GetLastError());
+    GetWindowRect(hwnd, &rect);
+    ok(rect.right == 0, "expected rect.right %d != %d\n", 0, rect.right);
+    ok(rect.bottom == 0, "expected rect.bottom %d != %d\n", 0, rect.bottom);
+    DestroyWindow(hwnd);
+
     /* WS_CHILD */
     SetLastError(0xdeadbeef);
     hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_CHILD,


More information about the wine-patches mailing list