qcap/tests: Add some tests for unconnected filter 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-09-26 21:40:51 -05:00 committed by Alexandre Julliard
parent 084cb90f58
commit 4f29ddf7fb
4 changed files with 222 additions and 0 deletions

View File

@ -245,6 +245,58 @@ static void test_property_bag(IMoniker *mon)
IPropertyBag_Release(devenum_bag); IPropertyBag_Release(devenum_bag);
} }
static void test_unconnected_filter_state(IBaseFilter *filter)
{
FILTER_STATE state;
HRESULT hr;
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
}
START_TEST(audiorecord) START_TEST(audiorecord)
{ {
ICreateDevEnum *devenum; ICreateDevEnum *devenum;
@ -285,6 +337,7 @@ START_TEST(audiorecord)
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
test_interfaces(filter); test_interfaces(filter);
test_unconnected_filter_state(filter);
ref = IBaseFilter_Release(filter); ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref); ok(!ref, "Got outstanding refcount %d.\n", ref);

View File

@ -655,6 +655,58 @@ static void test_enum_media_types(IBaseFilter *filter)
IPin_Release(pin); IPin_Release(pin);
} }
static void test_unconnected_filter_state(IBaseFilter *filter)
{
FILTER_STATE state;
HRESULT hr;
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
}
START_TEST(avico) START_TEST(avico)
{ {
static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':',
@ -697,6 +749,7 @@ START_TEST(avico)
test_pin_info(filter); test_pin_info(filter);
test_media_types(filter); test_media_types(filter);
test_enum_media_types(filter); test_enum_media_types(filter);
test_unconnected_filter_state(filter);
ref = IBaseFilter_Release(filter); ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref); ok(!ref, "Got outstanding refcount %d.\n", ref);

View File

@ -798,6 +798,63 @@ static void test_seeking(void)
ok(!ref, "Got unexpected refcount %d.\n", ref); ok(!ref, "Got unexpected refcount %d.\n", ref);
} }
static void test_unconnected_filter_state(void)
{
IBaseFilter *filter = create_avi_mux();
FILTER_STATE state;
HRESULT hr;
ULONG ref;
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
START_TEST(avimux) START_TEST(avimux)
{ {
CoInitialize(NULL); CoInitialize(NULL);
@ -810,6 +867,7 @@ START_TEST(avimux)
test_media_types(); test_media_types();
test_enum_media_types(); test_enum_media_types();
test_seeking(); test_seeking();
test_unconnected_filter_state();
CoUninitialize(); CoUninitialize();
} }

View File

@ -2154,6 +2154,63 @@ end:
IEnumMediaTypes_Release(enumMediaTypes); IEnumMediaTypes_Release(enumMediaTypes);
} }
static void test_unconnected_filter_state(void)
{
IBaseFilter *filter = create_smart_tee();
FILTER_STATE state;
HRESULT hr;
ULONG ref;
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Pause(filter);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Paused, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
hr = IBaseFilter_Run(filter, 0);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(state == State_Running, "Got state %u.\n", state);
hr = IBaseFilter_Stop(filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IBaseFilter_GetState(filter, 0, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(state == State_Stopped, "Got state %u.\n", state);
ref = IBaseFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_smart_tee_filter_aggregation(void) static void test_smart_tee_filter_aggregation(void)
{ {
SourceFilter *sourceFilter = create_video_SourceFilter(); SourceFilter *sourceFilter = create_video_SourceFilter();
@ -2381,6 +2438,7 @@ START_TEST(smartteefilter)
test_find_pin(); test_find_pin();
test_pin_info(); test_pin_info();
test_enum_media_types(); test_enum_media_types();
test_unconnected_filter_state();
test_smart_tee_filter_aggregation(); test_smart_tee_filter_aggregation();
test_smart_tee_filter(); test_smart_tee_filter();