user32/tests: Added test about minimal child window sizes.

Florian Köberle florian at fkoeberle.de
Thu Oct 2 15:13:27 CDT 2008


Child windows should have the minimal size of SxS with S=(4+2*borderWidth).
---
 dlls/user32/tests/win.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index fac40fe..5234794 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4894,6 +4894,44 @@ static void test_layered_window(void)
     DestroyWindow( hwnd );
 }
 
+static void test_minimal_child_window_size(HWND parentWindow) {
+    RECT rect;
+    HWND childWindow;
+    LONG width;
+    LONG height;
+    BOOL success;
+    UINT border;
+    UINT expectedSize;
+
+    SetLastError(0xdeadbeef);
+    childWindow = CreateWindowEx( 0, "STATIC", "",
+                                WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
+                                0,  0, 0, 0, parentWindow, 0,  GetModuleHandleA(0),  NULL );
+    ok(childWindow != NULL, "Failed to create child window, error: %u\n", GetLastError());
+
+    ShowWindow(parentWindow, SW_SHOW);
+
+    SetLastError(0xdeadbeef);
+    success = SystemParametersInfoA( SPI_GETBORDER, 0, &border, 0 );
+    ok(success,"Failed to determine boder size with SystemParametersInfoA, error: %u\n", GetLastError());
+    expectedSize = 4 + 2*border;
+
+    SetLastError(0xdeadbeef);
+    success = GetWindowRect(childWindow, &rect);
+    ok(success,"GetWindowRect call failed, error: %u\n", GetLastError());
+    width = rect.right - rect.left;
+    height = rect.bottom - rect.top;
+
+    todo_wine
+        ok( width == expectedSize && height == expectedSize,
+            "The minimal size of the child window should be %dx%d, but the window got enlarged to %dx%d.\n",
+            expectedSize, expectedSize, width, height);
+
+    SetLastError(0xdeadbeef);
+    success = DestroyWindow(childWindow);
+    ok(success,"DestroyWindow call failed, error: %u\n", GetLastError());
+}
+
 START_TEST(win)
 {
     HMODULE user32 = GetModuleHandleA( "user32.dll" );
@@ -4924,6 +4962,7 @@ START_TEST(win)
     our_pid = GetWindowThreadProcessId(hwndMain, NULL);
 
     /* Add the tests below this line */
+    test_minimal_child_window_size(hwndMain);
     test_hwnd_message();
     test_nonclient_area(hwndMain);
     test_params();
-- 
1.5.4.3


--------------090903050502070508040806--



More information about the wine-patches mailing list