quartz: Add tests for IBasicVideo.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Akihiro Sagawa 2016-11-25 01:08:50 +09:00 committed by Alexandre Julliard
parent efd063f5c5
commit 97405fc805
1 changed files with 208 additions and 0 deletions

View File

@ -50,6 +50,212 @@ 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);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width*2, video_height*2);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition 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_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, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, 0, video_height, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, -1, 0, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, 0, -1, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width, video_height+1);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, 0, 0, video_width+1, video_height);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetSourcePosition returned: %x\n", hr);
hr = IBasicVideo_SetSourcePosition(pbv, video_width/2, video_height/2, video_width/3+1, video_height/3+1);
ok(hr==S_OK, "Cannot set source position returned: %x\n", hr);
hr = IBasicVideo_get_SourceLeft(pbv, &left);
ok(hr==S_OK, "Cannot get source left returned: %x\n", hr);
ok(left==video_width/2, "expected %d, got %d\n", video_width/2, left);
hr = IBasicVideo_get_SourceTop(pbv, &top);
ok(hr==S_OK, "Cannot get source top returned: %x\n", hr);
ok(top==video_height/2, "expected %d, got %d\n", video_height/2, top);
hr = IBasicVideo_get_SourceWidth(pbv, &width);
ok(hr==S_OK, "Cannot get source width returned: %x\n", hr);
ok(width==video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
hr = IBasicVideo_get_SourceHeight(pbv, &height);
ok(hr==S_OK, "Cannot get source height returned: %x\n", hr);
ok(height==video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
hr = IBasicVideo_put_SourceLeft(pbv, video_width/3);
ok(hr==S_OK, "Cannot put source left 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 == video_width/3, "expected %d, got %d\n", video_width/3, left);
todo_wine ok(width == video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
hr = IBasicVideo_put_SourceTop(pbv, video_height/3);
ok(hr==S_OK, "Cannot put source top 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(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
todo_wine ok(height == video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
hr = IBasicVideo_put_SourceWidth(pbv, video_width/4+1);
ok(hr==S_OK, "Cannot put source width 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 == video_width/3, "expected %d, got %d\n", video_width/3, left);
ok(width == video_width/4+1, "expected %d, got %d\n", video_width/4+1, width);
hr = IBasicVideo_put_SourceHeight(pbv, video_height/4+1);
ok(hr==S_OK, "Cannot put source height 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(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
ok(height == video_height/4+1, "expected %d, got %d\n", video_height/4+1, height);
/* test desination rectangle */
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);
todo_wine ok(hr==E_INVALIDARG, "IBasicVideo_SetDestinationPosition returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width*2, video_height*2);
ok(hr==S_OK, "Cannot put destination position returned: %x\n", hr);
hr = IBasicVideo_put_DestinationLeft(pbv, -1);
ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
hr = IBasicVideo_put_DestinationLeft(pbv, 0);
ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
hr = IBasicVideo_put_DestinationLeft(pbv, 1);
ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, video_width, 0, video_width, video_height);
ok(hr==S_OK, "Cannot set destinaiton position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, video_height, video_width, video_height);
ok(hr==S_OK, "Cannot set destinaiton position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, -1, 0, video_width, video_height);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, -1, video_width, video_height);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width, video_height);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width, video_height);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width, video_height+1);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, 0, 0, video_width+1, video_height);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_SetDestinationPosition(pbv, video_width/2, video_height/2, video_width/3+1, video_height/3+1);
ok(hr==S_OK, "Cannot set destination position returned: %x\n", hr);
hr = IBasicVideo_get_DestinationLeft(pbv, &left);
ok(hr==S_OK, "Cannot get destination left returned: %x\n", hr);
ok(left==video_width/2, "expected %d, got %d\n", video_width/2, left);
hr = IBasicVideo_get_DestinationTop(pbv, &top);
ok(hr==S_OK, "Cannot get destination top returned: %x\n", hr);
ok(top==video_height/2, "expected %d, got %d\n", video_height/2, top);
hr = IBasicVideo_get_DestinationWidth(pbv, &width);
ok(hr==S_OK, "Cannot get destination width returned: %x\n", hr);
ok(width==video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
hr = IBasicVideo_get_DestinationHeight(pbv, &height);
ok(hr==S_OK, "Cannot get destination height returned: %x\n", hr);
todo_wine ok(height==video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
hr = IBasicVideo_put_DestinationLeft(pbv, video_width/3);
ok(hr==S_OK, "Cannot put destination left returned: %x\n", hr);
hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
todo_wine ok(width == video_width/3+1, "expected %d, got %d\n", video_width/3+1, width);
hr = IBasicVideo_put_DestinationTop(pbv, video_height/3);
ok(hr==S_OK, "Cannot put destination top returned: %x\n", hr);
hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
todo_wine ok(height == video_height/3+1, "expected %d, got %d\n", video_height/3+1, height);
hr = IBasicVideo_put_DestinationWidth(pbv, video_width/4+1);
ok(hr==S_OK, "Cannot put destination width returned: %x\n", hr);
hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
ok(left == video_width/3, "expected %d, got %d\n", video_width/3, left);
ok(width == video_width/4+1, "expected %d, got %d\n", video_width/4+1, width);
hr = IBasicVideo_put_DestinationHeight(pbv, video_height/4+1);
ok(hr==S_OK, "Cannot put destination height returned: %x\n", hr);
hr = IBasicVideo_GetDestinationPosition(pbv, &left, &top, &width, &height);
ok(hr == S_OK, "Cannot get source position returned: %x\n", hr);
ok(top == video_height/3, "expected %d, got %d\n", video_height/3, top);
todo_wine ok(height == video_height/4+1, "expected %d, got %d\n", video_height/4+1, height);
/* reset source rectangle */
hr = IBasicVideo_SetDefaultSourcePosition(pbv);
ok(hr==S_OK, "IBasicVideo_SetDefaultSourcePosition 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 +276,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);