Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 43 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index f8e6f21586..88b0562e38 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -36,7 +36,7 @@ static IBaseFilter *create_vmr9(DWORD mode) hr = IBaseFilter_QueryInterface(filter, &IID_IVMRFilterConfig9, (void **)&config); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IVMRFilterConfig9_SetRenderingMode(config, mode); - ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr); IVMRFilterConfig9_Release(config); } return filter; @@ -65,7 +65,7 @@ static void test_filter_config(void) ok(mode == VMRMode_Windowed, "Got mode %#x.\n", mode);
hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowed); - ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
hr = IVMRFilterConfig9_GetRenderingMode(config, &mode); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -82,7 +82,7 @@ static void test_filter_config(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless); - ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
hr = IVMRFilterConfig9_GetRenderingMode(config, &mode); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -134,7 +134,7 @@ static void test_filter_config(void) /* Despite MSDN, you can still change the rendering mode after setting the * stream count. */ hr = IVMRFilterConfig9_SetRenderingMode(config, VMR9Mode_Windowless); - ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK || broken(hr == E_FAIL), "Got hr %#x.\n", hr);
hr = IVMRFilterConfig9_GetRenderingMode(config, &mode); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -150,19 +150,30 @@ static void test_filter_config(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
-#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) -static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +#define check_interface_broken(a, b, c) check_interface_(__LINE__, a, b, c, TRUE) +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c, FALSE) +static HRESULT check_interface_(unsigned int line, void *iface, REFIID riid, BOOL supported, BOOL is_broken) { - IUnknown *iface = iface_ptr; - HRESULT hr, expected_hr; - IUnknown *unk; + HRESULT hr, expected_hr, broken_hr; + IUnknown *unknown = iface, *out;
- expected_hr = supported ? S_OK : E_NOINTERFACE; + if (supported) + { + expected_hr = S_OK; + broken_hr = E_NOINTERFACE; + } + else + { + expected_hr = E_NOINTERFACE; + broken_hr = S_OK; + }
- hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); - ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + hr = IUnknown_QueryInterface(unknown, riid, (void **)&out); + ok_(__FILE__, line)(hr == expected_hr || broken(is_broken && hr == broken_hr), + "Got hr %#x, expected %#x.\n", hr, expected_hr); if (SUCCEEDED(hr)) - IUnknown_Release(unk); + IUnknown_Release(out); + return hr; }
static void test_interfaces(void) @@ -188,7 +199,9 @@ static void test_interfaces(void) todo_wine check_interface(filter, &IID_IVMRDeinterlaceControl9, TRUE); check_interface(filter, &IID_IVMRFilterConfig9, TRUE); todo_wine check_interface(filter, &IID_IVMRMixerBitmap9, TRUE); - check_interface(filter, &IID_IVMRMonitorConfig9, TRUE); + /* IVMRMonitorConfig9 may not be available if the d3d9 device has + * insufficient support. */ + check_interface_broken(filter, &IID_IVMRMonitorConfig9, TRUE);
check_interface(filter, &IID_IBasicAudio, FALSE); check_interface(filter, &IID_IDirectDrawVideo, FALSE); @@ -210,7 +223,7 @@ static void test_interfaces(void) IBaseFilter_Release(filter); filter = create_vmr9(VMR9Mode_Windowless);
- check_interface(filter, &IID_IVMRMonitorConfig9, TRUE); + check_interface_broken(filter, &IID_IVMRMonitorConfig9, TRUE); check_interface(filter, &IID_IVMRWindowlessControl9, TRUE);
todo_wine check_interface(filter, &IID_IBasicVideo, FALSE);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 88b0562e38..a0d2ea1687 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -178,8 +178,10 @@ static HRESULT check_interface_(unsigned int line, void *iface, REFIID riid, BOO
static void test_interfaces(void) { + WCHAR sink_id[] = {'V','M','R',' ','I','n','p','u','t','0',0}; IBaseFilter *filter = create_vmr9(0); ULONG ref; + IPin *pin;
check_interface(filter, &IID_IAMCertifiedOutputProtection, TRUE); check_interface(filter, &IID_IAMFilterMiscFlags, TRUE); @@ -220,6 +222,20 @@ static void test_interfaces(void) check_interface(filter, &IID_IVMRWindowlessControl, FALSE); check_interface(filter, &IID_IVMRWindowlessControl9, FALSE);
+ IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); filter = create_vmr9(VMR9Mode_Windowless);
@@ -236,6 +252,20 @@ static void test_interfaces(void) todo_wine check_interface(filter, &IID_IVMRMonitorConfig, FALSE); todo_wine check_interface(filter, &IID_IVMRWindowlessControl, FALSE);
+ IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); filter = create_vmr9(VMR9Mode_Renderless);
@@ -251,6 +281,20 @@ static void test_interfaces(void) check_interface(filter, &IID_IVMRWindowlessControl, FALSE); check_interface(filter, &IID_IVMRWindowlessControl9, FALSE);
+ IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); }
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(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50549
Your paranoid android.
=== wxppro (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w2003std (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== wvistau64 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== wvistau64_zh_CN (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY". vmr7.c:614: Test failed: Expected description L"\4e3b\663e\793a\5668\9a71\52a8\7a0b\5e8f", got L"Primary Display Driver".
=== wvistau64_fr (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY". vmr7.c:614: Test failed: Expected description L"Pilote d'affichage principal", got L"Primary Display Driver".
=== wvistau64_he (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY". vmr7.c:614: Test failed: Expected description L"\05de\05e0\05d4\05dc \05ea\05e6\05d5\05d2\05d4 \05e8\05d0\05e9\05d9", got L"Primary Display Driver".
=== w2008s64 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w7u (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY". vmr7.c:614: Test failed: Expected description L"\30d7\30e9\30a4\30de\30ea \30c7\30a3\30b9\30d7\30ec\30a4 \30c9\30e9\30a4\30d0\30fc", got L"Primary Display Driver".
=== w7pro64 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w8 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w8adm (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w864 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w1064 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== wvistau64 (64 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w2008s64 (64 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w7pro64 (64 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w864 (64 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== w1064 (64 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"display", got L"DISPLAY".
=== debian9 (32 bit report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"\000e". vmr7.c:625: Test failed: Expected revision 0, got 0x610054. vmr7.c:686: Test failed: Expected count 2, got 1.
=== debian9 (32 bit French report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"\000e". vmr7.c:625: Test failed: Expected revision 0, got 0x610054. vmr7.c:686: Test failed: Expected count 2, got 1.
=== debian9 (32 bit Japanese:Japan report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"\000e". vmr7.c:625: Test failed: Expected revision 0, got 0x610054. vmr7.c:686: Test failed: Expected count 2, got 1.
=== debian9 (32 bit Chinese:China report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"\000e". vmr7.c:625: Test failed: Expected revision 0, got 0x610054. vmr7.c:686: Test failed: Expected count 2, got 1.
=== debian9 (32 bit WoW report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"\000e". vmr7.c:625: Test failed: Expected revision 0, got 0x610054. vmr7.c:686: Test failed: Expected count 2, got 1.
=== debian9 (64 bit WoW report) ===
quartz: vmr7.c:611: Test failed: Expected device name L"\\.\DISPLAY1", got L"". vmr7.c:686: Test failed: Expected count 2, got 1.
On 4/4/19 10:51 PM, Zebediah Figura wrote:
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(-)
Please ignore this patch and the equivalent patch for vmr9, it probably deserves a correct implementation first.
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(); }