Zhiyi Zhang : gdi32/tests: Fix possible test failures in test_clip_box().
Alexandre Julliard
julliard at winehq.org
Mon Dec 21 15:49:52 CST 2020
Module: wine
Branch: master
Commit: d93412ca67f6cadc0e593b27439ead8138093ec0
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d93412ca67f6cadc0e593b27439ead8138093ec0
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Mon Dec 14 15:11:43 2020 +0800
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: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/tests/dc.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index b4a89b213d2..2cb8c65dd64 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -1539,6 +1539,40 @@ static void test_pscript_printer_dc(void)
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)
{
DEVMODEA scale_mode = {.dmSize = sizeof(DEVMODEA)};
@@ -1554,7 +1588,7 @@ static void test_clip_box(void)
SetRect(&screen_rect, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN),
GetSystemMetrics(SM_XVIRTUALSCREEN) + GetSystemMetrics(SM_CXVIRTUALSCREEN),
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);
type = GetClipBox(dc, &rect);
More information about the wine-cvs
mailing list