12#define ok_lasterror(err) \
13 ok(GetLastError() == err, "expected last error " #err " but got 0x%lx\n", GetLastError());
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);
35 DWORD adwStyles[17] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
54 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
64 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
70 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
76 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
82 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
88 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
94 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
100 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
104 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
110 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
118 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
122 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
126 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
132 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
140 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
146 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
152 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
160 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
184 ok(hPen ==
NULL,
"ExtCreatePen should fail\n");
190 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
198 ok(hPen !=
NULL,
"ExtCreatePen failed\n");
213 PBOOL pbExpectException,
216 *pbExpectException =
FALSE;
220 if (pdwStyles ==
NULL)
227 if ((dwStyleCount != 0) || (pdwStyles !=
NULL))
235 if (lbHatch == 0)
return FALSE;
240 if (lbHatch == 0)
return FALSE;
241 if (lbHatch < 0xFFFF)
243 *pbExpectException =
TRUE;
255 if (dwStyleCount == 0)
260 if (dwStyleCount > 16)
267 if (pdwStyles[0] == 0)
274 if ((pdwStyles[0] == 0) && (dwStyleCount == 1))
312 if ((lbHatch != 8) &&
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);
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);
448 "dwPenStyle=0x%lx, dwWidth=%lu, dwStyleCount=%lu, pdwStyles=%p, lbStyle=%u, lbHatch=%p\n",
449 dwPenStyle,
dwWidth, dwStyleCount, pdwStyles, lbStyle, (
PVOID)lbHatch);
456 ok(0,
"failed again?\n");
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};
483 printf(
"adwStyles=%p, adwStyles2=%p\n", adwStyles, adwStyles2);
490 for (iStyle = 0; iStyle < 10; iStyle++)
493 for (iEndCap = 0; iEndCap <
sizeof(aflEndCap) /
sizeof(aflEndCap[0]); iEndCap++)
496 for (iJoin = 0; iJoin <
sizeof(aflJoin) /
sizeof(aflJoin[0]); iJoin++)
498 DWORD adwWidth[] = {0, 1, 2};
499 ULONG flPenStyle = aflPenType[
iType] | aflPenStyle[iStyle] | aflEndCap[iEndCap] | aflJoin[iJoin];
501 for (iWidth = 0; iWidth <
sizeof(adwWidth) /
sizeof(adwWidth[0]); iWidth++)
503 ULONG adwStyleCount[] = {0, 1, 2, 16, 17};
504 for (iStyleCount = 0; iStyleCount <
sizeof(adwStyleCount) /
sizeof(adwStyleCount[0]); iStyleCount++)
506 PULONG apdwStyles[] = {
NULL, adwStyles, adwStyles2};
507 for (iStyles = 0; iStyles <
sizeof(apdwStyles) /
sizeof(apdwStyles[0]); iStyles++)
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++)
512 ULONG_PTR alHatch[] = {0, 1, 6, 7, 8, 9, 10, 11, 12, 13};
518 adwStyleCount[iStyleCount],
520 albStyle[iBrushStyle],
#define ok2(expression, text, expected, got)
#define ok_lasterror(err)
void Test_ExtCreatePen_Helper(DWORD dwPenStyle, DWORD dwWidth, DWORD dwStyleCount, PDWORD pdwStyles, UINT lbStyle, ULONG_PTR lbHatch)
BOOL Test_ExtCreatePen_Expect(DWORD dwPenStyle, DWORD dwWidth, DWORD dwStyleCount, PDWORD pdwStyles, UINT lbStyle, ULONG_PTR lbHatch, PBOOL pbExpectException, PEXTLOGPEN pelpExpect)
void Test_ExtCreatePen_Params()
#define ok_elp(hPen, elp, pstyle, width, bstyle, color, hatch, cstyle)
void Test_ExtCreatePen_Params2()
static const WCHAR dwWidth[]
#define ERROR_INVALID_PARAMETER
#define GDI_HANDLE_GET_TYPE(h)
#define GDI_OBJECT_TYPE_EXTPEN
#define EXCEPTION_EXECUTE_HANDLER
#define _SEH2_EXCEPT(...)
_Inout_ SURFOBJ _In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_opt_ XLATEOBJ _In_ ULONG iHatch
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)