quartz/tests: Add some tests for allocator negotiation on the DirectSound renderer.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-15 22:57:18 -05:00 committed by Alexandre Julliard
parent 52862838db
commit aca967b8a5
1 changed files with 49 additions and 0 deletions

View File

@ -631,6 +631,49 @@ static void testfilter_init(struct testfilter *filter)
strmbase_source_init(&filter->source, &filter->filter, L"", &testsource_ops);
}
static void test_allocator(IMemInputPin *input)
{
IMemAllocator *req_allocator, *ret_allocator;
ALLOCATOR_PROPERTIES props;
HRESULT hr;
hr = IMemInputPin_GetAllocatorRequirements(input, &props);
ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr);
hr = IMemInputPin_GetAllocator(input, &ret_allocator);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (hr == S_OK)
{
hr = IMemAllocator_GetProperties(ret_allocator, &props);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!props.cBuffers, "Got %d buffers.\n", props.cBuffers);
ok(!props.cbBuffer, "Got size %d.\n", props.cbBuffer);
ok(!props.cbAlign, "Got alignment %d.\n", props.cbAlign);
ok(!props.cbPrefix, "Got prefix %d.\n", props.cbPrefix);
hr = IMemInputPin_NotifyAllocator(input, ret_allocator, TRUE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
IMemAllocator_Release(ret_allocator);
}
hr = IMemInputPin_NotifyAllocator(input, NULL, TRUE);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
&IID_IMemAllocator, (void **)&req_allocator);
hr = IMemInputPin_NotifyAllocator(input, req_allocator, TRUE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMemInputPin_GetAllocator(input, &ret_allocator);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(ret_allocator == req_allocator, "Allocators didn't match.\n");
IMemAllocator_Release(req_allocator);
IMemAllocator_Release(ret_allocator);
}
static void test_connect_pin(void)
{
WAVEFORMATEX wfx =
@ -653,6 +696,7 @@ static void test_connect_pin(void)
IBaseFilter *filter = create_dsound_render();
struct testfilter source;
IFilterGraph2 *graph;
IMemInputPin *input;
AM_MEDIA_TYPE mt;
IPin *pin, *peer;
HRESULT hr;
@ -686,6 +730,10 @@ static void test_connect_pin(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(compare_media_types(&mt, &req_mt), "Media types didn't match.\n");
IPin_QueryInterface(pin, &IID_IMemInputPin, (void **)&input);
test_allocator(input);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, pin);
@ -701,6 +749,7 @@ static void test_connect_pin(void)
hr = IPin_ConnectionMediaType(pin, &mt);
ok(hr == VFW_E_NOT_CONNECTED, "Got hr %#x.\n", hr);
IMemInputPin_Release(input);
IPin_Release(pin);
ref = IFilterGraph2_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);