2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for FrameRgn
5 * PROGRAMMERS: Timo Kreuzer
24 hrgnTemp
= CreateRectRgn(0, 0, 0, 0);
30 if (CombineRgn(hrgnTemp
, hrgn
, NULL
, RGN_COPY
) == ERROR
)
33 if (OffsetRgn(hrgn
, cx
, cy
) == ERROR
)
36 if (CombineRgn(hrgnTemp
, hrgnTemp
, hrgn
, RGN_AND
) == ERROR
)
39 if (OffsetRgn(hrgn
, -2 * cx
, 0) == ERROR
)
42 if (CombineRgn(hrgnTemp
, hrgnTemp
, hrgn
, RGN_AND
) == ERROR
)
45 if (OffsetRgn(hrgn
, 0, -2 * cy
) == ERROR
)
48 if (CombineRgn(hrgnTemp
, hrgnTemp
, hrgn
, RGN_AND
) == ERROR
)
51 if (OffsetRgn(hrgn
, 2 * cx
, 0) == ERROR
)
54 if (CombineRgn(hrgnTemp
, hrgnTemp
, hrgn
, RGN_AND
) == ERROR
)
57 if (OffsetRgn(hrgn
, -cx
, cy
) == ERROR
)
60 if (CombineRgn(hrgnTemp
, hrgn
, hrgnTemp
, RGN_DIFF
) == ERROR
)
63 if (!FillRgn(hdc
, hrgnTemp
, hbr
))
66 DeleteObject(hrgnTemp
);
70 DeleteObject(hrgnTemp
);
77 CheckBitmapBitsWithLine(
87 for (y
= 0; y
< cy
; y
++)
89 for (x
= 0; x
< cy
; x
++)
92 ok(GetPixel(hdc
, x
, y
) == pcrColors
[pjBits
[i
]],
93 "Wrong pixel at (%u,%u): expected 0x%08lx, got 0x%08lx\n",
94 x
, y
, pcrColors
[pjBits
[i
]], GetPixel(hdc
, x
, y
));
99 #define CheckBitmapBits(hdc,cx,cy,pj,pcr) \
100 CheckBitmapBitsWithLine(__LINE__, hdc,cx,cy,pj,pcr)
104 RECT rc
= {0, 0, 8, 8 };
108 0, 0, 0, 0, 0, 0, 0, 0, // 0000000
109 0, 1, 1, 1, 1, 0, 0, 0, // 0****00
110 0, 1, 2, 2, 1, 0, 0, 0, // 0*xx**0
111 0, 1, 2, 2, 1, 1, 1, 0, // 0*xxx*0
112 0, 1, 1, 1, 2, 2, 1, 0, // 0**xx*0
113 0, 0, 0, 1, 2, 2, 1, 0, // 00****0
114 0, 0, 0, 1, 1, 1, 1, 0, // 0000000
115 0, 0, 0, 0, 0, 0, 0, 0 // 0000000
117 COLORREF acrColors
[16] = {RGB(0,0,0), RGB(255,255,255), RGB(128,128,128), 0};
119 FillRect(ghdcDIB32
, &rc
, GetStockObject(BLACK_BRUSH
));
121 hrgn1
= CreateRectRgn(1, 1, 5, 5);
122 ok(hrgn1
!= NULL
, "failed to create region\n");
124 hrgn2
= CreateRectRgn(3, 3, 7, 7);
125 ok(hrgn1
!= NULL
, "failed to create region\n");
127 CombineRgn(hrgn1
, hrgn1
, hrgn2
, RGN_OR
);
129 bRet
= FillRgn(ghdcDIB32
, hrgn1
, GetStockObject(GRAY_BRUSH
));
130 ok(bRet
!= 0, "FrameRgn failed\n");
132 bRet
= FrameRgn(ghdcDIB32
, hrgn1
, GetStockObject(WHITE_BRUSH
), 1, 1);
133 ok(bRet
!= 0, "FrameRgn failed\n");
135 CheckBitmapBits(ghdcDIB32
, 8, 8, ajBits
, acrColors
);