user32/test: Added test about minimal child window sizes

Florian Köberle FloriansKarten at web.de
Thu Sep 11 08:46:23 CDT 2008


Child windows with the style WS_CHILD should have the minimal size of 6x6.
---
 dlls/user32/tests/win.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 1964e88..76043d1 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4809,6 +4809,61 @@ static void test_hwnd_message(void)
     DestroyWindow(hwnd);
 }
 
+static void test_minimal_child_window_size() {
+    char parentClassName[] ="parentWindowClass";
+    WNDCLASS parentClass;
+    RECT rect;
+    HWND childWindow;
+    HWND fakeChildWindow;
+    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,  400, 400, 0,  0,   GetModuleHandleA(0),  NULL );
+
+    childWindow = CreateWindowEx( 0, "STATIC", "",
+                                WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+                                0,  0, 0, 0, parentWindow, 0,  GetModuleHandleA(0),  NULL );
+
+    fakeChildWindow = CreateWindowEx( 0, "STATIC", "",
+                                WS_VISIBLE | WS_THICKFRAME,
+                                0,  200, 0, 0, parentWindow, 0,  GetModuleHandleA(0),  NULL );
+
+    ShowWindow(parentWindow, SW_SHOW);
+
+    GetWindowRect(childWindow, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    todo_wine
+        ok( width == 6 && height == 6,
+            "The minimal size of child windows with the style WS_CHILD is 6x6, but the window got enlarged too %dx%d.\n",
+            width, height);
+
+    GetWindowRect(fakeChildWindow, &rect);
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+    ok( width == GetSystemMetrics(SM_CXMINTRACK) && height == GetSystemMetrics(SM_CYMINTRACK),
+        "The minimal size of child windows without the style WS_CHILD should be %dx%d, but the window got enlarged too %dx%d",
+        GetSystemMetrics(SM_CYMINTRACK), GetSystemMetrics(SM_CYMINTRACK),  width, height);
+
+    UnregisterClass(parentClassName, GetModuleHandle(0));
+    DestroyWindow(parentWindow);
+}
+
 START_TEST(win)
 {
     pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
@@ -4836,6 +4891,7 @@ START_TEST(win)
     our_pid = GetWindowThreadProcessId(hwndMain, NULL);
 
     /* Add the tests below this line */
+    test_minimal_child_window_size();
     test_hwnd_message();
     test_nonclient_area(hwndMain);
     test_params();
-- 
1.5.4.3


--------------030206080707020205000904--



More information about the wine-patches mailing list