quartz/tests: Test receiving EC_COMPLETE when not connected.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8ef3c68f5f
commit
74b595162c
|
@ -40,6 +40,15 @@ static IBaseFilter *create_dsound_render(void)
|
|||
return filter;
|
||||
}
|
||||
|
||||
static IFilterGraph2 *create_graph(void)
|
||||
{
|
||||
IFilterGraph2 *ret;
|
||||
HRESULT hr;
|
||||
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph2, (void **)&ret);
|
||||
ok(hr == S_OK, "Failed to create FilterGraph: %#x\n", hr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b)
|
||||
{
|
||||
return !memcmp(a, b, offsetof(AM_MEDIA_TYPE, pbFormat))
|
||||
|
@ -1314,6 +1323,72 @@ static void test_media_types(void)
|
|||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
static void test_unconnected_eos(void)
|
||||
{
|
||||
IBaseFilter *filter = create_dsound_render();
|
||||
IFilterGraph2 *graph = create_graph();
|
||||
IMediaControl *control;
|
||||
IMediaEvent *eventsrc;
|
||||
unsigned int ret;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Stop(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
IMediaControl_Release(control);
|
||||
IMediaEvent_Release(eventsrc);
|
||||
ref = IFilterGraph2_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IBaseFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(dsoundrender)
|
||||
{
|
||||
IBaseFilter *filter;
|
||||
|
@ -1343,6 +1418,7 @@ START_TEST(dsoundrender)
|
|||
test_unconnected_filter_state();
|
||||
test_media_types();
|
||||
test_connect_pin();
|
||||
test_unconnected_eos();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -2865,6 +2865,72 @@ static void test_basic_video(void)
|
|||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
static void test_unconnected_eos(void)
|
||||
{
|
||||
IBaseFilter *filter = create_video_renderer();
|
||||
IFilterGraph2 *graph = create_graph();
|
||||
IMediaControl *control;
|
||||
IMediaEvent *eventsrc;
|
||||
unsigned int ret;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Stop(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
IMediaControl_Release(control);
|
||||
IMediaEvent_Release(eventsrc);
|
||||
ref = IFilterGraph2_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IBaseFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(videorenderer)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
@ -2881,6 +2947,7 @@ START_TEST(videorenderer)
|
|||
test_overlay();
|
||||
test_video_window();
|
||||
test_basic_video();
|
||||
test_unconnected_eos();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -1236,6 +1236,34 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
|
|||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
static unsigned int check_event_code(IMediaEvent *eventsrc, DWORD timeout, LONG expected_code, LONG_PTR expected1, LONG_PTR expected2)
|
||||
{
|
||||
LONG_PTR param1, param2;
|
||||
unsigned int ret = 0;
|
||||
HRESULT hr;
|
||||
LONG code;
|
||||
|
||||
while ((hr = IMediaEvent_GetEvent(eventsrc, &code, ¶m1, ¶m2, timeout)) == S_OK)
|
||||
{
|
||||
if (code == expected_code)
|
||||
{
|
||||
ok(param1 == expected1, "Got param1 %#lx.\n", param1);
|
||||
ok(param2 == expected2, "Got param2 %#lx.\n", param2);
|
||||
ret++;
|
||||
}
|
||||
IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
|
||||
timeout = 0;
|
||||
}
|
||||
ok(hr == E_ABORT, "Got hr %#x.\n", hr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
|
||||
{
|
||||
return check_event_code(eventsrc, timeout, EC_COMPLETE, S_OK, 0);
|
||||
}
|
||||
|
||||
static void test_current_image(IBaseFilter *filter, IMemInputPin *input,
|
||||
IMediaControl *control, const BITMAPINFOHEADER *req_bih)
|
||||
{
|
||||
|
@ -3041,6 +3069,72 @@ out:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_unconnected_eos(void)
|
||||
{
|
||||
IFilterGraph2 *graph = create_graph();
|
||||
IBaseFilter *filter = create_vmr7(0);
|
||||
IMediaControl *control;
|
||||
IMediaEvent *eventsrc;
|
||||
unsigned int ret;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Stop(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
IMediaControl_Release(control);
|
||||
IMediaEvent_Release(eventsrc);
|
||||
ref = IFilterGraph2_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IBaseFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(vmr7)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
@ -3059,6 +3153,7 @@ START_TEST(vmr7)
|
|||
test_video_window();
|
||||
test_basic_video();
|
||||
test_windowless_size();
|
||||
test_unconnected_eos();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -4170,6 +4170,72 @@ static void test_mixing_prefs(void)
|
|||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
static void test_unconnected_eos(void)
|
||||
{
|
||||
IFilterGraph2 *graph = create_graph();
|
||||
IBaseFilter *filter = create_vmr9(0);
|
||||
IMediaControl *control;
|
||||
IMediaEvent *eventsrc;
|
||||
unsigned int ret;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IFilterGraph2_AddFilter(graph, filter, L"renderer");
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&eventsrc);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Pause(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Stop(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
ok(!ret, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
hr = IMediaControl_Run(control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ret = check_ec_complete(eventsrc, 0);
|
||||
todo_wine ok(ret == 1, "Got %u EC_COMPLETE events.\n", ret);
|
||||
|
||||
IMediaControl_Release(control);
|
||||
IMediaEvent_Release(eventsrc);
|
||||
ref = IFilterGraph2_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IBaseFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(vmr9)
|
||||
{
|
||||
IBaseFilter *filter;
|
||||
|
@ -4205,6 +4271,7 @@ START_TEST(vmr9)
|
|||
test_basic_video();
|
||||
test_windowless_size();
|
||||
test_mixing_prefs();
|
||||
test_unconnected_eos();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue