quartz/filtergraph: Add tests for asynchronous state change.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-06-20 20:13:20 -05:00 committed by Alexandre Julliard
parent b583452af3
commit 6beabb2317
1 changed files with 35 additions and 4 deletions

View File

@ -1163,6 +1163,8 @@ struct testfilter
struct testpin *pins;
unsigned int pin_count, enum_idx;
HRESULT state_hr;
IAMFilterMiscFlags IAMFilterMiscFlags_iface;
ULONG misc_flags;
@ -1344,7 +1346,7 @@ static HRESULT WINAPI testfilter_Stop(IBaseFilter *iface)
check_state_transition(filter, State_Stopped);
filter->state = State_Stopped;
return S_OK;
return filter->state_hr;
}
static HRESULT WINAPI testfilter_Pause(IBaseFilter *iface)
@ -1355,7 +1357,7 @@ static HRESULT WINAPI testfilter_Pause(IBaseFilter *iface)
check_state_transition(filter, State_Paused);
filter->state = State_Paused;
return S_OK;
return filter->state_hr;
}
static HRESULT WINAPI testfilter_Run(IBaseFilter *iface, REFERENCE_TIME start)
@ -1367,7 +1369,7 @@ static HRESULT WINAPI testfilter_Run(IBaseFilter *iface, REFERENCE_TIME start)
filter->state = State_Running;
filter->start_time = start;
return S_OK;
return filter->state_hr;
}
static HRESULT WINAPI testfilter_GetState(IBaseFilter *iface, DWORD timeout, FILTER_STATE *state)
@ -1376,7 +1378,7 @@ static HRESULT WINAPI testfilter_GetState(IBaseFilter *iface, DWORD timeout, FIL
if (winetest_debug > 1) trace("%p->GetState(%u)\n", filter, timeout);
*state = filter->state;
return S_OK;
return filter->state_hr;
}
static HRESULT WINAPI testfilter_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
@ -2954,6 +2956,7 @@ static void test_filter_state(void)
IReferenceClock *clock;
IMediaControl *control;
IMediaFilter *filter;
OAFilterState state;
HRESULT hr;
ULONG ref;
@ -3094,6 +3097,34 @@ todo_wine
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_filter_state(graph, State_Stopped);
sink.state_hr = S_FALSE;
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
sink.state_hr = VFW_S_STATE_INTERMEDIATE;
hr = IMediaControl_GetState(control, 0, &state);
todo_wine ok(hr == VFW_S_STATE_INTERMEDIATE, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state_hr = VFW_S_CANT_CUE;
hr = IMediaControl_GetState(control, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state_hr = VFW_S_STATE_INTERMEDIATE;
source.state_hr = VFW_S_CANT_CUE;
hr = IMediaControl_GetState(control, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state_hr = VFW_S_CANT_CUE;
source.state_hr = VFW_S_STATE_INTERMEDIATE;
hr = IMediaControl_GetState(control, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
ok(state == State_Paused, "Got state %u.\n", state);
sink.state_hr = source.state_hr = S_OK;
/* Destroying the graph while it's running stops all filters. */
hr = IMediaFilter_Run(filter, 0);