1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for ExtCreatePen
5  * PROGRAMMERS:     Timo Kreuzer
6  */
7 
8 #include "precomp.h"
9 
10 #define ok_lasterror(err) \
11     ok(GetLastError() == err, "expected last error " #err " but got 0x%lx\n", GetLastError());
12 
13 #define ok_elp(hPen, elp, pstyle, width, bstyle, color, hatch, cstyle) \
14     ok(GetObjectA(hPen, sizeof(elpBuffer), elp) != 0, "GetObject failed\n"); \
15     ok((elp)->elpPenStyle == (pstyle), "Wrong elpPenStyle, expected 0x%lx, got 0x%lx\n", (DWORD)pstyle, (elp)->elpPenStyle); \
16     ok((elp)->elpWidth == width, "Wrong elpWidth, expected %lu, got %lu\n", (DWORD)width, (elp)->elpWidth); \
17     ok((elp)->elpBrushStyle == (bstyle), "Wrong elpBrushStyle, expected 0x%x, got 0x%x\n", bstyle, (elp)->elpBrushStyle); \
18     ok((elp)->elpColor == color, "Wrong elpColor, expected 0x%lx, got 0x%lx\n", (COLORREF)color, (elp)->elpColor); \
19     ok((elp)->elpHatch == hatch, "Wrong elpHatch, expected 0x%p, got 0x%p\n", (PVOID)hatch, (PVOID)(elp)->elpHatch); \
20     ok((elp)->elpNumEntries == cstyle, "Wrong elpNumEntries, expected %lu got %lu\n", (DWORD)cstyle, (elp)->elpNumEntries);
21 
22 void Test_ExtCreatePen_Params()
23 {
24     HPEN hPen;
25     LOGBRUSH logbrush;
26     struct
27     {
28         EXTLOGPEN extlogpen;
29         ULONG styles[16];
30     } elpBuffer;
31     PEXTLOGPEN pelp = &elpBuffer.extlogpen;
32 
33     DWORD adwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
34 
35     /* Test NULL logbrush */
36     SetLastError(0);
37     _SEH2_TRY
38     {
39         hPen = ExtCreatePen(PS_COSMETIC, 1, NULL, 0, 0);
40     }
41     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
42     {
43         SetLastError(0xdeadc0de);
44     }
45     _SEH2_END;
46     ok_lasterror(0xdeadc0de);
47 
48     logbrush.lbStyle = BS_SOLID;
49     logbrush.lbColor = RGB(1, 2, 3);
50     logbrush.lbHatch = 0;
51     hPen = ExtCreatePen(PS_COSMETIC, 1, &logbrush, 0, 0);
52     ok(hPen != NULL, "ExtCreatePen failed\n");
53     ok_elp(hPen, pelp, PS_COSMETIC, 1, BS_SOLID, RGB(1,2,3), 0, 0);
54 
55     /* Test if we have an EXTPEN */
56     ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN, "hPen=%p\n", hPen);
57     DeleteObject(hPen);
58 
59     /* Test invalid style mask (0x0F) */
60     SetLastError(0xdeadc0de);
61     hPen = ExtCreatePen(9, 1, &logbrush, 0, 0);
62     ok(hPen == NULL, "ExtCreatePen should fail\n");
63     ok_lasterror(ERROR_INVALID_PARAMETER);
64 
65     /* Test PS_ALTERNATE with PS_GEOMETRIC */
66     SetLastError(0xdeadc0de);
67     hPen = ExtCreatePen(PS_ALTERNATE | PS_GEOMETRIC, 1, &logbrush, 0, NULL);
68     ok(hPen == NULL, "ExtCreatePen should fail\n");
69     ok_lasterror(ERROR_INVALID_PARAMETER);
70 
71     /* Test invalid endcap mask (0xF00) */
72     SetLastError(0xdeadc0de);
73     hPen = ExtCreatePen(0x300, 1, &logbrush, 0, 0);
74     ok(hPen == NULL, "ExtCreatePen should fail\n");
75     ok_lasterror(ERROR_INVALID_PARAMETER);
76 
77     /* Test invalid join mask (F000) */
78     SetLastError(0xdeadc0de);
79     hPen = ExtCreatePen(0x3000, 1, &logbrush, 0, 0);
80     ok(hPen == NULL, "ExtCreatePen should fail\n");
81     ok_lasterror(ERROR_INVALID_PARAMETER);
82 
83     /* Test invalid type mask (F0000) */
84     SetLastError(0xdeadc0de);
85     hPen = ExtCreatePen(0x20000, 1, &logbrush, 0, 0);
86     ok(hPen == NULL, "ExtCreatePen should fail\n");
87     ok_lasterror(ERROR_INVALID_PARAMETER);
88 
89     /* Test PS_COSMETIC with dwWidth != 1 */
90     SetLastError(0xdeadc0de);
91     hPen = ExtCreatePen(PS_COSMETIC, -1, &logbrush, 0, 0);
92     ok(hPen != NULL, "ExtCreatePen failed\n");
93     ok_lasterror(0xdeadc0de);
94     ok_elp(hPen, pelp, PS_COSMETIC, 1, BS_SOLID, RGB(1,2,3), 0, 0);
95     DeleteObject(hPen);
96     SetLastError(0xdeadc0de);
97     hPen = ExtCreatePen(PS_COSMETIC, 2, &logbrush, 0, 0);
98     ok(hPen == NULL, "ExtCreatePen should fail\n");
99     ok_lasterror(ERROR_INVALID_PARAMETER);
100     SetLastError(0xdeadc0de);
101     hPen = ExtCreatePen(PS_COSMETIC, 0, &logbrush, 0, 0);
102     ok(hPen == NULL, "ExtCreatePen should fail\n");
103     ok_lasterror(ERROR_INVALID_PARAMETER);
104 
105     /* Test PS_COSMETIC with PS_ENDCAP_SQUARE */
106     SetLastError(0xdeadc0de);
107     hPen = ExtCreatePen(PS_COSMETIC | PS_ENDCAP_SQUARE, 1, &logbrush, 0, NULL);
108     ok(hPen != NULL, "ExtCreatePen failed\n");
109     ok_lasterror(0xdeadc0de);
110     ok_elp(hPen, pelp, PS_COSMETIC | PS_ENDCAP_SQUARE, 1, BS_SOLID, RGB(1,2,3), 0, 0);
111     DeleteObject(hPen);
112 
113     /* Test styles without PS_USERSTYLE */
114     SetLastError(0xdeadc0de);
115     hPen = ExtCreatePen(PS_GEOMETRIC, 1, &logbrush, 16, adwStyles);
116     ok(hPen == NULL, "ExtCreatePen should fail\n");
117     ok_lasterror(ERROR_INVALID_PARAMETER);
118     SetLastError(0xdeadc0de);
119     hPen = ExtCreatePen(PS_GEOMETRIC, 1, &logbrush, 0, adwStyles);
120     ok(hPen == NULL, "ExtCreatePen should fail\n");
121     ok_lasterror(ERROR_INVALID_PARAMETER);
122     SetLastError(0xdeadc0de);
123     hPen = ExtCreatePen(PS_GEOMETRIC, 1, &logbrush, 16, NULL);
124     ok(hPen == NULL, "ExtCreatePen should fail\n");
125     ok_lasterror(ERROR_INVALID_PARAMETER);
126 
127     /* Test PS_USERSTYLE */
128     SetLastError(0xdeadc0de);
129     hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, adwStyles);
130     ok(hPen != NULL, "ExtCreatePen failed\n");
131     ok_lasterror(0xdeadc0de);
132     ok_elp(hPen, pelp, PS_GEOMETRIC | PS_USERSTYLE, 5, BS_SOLID, RGB(1,2,3), 0, 16);
133     DeleteObject(hPen);
134 
135     /* Test PS_USERSTYLE with PS_COSMETIC */
136     SetLastError(0xdeadc0de);
137     hPen = ExtCreatePen(PS_COSMETIC | PS_USERSTYLE, 5, &logbrush, 16, adwStyles);
138     ok(hPen == NULL, "ExtCreatePen should fail\n");
139     ok_lasterror(ERROR_INVALID_PARAMETER);
140 
141     /* Test PS_USERSTYLE with 17 styles */
142     SetLastError(0xdeadc0de);
143     hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, adwStyles);
144     ok(hPen == NULL, "ExtCreatePen should fail\n");
145     ok_lasterror(ERROR_INVALID_PARAMETER);
146 
147     /* Test PS_USERSTYLE with 1 style */
148     SetLastError(0xdeadc0de);
149     hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 1, adwStyles);
150     ok(hPen != NULL, "ExtCreatePen failed\n");
151     ok_lasterror(0xdeadc0de);
152     ok_elp(hPen, pelp, PS_GEOMETRIC | PS_USERSTYLE, 5, BS_SOLID, RGB(1,2,3), 0, 1);
153     DeleteObject(hPen);
154 
155     /* Test PS_USERSTYLE with NULL lpStyles */
156     SetLastError(0xdeadc0de);
157     hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 1, &logbrush, 2, NULL);
158     ok(hPen == NULL, "ExtCreatePen should fail\n");
159     ok_lasterror(ERROR_INVALID_PARAMETER);
160 
161     /* Test PS_NULL */
162     SetLastError(0xdeadc0de);
163     hPen = ExtCreatePen(PS_NULL, 1, &logbrush, 0, NULL);
164     ok(hPen == GetStockObject(NULL_PEN), "ExtCreatePen should return NULL_PEN, but returned %p\n", hPen);
165     ok_lasterror(0xdeadc0de);
166 
167     /* When the size is anything other than sizeof(EXTLOGPEN), we will get a LOGPEN! */
168     ok(GetObjectA(hPen, sizeof(EXTLOGPEN) + 1, pelp) == sizeof(LOGPEN), "GetObject failed\n");
169 
170     /* ACHTUNG: special handling, we want sizeof(EXTLOGPEN) and nothing else */
171     ok(GetObjectA(hPen, sizeof(EXTLOGPEN), pelp) == sizeof(EXTLOGPEN), "GetObject failed\n");
172     ok(pelp->elpPenStyle == PS_NULL, "Wrong elpPenStyle, expected PS_NULL, got 0x%lx\n", pelp->elpPenStyle);
173     ok(pelp->elpWidth == 0, "Wrong elpWidth, expected 0, got %lu\n", pelp->elpWidth);
174     ok(pelp->elpBrushStyle == BS_SOLID, "Wrong elpBrushStyle, expected BS_SOLID, got 0x%x\n", pelp->elpBrushStyle);
175     ok(pelp->elpColor == 0, "Wrong elpColor, expected 0, got 0x%lx\n", pelp->elpColor);
176     ok(pelp->elpHatch == 0, "Wrong elpHatch, expected 0, got 0x%lx\n", pelp->elpHatch);
177     ok(pelp->elpNumEntries == 0, "Wrong elpNumEntries, expected %u got %lu\n", 0, pelp->elpNumEntries);
178 
179     /* Test PS_NULL with styles */
180     SetLastError(0xdeadc0de);
181     hPen = ExtCreatePen(PS_NULL, 1, &logbrush, 1, adwStyles);
182     ok(hPen == NULL, "ExtCreatePen should fail\n");
183     ok_lasterror(ERROR_INVALID_PARAMETER);
184 
185     /* Test 0 width */
186     SetLastError(0xdeadc0de);
187     hPen = ExtCreatePen(PS_GEOMETRIC, 0, &logbrush, 0, 0);
188     ok(hPen != NULL, "ExtCreatePen failed\n");
189     ok_lasterror(0xdeadc0de);
190     ok_elp(hPen, pelp, PS_GEOMETRIC, 0, BS_SOLID, RGB(1,2,3), 0, 0);
191     DeleteObject(hPen);
192 
193     /* Test negative width */
194     SetLastError(0xdeadc0de);
195     hPen = ExtCreatePen(PS_GEOMETRIC, -7942, &logbrush, 0, 0);
196     ok(hPen != NULL, "ExtCreatePen failed\n");
197     ok_lasterror(0xdeadc0de);
198     ok_elp(hPen, pelp, PS_GEOMETRIC, 7942, BS_SOLID, RGB(1,2,3), 0, 0);
199     DeleteObject(hPen);
200 
201 }
202 
203 BOOL
204 Test_ExtCreatePen_Expect(
205     DWORD dwPenStyle,
206     DWORD dwWidth,
207     DWORD dwStyleCount,
208     PDWORD pdwStyles,
209     UINT lbStyle,
210     ULONG_PTR lbHatch,
211     PBOOL pbExpectException,
212     PEXTLOGPEN pelpExpect)
213 {
214     *pbExpectException = FALSE;
215 
216     if ((dwPenStyle & PS_STYLE_MASK) == PS_USERSTYLE)
217     {
218         if (pdwStyles == NULL)
219         {
220             return FALSE;
221         }
222     }
223     else
224     {
225         if ((dwStyleCount != 0) || (pdwStyles != NULL))
226         {
227             return FALSE;
228         }
229     }
230 
231     if (lbStyle == BS_PATTERN)
232     {
233         if (lbHatch == 0) return FALSE;
234     }
235 
236     if (lbStyle == BS_DIBPATTERNPT)
237     {
238         if (lbHatch == 0) return FALSE;
239         if (lbHatch < 0xFFFF)
240         {
241             *pbExpectException = TRUE;
242             return FALSE;
243         }
244     }
245 
246     if (lbStyle == BS_DIBPATTERN)
247     {
248         return FALSE;
249     }
250 
251     if ((dwPenStyle & PS_STYLE_MASK) == PS_USERSTYLE)
252     {
253         if (dwStyleCount == 0)
254         {
255             return FALSE;
256         }
257 
258         if (dwStyleCount > 16)
259         {
260             return FALSE;
261         }
262 
263         if ((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC)
264         {
265             if (pdwStyles[0] == 0)
266             {
267                 return FALSE;
268             }
269         }
270         else
271         {
272             if ((pdwStyles[0] == 0) && (dwStyleCount == 1))
273             {
274                 return FALSE;
275             }
276         }
277     }
278 
279     if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL)
280     {
281         pelpExpect->elpPenStyle = PS_NULL;
282         pelpExpect->elpWidth = 0;
283         pelpExpect->elpBrushStyle = BS_SOLID;
284         pelpExpect->elpColor = 0;
285         pelpExpect->elpHatch = 0;
286         pelpExpect->elpNumEntries = 0;
287         return TRUE;
288     }
289 
290 
291     if (((dwPenStyle & PS_STYLE_MASK) >> 0) > PS_ALTERNATE) return FALSE;
292     if (((dwPenStyle & PS_ENDCAP_MASK) >> 8) > 2) return FALSE;
293     if (((dwPenStyle & PS_JOIN_MASK) >> 12) > 2) return FALSE;
294     if (((dwPenStyle & PS_TYPE_MASK) >> 16) > 1) return FALSE;
295 
296     dwWidth = abs(((LONG)dwWidth));
297 
298     if ((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC)
299     {
300         if (dwWidth != 1) return FALSE;
301 
302         if ((lbStyle != BS_SOLID) &&
303             (lbStyle != BS_HATCHED))
304         {
305             return FALSE;
306         }
307 
308         if (lbStyle == BS_HATCHED)
309         {
310             if ((lbHatch != 8) &&
311                 (lbHatch != 10) &&
312                 (lbHatch != 12))
313             {
314                 return FALSE;
315             }
316 
317             if (lbHatch >= HS_API_MAX)
318             {
319                 return FALSE;
320             }
321         }
322 
323         if ((dwPenStyle & PS_STYLE_MASK) == PS_INSIDEFRAME)
324         {
325             return FALSE;
326         }
327     }
328     else
329     {
330         if ((dwPenStyle & PS_STYLE_MASK) == PS_ALTERNATE)
331         {
332             return FALSE;
333         }
334 
335         if (((dwPenStyle & PS_STYLE_MASK) != PS_SOLID) &&
336             ((dwPenStyle & PS_STYLE_MASK) != PS_INSIDEFRAME) &&
337             ((dwPenStyle & PS_STYLE_MASK) != PS_USERSTYLE))
338         {
339             if (dwWidth == 0)
340             {
341                 return FALSE;
342             }
343         }
344 
345         if (lbStyle == BS_NULL)
346         {
347             pelpExpect->elpPenStyle = PS_NULL;
348             pelpExpect->elpWidth = 0;
349             pelpExpect->elpBrushStyle = BS_SOLID;
350             pelpExpect->elpColor = 0;
351             pelpExpect->elpHatch = 0;
352             pelpExpect->elpNumEntries = 0;
353             return TRUE;
354         }
355 
356         if (lbStyle > BS_HATCHED)
357         {
358             return FALSE;
359         }
360 
361         if (lbStyle == BS_HATCHED)
362         {
363             if (lbHatch >= HS_API_MAX)
364             {
365                 return FALSE;
366             }
367         }
368 
369     }
370 
371     pelpExpect->elpPenStyle = dwPenStyle;
372     pelpExpect->elpWidth = dwWidth;
373     pelpExpect->elpBrushStyle = lbStyle;
374     pelpExpect->elpColor = RGB(1,2,3);
375     pelpExpect->elpHatch = lbHatch;
376     pelpExpect->elpNumEntries = dwStyleCount;
377     //pelpExpect->elpStyleEntry[1];
378 
379     return TRUE;
380 }
381 
382 void
383 Test_ExtCreatePen_Helper(
384     DWORD dwPenStyle,
385     DWORD dwWidth,
386     DWORD dwStyleCount,
387     PDWORD pdwStyles,
388     UINT lbStyle,
389     ULONG_PTR lbHatch)
390 {
391     LOGBRUSH lb;
392     HPEN hpen;
393     BOOL bExpectSuccess, bExpectException, bGotException = FALSE;
394     struct
395     {
396         EXTLOGPEN extlogpen;
397         ULONG styles[16];
398     } elpBuffer;
399     PEXTLOGPEN pelp = &elpBuffer.extlogpen;
400     EXTLOGPEN elpExpect;
401 
402     lb.lbStyle = lbStyle;
403     lb.lbColor = RGB(1,2,3);
404     lb.lbHatch = lbHatch;
405 
406     bExpectSuccess = Test_ExtCreatePen_Expect(
407                              dwPenStyle,
408                              dwWidth,
409                              dwStyleCount,
410                              pdwStyles,
411                              lbStyle,
412                              lbHatch,
413                              &bExpectException,
414                              &elpExpect);
415 
416     _SEH2_TRY
417     {
418         hpen = ExtCreatePen(dwPenStyle, dwWidth, &lb, dwStyleCount, pdwStyles);
419     }
420     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
421     {
422         bGotException = TRUE;
423     }
424     _SEH2_END;
425 
426 #define ok2(expression, text, expected, got) \
427     ok(expression, text \
428        "(dwPenStyle=0x%lx, dwWidth=%lu, dwStyleCount=%lu, pdwStyles=%p, lbStyle=%u, lbHatch=%p)\n", \
429        expected, got, dwPenStyle, dwWidth, dwStyleCount, pdwStyles, lbStyle, (PVOID)lbHatch);
430 
431     //ok(bGotException == bExpectException, "ExtCreatePen expected exception=%lu for "
432     //   "dwPenStyle=0x%lx, dwWidth=%lu, dwStyleCount=%lu, pdwStyles=%p, lbStyle=%lu, lbHatch=%p\n",
433     //   bExpectException, dwPenStyle, dwWidth, dwStyleCount, pdwStyles, lbStyle, (PVOID)lbHatch);
434 
435     ok2(bGotException == bExpectException, "ExtCreatePen expception, expected %u, got %u", bExpectException, bGotException);
436 
437     if (!bExpectSuccess)
438     {
439         ok(hpen == NULL, "ExtCreatePen should fail for "
440            "dwPenStyle=0x%lx, dwWidth=%lu, dwStyleCount=%lu, pdwStyles=%p, lbStyle=%u, lbHatch=%p\n",
441            dwPenStyle, dwWidth, dwStyleCount, pdwStyles, lbStyle, (PVOID)lbHatch);
442     }
443     else
444     {
445         ok(hpen != NULL, "ExtCreatePen failed for "
446            "dwPenStyle=0x%lx, dwWidth=%lu, dwStyleCount=%lu, pdwStyles=%p, lbStyle=%u, lbHatch=%p\n",
447            dwPenStyle, dwWidth, dwStyleCount, pdwStyles, lbStyle, (PVOID)lbHatch);
448         if (hpen != NULL)
449         {
450             if (GetObjectA(hpen, sizeof(elpBuffer), pelp) < sizeof(EXTLOGPEN))
451             {
452                 if (!GetObjectA(hpen, sizeof(EXTLOGPEN), pelp))
453                 {
454                     ok(0, "failed again?\n");
455                     return;
456                 }
457             }
458 
459             ok2(pelp->elpPenStyle == elpExpect.elpPenStyle, "elpPenStyle, expected 0x%lx, got 0x%lx\n", elpExpect.elpPenStyle, pelp->elpPenStyle);
460             ok2(pelp->elpWidth == elpExpect.elpWidth, "elpWidth, expected 0x%lx, got 0x%lx\n", elpExpect.elpWidth, pelp->elpWidth);
461             ok2(pelp->elpBrushStyle == elpExpect.elpBrushStyle, "elpBrushStyle, expected 0x%x, got 0x%x\n", elpExpect.elpBrushStyle, pelp->elpBrushStyle);
462             ok2(pelp->elpColor == elpExpect.elpColor, "elpColor, expected 0x%lx, got 0x%lx\n", elpExpect.elpColor, pelp->elpColor);
463             ok2(pelp->elpHatch == elpExpect.elpHatch, "elpHatch, expected 0x%lx, got 0x%lx\n", elpExpect.elpHatch, pelp->elpHatch);
464             ok2(pelp->elpNumEntries == elpExpect.elpNumEntries, "elpNumEntries, expected 0x%lx, got 0x%lx\n", elpExpect.elpNumEntries, pelp->elpNumEntries);
465             //for (i = 0; i < pelp->elpNumEntries; i++)
466             //{
467             //    ok2(pelp->elpStyleEntry[i] == elpExpect.elpStyleEntry[i], "elpHatch, expected 0x%lx, got 0x%lx\n", elpExpect.elpStyleEntry[i], pelp->elpStyleEntry[i]);
468             //}
469         }
470     }
471 
472 }
473 
474 void Test_ExtCreatePen_Params2()
475 {
476     ULONG aflPenType[] = {PS_COSMETIC, PS_GEOMETRIC, 0x20000};
477     ULONG iType, iStyle, iEndCap, iJoin, iWidth, iStyleCount, iStyles, iBrushStyle, iHatch;
478     DWORD adwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
479     DWORD adwStyles2[17] = {0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
480 
481     printf("adwStyles=%p, adwStyles2=%p\n", adwStyles, adwStyles2);
482 
483     //for (iType = 0; iType < sizeof(aflPenType) / sizeof(aflPenType[0]); iType++)
484     for (iType = 0; iType < 3; iType++)
485     {
486         ULONG aflPenStyle[] = {PS_SOLID, PS_DASH, PS_DOT, PS_DASHDOT, PS_DASHDOTDOT, PS_NULL, PS_INSIDEFRAME, PS_USERSTYLE, PS_ALTERNATE, 9};
487         //for (iStyle = 0; iStyle < sizeof(aflPenStyle) / sizeof(aflPenStyle[0]); iStyle++)
488         for (iStyle = 0; iStyle < 10; iStyle++)
489         {
490             ULONG aflEndCap[] = {PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE, PS_ENDCAP_FLAT, 0x300, 0x400};
491             for (iEndCap = 0; iEndCap < sizeof(aflEndCap) / sizeof(aflEndCap[0]); iEndCap++)
492             {
493                 ULONG aflJoin[] = {PS_JOIN_ROUND, PS_JOIN_BEVEL, PS_JOIN_MITER, 0x3000, 0x4000};
494                 for (iJoin = 0; iJoin < sizeof(aflJoin) / sizeof(aflJoin[0]); iJoin++)
495                 {
496                     DWORD adwWidth[] = {0, 1, 2};
497                     ULONG flPenStyle = aflPenType[iType] | aflPenStyle[iStyle] | aflEndCap[iEndCap] | aflJoin[iJoin];
498 
499                     for (iWidth = 0; iWidth < sizeof(adwWidth) / sizeof(adwWidth[0]); iWidth++)
500                     {
501                         ULONG adwStyleCount[] = {0, 1, 2, 16, 17};
502                         for (iStyleCount = 0; iStyleCount < sizeof(adwStyleCount) / sizeof(adwStyleCount[0]); iStyleCount++)
503                         {
504                             PULONG apdwStyles[] = {NULL, adwStyles, adwStyles2};
505                             for (iStyles = 0; iStyles < sizeof(apdwStyles) / sizeof(apdwStyles[0]); iStyles++)
506                             {
507                                 UINT albStyle[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
508                                 for (iBrushStyle = 0; iBrushStyle < sizeof(albStyle) / sizeof(albStyle[0]); iBrushStyle++)
509                                 {
510                                     ULONG_PTR alHatch[] = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13};
511 
512                                     for (iHatch = 0; iHatch < sizeof(alHatch) / sizeof(alHatch[0]); iHatch++)
513                                     {
514                                         Test_ExtCreatePen_Helper(flPenStyle,
515                                                                  adwWidth[iWidth],
516                                                                  adwStyleCount[iStyleCount],
517                                                                  apdwStyles[iStyles],
518                                                                  albStyle[iBrushStyle],
519                                                                  alHatch[iHatch]);
520                                     }
521                                 }
522                             }
523                         }
524                     }
525                 }
526             }
527         }
528     }
529 
530 }
531 
532 START_TEST(ExtCreatePen)
533 {
534     Test_ExtCreatePen_Params();
535     //Test_ExtCreatePen_Params2();
536 }
537 
538