[4/5] quartz: Add tests for IBasicVideo.

Andrew Eikum aeikum at codeweavers.com
Mon Nov 21 10:29:00 CST 2016


It's a good start, though I'm a little concerned your tests didn't
turn up the bugs I found in 2/5, 3/5, and 5/5, nor the bug I noticed
in BaseControlVideoImpl_get_DestinationHeight while reviewing your
patches...

Andrew

On Sun, Nov 20, 2016 at 03:33:25PM +0900, Akihiro Sagawa wrote:
> Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
> ---
>  dlls/quartz/tests/filtergraph.c | 93 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 93 insertions(+)
> 

> diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
> index 87b1123..a92aab3 100644
> --- a/dlls/quartz/tests/filtergraph.c
> +++ b/dlls/quartz/tests/filtergraph.c
> @@ -50,6 +50,97 @@ static int createfiltergraph(void)
>          &CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&pgraph);
>  }
>  
> +static void test_basic_video(void)
> +{
> +    IBasicVideo* pbv;
> +    LONG video_width, video_height;
> +    LONG left, top, width, height;
> +    HRESULT hr;
> +
> +    hr = IGraphBuilder_QueryInterface(pgraph, &IID_IBasicVideo, (LPVOID*)&pbv);
> +    ok(hr==S_OK, "Cannot get IBasicVideo interface returned: %x\n", hr);
> +
> +    /* test get video size */
> +    hr = IBasicVideo_GetVideoSize(pbv, NULL, NULL);
> +    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
> +    hr = IBasicVideo_GetVideoSize(pbv, &video_width, NULL);
> +    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
> +    hr = IBasicVideo_GetVideoSize(pbv, NULL, &video_height);
> +    ok(hr==E_POINTER, "IBasicVideo_GetVideoSize returned: %x\n", hr);
> +    hr = IBasicVideo_GetVideoSize(pbv, &video_width, &video_height);
> +    ok(hr==S_OK, "Cannot get video size returned: %x\n", hr);
> +
> +    /* test source position */
> +    hr = IBasicVideo_GetSourcePosition(pbv, NULL, NULL, NULL, NULL);
> +    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, NULL, NULL);
> +    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetSourcePosition(pbv, NULL, NULL, &width, &height);
> +    ok(hr == E_POINTER, "IBasicVideo_GetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetSourcePosition(pbv, &left, &top, &width, &height);
> +    ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
> +    ok(left == 0, "expected 0, got %d\n", left);
> +    ok(top == 0, "expected 0, got %d\n", top);
> +    ok(width == video_width, "expected %d, got %d\n", video_width, width);
> +    ok(height == video_height, "expected %d, got %d\n", video_height, height);
> +
> +    hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, 0, 0);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_put_SourceTop(pbv, -1);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_put_SourceTop returned: %x\n", hr);
> +    hr = IBasicVideo_put_SourceTop(pbv, 0);
> +    ok(hr==S_OK, "Cannot put source top returned: %x\n", hr);
> +    hr = IBasicVideo_put_SourceTop(pbv, 1);
> +    todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_put_SourceTop returned: %x\n", hr);
> +
> +    hr = IBasicVideo_SetSourcePosition(pbv, video_width, 0, 1, video_height);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_SetSourcePosition(pbv, 0, video_height, video_width, 1);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
> +
> +    hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width, video_height+1);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
> +    hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width+1, video_height);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
> +
> +    /* test destination position */
> +    hr = IBasicVideo_GetDestinationPosition(pbv, NULL, NULL, NULL, NULL);
> +    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, NULL, NULL);
> +    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetDestinationPosition(pbv, NULL, NULL, &width, &height);
> +    ok(hr == E_POINTER, "IBasicVideo_GetDestinationPosition returned: %x\n", hr);
> +    hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
> +    ok(hr == S_OK, "Cannot get destination position returned: %x\n", hr);
> +    ok(left == 0, "expected 0, got %d\n", left);
> +    ok(top == 0, "expected 0, got %d\n", top);
> +    todo_wine ok(width == video_width, "expected %d, got %d\n", video_width, width);
> +    todo_wine ok(height == video_height, "expected %d, got %d\n", video_height, height);
> +
> +    hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, 0, 0);
> +    ok(hr==E_INVALIDARG, "IBasicVideo_SetDestinationPosition returned: %x\n", hr);
> +
> +    hr = IBasicVideo_put_DestinationLeft(pbv, -1);
> +    todo_wine ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
> +    hr = IBasicVideo_put_DestinationLeft(pbv, 0);
> +    todo_wine ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
> +    hr = IBasicVideo_put_DestinationLeft(pbv, 1);
> +    todo_wine ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
> +
> +    hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width * 2, video_height * 2);
> +    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
> +
> +    /* reset source position */
> +    hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width, video_height);
> +    ok(hr==S_OK, "Cannot set source position returned: %x\n", hr);
> +
> +    /* reset destination position */
> +    hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width, video_height);
> +    ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
> +
> +    IBasicVideo_Release(pbv);
> +}
> +
>  static void rungraph(void)
>  {
>      HRESULT hr;
> @@ -70,6 +161,8 @@ static void rungraph(void)
>  
>      IMediaFilter_Release(pmf);
>  
> +    test_basic_video();
> +
>      hr = IMediaControl_Run(pmc);
>      ok(hr==S_FALSE, "Cannot run the graph returned: %x\n", hr);
>  

> 




More information about the wine-devel mailing list