2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for ...
5 * PROGRAMMERS: Timo Kreuzer
14 PULONG gpulTargetBits
;
17 void Test_PatBlt_Params()
23 /* Test a rop that contains only the operation index */
24 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, PATCOPY
& 0x00FF0000);
27 /* Test a rop that contains arbitrary values outside the operation index */
28 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, (PATCOPY
& 0x00FF0000) | 0xab00cdef);
31 /* Test an invalid rop */
33 ok_long(PatBlt(hdcTarget
, 0, 0, 1, 1, SRCCOPY
) , 0);
37 for (i
= 0; i
< 256; i
++)
40 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, rop
);
42 /* Only these should succeed (they use no source) */
43 if ((i
== 0) || (i
== 5) || (i
== 10) || (i
== 15) || (i
== 80) ||
44 (i
== 85) || (i
== 90) || (i
== 95) || (i
== 160) || (i
== 165) ||
45 (i
== 170) || (i
== 175) || (i
== 240) || (i
== 245) ||
46 (i
== 250) || (i
== 255))
48 ok(ret
== 1, "index %ld failed, but should succeed\n", i
);
52 ok(ret
== 0, "index %ld succeeded, but should fail\n", i
);
56 /* Test quaternary rop, the background part is simply ignored */
57 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(PATCOPY
, PATINVERT
));
59 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(PATCOPY
, SRCCOPY
));
61 ret
= PatBlt(hdcTarget
, 0, 0, 1, 1, MAKEROP4(SRCCOPY
, PATCOPY
));
65 hdc
= CreateICA("DISPLAY", NULL
, NULL
, NULL
);
68 ok_long(PatBlt(hdc
, 0, 0, 1, 1, PATCOPY
), 1);
72 /* Test a mem DC without selecting a bitmap */
73 hdc
= CreateCompatibleDC(NULL
);
75 ok_long(PatBlt(hdc
, 0, 0, 1, 1, PATCOPY
), 1);
83 void Test_BrushOrigin()
85 ULONG aulBits
[2] = {0x5555AAAA, 0};
90 hbmp
= CreateBitmap(2, 2, 1, 1, aulBits
);
93 printf("Couln not create a bitmap\n");
97 hbr
= CreatePatternBrush(hbmp
);
100 printf("Couln not create a bitmap\n");
104 if (!SelectObject(hdcTarget
, hbr
))
106 printf("failed to select pattern brush\n");
110 ret
= PatBlt(hdcTarget
, 0, 0, 2, 2, PATCOPY
);
112 ok_long(gpulTargetBits
[0], 0xffffff);
113 ok_long(gpulTargetBits
[1], 0);
114 ok_long(gpulTargetBits
[16], 0);
115 ok_long(gpulTargetBits
[17], 0xffffff);
116 //printf("0x%lx, 0x%lx\n", gpulTargetBits[0], gpulTargetBits[1]);
118 ret
= PatBlt(hdcTarget
, 1, 0, 2, 2, PATCOPY
);
120 ok_long(gpulTargetBits
[0], 0xffffff);
121 ok_long(gpulTargetBits
[1], 0);
122 ok_long(gpulTargetBits
[2], 0xffffff);
123 ok_long(gpulTargetBits
[16], 0);
124 ok_long(gpulTargetBits
[17], 0xffffff);
125 ok_long(gpulTargetBits
[18], 0);
133 bmi
.bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
134 bmi
.bmiHeader
.biWidth
= 16;
135 bmi
.bmiHeader
.biHeight
= -16;
136 bmi
.bmiHeader
.biPlanes
= 1;
137 bmi
.bmiHeader
.biBitCount
= 32;
138 bmi
.bmiHeader
.biCompression
= BI_RGB
;
139 bmi
.bmiHeader
.biSizeImage
= 0;
140 bmi
.bmiHeader
.biXPelsPerMeter
= 1;
141 bmi
.bmiHeader
.biYPelsPerMeter
= 1;
142 bmi
.bmiHeader
.biClrUsed
= 0;
143 bmi
.bmiHeader
.biClrImportant
= 0;
144 ghbmpTarget
= CreateDIBSection(NULL
,
147 (PVOID
*)&gpulTargetBits
,
152 printf("Couln not create target bitmap\n");
156 hdcTarget
= CreateCompatibleDC(0);
159 printf("Couln not create target dc\n");
164 if (!SelectObject(hdcTarget
, ghbmpTarget
))
166 printf("Failed to select bitmap\n");
170 Test_PatBlt_Params();