2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for ...
5 * PROGRAMMERS: Timo Kreuzer
11 PULONG gpulTargetBits
;
14 void Test_PatBlt_Params()
20 /* Test a rop that contains only the operation index */
21 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, PATCOPY
& 0x00FF0000);
24 /* Test a rop that contains arbitrary values outside the operation index */
25 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, (PATCOPY
& 0x00FF0000) | 0xab00cdef);
28 /* Test an invalid rop */
30 ok_long(PatBlt(hdcTarget
, 0, 0, 1, 1, SRCCOPY
) , 0);
34 for (i
= 0; i
< 256; i
++)
37 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, rop
);
39 /* Only these should succeed (they use no source) */
40 if ((i
== 0) || (i
== 5) || (i
== 10) || (i
== 15) || (i
== 80) ||
41 (i
== 85) || (i
== 90) || (i
== 95) || (i
== 160) || (i
== 165) ||
42 (i
== 170) || (i
== 175) || (i
== 240) || (i
== 245) ||
43 (i
== 250) || (i
== 255))
45 ok(ret
== 1, "index %ld failed, but should succeed\n", i
);
49 ok(ret
== 0, "index %ld succeeded, but should fail\n", i
);
53 /* Test quaternary rop, the background part is simply ignored */
54 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(PATCOPY
, PATINVERT
));
56 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(PATCOPY
, SRCCOPY
));
58 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(SRCCOPY
, PATCOPY
));
62 hdc
= CreateICA("DISPLAY", NULL
, NULL
, NULL
);
65 ok_long(PatBlt(hdc
, 0, 0, 1, 1, PATCOPY
), 1);
69 /* Test a mem DC without selecting a bitmap */
70 hdc
= CreateCompatibleDC(NULL
);
72 ok_long(PatBlt(hdc
, 0, 0, 1, 1, PATCOPY
), 1);
80 void Test_BrushOrigin()
82 ULONG aulBits
[2] = {0x5555AAAA, 0};
87 hbmp
= CreateBitmap(2, 2, 1, 1, aulBits
);
90 printf("Couln not create a bitmap\n");
94 hbr
= CreatePatternBrush(hbmp
);
97 printf("Couln not create a bitmap\n");
101 if (!SelectObject(hdcTarget
, hbr
))
103 printf("failed to select pattern brush\n");
107 ret
= PatBlt(hdcTarget
, 0, 0, 2, 2, PATCOPY
);
109 ok_long(gpulTargetBits
[0], 0xffffff);
110 ok_long(gpulTargetBits
[1], 0);
111 ok_long(gpulTargetBits
[16], 0);
112 ok_long(gpulTargetBits
[17], 0xffffff);
113 //printf("0x%lx, 0x%lx\n", gpulTargetBits[0], gpulTargetBits[1]);
115 ret
= PatBlt(hdcTarget
, 1, 0, 2, 2, PATCOPY
);
117 ok_long(gpulTargetBits
[0], 0xffffff);
118 ok_long(gpulTargetBits
[1], 0);
119 ok_long(gpulTargetBits
[2], 0xffffff);
120 ok_long(gpulTargetBits
[16], 0);
121 ok_long(gpulTargetBits
[17], 0xffffff);
122 ok_long(gpulTargetBits
[18], 0);
130 bmi
.bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
131 bmi
.bmiHeader
.biWidth
= 16;
132 bmi
.bmiHeader
.biHeight
= -16;
133 bmi
.bmiHeader
.biPlanes
= 1;
134 bmi
.bmiHeader
.biBitCount
= 32;
135 bmi
.bmiHeader
.biCompression
= BI_RGB
;
136 bmi
.bmiHeader
.biSizeImage
= 0;
137 bmi
.bmiHeader
.biXPelsPerMeter
= 1;
138 bmi
.bmiHeader
.biYPelsPerMeter
= 1;
139 bmi
.bmiHeader
.biClrUsed
= 0;
140 bmi
.bmiHeader
.biClrImportant
= 0;
141 ghbmpTarget
= CreateDIBSection(NULL
,
144 (PVOID
*)&gpulTargetBits
,
149 printf("Couln not create target bitmap\n");
153 hdcTarget
= CreateCompatibleDC(0);
156 printf("Couln not create target dc\n");
161 if (!SelectObject(hdcTarget
, ghbmpTarget
))
163 printf("Failed to select bitmap\n");
167 Test_PatBlt_Params();