Commit d93412ca authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

gdi32/tests: Fix possible test failures in test_clip_box().

When there are multiple monitors and their monitor region union can still be represented by a simple rectangle, the clip box region type for the screen DC is still SIMPLEREGION. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a4456ff9
...@@ -1539,6 +1539,40 @@ static void test_pscript_printer_dc(void) ...@@ -1539,6 +1539,40 @@ static void test_pscript_printer_dc(void)
DeleteDC(hdc); DeleteDC(hdc);
} }
struct screen_region_info
{
HRGN region;
INT type;
};
static BOOL CALLBACK enum_monitor_proc(HMONITOR monitor, HDC hdc, RECT *rect, LPARAM lparam)
{
struct screen_region_info *info = (struct screen_region_info *)lparam;
HRGN region;
if (!info->region)
{
info->region = CreateRectRgnIndirect(rect);
info->type = SIMPLEREGION;
}
else
{
region = CreateRectRgnIndirect(rect);
info->type = CombineRgn(info->region, info->region, region, RGN_OR);
DeleteObject(region);
}
return TRUE;
}
static INT get_screen_region_type(void)
{
struct screen_region_info info = {NULL, NULLREGION};
EnumDisplayMonitors(NULL, NULL, enum_monitor_proc, (LPARAM)&info);
DeleteObject(info.region);
return info.type;
}
static void test_clip_box(void) static void test_clip_box(void)
{ {
DEVMODEA scale_mode = {.dmSize = sizeof(DEVMODEA)}; DEVMODEA scale_mode = {.dmSize = sizeof(DEVMODEA)};
...@@ -1554,7 +1588,7 @@ static void test_clip_box(void) ...@@ -1554,7 +1588,7 @@ static void test_clip_box(void)
SetRect(&screen_rect, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN), SetRect(&screen_rect, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN),
GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN)); GetSystemMetrics(SM_YVIRTUALSCREEN) + GetSystemMetrics(SM_CYVIRTUALSCREEN));
screen_type = GetSystemMetrics(SM_CMONITORS) > 1 ? COMPLEXREGION : SIMPLEREGION; screen_type = get_screen_region_type();
dc = CreateDCA("DISPLAY", NULL, NULL, NULL); dc = CreateDCA("DISPLAY", NULL, NULL, NULL);
type = GetClipBox(dc, &rect); type = GetClipBox(dc, &rect);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment