From: Paul Gofman Subject: [PATCH v2 3/3] user32/tests: Add test for GUID_DISPLAY_DEVICE_ARRIVAL device interface presence. Message-Id: <20210906124239.59283-3-pgofman@codeweavers.com> Date: Mon, 6 Sep 2021 15:42:39 +0300 In-Reply-To: <20210906124239.59283-1-pgofman@codeweavers.com> References: <20210906124239.59283-1-pgofman@codeweavers.com> Signed-off-by: Paul Gofman --- v2: - moved from gdi32/tests/driver.c to user32/tests/monitor.c. dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/monitor.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index dd101d69f3c..1422efb142b 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 hid +IMPORTS = setupapi user32 gdi32 advapi32 hid C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index cee7b629cd7..6fa5053719a 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -29,6 +29,10 @@ #include "winreg.h" #include "winternl.h" #include "ddk/d3dkmthk.h" +#include "initguid.h" +#include "ntddvdeo.h" +#include "devguid.h" +#include "setupapi.h" #include "wine/heap.h" #include @@ -2389,6 +2393,34 @@ static void test_display_dc(void) } } +static void test_device_interfaces(void) +{ + SP_DEVINFO_DATA device_data = {sizeof(device_data)}; + SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; + unsigned int i; + HDEVINFO set; + BOOL ret; + + set = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL, NULL, NULL, DIGCF_DEVICEINTERFACE); + ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed, error %u.\n", GetLastError()); + + i = 0; + while ((ret = SetupDiEnumDeviceInfo(set, i, &device_data))) + { + ret = SetupDiEnumDeviceInterfaces(set, &device_data, &GUID_DISPLAY_DEVICE_ARRIVAL, 0, &iface); + ok(IsEqualGUID(&iface.InterfaceClassGuid, &GUID_DISPLAY_DEVICE_ARRIVAL), + "Got unexpected guid %s.\n", + wine_dbgstr_guid(&iface.InterfaceClassGuid)); + ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError()); + ++i; + } + ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected ret %#x, GetLastError() %u.\n", + ret, GetLastError()); + ok(i || broken(!i) /* before Win8 */, "Could not find any devices.\n"); + + SetupDiDestroyDeviceInfoList(set); +} + START_TEST(monitor) { init_function_pointers(); @@ -2401,4 +2433,5 @@ START_TEST(monitor) test_display_config(); test_handles(); test_display_dc(); + test_device_interfaces(); } -- 2.31.1