From 9e7b8a2f2f76bc678063c7796d272cb387adba5d Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 21 Feb 2019 18:43:00 -0600 Subject: [PATCH] quartz/tests/filesource: Add some tests for filter state. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/tests/filesource.c | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index d485211429c..ddf0709a8e5 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -602,6 +602,70 @@ todo_wine ok(ret, "Failed to delete file, error %u.\n", GetLastError()); } +static void test_filter_state(void) +{ + IBaseFilter *filter = create_file_source(); + IMediaControl *control; + IFilterGraph2 *graph; + FILTER_STATE state; + HRESULT hr; + ULONG ref; + + CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + IFilterGraph2_AddFilter(graph, filter, NULL); + IFilterGraph2_QueryInterface(graph, &IID_IMediaControl, (void **)&control); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %d.\n", state); + + hr = IMediaControl_Run(control); +todo_wine + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %d.\n", state); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %d.\n", state); + + hr = IMediaControl_Pause(control); +todo_wine + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %d.\n", state); + + hr = IMediaControl_Run(control); +todo_wine + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %d.\n", state); + + hr = IMediaControl_Pause(control); +todo_wine + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %d.\n", state); + + hr = IMediaControl_Stop(control); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IBaseFilter_GetState(filter, 1000, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %d.\n", state); + + IMediaControl_Release(control); + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(filesource) { CoInitialize(NULL); @@ -610,6 +674,7 @@ START_TEST(filesource) test_enum_pins(); test_find_pin(); test_pin_info(); + test_filter_state(); test_file_source_filter(); CoUninitialize();