Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d8/tests/device.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 80bf62e361..c897341629 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9760,6 +9760,47 @@ static void test_get_display_mode(void) DestroyWindow(window); }
+static void test_multi_adapter(void) +{ + UINT adapter_count, expected_adapter_count = 0; + DISPLAY_DEVICEA display_device; + MONITORINFO monitor_info; + HMONITOR monitor; + IDirect3D8 *d3d8; + DWORD i; + + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(d3d8 != NULL, "Failed to create a D3D object.\n"); + + display_device.cb = sizeof(display_device); + for (i = 0; EnumDisplayDevicesA(NULL, i, &display_device, 0); ++i) + { + if (display_device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) + ++expected_adapter_count; + } + + adapter_count = IDirect3D8_GetAdapterCount(d3d8); + todo_wine_if(expected_adapter_count > 1) + ok(adapter_count == expected_adapter_count, "Expect adapter count %u, got %u.\n", + expected_adapter_count, adapter_count); + + for (i = 0; i < adapter_count; ++i) + { + monitor = IDirect3D8_GetAdapterMonitor(d3d8, i); + ok(monitor != NULL, "IDirect3D8_GetAdapterMonitor failed\n"); + + monitor_info.cbSize = sizeof(monitor_info); + ok(GetMonitorInfoA(monitor, &monitor_info), "GetMonitorInfoA failed, error %#x.\n", GetLastError()); + + if (i == 0) + ok(monitor_info.dwFlags == MONITORINFOF_PRIMARY, "Expect adapter is primary.\n"); + else + ok(monitor_info.dwFlags == 0, "Expect adapter is non-primary.\n"); + } + + IDirect3D8_Release(d3d8); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -9876,6 +9917,7 @@ START_TEST(device) test_multiply_transform(); test_draw_primitive(); test_get_display_mode(); + test_multi_adapter();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }