[PATCH] amstream: Add AMMediaStream::JoinFilterGraph() tests.

Zebediah Figura z.figura12 at gmail.com
Thu Jul 9 14:54:35 CDT 2020


On 7/9/20 7:04 AM, Gijs Vermeulen wrote:
> Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
> ---
>  dlls/amstream/tests/amstream.c | 84 ++++++++++++++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
> 
> diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
> index 2d9f3e35f2..64edca0742 100644
> --- a/dlls/amstream/tests/amstream.c
> +++ b/dlls/amstream/tests/amstream.c
> @@ -4328,6 +4328,89 @@ static void test_ammediastream_join_filter(void)
>      check_ammediastream_join_filter(&CLSID_AMDirectDrawStream);
>  }
>  
> +static void check_ammediastream_join_filter_graph(const CLSID *clsid, const MSPID *id)

You don't seem to be using this parameter.

> +{
> +    IAMMultiMediaStream *mmstream = create_ammultimediastream();
> +    IGraphBuilder *builder, *builder2;
> +    IMediaStreamFilter *filter;
> +    IAMMediaStream *stream;
> +    IFilterGraph *graph;
> +    FILTER_INFO info;
> +    HRESULT hr;
> +    ULONG ref;
> +
> +    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, id, 0, (IMediaStream **)&stream);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +
> +    hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &builder);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(!!builder, "Expected non-null graph.\n");
> +    EXPECT_REF(builder, 4);
> +
> +    hr = IMediaStreamFilter_QueryFilterInfo(filter, &info);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(info.pGraph == (IFilterGraph *)builder, "Expected graph %p, got %p.\n", (IFilterGraph *)builder, info.pGraph);
> +    EXPECT_REF(builder, 5);
> +    IFilterGraph_Release(info.pGraph);
> +    EXPECT_REF(builder, 4);
> +
> +    hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterGraph, (void **)&graph);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    EXPECT_REF(builder, 4);
> +    EXPECT_REF(graph, 1);
> +
> +    /* Crashes on native. */
> +    if (0)
> +    {
> +        hr = IAMMediaStream_JoinFilterGraph(stream, NULL);
> +        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
> +    }
> +
> +    hr = IAMMediaStream_JoinFilterGraph(stream, graph);
> +    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    EXPECT_REF(builder, 4);
> +    EXPECT_REF(graph, 1);
> +
> +    hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &builder2);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(builder2 == builder, "Expected graph %p, got %p.\n", builder, builder2);
> +    EXPECT_REF(builder, 5);
> +    EXPECT_REF(graph, 1);
> +    IGraphBuilder_Release(builder2);
> +    EXPECT_REF(builder, 4);
> +    EXPECT_REF(graph, 1);
> +
> +    hr = IMediaStreamFilter_QueryFilterInfo(filter, &info);
> +    ok(hr == S_OK, "Got hr %#x.\n", hr);
> +    ok(info.pGraph == (IFilterGraph *)builder, "Expected graph %p, got %p.\n", (IFilterGraph *)builder, info.pGraph);
> +    EXPECT_REF(builder, 5);
> +    EXPECT_REF(graph, 1);
> +    IFilterGraph_Release(info.pGraph);
> +    EXPECT_REF(builder, 4);
> +    EXPECT_REF(graph, 1);

I'm not sure if these calls to GetFilterGraph() and QueryFilterInfo()
are particularly interesting, but maybe there's something I'm not
thinking of...?

> +
> +    ref = IFilterGraph_Release(graph);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +    ref = IAMMultiMediaStream_Release(mmstream);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +    ref = IGraphBuilder_Release(builder);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +    ref = IMediaStreamFilter_Release(filter);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +    ref = IAMMediaStream_Release(stream);
> +    ok(!ref, "Got outstanding refcount %d.\n", ref);
> +}
> +
> +static void test_ammediastream_join_filter_graph(void)
> +{
> +    check_ammediastream_join_filter_graph(&CLSID_AMAudioStream, &MSPID_PrimaryAudio);
> +    check_ammediastream_join_filter_graph(&CLSID_AMDirectDrawStream, &MSPID_PrimaryVideo);
> +}
> +
>  void test_mediastreamfilter_get_state(void)
>  {
>      IAMMultiMediaStream *mmstream = create_ammultimediastream();
> @@ -5023,6 +5106,7 @@ START_TEST(amstream)
>  
>      test_ammediastream_join_am_multi_media_stream();
>      test_ammediastream_join_filter();
> +    test_ammediastream_join_filter_graph();
>  
>      test_mediastreamfilter_get_state();
>      test_mediastreamfilter_stop_pause_run();
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200709/4363eae7/attachment.sig>


More information about the wine-devel mailing list