From: Paul Gofman pgofman@codeweavers.com
--- dlls/msvfw32/tests/mciwnd.c | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
diff --git a/dlls/msvfw32/tests/mciwnd.c b/dlls/msvfw32/tests/mciwnd.c index af368cfcb19..b1459a28768 100644 --- a/dlls/msvfw32/tests/mciwnd.c +++ b/dlls/msvfw32/tests/mciwnd.c @@ -25,6 +25,17 @@
#include "wine/test.h"
+static void pump_messages(void) +{ + MSG msg; + + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) + { + TranslateMessage( &msg ); + DispatchMessageA( &msg ); + } +} + static const DWORD file_header[] = /* file_header */ { FOURCC_RIFF, 0x8c0 /* file size */, @@ -260,13 +271,32 @@ static void test_window_create(unsigned line, const char* fname, HWND parent,
static void test_MCIWndCreate(void) { + static struct + { + DWORD mci_style; + BOOL parent; + DWORD expected_style; + } + tests[] = + { + { MCIWNDF_NOERRORDLG, FALSE, WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX + | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + { MCIWNDF_NOERRORDLG, TRUE, WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + { WS_CHILD | MCIWNDF_NOERRORDLG, TRUE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + { WS_POPUP | MCIWNDF_NOERRORDLG, FALSE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + { WS_POPUP | MCIWNDF_NOERRORDLG, TRUE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + { WS_POPUP | WS_CHILD | MCIWNDF_NOERRORDLG, TRUE, WS_POPUP | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MCIWNDF_NOERRORDLG}, + }; HWND parent, window; HMODULE hinst = GetModuleHandleA(NULL); char fname[MAX_PATH]; char invalid_fname[] = "invalid.avi"; char error[200]; + unsigned int i; + DWORD style; HHOOK hook; LRESULT ret; + int id;
create_avi_file(fname);
@@ -313,6 +343,44 @@ static void test_MCIWndCreate(void)
DestroyWindow(window);
+ parent = CreateWindowExA(0, "static", "msvfw32 test", + WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 200, 200, + 0, 0, 0, NULL); + ok(parent != NULL, "got error %lu\n", GetLastError()); + pump_messages(); + for (i = 0; i < ARRAYSIZE(tests); ++i) + { + winetest_push_context("test %u", i); + SetLastError(0xdeadbeef); + window = MCIWndCreateA(tests[i].parent ? parent : NULL, hinst, tests[i].mci_style, invalid_fname); + if ((tests[i].mci_style & (WS_POPUP | WS_CHILD)) == (WS_POPUP | WS_CHILD)) + { + todo_wine ok(!window, "window creation succeeded.\n"); + todo_wine ok(GetLastError() == ERROR_INVALID_MENU_HANDLE, "got %lu.\n", GetLastError()); + } + else + { + ok(window != NULL, "got error %lu\n", GetLastError()); + + id = GetDlgCtrlID(window); + if (tests[i].parent && !(tests[i].mci_style & WS_POPUP)) + todo_wine ok(id == 66, "got %d.\n", id); + else + ok(!id, "got %d.\n", id); + pump_messages(); + style = GetWindowLongA(window, GWL_STYLE); + todo_wine_if((tests[i].mci_style & (WS_POPUP | WS_CHILD)) || tests[i].parent) + ok(style == tests[i].expected_style, "got %#lx, expected %#lx (extra %#lx, missing %#lx).\n", + style, tests[i].expected_style, style & ~tests[i].expected_style, tests[i].expected_style & ~style); + } + if (window) + DestroyWindow(window); + pump_messages(); + winetest_pop_context(); + } + DestroyWindow(parent); + + DeleteFileA(fname); }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/msvfw32/mciwnd.c | 2 +- dlls/msvfw32/tests/mciwnd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvfw32/mciwnd.c b/dlls/msvfw32/mciwnd.c index c71e4fe5567..dd8878cf7d9 100644 --- a/dlls/msvfw32/mciwnd.c +++ b/dlls/msvfw32/mciwnd.c @@ -111,7 +111,7 @@ HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, if (!hInstance) hInstance = GetModuleHandleW(0);
if (hwndParent) - dwStyle |= WS_VISIBLE | WS_BORDER /*| WS_CHILD*/; + dwStyle |= WS_VISIBLE | WS_BORDER | WS_CHILD; else dwStyle |= WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
diff --git a/dlls/msvfw32/tests/mciwnd.c b/dlls/msvfw32/tests/mciwnd.c index b1459a28768..d9fe7958c25 100644 --- a/dlls/msvfw32/tests/mciwnd.c +++ b/dlls/msvfw32/tests/mciwnd.c @@ -369,7 +369,7 @@ static void test_MCIWndCreate(void) ok(!id, "got %d.\n", id); pump_messages(); style = GetWindowLongA(window, GWL_STYLE); - todo_wine_if((tests[i].mci_style & (WS_POPUP | WS_CHILD)) || tests[i].parent) + todo_wine_if((tests[i].mci_style & (WS_POPUP | WS_CHILD))) ok(style == tests[i].expected_style, "got %#lx, expected %#lx (extra %#lx, missing %#lx).\n", style, tests[i].expected_style, style & ~tests[i].expected_style, tests[i].expected_style & ~style); }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/msvfw32/mciwnd.c | 11 +++++++---- dlls/msvfw32/tests/mciwnd.c | 1 - 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/msvfw32/mciwnd.c b/dlls/msvfw32/mciwnd.c index dd8878cf7d9..a3edb9e794f 100644 --- a/dlls/msvfw32/mciwnd.c +++ b/dlls/msvfw32/mciwnd.c @@ -110,10 +110,13 @@ HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance,
if (!hInstance) hInstance = GetModuleHandleW(0);
- if (hwndParent) - dwStyle |= WS_VISIBLE | WS_BORDER | WS_CHILD; - else - dwStyle |= WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + if (!(dwStyle & (WS_POPUP | WS_CHILD))) + { + if (hwndParent) + dwStyle |= WS_VISIBLE | WS_BORDER | WS_CHILD; + else + dwStyle |= WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; + }
return CreateWindowExW(0, mciWndClassW, mciWndNameW, dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, diff --git a/dlls/msvfw32/tests/mciwnd.c b/dlls/msvfw32/tests/mciwnd.c index d9fe7958c25..6131105dd5c 100644 --- a/dlls/msvfw32/tests/mciwnd.c +++ b/dlls/msvfw32/tests/mciwnd.c @@ -369,7 +369,6 @@ static void test_MCIWndCreate(void) ok(!id, "got %d.\n", id); pump_messages(); style = GetWindowLongA(window, GWL_STYLE); - todo_wine_if((tests[i].mci_style & (WS_POPUP | WS_CHILD))) ok(style == tests[i].expected_style, "got %#lx, expected %#lx (extra %#lx, missing %#lx).\n", style, tests[i].expected_style, style & ~tests[i].expected_style, tests[i].expected_style & ~style); }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/msvfw32/mciwnd.c | 7 ++++++- dlls/msvfw32/tests/mciwnd.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/msvfw32/mciwnd.c b/dlls/msvfw32/mciwnd.c index a3edb9e794f..227dd0ebed6 100644 --- a/dlls/msvfw32/mciwnd.c +++ b/dlls/msvfw32/mciwnd.c @@ -104,6 +104,8 @@ BOOL VFWAPIV MCIWndRegisterClass(void) HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, DWORD dwStyle, LPCWSTR szFile) { + HMENU child_id = 0; + TRACE("%p %p %lx %s\n", hwndParent, hInstance, dwStyle, debugstr_w(szFile));
MCIWndRegisterClass(); @@ -118,10 +120,13 @@ HWND VFWAPIV MCIWndCreateW(HWND hwndParent, HINSTANCE hInstance, dwStyle |= WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; }
+ if (dwStyle & WS_CHILD) + child_id = (HMENU)66; + return CreateWindowExW(0, mciWndClassW, mciWndNameW, dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 300, 0, - hwndParent, 0, hInstance, (LPVOID)szFile); + hwndParent, child_id, hInstance, (LPVOID)szFile); }
/*********************************************************************** diff --git a/dlls/msvfw32/tests/mciwnd.c b/dlls/msvfw32/tests/mciwnd.c index 6131105dd5c..1d9a2204f65 100644 --- a/dlls/msvfw32/tests/mciwnd.c +++ b/dlls/msvfw32/tests/mciwnd.c @@ -355,8 +355,8 @@ static void test_MCIWndCreate(void) window = MCIWndCreateA(tests[i].parent ? parent : NULL, hinst, tests[i].mci_style, invalid_fname); if ((tests[i].mci_style & (WS_POPUP | WS_CHILD)) == (WS_POPUP | WS_CHILD)) { - todo_wine ok(!window, "window creation succeeded.\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_MENU_HANDLE, "got %lu.\n", GetLastError()); + ok(!window, "window creation succeeded.\n"); + ok(GetLastError() == ERROR_INVALID_MENU_HANDLE, "got %lu.\n", GetLastError()); } else { @@ -364,7 +364,7 @@ static void test_MCIWndCreate(void)
id = GetDlgCtrlID(window); if (tests[i].parent && !(tests[i].mci_style & WS_POPUP)) - todo_wine ok(id == 66, "got %d.\n", id); + ok(id == 66, "got %d.\n", id); else ok(!id, "got %d.\n", id); pump_messages();
This helps Adventures Of Fluzz not to create a bogus "No Device" window.