Piotr Caban : user32/tests: Test style returned by GetWindowLong in WM_CREATE.

Alexandre Julliard julliard at winehq.org
Thu Oct 7 16:21:21 CDT 2021


Module: wine
Branch: master
Commit: ce3efca24a3c10dc52deff970b4f29704f93fb82
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ce3efca24a3c10dc52deff970b4f29704f93fb82

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Oct  7 16:33:45 2021 +0200

user32/tests: Test style returned by GetWindowLong in WM_CREATE.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/win.c | 65 +++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 26 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 744f7781439..d725f129d36 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4424,34 +4424,39 @@ static void test_SetParent(void)
     ok(!IsWindow(popup), "popup still exists\n");
 }
 
+typedef struct
+{
+    DWORD cs_style;
+    DWORD cs_exstyle;
+    DWORD style;
+    DWORD exstyle;
+} test_style;
+
 static LRESULT WINAPI StyleCheckProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
-    LPCREATESTRUCTA lpcs;
-    LPSTYLESTRUCT lpss;
+    CREATESTRUCTA *cs;
+    test_style *ts;
+    DWORD style;
 
     switch (msg)
     {
     case WM_NCCREATE:
     case WM_CREATE:
-        lpcs = (LPCREATESTRUCTA)lparam;
-        lpss = lpcs->lpCreateParams;
-        if (lpss)
-        {
-            if ((lpcs->dwExStyle & WS_EX_DLGMODALFRAME) ||
-                ((!(lpcs->dwExStyle & WS_EX_STATICEDGE)) &&
-                    (lpcs->style & (WS_DLGFRAME | WS_THICKFRAME))))
-                ok(lpcs->dwExStyle & WS_EX_WINDOWEDGE, "Window should have WS_EX_WINDOWEDGE style\n");
-            else
-                ok(!(lpcs->dwExStyle & WS_EX_WINDOWEDGE), "Window shouldn't have WS_EX_WINDOWEDGE style\n");
-
-            ok((lpss->styleOld & ~WS_EX_WINDOWEDGE) == (lpcs->dwExStyle & ~WS_EX_WINDOWEDGE),
-                "Ex style (0x%08x) should match what the caller passed to CreateWindowEx (0x%08x)\n",
-                lpss->styleOld, lpcs->dwExStyle);
-
-            ok(lpss->styleNew == lpcs->style,
-                "Style (0x%08x) should match what the caller passed to CreateWindowEx (0x%08x)\n",
-                lpss->styleNew, lpcs->style);
-        }
+        cs = (LPCREATESTRUCTA)lparam;
+        ts = cs->lpCreateParams;
+
+        ok(ts != NULL, "lpCreateParams not set\n");
+        ok(cs->style == ts->cs_style, "style = 0x%08x, expected 0x%08x\n",
+                cs->style, ts->cs_style);
+        ok(cs->dwExStyle == ts->cs_exstyle, "exstyle = 0x%08x, expected 0x%08x\n",
+                cs->dwExStyle, ts->cs_exstyle);
+
+        style = GetWindowLongW(hwnd, GWL_STYLE);
+        ok(style == ts->style, "style = 0x%08x, expected 0x%08x\n",
+                style, ts->style);
+        style = GetWindowLongW(hwnd, GWL_EXSTYLE);
+        ok(style == ts->exstyle, "exstyle = 0x%08x, expected 0x%08x\n",
+                style, ts->exstyle);
         break;
     }
     return DefWindowProcA(hwnd, msg, wparam, lparam);
@@ -4483,21 +4488,29 @@ static void check_window_style(DWORD dwStyleIn, DWORD dwExStyleIn, DWORD dwStyle
 {
     DWORD dwActualStyle;
     DWORD dwActualExStyle;
-    STYLESTRUCT ss;
+    test_style ts;
     HWND hwnd;
     HWND hwndParent = NULL;
 
-    ss.styleNew = dwStyleIn;
-    ss.styleOld = dwExStyleIn;
+    ts.cs_style = dwStyleIn;
+    ts.cs_exstyle = dwExStyleIn;
+    if ((dwExStyleIn & WS_EX_DLGMODALFRAME) ||
+            ((!(dwExStyleIn & WS_EX_STATICEDGE)) &&
+             (dwStyleIn & (WS_DLGFRAME | WS_THICKFRAME))))
+        ts.cs_exstyle |= WS_EX_WINDOWEDGE;
+    else
+        ts.cs_exstyle &= ~WS_EX_WINDOWEDGE;
+    ts.style = dwStyleOut;
+    ts.exstyle = dwExStyleOut;
 
     if (dwStyleIn & WS_CHILD)
     {
-        hwndParent = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
+        hwndParent = CreateWindowExA(0, "static", NULL,
             WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
     }
 
     hwnd = CreateWindowExA(dwExStyleIn, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), NULL,
-                    dwStyleIn, 0, 0, 0, 0, hwndParent, NULL, NULL, &ss);
+                    dwStyleIn, 0, 0, 0, 0, hwndParent, NULL, NULL, &ts);
     assert(hwnd);
 
     flush_events( TRUE );




More information about the wine-cvs mailing list