Commit ce3efca2 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

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

parent 0483e2b4
...@@ -4424,34 +4424,39 @@ static void test_SetParent(void) ...@@ -4424,34 +4424,39 @@ static void test_SetParent(void)
ok(!IsWindow(popup), "popup still exists\n"); 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) static LRESULT WINAPI StyleCheckProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
LPCREATESTRUCTA lpcs; CREATESTRUCTA *cs;
LPSTYLESTRUCT lpss; test_style *ts;
DWORD style;
switch (msg) switch (msg)
{ {
case WM_NCCREATE: case WM_NCCREATE:
case WM_CREATE: case WM_CREATE:
lpcs = (LPCREATESTRUCTA)lparam; cs = (LPCREATESTRUCTA)lparam;
lpss = lpcs->lpCreateParams; ts = cs->lpCreateParams;
if (lpss)
{ ok(ts != NULL, "lpCreateParams not set\n");
if ((lpcs->dwExStyle & WS_EX_DLGMODALFRAME) || ok(cs->style == ts->cs_style, "style = 0x%08x, expected 0x%08x\n",
((!(lpcs->dwExStyle & WS_EX_STATICEDGE)) && cs->style, ts->cs_style);
(lpcs->style & (WS_DLGFRAME | WS_THICKFRAME)))) ok(cs->dwExStyle == ts->cs_exstyle, "exstyle = 0x%08x, expected 0x%08x\n",
ok(lpcs->dwExStyle & WS_EX_WINDOWEDGE, "Window should have WS_EX_WINDOWEDGE style\n"); cs->dwExStyle, ts->cs_exstyle);
else
ok(!(lpcs->dwExStyle & WS_EX_WINDOWEDGE), "Window shouldn't have WS_EX_WINDOWEDGE style\n"); style = GetWindowLongW(hwnd, GWL_STYLE);
ok(style == ts->style, "style = 0x%08x, expected 0x%08x\n",
ok((lpss->styleOld & ~WS_EX_WINDOWEDGE) == (lpcs->dwExStyle & ~WS_EX_WINDOWEDGE), style, ts->style);
"Ex style (0x%08x) should match what the caller passed to CreateWindowEx (0x%08x)\n", style = GetWindowLongW(hwnd, GWL_EXSTYLE);
lpss->styleOld, lpcs->dwExStyle); ok(style == ts->exstyle, "exstyle = 0x%08x, expected 0x%08x\n",
style, ts->exstyle);
ok(lpss->styleNew == lpcs->style,
"Style (0x%08x) should match what the caller passed to CreateWindowEx (0x%08x)\n",
lpss->styleNew, lpcs->style);
}
break; break;
} }
return DefWindowProcA(hwnd, msg, wparam, lparam); return DefWindowProcA(hwnd, msg, wparam, lparam);
...@@ -4483,21 +4488,29 @@ static void check_window_style(DWORD dwStyleIn, DWORD dwExStyleIn, DWORD dwStyle ...@@ -4483,21 +4488,29 @@ static void check_window_style(DWORD dwStyleIn, DWORD dwExStyleIn, DWORD dwStyle
{ {
DWORD dwActualStyle; DWORD dwActualStyle;
DWORD dwActualExStyle; DWORD dwActualExStyle;
STYLESTRUCT ss; test_style ts;
HWND hwnd; HWND hwnd;
HWND hwndParent = NULL; HWND hwndParent = NULL;
ss.styleNew = dwStyleIn; ts.cs_style = dwStyleIn;
ss.styleOld = dwExStyleIn; 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) 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); WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
} }
hwnd = CreateWindowExA(dwExStyleIn, (LPCSTR)MAKEINTATOM(atomStyleCheckClass), 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); assert(hwnd);
flush_events( TRUE ); flush_events( TRUE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment