Commit 34671bdc authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

winmm/tests: Add tests for window style of video window.

The test shows that even if MCI_DGV_OPEN_PARENT is specified, the video window is shown. In other words, it doesn't imply the window is a child window. Signed-off-by: 's avatarAkihiro Sagawa <sagawa.aki@gmail.com>
parent 92f661da
...@@ -1488,41 +1488,130 @@ static void test_video_window(void) ...@@ -1488,41 +1488,130 @@ static void test_video_window(void)
{ {
const WCHAR *filename = load_resource(L"test.mpg"); const WCHAR *filename = load_resource(L"test.mpg");
MCI_PARMS_UNION parm; MCI_PARMS_UNION parm;
HWND video_window; unsigned int i;
MCIDEVICEID id; MCIDEVICEID id;
MCIERROR err; MCIERROR err;
BOOL ret; BOOL ret;
parm.dgv_open.lpstrDeviceType = (WCHAR *)L"MPEGVideo"; static const struct
parm.dgv_open.lpstrElementName = (WCHAR *)filename; {
err = mciSendCommandW(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE, (DWORD_PTR)&parm); DWORD open_flags;
ok(!err, "Got %s.\n", dbg_mcierr(err)); DWORD style;
id = parm.dgv_open.wDeviceID; DWORD expected_style;
}
err = mciSendCommandW(id, MCI_PLAY, 0, (DWORD_PTR)&parm); testcase[] =
ok(!err, "Got %s.\n", dbg_mcierr(err)); {
{
video_window = NULL; 0,
EnumWindows(my_visible_window_proc, (LPARAM)&video_window); 0,
ok(video_window != NULL, "Video window should be shown.\n"); (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) & ~WS_MAXIMIZEBOX,
},
err = mciSendCommandW(id, MCI_STOP, 0, (DWORD_PTR)&parm); {
ok(!err, "Got %s.\n", dbg_mcierr(err)); MCI_DGV_OPEN_PARENT,
0,
ok(IsWindowVisible(video_window), "Video window should be visible.\n"); (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) & ~WS_MAXIMIZEBOX,
},
err = mciSendCommandW(id, MCI_PLAY, 0, (DWORD_PTR)&parm); {
ok(!err, "Got %s.\n", dbg_mcierr(err)); MCI_DGV_OPEN_WS,
0,
ok(IsWindowVisible(video_window), "Video window should be visible.\n"); WS_BORDER | WS_CLIPSIBLINGS | WS_BORDER | WS_DLGFRAME,
},
err = mciSendCommandW(id, MCI_SEEK, MCI_SEEK_TO_START, (DWORD_PTR)&parm); {
ok(!err, "Got %s.\n", dbg_mcierr(err)); MCI_DGV_OPEN_WS,
WS_POPUPWINDOW,
ok(IsWindowVisible(video_window), "Video window should be visible.\n"); WS_POPUPWINDOW | WS_CLIPSIBLINGS,
},
err = mciSendCommandW(id, MCI_CLOSE, 0, 0); {
ok(!err, "Got %s.\n", dbg_mcierr(err)); MCI_DGV_OPEN_PARENT | MCI_DGV_OPEN_WS,
WS_OVERLAPPEDWINDOW,
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS,
},
{
MCI_DGV_OPEN_PARENT | MCI_DGV_OPEN_WS,
WS_CHILDWINDOW,
WS_CHILD,
},
};
for (i = 0; i < ARRAY_SIZE(testcase); ++i)
{
HWND parent_window = NULL, hwnd, video_window;
DWORD style, expected;
winetest_push_context("%u", i);
if (testcase[i].open_flags & MCI_DGV_OPEN_PARENT)
parent_window = CreateWindowExA(0, "static", "parent",
WS_POPUPWINDOW, 0, 0, 100, 100, 0, 0, 0, NULL);
parm.dgv_open.lpstrDeviceType = (WCHAR *)L"MPEGVideo";
parm.dgv_open.lpstrElementName = (WCHAR *)filename;
parm.dgv_open.hWndParent = parent_window;
parm.dgv_open.dwStyle = testcase[i].style;
err = mciSendCommandW(0, MCI_OPEN,
MCI_OPEN_ELEMENT | MCI_OPEN_TYPE | testcase[i].open_flags, (DWORD_PTR)&parm);
ok(!err, "Got %s.\n", dbg_mcierr(err));
id = parm.dgv_open.wDeviceID;
err = mciSendCommandW(id, MCI_PLAY, 0, (DWORD_PTR)&parm);
ok(!err, "Got %s.\n", dbg_mcierr(err));
if (!(testcase[i].style & WS_CHILD))
{
video_window = NULL;
EnumWindows(my_visible_window_proc, (LPARAM)&video_window);
todo_wine_if (testcase[i].open_flags & MCI_DGV_OPEN_PARENT)
ok(video_window != NULL, "Video window should be shown.\n");
/* FIXME: Remove once Wine is fixed */
if (!video_window) goto next;
hwnd = GetWindow(video_window, GW_OWNER);
todo_wine_if (testcase[i].open_flags & MCI_DGV_OPEN_PARENT)
ok(hwnd == parent_window, "Got owner %p, expected %p.\n", hwnd, parent_window);
}
else
{
ok(!IsWindowVisible(parent_window), "Parent window should be hidden.\n");
ShowWindow(parent_window, SW_SHOWNA);
hwnd = GetWindow(parent_window, GW_CHILD);
ok(hwnd != NULL, "Child video window should be shown.\n");
video_window = hwnd;
}
expected = testcase[i].expected_style | WS_VISIBLE;
style = GetWindowLongW(video_window, GWL_STYLE);
todo_wine_if (i != 3)
ok(style == expected, "Got style %#lx for window %p, expected %#lx.\n", style, video_window, expected);
err = mciSendCommandW(id, MCI_STOP, 0, (DWORD_PTR)&parm);
ok(!err, "Got %s.\n", dbg_mcierr(err));
ok(IsWindowVisible(video_window), "Video window should be visible.\n");
err = mciSendCommandW(id, MCI_PLAY, 0, (DWORD_PTR)&parm);
ok(!err, "Got %s.\n", dbg_mcierr(err));
ok(IsWindowVisible(video_window), "Video window should be visible.\n");
err = mciSendCommandW(id, MCI_SEEK, MCI_SEEK_TO_START, (DWORD_PTR)&parm);
ok(!err, "Got %s.\n", dbg_mcierr(err));
ok(IsWindowVisible(video_window), "Video window should be visible.\n");
next:
err = mciSendCommandW(id, MCI_CLOSE, 0, 0);
ok(!err, "Got %s.\n", dbg_mcierr(err));
if (parent_window)
{
ret = DestroyWindow(parent_window);
ok(ret, "Failed to destroy parent window\n");
}
winetest_pop_context();
}
ret = DeleteFileW(filename); ret = DeleteFileW(filename);
ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(filename), GetLastError()); ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(filename), GetLastError());
......
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