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