Jörg Höhle : winmm/tests: Fix up to 3 MCI test failures.
Alexandre Julliard
julliard at winehq.org
Tue Mar 2 10:32:34 CST 2010
Module: wine
Branch: master
Commit: bafbc9820e8a6bb4799540a9ea3936f5b98a5c63
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bafbc9820e8a6bb4799540a9ea3936f5b98a5c63
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sun Feb 28 20:19:03 2010 +0100
winmm/tests: Fix up to 3 MCI test failures.
---
dlls/winmm/tests/mci.c | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index f9ab137..bbc21dd 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -150,7 +150,7 @@ static void test_notification(HWND hwnd, const char* command, WPARAM type)
seen = PeekMessageA(&msg, hwnd, MM_MCINOTIFY, MM_MCINOTIFY, PM_REMOVE);
}
if(!seen)
- ok(type==0, "Expect message %lx from %s\n", type, command);
+ ok(type==0, "Expect message %04lx from %s\n", type, command);
else if(msg.hwnd != hwnd)
ok(msg.hwnd == hwnd, "Didn't get the handle to our test window\n");
else if(msg.message != MM_MCINOTIFY)
@@ -251,6 +251,7 @@ static void test_recordWAVE(HWND hwnd)
WORD nch = 1;
WORD nbits = 16;
DWORD nsamp = 16000, expect;
+ UINT ndevs = waveInGetNumDevs();
MCIERROR err, ok_pcm;
MCIDEVICEID wDeviceID;
MCI_PARMS_UNION parm;
@@ -293,19 +294,29 @@ static void test_recordWAVE(HWND hwnd)
/* MCI appears to scan the available devices for support of this format,
* returning MCIERR_OUTOFRANGE on machines with no sound.
+ * However some w2k8/w7 machines return no error when there's no wave
+ * input device (perhaps querying waveOutGetNumDevs instead of waveIn?),
+ * still the record command below fails with MCIERR_WAVE_INPUTSUNSUITABLE.
* Don't skip here, record will fail below. */
err = mciSendString("set x format tag pcm", NULL, 0, NULL);
ok(!err || err==MCIERR_OUTOFRANGE,"mci set format tag pcm returned %s\n", dbg_mcierr(err));
ok_pcm = err;
- err = mciSendString("set x samplespersec 41000 alignment 4 channels 2", NULL, 0, NULL);
- ok(err==ok_pcm,"mci set samples+align+channels returned %s\n", dbg_mcierr(err));
-
+ /* MSDN warns against not setting all wave format parameters.
+ * Indeed, it produces strange results, incl.
+ * inconsistent PCMWAVEFORMAT headers in the saved file.
+ */
+ err = mciSendString("set x bytespersec 22050 alignment 2 samplespersec 11025 channels 1 bitspersample 16", NULL, 0, NULL);
+ ok(err==ok_pcm,"mci set 5 wave parameters returned %s\n", dbg_mcierr(err));
/* Investigate: on w2k, set samplespersec 22050 sets nChannels to 2!
* err = mciSendString("set x samplespersec 22050", NULL, 0, NULL);
* ok(!err,"mci set samplespersec returned %s\n", dbg_mcierr(err));
*/
+ /* Checks are generally performed immediately. */
+ err = mciSendString("set x bitspersample 4", NULL, 0, NULL);
+ todo_wine ok(err==MCIERR_OUTOFRANGE,"mci set bitspersample 4 returned %s\n", dbg_mcierr(err));
+
parm.set.wFormatTag = WAVE_FORMAT_PCM;
parm.set.nSamplesPerSec = nsamp;
parm.set.wBitsPerSample = nbits;
@@ -321,7 +332,10 @@ static void test_recordWAVE(HWND hwnd)
/* A few ME machines pass all tests except set format tag pcm! */
err = mciSendString("record x to 2000 wait", NULL, 0, hwnd);
ok(err || !ok_pcm,"can record yet set wave format pcm returned %s\n", dbg_mcierr(ok_pcm));
- ok(!err || err==(ok_pcm==MCIERR_OUTOFRANGE ? MCIERR_WAVE_INPUTSUNSUITABLE : 0),"mci record to 2000 returned %s\n", dbg_mcierr(err));
+ if(!ndevs) todo_wine /* with sound disabled */
+ ok(ndevs>0 ? !err : err==MCIERR_WAVE_INPUTSUNSUITABLE,"mci record to 2000 returned %s\n", dbg_mcierr(err));
+ else
+ ok(ndevs>0 ? !err : err==MCIERR_WAVE_INPUTSUNSUITABLE,"mci record to 2000 returned %s\n", dbg_mcierr(err));
if(err) {
if (err==MCIERR_WAVE_INPUTSUNSUITABLE)
skip("Please install audio driver. Everything is skipped.\n");
@@ -699,7 +713,7 @@ static void test_AutoOpenWAVE(HWND hwnd)
/* This test used(?) to cause intermittent crashes when Wine exits, after
* fixme:winmm:MMDRV_Exit Closing while ll-driver open
*/
- MCIERROR err, ok_snd;
+ MCIERROR err, ok_snd = waveOutGetNumDevs() ? 0 : MCIERR_HARDWARE;
char buf[512], path[300], command[330];
memset(buf, 0, sizeof(buf)); memset(path, 0, sizeof(path));
@@ -711,12 +725,12 @@ static void test_AutoOpenWAVE(HWND hwnd)
ok(!err,"mci sysinfo waveaudio quantity open returned %s\n", dbg_mcierr(err));
if(!err) todo_wine ok(!strcmp(buf,"0"), "sysinfo quantity open expected 0, got: %s, some more tests will fail.\n", buf);
- ok_snd = waveOutGetNumDevs() ? 0 : MCIERR_HARDWARE;
+ /* Who knows why some machines pass all tests but return MCIERR_HARDWARE here? */
err = mciSendString("sound NoSuchSoundDefined wait", NULL, 0, NULL);
- todo_wine ok(err==ok_snd,"mci sound NoSuchSoundDefined returned %s\n", dbg_mcierr(err));
+ todo_wine ok(err==ok_snd || broken(err==MCIERR_HARDWARE),"mci sound NoSuchSoundDefined returned %s\n", dbg_mcierr(err));
err = mciSendString("sound SystemExclamation notify wait", NULL, 0, hwnd);
- todo_wine ok(err==ok_snd,"mci sound SystemExclamation returned %s\n", dbg_mcierr(err));
+ todo_wine ok(err==ok_snd || broken(err==MCIERR_HARDWARE),"mci sound SystemExclamation returned %s\n", dbg_mcierr(err));
test_notification(hwnd, "sound notify", err ? 0 : MCI_NOTIFY_SUCCESSFUL);
buf[0]=0;
More information about the wine-cvs
mailing list