Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43187
Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- This patch is not merged with the previous one because there is no todo_wine for service_ok.
Supersedes patch 151899.
v2: Fix test for wxppro or w2003. --- programs/services/tests/service.c | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/programs/services/tests/service.c b/programs/services/tests/service.c index 728d515f85..e4538559c0 100644 --- a/programs/services/tests/service.c +++ b/programs/services/tests/service.c @@ -127,6 +127,41 @@ static void test_create_window(void) service_ok(r, "DestroyWindow failed: %08x\n", GetLastError()); }
+static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc, LPARAM lparam) +{ + BOOL r; + MONITORINFOEXA mi; + + mi.cbSize = sizeof(mi); + + r = GetMonitorInfoA(hmon, (MONITORINFO*)&mi); + service_ok(r, "GetMonitorInfo failed.\n"); + + service_ok(mi.rcMonitor.left == 0 && mi.rcMonitor.top == 0 && mi.rcMonitor.right >= 640 && mi.rcMonitor.bottom >= 480, + "Unexepected monitor rcMonitor values: {%d,%d,%d,%d}\n", + mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom); + + service_ok(mi.rcWork.left == 0 && mi.rcWork.top == 0 && mi.rcWork.right >= 640 && mi.rcWork.bottom >= 480, + "Unexepected monitor rcWork values: {%d,%d,%d,%d}\n", + mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom); + + service_ok(!strcmp(mi.szDevice, "WinDisc") || !strcmp(mi.szDevice, "\\.\DISPLAY1"), + "Unexpected szDevice received: %s\n", mi.szDevice); + + service_ok(mi.dwFlags & MONITORINFOF_PRIMARY, "Unexpected secondary monitor info.\n"); + + return TRUE; +} + +/* query informations monitor information, even in non-interactive services */ +static void test_monitors(void) +{ + BOOL r; + + r = EnumDisplayMonitors(0, 0, monitor_enum_proc, 0); + service_ok(r, "EnumDisplayMonitors failed.\n"); +} + static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_data, void *context) { SERVICE_STATUS status; @@ -151,6 +186,7 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da case 128: test_winstation(); test_create_window(); + test_monitors(); service_event("CUSTOM"); return 0xdeadbeef; default: