user32/test Added test about window sizes

Florian Köberle FloriansKarten at web.de
Mon Sep 8 16:36:51 CDT 2008


The smalles size a specic kind of child window can have differs between Wine and Windows. The World-Editor of Warcraft III need such small child windows for splitter components.
---
 dlls/user32/tests/win.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 1964e88..391322e 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4809,6 +4809,72 @@ static void test_hwnd_message(void)
     DestroyWindow(hwnd);
 }
 
+static void test_size() {
+    char parentClassName[] ="parentWindowClass";
+    WNDCLASS parentClass;
+    RECT rect;
+    HWND window;
+    HWND parentWindow;
+    LONG width;
+    LONG height;
+    parentClass.style = CS_SAVEBITS | CS_DBLCLKS;
+    parentClass.lpfnWndProc = DefWindowProc;
+    parentClass.cbClsExtra = 0x0;
+    parentClass.cbWndExtra = 0x1e;
+    parentClass.hInstance = GetModuleHandleA(0);
+    parentClass.hIcon = NULL;
+    parentClass.hCursor = LoadCursor(NULL,IDC_ARROW);
+    parentClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
+    parentClass.lpszMenuName = NULL;
+    parentClass.lpszClassName = parentClassName;
+    RegisterClass(&parentClass);
+
+    parentWindow = CreateWindowExA( WS_EX_NOPARENTNOTIFY, parentClassName, "",
+                                         WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
+                                         WS_MINIMIZEBOX | WS_MAXIMIZEBOX , // = 0x00cf0000,
+                                         0, 0,  800, 600, 0,  0,   GetModuleHandleA(0),  NULL );
+
+    window = CreateWindowEx( 0, "STATIC", "",
+                                WS_CHILD | WS_VISIBLE | WS_THICKFRAME | 0x100, // = 0x50040100
+                                0,  0, 0, 0, parentWindow, 0,  GetModuleHandleA(0),  NULL );
+
+    ShowWindow(parentWindow, SW_SHOW);
+
+    GetWindowRect(window, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    todo_wine
+        ok( width == 6 && height == 6, "rect is not 6x6 but %dx%d: %d,%d-%d,%d\n",
+            width, height, rect.left, rect.top, rect.right, rect.bottom);
+
+    SetWindowPos(window, 0, 367, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+    GetWindowRect(window, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    todo_wine
+        ok( width == 6 && height == 6, "rect is not 6x6 but %dx%d: %d,%d-%d,%d\n",
+            width, height, rect.left, rect.top, rect.right, rect.bottom);
+
+    SetWindowPos(window, 0, 0, 0, 500, 6, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
+    GetWindowRect(window, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    todo_wine
+        ok( width == 500 && height == 6, "rect is not 6x6 but %dx%d: %d,%d-%d,%d\n",
+            width, height, rect.left, rect.top, rect.right, rect.bottom);
+
+    SetWindowPos(window, 0, 0, 0, 6, 500, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
+    GetWindowRect(window, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    todo_wine
+        ok( width == 6 && height == 500, "rect is not 6x6 but %dx%d: %d,%d-%d,%d\n",
+            width, height, rect.left, rect.top, rect.right, rect.bottom);
+
+    UnregisterClass(parentClassName, GetModuleHandle(0));
+    DestroyWindow(parentWindow);
+}
+
 START_TEST(win)
 {
     pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
@@ -4836,6 +4902,7 @@ START_TEST(win)
     our_pid = GetWindowThreadProcessId(hwndMain, NULL);
 
     /* Add the tests below this line */
+    test_size();
     test_hwnd_message();
     test_nonclient_area(hwndMain);
     test_params();
-- 
1.5.4.3




More information about the wine-patches mailing list