Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/Makefile.in | 2 +- dlls/quartz/tests/vmr7.c | 125 ++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in index 1a12ffaa6a..772b40409f 100644 --- a/dlls/quartz/tests/Makefile.in +++ b/dlls/quartz/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = quartz.dll -IMPORTS = advapi32 msvfw32 ole32 oleaut32 strmiids user32 uuid +IMPORTS = advapi32 ddraw msvfw32 ole32 oleaut32 strmiids user32 uuid
C_SRCS = \ acmwrapper.c \ diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index e9efe55d35..8a16039673 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -22,6 +22,7 @@ #include "dshow.h" #include "d3d9.h" #include "vmr9.h" +#include "wine/heap.h" #include "wine/test.h"
static IBaseFilter *create_vmr7(DWORD mode) @@ -567,6 +568,129 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static DWORD ddraw_device_idx; + +static BOOL CALLBACK ddraw_enum_cb(GUID *guid, char *description, char *name, void *ctx, HMONITOR hmonitor) +{ + VMRMONITORINFO *monitors = ctx; + VMRMONITORINFO *monitor = &monitors[ddraw_device_idx]; + MONITORINFO monitor_info = {sizeof(MONITORINFO)}; + DDDEVICEIDENTIFIER2 id; + IDirectDraw7 *ddraw; + WCHAR buffer[256]; + HRESULT hr; + + hr = DirectDrawCreateEx(guid, (void **)&ddraw, &IID_IDirectDraw7, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &id, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + if (guid) + { + todo_wine ok(IsEqualGUID(&monitor->guid.GUID, guid), "Expected GUID %s, got %s.\n", + wine_dbgstr_guid(guid), wine_dbgstr_guid(&monitor->guid.GUID)); + } + else + { + ok(!monitor->guid.pGUID, "Got GUID pointer %p.\n", monitor->guid.pGUID); + ok(IsEqualGUID(&monitor->guid.GUID, &GUID_NULL), "Got GUID %s.\n", + wine_dbgstr_guid(&monitor->guid.GUID)); + hmonitor = MonitorFromWindow(0, MONITOR_DEFAULTTOPRIMARY); + } + todo_wine_if(ddraw_device_idx) + { + ok(monitor->hMon == hmonitor, "Expected monitor handle %p, got %p.\n", hmonitor, monitor->hMon); + GetMonitorInfoA(hmonitor, &monitor_info); + ok(EqualRect(&monitor->rcMonitor, &monitor_info.rcMonitor), "Expected rect %s, got %s.\n", + wine_dbgstr_rect(&monitor_info.rcMonitor), wine_dbgstr_rect(&monitor->rcMonitor)); + ok(monitor->dwFlags == monitor_info.dwFlags, "Expected flags %#x, got %#x.\n", + monitor_info.dwFlags, monitor->dwFlags); + } + MultiByteToWideChar(CP_ACP, 0, name, -1, buffer, ARRAY_SIZE(buffer)); + todo_wine_if(!guid) ok(!lstrcmpW(monitor->szDevice, buffer), "Expected device name %s, got %s.\n", + wine_dbgstr_w(buffer), wine_dbgstr_w(monitor->szDevice)); + MultiByteToWideChar(CP_ACP, 0, description, -1, buffer, ARRAY_SIZE(buffer)); + todo_wine ok(!lstrcmpW(monitor->szDescription, buffer), "Expected description %s, got %s.\n", + wine_dbgstr_w(buffer), wine_dbgstr_w(monitor->szDescription)); + todo_wine ok(monitor->liDriverVersion.QuadPart == id.liDriverVersion.QuadPart, + "Expected version %s, got %s.\n", wine_dbgstr_longlong(id.liDriverVersion.QuadPart), + wine_dbgstr_longlong(monitor->liDriverVersion.QuadPart)); + todo_wine ok(monitor->dwVendorId == id.dwVendorId, "Expected vendor ID %#x, got %#x.\n", + id.dwVendorId, monitor->dwVendorId); + todo_wine ok(monitor->dwDeviceId == id.dwDeviceId, "Expected device ID %#x, got %#x.\n", + id.dwDeviceId, monitor->dwDeviceId); + ok(monitor->dwSubSysId == id.dwSubSysId, "Expected subsystem ID %#x, got %#x.\n", + id.dwSubSysId, monitor->dwSubSysId); + ok(monitor->dwRevision == id.dwRevision, "Expected revision %#x, got %#x.\n", + id.dwRevision, monitor->dwRevision); + + ddraw_device_idx++; + return TRUE; +} + +static void test_monitor_config(void) +{ + IBaseFilter *filter = create_vmr7(0); + IVMRMonitorConfig *config; + VMRMONITORINFO *monitors; + DWORD count, needed; + GUID expect_guid; + VMRGUID guid; + HRESULT hr; + ULONG ref; + + hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMonitorConfig, (void **)&config); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig_GetMonitor(config, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + memset(&guid, 0xcc, sizeof(guid)); + hr = IVMRMonitorConfig_GetMonitor(config, &guid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!guid.pGUID, "Got guid pointer %p.\n", guid.pGUID); + todo_wine ok(IsEqualGUID(&guid.GUID, &GUID_NULL), "Got guid %s.\n", wine_dbgstr_guid(&guid.GUID)); + + hr = IVMRMonitorConfig_GetDefaultMonitor(config, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + memset(&guid, 0xcc, sizeof(guid)); + memset(&expect_guid, 0xcc, sizeof(expect_guid)); + hr = IVMRMonitorConfig_GetDefaultMonitor(config, &guid); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!guid.pGUID, "Got guid pointer %p.\n", guid.pGUID); + ok(IsEqualGUID(&guid.GUID, &expect_guid), "Got guid %s.\n", wine_dbgstr_guid(&guid.GUID)); + + hr = IVMRMonitorConfig_GetAvailableMonitors(config, NULL, 0, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig_GetAvailableMonitors(config, NULL, 0, &needed); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + count = needed; + monitors = heap_alloc(count * sizeof(VMRMONITORINFO)); + + hr = IVMRMonitorConfig_GetAvailableMonitors(config, monitors, 0, &needed); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig_GetAvailableMonitors(config, monitors, count, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + memset(monitors, 0xcc, count * sizeof(VMRMONITORINFO)); + hr = IVMRMonitorConfig_GetAvailableMonitors(config, monitors, count, &needed); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = DirectDrawEnumerateExA(ddraw_enum_cb, monitors, DDENUM_ATTACHEDSECONDARYDEVICES); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(ddraw_device_idx == count, "Expected count %u, got %u.\n", ddraw_device_idx, count); + + heap_free(monitors); + IVMRMonitorConfig_Release(config); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(vmr7) { CoInitialize(NULL); @@ -576,6 +700,7 @@ START_TEST(vmr7) test_enum_pins(); test_find_pin(); test_pin_info(); + test_monitor_config();
CoUninitialize(); }