From 27adecec49c7a02f2e8cbdbed9d2012e97bb6532 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Wed, 29 Feb 2012 23:43:56 +0100 Subject: [PATCH] mmdevapi: Add tests for checking events to capture. --- dlls/mmdevapi/tests/capture.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/mmdevapi/tests/capture.c b/dlls/mmdevapi/tests/capture.c index e13e8139aeb..96ddf77f2ab 100644 --- a/dlls/mmdevapi/tests/capture.c +++ b/dlls/mmdevapi/tests/capture.c @@ -82,7 +82,7 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) HRESULT hr; UINT32 frames, next, pad, sum = 0; BYTE *data; - DWORD flags; + DWORD flags, r; UINT64 pos, qpc; REFERENCE_TIME period; @@ -413,8 +413,35 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) /* Some w7 machines signal DATA_DISCONTINUITY here following the * previous AUDCLNT_S_BUFFER_EMPTY, others not. What logic? */ ok(pos >= sum, "Position %u gap %d\n", (UINT)pos, (UINT)pos - sum); + IAudioCaptureClient_ReleaseBuffer(acc, frames); } + hr = IAudioClient_Stop(ac); + ok(hr == S_OK, "Stop failed: %08x\n", hr); + + ok(ResetEvent(handle), "ResetEvent\n"); + + /* Still receiving events! */ + r = WaitForSingleObject(handle, 20); + todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Stop gave %x\n", r); + + hr = IAudioClient_Reset(ac); + ok(hr == S_OK, "Reset failed: %08x\n", hr); + + ok(ResetEvent(handle), "ResetEvent\n"); + + r = WaitForSingleObject(handle, 120); + todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Reset gave %x\n", r); + + hr = IAudioClient_SetEventHandle(ac, NULL); + ok(hr == E_INVALIDARG, "SetEventHandle(NULL) returns %08x\n", hr); + + r = WaitForSingleObject(handle, 70); + todo_wine ok(r == WAIT_OBJECT_0, "Wait(NULL event) gave %x\n", r); + + hr = IAudioClient_Start(ac); + ok(hr == S_OK, "Start failed: %08x\n", hr); + IUnknown_Release(acc); } -- 2.11.4.GIT