2 * Unit tests for Video Renderer functions
4 * Copyright (C) 2007 Google (Lei Zhang)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
26 #define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
27 ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
28 ok(ppv != NULL, "Pointer is NULL\n");
30 #define RELEASE_EXPECT(iface, num) if (iface) { \
31 hr = IUnknown_Release(iface); \
32 ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
35 static IUnknown *pVideoRenderer = NULL;
37 static int create_video_renderer(void)
41 hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
42 &IID_IUnknown, (LPVOID*)&pVideoRenderer);
43 return (hr == S_OK && pVideoRenderer != NULL);
46 static void release_video_renderer(void)
50 hr = IUnknown_Release(pVideoRenderer);
51 ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
54 static void test_query_interface(void)
57 IBaseFilter *pBaseFilter = NULL;
58 IBasicVideo *pBasicVideo = NULL;
59 IDirectDrawVideo *pDirectDrawVideo = NULL;
60 IKsPropertySet *pKsPropertySet = NULL;
61 IMediaPosition *pMediaPosition = NULL;
62 IMediaSeeking *pMediaSeeking = NULL;
63 IQualityControl *pQualityControl = NULL;
64 IQualProp *pQualProp = NULL;
65 IVideoWindow *pVideoWindow = NULL;
67 QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter);
68 RELEASE_EXPECT(pBaseFilter, 1);
69 QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo);
70 RELEASE_EXPECT(pBasicVideo, 1);
72 QI_SUCCEED(pVideoRenderer, IID_IDirectDrawVideo, pDirectDrawVideo);
73 RELEASE_EXPECT(pDirectDrawVideo, 1);
74 QI_SUCCEED(pVideoRenderer, IID_IKsPropertySet, pKsPropertySet);
75 RELEASE_EXPECT(pKsPropertySet, 1);
76 QI_SUCCEED(pVideoRenderer, IID_IMediaPosition, pMediaPosition);
77 RELEASE_EXPECT(pMediaPosition, 1);
78 QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking);
79 RELEASE_EXPECT(pMediaSeeking, 1);
80 QI_SUCCEED(pVideoRenderer, IID_IQualityControl, pQualityControl);
81 RELEASE_EXPECT(pQualityControl, 1);
82 QI_SUCCEED(pVideoRenderer, IID_IQualProp, pQualProp);
83 RELEASE_EXPECT(pQualProp, 1);
85 QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow);
86 RELEASE_EXPECT(pVideoWindow, 1);
89 START_TEST(videorenderer)
92 if (!create_video_renderer())
95 test_query_interface();
97 release_video_renderer();