From: Giovanni Mascellani gmascellani@codeweavers.com
Trying to balance between coverage and running time. Especially on macOS it takes a lot of time to initialize and deinitialize the audio system over and over. --- dlls/mmdevapi/tests/capture.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/mmdevapi/tests/capture.c b/dlls/mmdevapi/tests/capture.c index 407eeabaa41..a3d0aefd2b9 100644 --- a/dlls/mmdevapi/tests/capture.c +++ b/dlls/mmdevapi/tests/capture.c @@ -37,10 +37,10 @@ #include "mmdeviceapi.h" #include "audioclient.h"
-static const unsigned int sampling_rates[] = { 8000, 11025, 12000, 16000, 22050, 44100, 48000, 96000 }; -static const unsigned int channel_counts[] = { 1, 2 }; +static const unsigned int sampling_rates[] = { 8000, 16000, 22050, 44100, 48000, 96000 }; +static const unsigned int channel_counts[] = { 1, 2, 8 }; static const unsigned int sample_formats[][2] = { {WAVE_FORMAT_PCM, 8}, {WAVE_FORMAT_PCM, 16}, - {WAVE_FORMAT_IEEE_FLOAT, 32} }; + {WAVE_FORMAT_PCM, 32}, {WAVE_FORMAT_IEEE_FLOAT, 32} };
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
@@ -590,7 +590,8 @@ static void test_formats(AUDCLNT_SHAREMODE mode) hrs = hr; /* Only shared mode suggests something ... GetMixFormat! */ ok(hr == S_OK || (mode == AUDCLNT_SHAREMODE_SHARED - ? hr == S_FALSE : hr == AUDCLNT_E_UNSUPPORTED_FORMAT), + ? hr == S_FALSE || (hr == AUDCLNT_E_UNSUPPORTED_FORMAT && fmt.nChannels > 2) + : hr == AUDCLNT_E_UNSUPPORTED_FORMAT), "IsFormatSupported(%d, %c%lux%2ux%u) returns %08lx\n", mode, format_chr, fmt.nSamplesPerSec, fmt.wBitsPerSample, fmt.nChannels, hr); if (hr == S_OK) @@ -603,8 +604,11 @@ static void test_formats(AUDCLNT_SHAREMODE mode) { BOOL compatible = fmt.nSamplesPerSec == pwfx->nSamplesPerSec && fmt.nChannels == pwfx->nChannels; HRESULT expected = compatible ? S_OK : S_FALSE; + if (fmt.nChannels > 2) + expected = AUDCLNT_E_UNSUPPORTED_FORMAT; todo_wine_if(hr != expected) - ok(hr == expected, "Got %lx expected %lx\n", hr, expected); + ok(hr == expected, "IsFormatSupported(shared, %c%lux%2ux%u) returns %08lx, expected %08lx\n", + format_chr, fmt.nSamplesPerSec, fmt.wBitsPerSample, fmt.nChannels, hr, expected); }
ok((hr == S_FALSE)^(pwfx2 == NULL), "hr %lx<->suggest %p\n", hr, pwfx2); @@ -623,7 +627,8 @@ static void test_formats(AUDCLNT_SHAREMODE mode) mode == AUDCLNT_SHAREMODE_SHARED ? "shared " : "exclus.", format_chr, fmt.nSamplesPerSec, fmt.wBitsPerSample, fmt.nChannels, hr); if (mode == AUDCLNT_SHAREMODE_SHARED) - ok(hrs == S_OK ? hr == S_OK : hr == AUDCLNT_E_UNSUPPORTED_FORMAT, + ok(hrs == S_OK ? hr == S_OK : hr == AUDCLNT_E_UNSUPPORTED_FORMAT + || (hr == E_INVALIDARG && fmt.nChannels > 2), "Initialize(shared, %c%lux%2ux%u) returns %08lx\n", format_chr, fmt.nSamplesPerSec, fmt.wBitsPerSample, fmt.nChannels, hr); else if (hrs == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED) @@ -634,7 +639,8 @@ static void test_formats(AUDCLNT_SHAREMODE mode) else todo_wine_if(hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED) ok(hrs == S_OK ? hr == S_OK - : hr == AUDCLNT_E_ENDPOINT_CREATE_FAILED || hr == AUDCLNT_E_UNSUPPORTED_FORMAT, + : hr == AUDCLNT_E_ENDPOINT_CREATE_FAILED || hr == AUDCLNT_E_UNSUPPORTED_FORMAT + || (hr == E_INVALIDARG && fmt.nChannels > 2), "Initialize(exclus., %c%lux%2ux%u) returns %08lx\n", format_chr, fmt.nSamplesPerSec, fmt.wBitsPerSample, fmt.nChannels, hr);