[WS2_32_APITEST]
[reactos.git] / rostests / apitests / gdi32 / PaintRgn.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for FrameRgn
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8 #include <apitest.h>
9 #include <windows.h>
10 #include <stdio.h>
11 #include "init.h"
12
13
14 void Test_PaintRgn()
15 {
16 RECT rc = { 0, 0, 100, 100 };
17 HRGN hrgn1, hrgn2;
18 BOOL bRet;
19 XFORM xform;
20 PULONG pulDIB = gpvDIB1;
21
22 FillRect(ghdcDIB1, &rc, GetStockObject(BLACK_BRUSH));
23
24 hrgn1 = CreateRectRgn(0, 0, 8, 3);
25 ok(hrgn1 != NULL, "failed to create region\n");
26
27 hrgn2 = CreateRectRgn(2, 3, 5, 8);
28 ok(hrgn1 != NULL, "failed to create region\n");
29
30 CombineRgn(hrgn1, hrgn1, hrgn2, RGN_OR);
31
32 xform.eM11 = 1.0;
33 xform.eM12 = 0.5f;
34 xform.eM21 = 0.0;
35 xform.eM22 = 1.0;
36 xform.eDx = 0.0;
37 xform.eDy = 0.0;
38
39 SetGraphicsMode(ghdcDIB1, GM_ADVANCED);
40 ok(SetWorldTransform(ghdcDIB1, &xform) == TRUE, "SetWorldTransform failed\n");
41
42 SelectObject(ghdcDIB1, GetStockObject(WHITE_BRUSH));
43
44 bRet = PaintRgn(ghdcDIB1, hrgn1);
45 ok(bRet == TRUE, "PaintRgn failed\n");
46
47 ok_long(pulDIB[0], 0x00000000); // 000000000
48 ok_long(pulDIB[1], 0x000000C0); // 110000000
49 ok_long(pulDIB[2], 0x000000F0); // 111110000
50 ok_long(pulDIB[3], 0x000000FC); // 111111000
51 ok_long(pulDIB[4], 0x0000003F); // 001111110
52 ok_long(pulDIB[5], 0x0000003F); // 001111110
53 ok_long(pulDIB[6], 0x0000003B); // 001110110
54 ok_long(pulDIB[7], 0x00000038); // 001110000
55 ok_long(pulDIB[8], 0x00000038); // 001110000
56 }
57
58 START_TEST(PaintRgn)
59 {
60 InitStuff();
61 Test_PaintRgn();
62 }
63