[PATCH] mmdevapi/tests: Fix some test failures on Windows <= 7.
Andrew Eikum
aeikum at codeweavers.com
Tue Oct 13 08:26:32 CDT 2020
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Sun, Oct 11, 2020 at 01:20:22PM +0200, Sven Baars wrote:
> Signed-off-by: Sven Baars <sbaars at codeweavers.com>
> ---
> dlls/mmdevapi/tests/mmdevenum.c | 7 ++++
> dlls/mmdevapi/tests/render.c | 60 ++++++++++++++++++---------------
> 2 files changed, 40 insertions(+), 27 deletions(-)
>
> diff --git a/dlls/mmdevapi/tests/mmdevenum.c b/dlls/mmdevapi/tests/mmdevenum.c
> index 11df1f0229b..4708c2fef84 100644
> --- a/dlls/mmdevapi/tests/mmdevenum.c
> +++ b/dlls/mmdevapi/tests/mmdevenum.c
> @@ -218,6 +218,13 @@ static void test_ActivateAudioInterfaceAsync(void)
>
> h_mmdev = LoadLibraryA("mmdevapi.dll");
>
> + pActivateAudioInterfaceAsync = (void*)GetProcAddress(h_mmdev, "ActivateAudioInterfaceAsync");
> + if (!pActivateAudioInterfaceAsync)
> + {
> + win_skip("ActivateAudioInterfaceAsync is not supported on Win <= 7\n");
> + return;
> + }
> +
> /* some applications look this up by ordinal */
> pActivateAudioInterfaceAsync = (void*)GetProcAddress(h_mmdev, (char *)17);
> ok(pActivateAudioInterfaceAsync != NULL, "mmdevapi.ActivateAudioInterfaceAsync missing!\n");
> diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
> index 5800ec5fd66..3ad00eaa2e2 100644
> --- a/dlls/mmdevapi/tests/render.c
> +++ b/dlls/mmdevapi/tests/render.c
> @@ -154,8 +154,11 @@ static void test_audioclient(void)
>
> hr = IMMDevice_Activate(dev, &IID_IAudioClient2, CLSCTX_INPROC_SERVER,
> NULL, (void**)&ac2);
> - ok(hr == S_OK, "IAudioClient2 Activation failed with %08x\n", hr);
> - IAudioClient2_Release(ac2);
> + ok(hr == S_OK ||
> + broken(hr == E_NOINTERFACE) /* win7 */,
> + "IAudioClient2 Activation failed with %08x\n", hr);
> + if(hr == S_OK)
> + IAudioClient2_Release(ac2);
>
> hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
> NULL, (void**)&ac);
> @@ -262,39 +265,42 @@ static void test_audioclient(void)
> }
>
> hr = IAudioClient_QueryInterface(ac, &IID_IAudioClient2, (void**)&ac2);
> - ok(hr == S_OK, "Failed to query IAudioClient2 interface: %08x\n", hr);
> -
> - hr = IAudioClient2_IsOffloadCapable(ac2, AudioCategory_BackgroundCapableMedia, NULL);
> - ok(hr == E_INVALIDARG, "IsOffloadCapable gave wrong error: %08x\n", hr);
> + if (hr == S_OK)
> + {
> + hr = IAudioClient2_IsOffloadCapable(ac2, AudioCategory_BackgroundCapableMedia, NULL);
> + ok(hr == E_INVALIDARG, "IsOffloadCapable gave wrong error: %08x\n", hr);
>
> - hr = IAudioClient2_IsOffloadCapable(ac2, AudioCategory_BackgroundCapableMedia, &offload_capable);
> - ok(hr == S_OK, "IsOffloadCapable failed: %08x\n", hr);
> + hr = IAudioClient2_IsOffloadCapable(ac2, AudioCategory_BackgroundCapableMedia, &offload_capable);
> + ok(hr == S_OK, "IsOffloadCapable failed: %08x\n", hr);
>
> - hr = IAudioClient2_SetClientProperties(ac2, NULL);
> - ok(hr == E_POINTER, "SetClientProperties with NULL props gave wrong error: %08x\n", hr);
> + hr = IAudioClient2_SetClientProperties(ac2, NULL);
> + ok(hr == E_POINTER, "SetClientProperties with NULL props gave wrong error: %08x\n", hr);
>
> - client_props.cbSize = 0;
> - client_props.bIsOffload = FALSE;
> - client_props.eCategory = AudioCategory_BackgroundCapableMedia;
> - client_props.Options = 0;
> + client_props.cbSize = 0;
> + client_props.bIsOffload = FALSE;
> + client_props.eCategory = AudioCategory_BackgroundCapableMedia;
> + client_props.Options = 0;
>
> - hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> - ok(hr == E_INVALIDARG, "SetClientProperties with invalid cbSize gave wrong error: %08x\n", hr);
> + hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> + ok(hr == E_INVALIDARG, "SetClientProperties with invalid cbSize gave wrong error: %08x\n", hr);
>
> - client_props.cbSize = sizeof(client_props);
> - client_props.bIsOffload = TRUE;
> + client_props.cbSize = sizeof(client_props);
> + client_props.bIsOffload = TRUE;
>
> - hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> - if(!offload_capable)
> - ok(hr == AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE, "SetClientProperties(offload) gave wrong error: %08x\n", hr);
> - else
> - ok(hr == S_OK, "SetClientProperties(offload) failed: %08x\n", hr);
> + hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> + if(!offload_capable)
> + ok(hr == AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE, "SetClientProperties(offload) gave wrong error: %08x\n", hr);
> + else
> + ok(hr == S_OK, "SetClientProperties(offload) failed: %08x\n", hr);
>
> - client_props.bIsOffload = FALSE;
> - hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> - ok(hr == S_OK, "SetClientProperties failed: %08x\n", hr);
> + client_props.bIsOffload = FALSE;
> + hr = IAudioClient2_SetClientProperties(ac2, &client_props);
> + ok(hr == S_OK, "SetClientProperties failed: %08x\n", hr);
>
> - IAudioClient2_Release(ac2);
> + IAudioClient2_Release(ac2);
> + }
> + else
> + win_skip("IAudioClient2 is not present on Win <= 7\n");
>
> hr = IAudioClient_QueryInterface(ac, &IID_IAudioClient3, (void**)&ac3);
> ok(hr == S_OK ||
> --
> 2.25.1
>
>
More information about the wine-devel
mailing list