[v2 PATCH 5/9] user32/tests: multi-device case
Donat Enikeev
donat at enikeev.net
Mon May 8 14:18:55 CDT 2017
v2: one more case for at least one display device expected
Supersedes: https://source.winehq.org/patches/data/133107
Signed-off-by: Donat Enikeev <donat at enikeev.net>
---
dlls/user32/tests/monitor.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index dfdca49..983b2b1 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -76,10 +76,10 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc,
static void test_enumdisplaydevices(void)
{
- DISPLAY_DEVICEA dd;
+ DISPLAY_DEVICEA dd, dd_mon;
char primary_device_name[32];
char primary_monitor_device_name[32];
- DWORD primary_num = -1, num = 0;
+ DWORD primary_num = -1, dd_num = 0, mon_num = 0;
BOOL ret;
if (!pEnumDisplayDevicesA)
@@ -89,17 +89,23 @@ static void test_enumdisplaydevices(void)
}
dd.cb = sizeof(dd);
+ dd_mon.cb = sizeof(dd);
+
while(1)
{
BOOL ret;
HDC dc;
- ret = pEnumDisplayDevicesA(NULL, num, &dd, 0);
+ ret = pEnumDisplayDevicesA(NULL, dd_num, &dd, 0);
+ if (!dd_num)
+ ok(ret, "At least one display device expected\n");
if(!ret) break;
+
if(dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
{
strcpy(primary_device_name, dd.DeviceName);
- primary_num = num;
+ primary_num = dd_num;
}
+
if(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
{
/* test creating DC */
@@ -107,7 +113,24 @@ static void test_enumdisplaydevices(void)
ok(dc != NULL, "Failed to CreateDC(\"%s\") err=%d\n", dd.DeviceName, GetLastError());
DeleteDC(dc);
}
- num++;
+
+ mon_num = 0;
+ while (pEnumDisplayDevicesA(dd.DeviceName, mon_num, &dd_mon, 0))
+ {
+ ok(dd_mon.DeviceString && *dd_mon.DeviceString,
+ "DeviceString expected for device %u (adapter %u)\n", mon_num, dd_num);
+
+ ok(dd_mon.DeviceID && *dd_mon.DeviceID,
+ "DeviceID expected for device %u (adapter %u)\n", mon_num, dd_num);
+
+ ok(!strncmp(dd_mon.DeviceName, dd.DeviceName, strlen(dd.DeviceName)),
+ "DeviceName prefix of device %u (%s) doesn't match adapter %u (%s))\n",
+ mon_num, dd_mon.DeviceName, dd_num, dd.DeviceName);
+
+ mon_num++;
+ }
+
+ dd_num++;
}
if (primary_num == -1 || !pEnumDisplayMonitors || !pGetMonitorInfoA)
--
2.7.4
More information about the wine-patches
mailing list