Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/Makefile.in | 2 +- dlls/quartz/tests/vmr9.c | 102 ++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in index 772b40409f..59124c32af 100644 --- a/dlls/quartz/tests/Makefile.in +++ b/dlls/quartz/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = quartz.dll -IMPORTS = advapi32 ddraw msvfw32 ole32 oleaut32 strmiids user32 uuid +IMPORTS = advapi32 d3d9 ddraw msvfw32 ole32 oleaut32 strmiids user32 uuid
C_SRCS = \ acmwrapper.c \ diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index a0d2ea1687..6c1c314502 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.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_vmr9(DWORD mode) @@ -569,6 +570,106 @@ static void test_pin_info(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_monitor_config(void) +{ + MONITORINFO monitor_info = {sizeof(MONITORINFO)}; + DWORD count, needed, expect_count, i; + IBaseFilter *filter = create_vmr9(0); + IVMRMonitorConfig9 *config; + D3DADAPTER_IDENTIFIER9 id; + VMR9MonitorInfo *monitors; + HMONITOR hmonitor; + WCHAR buffer[256]; + IDirect3D9 *d3d; + HRESULT hr; + UINT index; + ULONG ref; + + hr = IBaseFilter_QueryInterface(filter, &IID_IVMRMonitorConfig9, (void **)&config); + if (hr == E_NOINTERFACE) + { + win_skip("Filter does not implement IVMRMonitorConfig9.\n"); + IBaseFilter_Release(filter); + return; + } + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig9_GetMonitor(config, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + index = 0xdeadbeef; + hr = IVMRMonitorConfig9_GetMonitor(config, &index); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!index, "Got index %u.\n", index); + + hr = IVMRMonitorConfig9_GetDefaultMonitor(config, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + index = 0xdeadbeef; + hr = IVMRMonitorConfig9_GetDefaultMonitor(config, &index); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!index, "Got index %u.\n", index); + + hr = IVMRMonitorConfig9_GetAvailableMonitors(config, NULL, 0, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig9_GetAvailableMonitors(config, NULL, 0, &needed); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + count = needed; + monitors = heap_alloc(count * sizeof(VMR9MonitorInfo)); + + hr = IVMRMonitorConfig9_GetAvailableMonitors(config, monitors, 0, &needed); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IVMRMonitorConfig9_GetAvailableMonitors(config, monitors, count, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + memset(monitors, 0xcc, count * sizeof(VMR9MonitorInfo)); + hr = IVMRMonitorConfig9_GetAvailableMonitors(config, monitors, count, &needed); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + expect_count = IDirect3D9_GetAdapterCount(d3d); + ok(count == expect_count, "Expected count %u, got %u.\n", expect_count, count); + for (i = 0; i < count; ++i) + { + hmonitor = IDirect3D9_GetAdapterMonitor(d3d, i); + GetMonitorInfoA(hmonitor, &monitor_info); + hr = IDirect3D9_GetAdapterIdentifier(d3d, i, 0, &id); + ok(hr == S_OK, "%u: Got hr %#x.\n", i, hr); + + ok(monitors[i].uDevID == i, "Expected index %u, got %u.\n", i, monitors[i].uDevID); + ok(EqualRect(&monitors[i].rcMonitor, &monitor_info.rcMonitor), "%u: Expected rect %s, got %s.\n", + i, wine_dbgstr_rect(&monitor_info.rcMonitor), wine_dbgstr_rect(&monitors[i].rcMonitor)); + ok(monitors[i].dwFlags == monitor_info.dwFlags, "%u: Expected flags %#x, got %#x.\n", + i, monitor_info.dwFlags, monitors[i].dwFlags); + MultiByteToWideChar(CP_ACP, 0, id.DeviceName, -1, buffer, ARRAY_SIZE(buffer)); + ok(!lstrcmpW(monitors[i].szDevice, buffer), "%u: Expected device name %s, got %s.\n", + i, wine_dbgstr_w(buffer), wine_dbgstr_w(monitors[i].szDevice)); + MultiByteToWideChar(CP_ACP, 0, id.Description, -1, buffer, ARRAY_SIZE(buffer)); + todo_wine ok(!lstrcmpW(monitors[i].szDescription, buffer), "%u: Expected description %s, got %s.\n", + i, wine_dbgstr_w(buffer), wine_dbgstr_w(monitors[i].szDescription)); + todo_wine ok(monitors[i].liDriverVersion.QuadPart == id.DriverVersion.QuadPart, + "%u: Expected version %s, got %s.\n", i, wine_dbgstr_longlong(id.DriverVersion.QuadPart), + wine_dbgstr_longlong(monitors[i].liDriverVersion.QuadPart)); + todo_wine ok(monitors[i].dwVendorId == id.VendorId, "%u: Expected vendor ID %#x, got %#x.\n", + i, id.VendorId, monitors[i].dwVendorId); + todo_wine ok(monitors[i].dwDeviceId == id.DeviceId, "%u: Expected device ID %#x, got %#x.\n", + i, id.DeviceId, monitors[i].dwDeviceId); + ok(monitors[i].dwSubSysId == id.SubSysId, "%u: Expected subsystem ID %#x, got %#x.\n", + i, id.SubSysId, monitors[i].dwSubSysId); + ok(monitors[i].dwRevision == id.Revision, "%u: Expected revision %#x, got %#x.\n", + i, id.Revision, monitors[i].dwRevision); + } + + heap_free(monitors); + IVMRMonitorConfig9_Release(config); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(vmr9) { IBaseFilter *filter; @@ -589,6 +690,7 @@ START_TEST(vmr9) test_enum_pins(); test_find_pin(); test_pin_info(); + test_monitor_config();
CoUninitialize(); }