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