From: Akihiro Sagawa sagawa.aki@gmail.com
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com --- dlls/winmm/tests/mci.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c index 6f17d6ddd4f..cbbe4f70266 100644 --- a/dlls/winmm/tests/mci.c +++ b/dlls/winmm/tests/mci.c @@ -39,6 +39,7 @@ typedef union { MCI_SYSINFO_PARMSA sys; MCI_SEEK_PARMS seek; MCI_DGV_OPEN_PARMSW dgv_open; + MCI_DGV_WINDOW_PARMSW win; MCI_GENERIC_PARMS gen; } MCI_PARMS_UNION;
@@ -1463,11 +1464,14 @@ static void test_video_window(HWND hwnd) const WCHAR *filename = load_resource(L"test.mpg"); MCI_PARMS_UNION parm; MCIERROR err; + WCHAR text[32], original[32]; HWND video_window, parent; MCIDEVICEID wDeviceID; DWORD style, expected; BOOL ret;
+ GetWindowTextW(hwnd, original, ARRAY_SIZE(original)); + parm.dgv_open.lpstrDeviceType = (WCHAR *)L"MPEGVideo"; parm.dgv_open.lpstrElementName = (WCHAR *)filename; parm.dgv_open.hWndParent = hwnd; @@ -1490,9 +1494,78 @@ static void test_video_window(HWND hwnd) expected = (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW) & ~WS_MAXIMIZEBOX; ok(style == expected, "expected style %08lx, got %08lx\n", expected, style);
+ err = mciSendCommandW(wDeviceID, MCI_WINDOW, 0, (DWORD_PTR)&parm); + ok(!err,"mciCommand window 0 returned %s\n", dbg_mcierr(err)); + + parm.win.lpstrText = (LPWSTR)L"abracadabra"; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_TEXT, (DWORD_PTR)&parm); + ok(!err,"mciCommand window text returned %s\n", dbg_mcierr(err)); + + GetWindowTextW(video_window, text, ARRAY_SIZE(text)); + todo_wine ok(!wcscmp(text, parm.win.lpstrText),"expected %s, got %s\n", debugstr_w(parm.win.lpstrText), debugstr_w(text)); + + ok(!IsWindowVisible(video_window), "video window (%p) should be hidden\n", video_window); + + /* MCI_PLAY shows default video window */ + err = mciSendCommandW(wDeviceID, MCI_PLAY, 0, (DWORD_PTR)&parm); + ok(!err,"mciCommand play returned %s\n", dbg_mcierr(err)); + ok(IsWindowVisible(video_window), "video window (%p) should be visible\n", video_window); + + /* MCI_STOP doesn't hide the window */ + err = mciSendCommandW(wDeviceID, MCI_STOP, 0, (DWORD_PTR)&parm); + ok(!err,"mciCommand stop returned %s\n", dbg_mcierr(err)); + ok(IsWindowVisible(video_window), "video window (%p) should be visible\n", video_window); + + parm.win.nCmdShow = SW_HIDE; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_STATE, (DWORD_PTR)&parm); + ok(!err,"mciCommand window state returned %s\n", dbg_mcierr(err)); + todo_wine ok(!IsWindowVisible(video_window), "video window (%p) should be hidden\n", video_window); + + parm.win.hWnd = (HWND)0xdeadbeef; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&parm); + todo_wine ok(err == MCIERR_NO_WINDOW, "mciCommand window hwnd returned %s\n", dbg_mcierr(err)); + + parm.win.hWnd = hwnd; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&parm); + ok(!err,"mciCommand window hwnd returned %s\n", dbg_mcierr(err)); + + parm.status.dwItem = MCI_DGV_STATUS_HWND; + parm.status.dwReturn = 0xdeadbeef; + err = mciSendCommandW(wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD_PTR)&parm); + ok(!err,"mciCommand status hwnd returned %s\n", dbg_mcierr(err)); + video_window = (HWND)parm.status.dwReturn; + + ok(video_window == hwnd, "got %p, expected %p\n", video_window, hwnd); + + parm.win.lpstrText = (LPWSTR)L"foobar"; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_TEXT, (DWORD_PTR)&parm); + ok(!err,"mciCommand window text returned %s\n", dbg_mcierr(err)); + + GetWindowTextW(hwnd, text, ARRAY_SIZE(text)); + todo_wine ok(!wcscmp(text, parm.win.lpstrText),"expected %s, got %s\n", debugstr_w(parm.win.lpstrText), debugstr_w(text)); + + parm.win.lpstrText = NULL; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_TEXT, (DWORD_PTR)&parm); + ok(!err,"mciCommand window text returned %s\n", dbg_mcierr(err)); + GetWindowTextW(hwnd, text, ARRAY_SIZE(text)); + todo_wine ok(!wcscmp(text, L""), "expected L"", got %s\n", debugstr_w(text)); + + /* MCI_PLAY shows parent window */ + err = mciSendCommandW(wDeviceID, MCI_PLAY, 0, (DWORD_PTR)&parm); + ok(!err,"mciCommand play returned %s\n", dbg_mcierr(err)); + ok(IsWindowVisible(hwnd), "window (%p) should be visible\n", hwnd); + + parm.win.nCmdShow = SW_HIDE; + err = mciSendCommandW(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_STATE, (DWORD_PTR)&parm); + ok(!err,"mciCommand window state returned %s\n", dbg_mcierr(err)); + todo_wine ok(!IsWindowVisible(hwnd), "window (%p) should be hidden\n", hwnd); + err = mciSendCommandW(wDeviceID, MCI_CLOSE, 0, 0); ok(!err,"mciCommand close returned %s\n", dbg_mcierr(err));
+ SetWindowTextW(hwnd, original); + ShowWindow(hwnd, SW_HIDE); + ret = DeleteFileW(filename); ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(filename), GetLastError()); }