push cc8bc80451cc24f4d7cf75168b569f0ebfe19547
[wine/hacks.git] / dlls / winmm / tests / mci.c
blob8764b307f177aa1486c96e97bae82c34e3c6e8ff
1 /*
2 * Test winmm mci
4 * Copyright 2006 Jan Zerebecki
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
22 #include "winuser.h"
23 #include "mmsystem.h"
25 START_TEST(mci)
27 int err;
28 const char command_open[] = "open new type waveaudio alias mysound";
29 const char command_close_my[] = "close mysound notify";
30 const char command_close_all[] = "close all notify";
31 const char command_sysinfo[] = "sysinfo waveaudio quantity open";
32 MSG msg;
33 char buf[1024];
34 HWND hwnd;
36 hwnd = CreateWindowExA(0, "static", "winmm test", WS_POPUP, 0,0,100,100,
37 0, 0, 0, NULL);
39 err = mciSendString(command_open, NULL, 0, NULL);
40 ok(!err,"mciSendString(%s, NULL, 0 , NULL) returned error: %d\n", command_open, err);
42 err = mciSendString(command_close_my, NULL, 0, hwnd);
43 ok(!err,"mciSendString(%s, NULL, 0 , NULL) returned error: %d\n", command_close_my, err);
45 ok(PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
46 ok(msg.hwnd == hwnd, "Didn't get the handle to our test window\n");
47 ok(msg.message == MM_MCINOTIFY, "got %04x instead of MM_MCINOTIFY\n", msg.message);
48 ok(msg.wParam == MCI_NOTIFY_SUCCESSFUL, "got %08lx instead of MCI_NOTIFY_SUCCESSFUL\n", msg.wParam);
50 err = mciSendString(command_close_all, NULL, 0, NULL);
51 todo_wine ok(!err,"mciSendString(%s, NULL, 0 , NULL) returned error: %d\n", command_close_all, err);
53 memset(buf, 0, sizeof(buf));
54 err = mciSendString(command_close_all, buf, sizeof(buf), hwnd);
55 todo_wine ok(!err,"mciSendString(%s, buf, sizeof(buf) , NULL) returned error: %d\n", command_close_all, err);
56 todo_wine ok(buf[0] == 0, "mciSendString(%s, buf, sizeof(buf) , NULL) changed output buffer: %s\n", command_close_all, buf);
58 memset(buf, 0, sizeof(buf));
59 err = mciSendString(command_sysinfo, buf, sizeof(buf), NULL);
60 ok(!err,"mciSendString(%s, buf, sizeof(buf) , NULL) returned error: %d\n", command_sysinfo, err);
61 todo_wine ok(buf[0] == '0' && buf[1] == 0, "mciSendString(%s, buf, sizeof(buf) , NULL), expected output buffer '0', got: '%s'\n", command_sysinfo, buf);
63 err = mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_NOTIFY, 0);
64 todo_wine ok(err == MCIERR_INVALID_DEVICE_ID ||
65 broken(!err), /* Win9x and WinMe */
66 "mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_NOTIFY, NULL) returned %d instead of %d\n",
67 err, MCIERR_INVALID_DEVICE_ID);
69 DestroyWindow(hwnd);