mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Improved VMRMonitorConfig tests according to suggestions by A. Hentschel
This commit is contained in:
parent
6cc7c450bf
commit
5808f78d07
@ -1,15 +1,15 @@
|
||||
From 8c8c8c24a8c90c292c6af2c83fd2587a04492a4f Mon Sep 17 00:00:00 2001
|
||||
From 4347b37128afcd1878a0f993a058fe147f219982 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 22 Nov 2013 18:40:59 +0100
|
||||
Subject: quartz/tests: Add tests for IVMRMonitorConfig and IVMRMonitorConfig9
|
||||
interface
|
||||
|
||||
---
|
||||
dlls/quartz/tests/videorenderer.c | 210 ++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 205 insertions(+), 5 deletions(-)
|
||||
dlls/quartz/tests/videorenderer.c | 275 ++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 254 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c
|
||||
index ce1ac29..df45e1e 100644
|
||||
index ce1ac29..e3a4fa2 100644
|
||||
--- a/dlls/quartz/tests/videorenderer.c
|
||||
+++ b/dlls/quartz/tests/videorenderer.c
|
||||
@@ -22,6 +22,9 @@
|
||||
@ -22,43 +22,124 @@ index ce1ac29..df45e1e 100644
|
||||
|
||||
#define QI_SUCCEED(iface, riid, ppv) hr = IUnknown_QueryInterface(iface, &riid, (LPVOID*)&ppv); \
|
||||
ok(hr == S_OK, "IUnknown_QueryInterface returned %x\n", hr); \
|
||||
@@ -33,6 +36,8 @@
|
||||
@@ -32,28 +35,17 @@
|
||||
ok(hr == num, "IUnknown_Release should return %d, got %d\n", num, hr); \
|
||||
}
|
||||
|
||||
static IUnknown *pVideoRenderer = NULL;
|
||||
+static IUnknown *pVMR7 = NULL;
|
||||
+static IUnknown *pVMR9 = NULL;
|
||||
|
||||
static int create_video_renderer(void)
|
||||
-static IUnknown *pVideoRenderer = NULL;
|
||||
-
|
||||
-static int create_video_renderer(void)
|
||||
+static const WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
|
||||
{
|
||||
@@ -150,16 +155,211 @@ static void test_basefilter(void)
|
||||
IBaseFilter_Release(base);
|
||||
- HRESULT hr;
|
||||
-
|
||||
- hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
- &IID_IUnknown, (LPVOID*)&pVideoRenderer);
|
||||
- return (hr == S_OK && pVideoRenderer != NULL);
|
||||
-}
|
||||
-
|
||||
-static void release_video_renderer(void)
|
||||
-{
|
||||
- HRESULT hr;
|
||||
-
|
||||
- hr = IUnknown_Release(pVideoRenderer);
|
||||
- ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
|
||||
+ const WCHAR *end;
|
||||
+ for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return ptr;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
+static int create_vmr7(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
static void test_query_interface(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
+ IUnknown *pVideoRenderer = NULL;
|
||||
IBaseFilter *pBaseFilter = NULL;
|
||||
IBasicVideo *pBasicVideo = NULL;
|
||||
IDirectDrawVideo *pDirectDrawVideo = NULL;
|
||||
@@ -64,6 +56,15 @@ static void test_query_interface(void)
|
||||
IQualProp *pQualProp = NULL;
|
||||
IVideoWindow *pVideoWindow = NULL;
|
||||
|
||||
+ hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVideoRenderer);
|
||||
+ ok(hr != S_OK || pVideoRenderer != NULL, "CoCreateInstance returned S_OK, but pVideoRenderer is NULL.\n");
|
||||
+ if (hr != S_OK || !pVideoRenderer)
|
||||
+ {
|
||||
+ skip("VideoRenderer is not available, skipping QI test.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVMR7);
|
||||
+ return (hr == S_OK && pVMR7 != NULL);
|
||||
+}
|
||||
QI_SUCCEED(pVideoRenderer, IID_IBaseFilter, pBaseFilter);
|
||||
RELEASE_EXPECT(pBaseFilter, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo);
|
||||
@@ -84,6 +85,8 @@ static void test_query_interface(void)
|
||||
RELEASE_EXPECT(pMediaPosition, 1);
|
||||
QI_SUCCEED(pVideoRenderer, IID_IVideoWindow, pVideoWindow);
|
||||
RELEASE_EXPECT(pVideoWindow, 1);
|
||||
+
|
||||
+static void release_vmr7(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+ RELEASE_EXPECT(pVideoRenderer, 0);
|
||||
}
|
||||
|
||||
static void test_pin(IPin *pin)
|
||||
@@ -104,18 +107,28 @@ static void test_pin(IPin *pin)
|
||||
|
||||
static void test_basefilter(void)
|
||||
{
|
||||
+ IUnknown *pVideoRenderer = NULL;
|
||||
IEnumPins *pin_enum = NULL;
|
||||
IBaseFilter *base = NULL;
|
||||
IPin *pins[2];
|
||||
ULONG ref;
|
||||
HRESULT hr;
|
||||
|
||||
+ hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVideoRenderer);
|
||||
+ ok(hr != S_OK || pVideoRenderer != NULL, "CoCreateInstance returned S_OK, but pVideoRenderer is NULL.\n");
|
||||
+ if (hr != S_OK || !pVideoRenderer)
|
||||
+ {
|
||||
+ skip("VideoRenderer is not available, skipping BaseFilter test.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = IUnknown_Release(pVMR7);
|
||||
+ ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
|
||||
IUnknown_QueryInterface(pVideoRenderer, &IID_IBaseFilter, (void *)&base);
|
||||
if (base == NULL)
|
||||
{
|
||||
/* test_query_interface handles this case */
|
||||
skip("No IBaseFilter\n");
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
hr = IBaseFilter_EnumPins(base, NULL);
|
||||
@@ -147,19 +160,239 @@ static void test_basefilter(void)
|
||||
ref = IEnumPins_Release(pin_enum);
|
||||
ok(ref == 0, "ref is %u and not 0!\n", ref);
|
||||
|
||||
- IBaseFilter_Release(base);
|
||||
+out:
|
||||
+ if (base) IBaseFilter_Release(base);
|
||||
+ RELEASE_EXPECT(pVideoRenderer, 0);
|
||||
+}
|
||||
+
|
||||
+static void test_monitorconfig7(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+ IUnknown *pVMR7 = NULL;
|
||||
+ IVMRMonitorConfig *pMonitorConfig = NULL;
|
||||
+ VMRGUID guid;
|
||||
+ VMRMONITORINFO info[8];
|
||||
+ DWORD numdev_total, numdev;
|
||||
+ GUID max_guid;
|
||||
+ RECT max_rect;
|
||||
+
|
||||
+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVMR7);
|
||||
+ ok(hr != S_OK || pVMR7 != NULL, "CoCreateInstance returned S_OK, but pVMR7 is NULL.\n");
|
||||
+ if (hr != S_OK || !pVMR7)
|
||||
+ {
|
||||
+ skip("VideoMixingRenderer7 is not available, skipping MonitorConfig7 test.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = IUnknown_QueryInterface(pVMR7, &IID_IVMRMonitorConfig, (LPVOID*)&pMonitorConfig);
|
||||
+ ok(hr == S_OK, "IUnknown_QueryInterface returned %x.\n", hr);
|
||||
@ -119,40 +200,56 @@ index ce1ac29..df45e1e 100644
|
||||
+ /* don't request information for more monitors than memory available */
|
||||
+ if (numdev_total > sizeof(info)/sizeof(info[0]))
|
||||
+ numdev_total = sizeof(info)/sizeof(info[0]);
|
||||
+ memset(info, 255, sizeof(info));
|
||||
+ hr = IVMRMonitorConfig_GetAvailableMonitors(pMonitorConfig, info, numdev_total, &numdev);
|
||||
+ ok(hr == S_OK, "GetAvailableMonitors failed with %x.\n", hr);
|
||||
+ ok(numdev == numdev_total, "GetAvailableMonitors returned numdev = %d, expected %d.\n", numdev, numdev_total);
|
||||
+
|
||||
+ /* TODO: Add more tests for content of info */
|
||||
+ memset(&max_guid, 255, sizeof(max_guid));
|
||||
+ memset(&max_rect, 255, sizeof(max_rect));
|
||||
+
|
||||
+ /* check that result is filled out, we do not check if the values actually make any sense */
|
||||
+ while (numdev--)
|
||||
+ {
|
||||
+ ok(info[numdev].guid.pGUID == NULL || info[numdev].guid.pGUID == &info[numdev].guid.GUID,
|
||||
+ "GetAvailableMonitors returned info[%d].guid.pGUID = %p, expected NULL or %p.\n", numdev, info[numdev].guid.pGUID, &info[numdev].guid.GUID);
|
||||
+ ok(info[numdev].guid.pGUID != &info[numdev].guid.GUID || memcmp(&info[numdev].guid.GUID, &max_guid, sizeof(max_guid)) != 0,
|
||||
+ "GetAvailableMonitors returned info[%d].GUID = {FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF}, expected any other value.\n", numdev);
|
||||
+ ok(memcmp(&info[numdev].rcMonitor, &max_rect, sizeof(max_rect)) != 0,
|
||||
+ "GetAvailableMonitors returned info[%d].rcMonitor = {-1, -1, -1, -1}, expected any other value.\n", numdev);
|
||||
+ ok(info[numdev].hMon != (HMONITOR)0 && info[numdev].hMon != (HMONITOR)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].hMon = %p, expected != 0 and != -1.\n", numdev, info[numdev].hMon);
|
||||
+ ok(info[numdev].dwFlags != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwFlags = -1, expected != -1.\n", numdev);
|
||||
+ ok(memchrW(info[numdev].szDevice, 0, sizeof(info[numdev].szDevice)/sizeof(WCHAR)) != NULL,
|
||||
+ "GetAvailableMonitors returned info[%d].szDevice without null-termination.\n", numdev);
|
||||
+ ok(memchrW(info[numdev].szDescription, 0, sizeof(info[numdev].szDescription)/sizeof(WCHAR)) != NULL,
|
||||
+ "GetAvailableMonitors returned info[%d].szDescription without null-termination.\n", numdev);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ if (pMonitorConfig) IVMRMonitorConfig_Release(pMonitorConfig);
|
||||
+}
|
||||
+
|
||||
+static int create_vmr9(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVMR9);
|
||||
+ return (hr == S_OK && pVMR7 != NULL);
|
||||
+}
|
||||
+
|
||||
+static void release_vmr9(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ hr = IUnknown_Release(pVMR9);
|
||||
+ ok(hr == 0, "IUnknown_Release failed with %x\n", hr);
|
||||
+ RELEASE_EXPECT(pVMR7, 0);
|
||||
+}
|
||||
+
|
||||
+static void test_monitorconfig9(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+ IUnknown *pVMR9 = NULL;
|
||||
+ IVMRMonitorConfig9 *pMonitorConfig = NULL;
|
||||
+ UINT uDev;
|
||||
+ VMR9MonitorInfo info[8];
|
||||
+ DWORD numdev_total, numdev;
|
||||
+ RECT max_rect;
|
||||
+
|
||||
+ hr = CoCreateInstance(&CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC_SERVER,
|
||||
+ &IID_IUnknown, (LPVOID*)&pVMR9);
|
||||
+ ok(hr != S_OK || pVMR9 != NULL, "CoCreateInstance returned S_OK, but pVMR9 is NULL.\n");
|
||||
+ if (hr != S_OK || !pVMR9)
|
||||
+ {
|
||||
+ skip("VideoMixingRenderer9 is not available, skipping MonitorConfig9 test.\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ hr = IUnknown_QueryInterface(pVMR9, &IID_IVMRMonitorConfig9, (LPVOID*)&pMonitorConfig);
|
||||
+ ok(hr == S_OK, "IUnknown_QueryInterface returned %x.\n", hr);
|
||||
@ -202,49 +299,59 @@ index ce1ac29..df45e1e 100644
|
||||
+
|
||||
+ if (numdev_total > sizeof(info)/sizeof(info[0]))
|
||||
+ numdev_total = sizeof(info)/sizeof(info[0]);
|
||||
+ memset(info, 255, sizeof(info));
|
||||
+ hr = IVMRMonitorConfig9_GetAvailableMonitors(pMonitorConfig, info, numdev_total, &numdev);
|
||||
+ ok(hr == S_OK, "GetAvailableMonitors failed with %x.\n", hr);
|
||||
+ ok(numdev == numdev_total, "GetAvailableMonitors returned numdev = %d, expected %d.\n", numdev, numdev_total);
|
||||
+
|
||||
+ /* TODO: Add more tests for content of info */
|
||||
+ memset(&max_rect, 255, sizeof(max_rect));
|
||||
+
|
||||
+ /* check that result is filled out, we do not check if the values actually make any sense */
|
||||
+ while (numdev--)
|
||||
+ {
|
||||
+ ok(info[numdev].uDevID != (UINT)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].uDevID = -1, expected != -1.\n", numdev);
|
||||
+ ok(memcmp(&info[numdev].rcMonitor, &max_rect, sizeof(max_rect)) != 0,
|
||||
+ "GetAvailableMonitors returned info[%d].rcMonitor = {-1, -1, -1, -1}, expected any other value.\n", numdev);
|
||||
+ ok(info[numdev].hMon != (HMONITOR)0 && info[numdev].hMon != (HMONITOR)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].hMon = %p, expected != 0 and != -1.\n", numdev, info[numdev].hMon);
|
||||
+ ok(info[numdev].dwFlags != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwFlags = -1, expected != -1.\n", numdev);
|
||||
+ ok(memchrW(info[numdev].szDevice, 0, sizeof(info[numdev].szDevice)/sizeof(WCHAR)) != NULL,
|
||||
+ "GetAvailableMonitors returned info[%d].szDevice without null-termination.\n", numdev);
|
||||
+ ok(memchrW(info[numdev].szDescription, 0, sizeof(info[numdev].szDescription)/sizeof(WCHAR)) != NULL,
|
||||
+ "GetAvailableMonitors returned info[%d].szDescription without null-termination.\n", numdev);
|
||||
+ ok(info[numdev].dwVendorId != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwVendorId = -1, expected != -1.\n", numdev);
|
||||
+ ok(info[numdev].dwDeviceId != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwDeviceId = -1, expected != -1.\n", numdev);
|
||||
+ ok(info[numdev].dwSubSysId != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwSubSysId = -1, expected != -1.\n", numdev);
|
||||
+ ok(info[numdev].dwRevision != (DWORD)-1,
|
||||
+ "GetAvailableMonitors returned info[%d].dwRevision = -1, expected != -1.\n", numdev);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ if (pMonitorConfig) IVMRMonitorConfig9_Release(pMonitorConfig);
|
||||
+}
|
||||
+
|
||||
+ RELEASE_EXPECT(pVMR9, 0);
|
||||
}
|
||||
|
||||
START_TEST(videorenderer)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
- if (!create_video_renderer())
|
||||
- return;
|
||||
|
||||
- test_query_interface();
|
||||
- test_basefilter();
|
||||
+ /* Video Renderer tests */
|
||||
+ if (create_video_renderer())
|
||||
+ {
|
||||
+ test_query_interface();
|
||||
+ test_basefilter();
|
||||
+ release_video_renderer();
|
||||
+ }else
|
||||
+ skip("VideoRenderer is not available.\n");
|
||||
+
|
||||
+ /* Video Mixing Renderer 7 tests */
|
||||
+ if (create_vmr7())
|
||||
+ {
|
||||
+ test_monitorconfig7();
|
||||
+ release_vmr7();
|
||||
+ }else
|
||||
+ skip("VideoMixingRenderer7 is not available.\n");
|
||||
test_query_interface();
|
||||
test_basefilter();
|
||||
|
||||
- release_video_renderer();
|
||||
+ /* Video Mixing Renderer 7 tests */
|
||||
+ test_monitorconfig7();
|
||||
+
|
||||
+ /* Video Mixing Renderer 9 tests */
|
||||
+ if (create_vmr9())
|
||||
+ {
|
||||
+ test_monitorconfig9();
|
||||
+ release_vmr9();
|
||||
+ }else
|
||||
+ skip("VideoMixingRenderer9 is not available.\n");
|
||||
+ test_monitorconfig9();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user