Commit ba44377f authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

amstream/tests: Add tests for AMMultiMediaStream::GetEndOfStreamEventHandle.

parent 655adf65
......@@ -2961,6 +2961,87 @@ static void test_media_types(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_get_end_of_stream_event_handle(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
IMediaStreamFilter *filter;
struct testfilter source;
IGraphBuilder *graph;
IMediaStream *stream;
HANDLE event;
HRESULT hr;
ULONG ref;
IPin *pin;
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilter(mmstream, &filter);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!!filter, "Expected non-null filter.\n");
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaStream_QueryInterface(stream, &IID_IPin, (void **)&pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(!!graph, "Expected non-NULL graph.\n");
testfilter_init(&source);
source.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl;
hr = IGraphBuilder_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, NULL);
todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
event = INVALID_HANDLE_VALUE;
hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, &event);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IGraphBuilder_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &rgb32_mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);
IGraphBuilder_Disconnect(graph, pin);
IGraphBuilder_Disconnect(graph, &source.source.pin.IPin_iface);
ref = IAMMultiMediaStream_Release(mmstream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IGraphBuilder_Release(graph);
ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IMediaStreamFilter_Release(filter);
ok(!ref, "Got outstanding refcount %d.\n", ref);
IPin_Release(pin);
ref = IMediaStream_Release(stream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static IUnknown *create_audio_data(void)
{
IUnknown *audio_data = NULL;
......@@ -9301,6 +9382,7 @@ START_TEST(amstream)
test_set_state();
test_enum_media_types();
test_media_types();
test_get_end_of_stream_event_handle();
test_avi_path = load_resource(L"test.avi");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment