Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/dmusic/tests/dmusic.c | 96 ++++++++++++++++++++++++++++++++------ 1 file changed, 81 insertions(+), 15 deletions(-)
diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index cf648228a43..cc06e8200aa 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -498,31 +498,40 @@ static BOOL missing_dmusic(void) return TRUE; }
-static void test_COM_synthport(void) +static IDirectMusicPort *create_synth_port(IDirectMusic **dmusic) { - IDirectMusic *dmusic = NULL; IDirectMusicPort *port = NULL; + DMUS_PORTPARAMS params; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, (void **)dmusic); + ok(hr == S_OK, "Cannot create DirectMusic object: %#x\n", hr); + + params.dwSize = sizeof(params); + params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_AUDIOCHANNELS; + params.dwChannelGroups = 1; + params.dwAudioChannels = 2; + hr = IDirectMusic_SetDirectSound(*dmusic, NULL, NULL); + ok(hr == S_OK, "IDirectMusic_SetDirectSound failed: %#x\n", hr); + hr = IDirectMusic_CreatePort(*dmusic, &GUID_NULL, ¶ms, &port, NULL); + ok(hr == S_OK, "IDirectMusic_CreatePort failed: %#x\n", hr); + + return port; +} + +static void test_COM_synthport(void) +{ + IDirectMusic *dmusic; + IDirectMusicPort *port; IDirectMusicPortDownload *dmpd; IDirectMusicThru *dmt; IKsControl *iksc; IReferenceClock *clock; IUnknown *unk; - DMUS_PORTPARAMS port_params; ULONG refcount; HRESULT hr;
- /* Create a IDirectMusicPort */ - hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic, - (void**)&dmusic); - ok(hr == S_OK, "Cannot create DirectMusic object (%x)\n", hr); - port_params.dwSize = sizeof(port_params); - port_params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_AUDIOCHANNELS; - port_params.dwChannelGroups = 1; - port_params.dwAudioChannels = 2; - hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL); - ok(hr == S_OK, "IDirectMusic_SetDirectSound returned: %x\n", hr); - hr = IDirectMusic_CreatePort(dmusic, &GUID_NULL, &port_params, &port, NULL); - ok(hr == S_OK, "IDirectMusic_CreatePort returned: %x\n", hr); + port = create_synth_port(&dmusic);
/* Same refcount for all DirectMusicPort interfaces */ refcount = IDirectMusicPort_AddRef(port); @@ -861,6 +870,62 @@ static void test_master_clock(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_synthport(void) +{ + IDirectMusic *dmusic; + IDirectMusicBuffer *buf; + IDirectMusicPort *port; + DMUS_BUFFERDESC desc; + DMUS_PORTCAPS caps; + HRESULT hr; + + port = create_synth_port(&dmusic); + + /* Create a IDirectMusicPortBuffer */ + desc.dwSize = sizeof(DMUS_BUFFERDESC); + desc.dwFlags = 0; + desc.cbBuffer = 1023; + memcpy(&desc.guidBufferFormat, &GUID_NULL, sizeof(GUID)); + hr = IDirectMusic_CreateMusicBuffer(dmusic, &desc, &buf, NULL); + ok(hr == S_OK, "IDirectMusic_CreateMusicBuffer failed: %#x\n", hr); + + /* Unsupported methods */ + hr = IDirectMusicPort_Read(port, (IDirectMusicBuffer *)0xdeadbeef); + todo_wine ok(hr == E_POINTER, "Read returned: %#x\n", hr); + hr = IDirectMusicPort_Read(port, buf); + ok(hr == E_NOTIMPL, "Read returned: %#x\n", hr); + hr = IDirectMusicPort_SetReadNotificationHandle(port, NULL); + ok(hr == E_NOTIMPL, "SetReadNotificationHandle returned: %#x\n", hr); + hr = IDirectMusicPort_Compact(port); + ok(hr == E_NOTIMPL, "Compact returned: %#x\n", hr); + + /* GetCaps */ + hr = IDirectMusicPort_GetCaps(port, NULL); + ok(hr == E_INVALIDARG, "GetCaps failed: %#x\n", hr); + memset(&caps, 0, sizeof(caps)); + hr = IDirectMusicPort_GetCaps(port, &caps); + ok(hr == E_INVALIDARG, "GetCaps failed: %#x\n", hr); + caps.dwSize = sizeof(caps); + hr = IDirectMusicPort_GetCaps(port, &caps); + ok(hr == S_OK, "GetCaps failed: %#x\n", hr); + ok(caps.dwSize == sizeof(caps), "dwSize was modified to %d\n", caps.dwSize); + ok(IsEqualGUID(&caps.guidPort, &CLSID_DirectMusicSynth), "Expected port guid CLSID_DirectMusicSynth, got %s\n", + wine_dbgstr_guid(&caps.guidPort)); + ok(caps.dwClass == DMUS_PC_OUTPUTCLASS, "Got wrong dwClass: %#x\n", caps.dwClass); + ok(caps.dwType == DMUS_PORT_USER_MODE_SYNTH, "Got wrong dwType: %#x\n", caps.dwType); + ok(caps.dwFlags == (DMUS_PC_AUDIOPATH|DMUS_PC_DIRECTSOUND|DMUS_PC_DLS|DMUS_PC_DLS2|DMUS_PC_SOFTWARESYNTH| + DMUS_PC_WAVE), "Unexpected dwFlags returned: %#x\n", caps.dwFlags); + ok(caps.dwMemorySize == DMUS_PC_SYSTEMMEMORY, "Got dwMemorySize: %#x\n", caps.dwMemorySize); + ok(caps.dwMaxChannelGroups == 1000, "Got dwMaxChannelGroups: %d\n", caps.dwMaxChannelGroups); + ok(caps.dwMaxVoices == 1000, "Got dwMaxVoices: %d\n", caps.dwMaxVoices); + ok(caps.dwMaxAudioChannels == 2, "Got dwMaxAudioChannels: %#x\n", caps.dwMaxAudioChannels); + ok(caps.dwEffectFlags == DMUS_EFFECT_REVERB, "Unexpected dwEffectFlags returned: %#x\n", caps.dwEffectFlags); + trace("Port wszDescription: %s\n", wine_dbgstr_w(caps.wszDescription)); + + IDirectMusicPort_Release(port); + IDirectMusic_Release(dmusic); +} + START_TEST(dmusic) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -880,6 +945,7 @@ START_TEST(dmusic) test_dmcoll(); test_parsedescriptor(); test_master_clock(); + test_synthport();
CoUninitialize(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=106001
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
dmusic: 06f4:dmusic: unhandled exception c0000005 at 726B8B28
=== w7u_adm (32 bit report) ===
dmusic: 0870:dmusic: unhandled exception c0000005 at 71DB8B28
=== w7u_el (32 bit report) ===
dmusic: 086c:dmusic: unhandled exception c0000005 at 723B8B28
=== w8 (32 bit report) ===
dmusic: 0c74:dmusic: unhandled exception c0000005 at 6A0F81B1
=== w8adm (32 bit report) ===
dmusic: 0ccc:dmusic: unhandled exception c0000005 at 69A681B1
=== w864 (32 bit report) ===
dmusic: 0b2c:dmusic: unhandled exception c0000005 at 73D781B1
=== w1064v1507 (32 bit report) ===
dmusic: 0d58:dmusic: unhandled exception c0000005 at 73F99AC3
=== w1064v1809 (32 bit report) ===
dmusic: 19d0:dmusic: unhandled exception c0000005 at 749C94FC
=== w1064 (32 bit report) ===
dmusic: 1c08:dmusic: unhandled exception c0000005 at 748A940C
=== w1064_tsign (32 bit report) ===
dmusic: 0e2c:dmusic: unhandled exception c0000005 at 7514940C
=== w10pro64 (32 bit report) ===
dmusic: 1fc0:dmusic: unhandled exception c0000005 at 6F6B940C
=== w864 (64 bit report) ===
dmusic: 09e4:dmusic: unhandled exception c0000005 at 00007FF9F6019F8B
=== w1064v1507 (64 bit report) ===
dmusic: 0c70:dmusic: unhandled exception c0000005 at 00007FF989B09ACB
=== w1064v1809 (64 bit report) ===
dmusic: 1970:dmusic: unhandled exception c0000005 at 00007FFF8D0794C5
=== w1064 (64 bit report) ===
dmusic: 00b0:dmusic: unhandled exception c0000005 at 00007FFDBDB09835
=== w1064_2qxl (64 bit report) ===
dmusic: 0658:dmusic: unhandled exception c0000005 at 00007FFAB51E9835
=== w1064_tsign (64 bit report) ===
dmusic: 0cc4:dmusic: unhandled exception c0000005 at 00007FFEE3BB9835
=== w10pro64 (64 bit report) ===
dmusic: 0318:dmusic: unhandled exception c0000005 at 00007FFF3BD59835
=== w10pro64_ar (64 bit report) ===
dmusic: 1fe4:dmusic: unhandled exception c0000005 at 00007FFB13C79835
=== w10pro64_he (64 bit report) ===
dmusic: 1f84:dmusic: unhandled exception c0000005 at 00007FF9E3AC9835
=== w10pro64_ja (64 bit report) ===
dmusic: 1db8:dmusic: unhandled exception c0000005 at 00007FFDCD789835
=== w10pro64_zh_CN (64 bit report) ===
dmusic: 1d80:dmusic: unhandled exception c0000005 at 00007FFCAC6D9835