Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/audiorecord.c | 53 +++++++++++++++++++++++++++++ dlls/qcap/tests/avico.c | 53 +++++++++++++++++++++++++++++ dlls/qcap/tests/avimux.c | 58 ++++++++++++++++++++++++++++++++ dlls/qcap/tests/smartteefilter.c | 58 ++++++++++++++++++++++++++++++++ 4 files changed, 222 insertions(+)
diff --git a/dlls/qcap/tests/audiorecord.c b/dlls/qcap/tests/audiorecord.c index e599165d191..11ef690b99d 100644 --- a/dlls/qcap/tests/audiorecord.c +++ b/dlls/qcap/tests/audiorecord.c @@ -245,6 +245,58 @@ static void test_property_bag(IMoniker *mon) 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) { ICreateDevEnum *devenum; @@ -285,6 +337,7 @@ START_TEST(audiorecord) ok(hr == S_OK, "Got hr %#x.\n", hr);
test_interfaces(filter); + test_unconnected_filter_state(filter);
ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index dbc15e3f15d..5c6d4aa54f4 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -655,6 +655,58 @@ static void test_enum_media_types(IBaseFilter *filter) 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) { static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':', @@ -697,6 +749,7 @@ START_TEST(avico) test_pin_info(filter); test_media_types(filter); test_enum_media_types(filter); + test_unconnected_filter_state(filter);
ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index 85ebd5c82c7..572314f8ab3 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -798,6 +798,63 @@ static void test_seeking(void) 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) { CoInitialize(NULL); @@ -810,6 +867,7 @@ START_TEST(avimux) test_media_types(); test_enum_media_types(); test_seeking(); + test_unconnected_filter_state();
CoUninitialize(); } diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index 487c8eca3c1..437f3f4a7f2 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -2154,6 +2154,63 @@ end: 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) { SourceFilter *sourceFilter = create_video_SourceFilter(); @@ -2381,6 +2438,7 @@ START_TEST(smartteefilter) test_find_pin(); test_pin_info(); test_enum_media_types(); + test_unconnected_filter_state();
test_smart_tee_filter_aggregation(); test_smart_tee_filter();