2 * Unit test suite for GDI objects
4 * Copyright 2002 Mike McCormack
5 * Copyright 2004 Dmitry Timoshkov
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/test.h"
33 static void check_font(const char* test
, const LOGFONTA
* lf
, HFONT hfont
)
41 ret
= GetObject(hfont
, sizeof(getobj_lf
), &getobj_lf
);
42 /* NT4 tries to be clever and only returns the minimum length */
43 while (lf
->lfFaceName
[minlen
] && minlen
< LF_FACESIZE
-1)
45 minlen
+= FIELD_OFFSET(LOGFONTA
, lfFaceName
) + 1;
46 ok(ret
== sizeof(LOGFONTA
) || ret
== minlen
,
47 "%s: GetObject returned %d expected %d or %d\n", test
, ret
, sizeof(LOGFONTA
), minlen
);
48 ok(!memcmp(&lf
, &lf
, FIELD_OFFSET(LOGFONTA
, lfFaceName
)), "%s: fonts don't match\n", test
);
49 ok(!lstrcmpA(lf
->lfFaceName
, getobj_lf
.lfFaceName
),
50 "%s: font names don't match: %s != %s\n", test
, lf
->lfFaceName
, getobj_lf
.lfFaceName
);
53 static HFONT
create_font(const char* test
, const LOGFONTA
* lf
)
55 HFONT hfont
= CreateFontIndirectA(lf
);
56 ok(hfont
!= 0, "%s: CreateFontIndirect failed\n", test
);
58 check_font(test
, lf
, hfont
);
62 static void test_logfont(void)
67 memset(&lf
, 0, sizeof lf
);
69 lf
.lfCharSet
= ANSI_CHARSET
;
70 lf
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
71 lf
.lfWeight
= FW_DONTCARE
;
74 lf
.lfQuality
= DEFAULT_QUALITY
;
76 lstrcpyA(lf
.lfFaceName
, "Arial");
77 hfont
= create_font("Arial", &lf
);
80 memset(&lf
, 'A', sizeof(lf
));
81 hfont
= CreateFontIndirectA(&lf
);
82 ok(hfont
!= 0, "CreateFontIndirectA with strange LOGFONT failed\n");
84 lf
.lfFaceName
[LF_FACESIZE
- 1] = 0;
85 check_font("AAA...", &lf
, hfont
);
89 static INT CALLBACK
font_enum_proc(const LOGFONT
*elf
, const TEXTMETRIC
*ntm
, DWORD type
, LPARAM lParam
)
91 if (type
& RASTER_FONTTYPE
)
93 LOGFONT
*lf
= (LOGFONT
*)lParam
;
95 return 0; /* stop enumeration */
98 return 1; /* continue enumeration */
101 static void test_font_metrics(HDC hdc
, HFONT hfont
, const char *test_str
,
102 INT test_str_len
, const TEXTMETRICA
*tm_orig
,
103 const SIZE
*size_orig
, INT width_orig
,
104 INT scale_x
, INT scale_y
)
114 old_hfont
= SelectObject(hdc
, hfont
);
116 GetTextMetricsA(hdc
, &tm
);
118 ok(tm
.tmHeight
== tm_orig
->tmHeight
* scale_y
, "%ld != %ld\n", tm
.tmHeight
, tm_orig
->tmHeight
* scale_y
);
119 ok(tm
.tmAscent
== tm_orig
->tmAscent
* scale_y
, "%ld != %ld\n", tm
.tmAscent
, tm_orig
->tmAscent
* scale_y
);
120 ok(tm
.tmDescent
== tm_orig
->tmDescent
* scale_y
, "%ld != %ld\n", tm
.tmDescent
, tm_orig
->tmDescent
* scale_y
);
121 ok(tm
.tmAveCharWidth
== tm_orig
->tmAveCharWidth
* scale_x
, "%ld != %ld\n", tm
.tmAveCharWidth
, tm_orig
->tmAveCharWidth
* scale_x
);
123 GetTextExtentPoint32A(hdc
, test_str
, test_str_len
, &size
);
125 ok(size
.cx
== size_orig
->cx
* scale_x
, "%ld != %ld\n", size
.cx
, size_orig
->cx
* scale_x
);
126 ok(size
.cy
== size_orig
->cy
* scale_y
, "%ld != %ld\n", size
.cy
, size_orig
->cy
* scale_y
);
128 GetCharWidthA(hdc
, 'A', 'A', &width
);
130 ok(width
== width_orig
* scale_x
, "%d != %d\n", width
, width_orig
* scale_x
);
132 SelectObject(hdc
, old_hfont
);
135 /* see whether GDI scales bitmap font metrics */
136 static void test_bitmap_font(void)
138 static const char test_str
[11] = "Test String";
141 HFONT hfont
, old_hfont
;
144 INT ret
, i
, width_orig
, height_orig
;
148 /* "System" has only 1 pixel size defined, otherwise the test breaks */
149 ret
= EnumFontFamiliesA(hdc
, "System", font_enum_proc
, (LPARAM
)&bitmap_lf
);
153 trace("no bitmap fonts were found, skipping the test\n");
157 trace("found bitmap font %s, height %ld\n", bitmap_lf
.lfFaceName
, bitmap_lf
.lfHeight
);
159 height_orig
= bitmap_lf
.lfHeight
;
160 hfont
= create_font("bitmap", &bitmap_lf
);
162 old_hfont
= SelectObject(hdc
, hfont
);
163 ok(GetTextMetricsA(hdc
, &tm_orig
), "GetTextMetricsA failed\n");
164 ok(GetTextExtentPoint32A(hdc
, test_str
, sizeof(test_str
), &size_orig
), "GetTextExtentPoint32A failed\n");
165 ok(GetCharWidthA(hdc
, 'A', 'A', &width_orig
), "GetCharWidthA failed\n");
166 SelectObject(hdc
, old_hfont
);
169 /* test fractional scaling */
170 for (i
= 1; i
< height_orig
; i
++)
172 hfont
= create_font("fractional", &bitmap_lf
);
173 test_font_metrics(hdc
, hfont
, test_str
, sizeof(test_str
), &tm_orig
, &size_orig
, width_orig
, 1, 1);
177 /* test integer scaling 3x2 */
178 bitmap_lf
.lfHeight
= height_orig
* 2;
179 bitmap_lf
.lfWidth
*= 3;
180 hfont
= create_font("3x2", &bitmap_lf
);
183 test_font_metrics(hdc
, hfont
, test_str
, sizeof(test_str
), &tm_orig
, &size_orig
, width_orig
, 3, 2);
187 /* test integer scaling 3x3 */
188 bitmap_lf
.lfHeight
= height_orig
* 3;
189 bitmap_lf
.lfWidth
= 0;
190 hfont
= create_font("3x3", &bitmap_lf
);
194 test_font_metrics(hdc
, hfont
, test_str
, sizeof(test_str
), &tm_orig
, &size_orig
, width_orig
, 3, 3);
201 static INT CALLBACK
find_font_proc(const LOGFONT
*elf
, const TEXTMETRIC
*ntm
, DWORD type
, LPARAM lParam
)
203 LOGFONT
*lf
= (LOGFONT
*)lParam
;
205 trace("found font %s, height %ld\n", elf
->lfFaceName
, elf
->lfHeight
);
207 if (elf
->lfHeight
== lf
->lfHeight
&& !strcmp(elf
->lfFaceName
, lf
->lfFaceName
))
210 return 0; /* stop enumeration */
212 return 1; /* continue enumeration */
215 static void test_bitmap_font_metrics(void)
217 static const struct font_data
219 const char face_name
[LF_FACESIZE
];
220 int weight
, height
, ascent
, descent
, int_leading
, ext_leading
;
221 int ave_char_width
, max_char_width
;
224 { "MS Sans Serif", FW_NORMAL
, 13, 11, 2, 2, 0, 5, 11 },
225 { "MS Sans Serif", FW_NORMAL
, 16, 13, 3, 3, 0, 7, 14 },
226 { "MS Sans Serif", FW_NORMAL
, 20, 16, 4, 4, 0, 8, 16 },
227 { "MS Sans Serif", FW_NORMAL
, 24, 19, 5, 6, 0, 9, 20 },
228 { "MS Sans Serif", FW_NORMAL
, 29, 23, 6, 5, 0, 12, 25 },
229 { "MS Sans Serif", FW_NORMAL
, 37, 29, 8, 5, 0, 16, 32 },
230 { "MS Serif", FW_NORMAL
, 10, 8, 2, 2, 0, 5, 8 },
231 { "MS Serif", FW_NORMAL
, 11, 9, 2, 2, 0, 5, 9 },
232 { "MS Serif", FW_NORMAL
, 13, 11, 2, 2, 0, 5, 12 },
233 { "MS Serif", FW_NORMAL
, 16, 13, 3, 3, 0, 6, 16 },
234 { "MS Serif", FW_NORMAL
, 19, 15, 4, 3, 0, 8, 19 },
235 { "MS Serif", FW_NORMAL
, 21, 16, 5, 3, 0, 9, 23 },
236 { "MS Serif", FW_NORMAL
, 27, 21, 6, 3, 0, 12, 27 },
237 { "MS Serif", FW_NORMAL
, 35, 27, 8, 3, 0, 16, 34 },
238 #if 0 /* FIXME: enable once the bug in sfnt2fnt is fixed */
239 { "Courier", FW_NORMAL
, 13, 11, 2, 0, 0, 8, 8 },
241 { "Courier", FW_NORMAL
, 16, 13, 3, 0, 0, 9, 9 },
242 { "Courier", FW_NORMAL
, 20, 16, 4, 0, 0, 12, 12 },
243 { "System", FW_BOLD
, 16, 13, 3, 3, 0, 7, 15 }
244 /* FIXME: add "Fixedsys", "Terminal", "Small Fonts" */
248 HFONT hfont
, old_hfont
;
252 hdc
= CreateCompatibleDC(0);
255 for (i
= 0; i
< sizeof(fd
)/sizeof(fd
[0]); i
++)
257 memset(&lf
, 0, sizeof(lf
));
259 lf
.lfHeight
= fd
[i
].height
;
260 strcpy(lf
.lfFaceName
, fd
[i
].face_name
);
261 ret
= EnumFontFamilies(hdc
, fd
[i
].face_name
, find_font_proc
, (LPARAM
)&lf
);
264 trace("font %s height %d not found\n", fd
[i
].face_name
, fd
[i
].height
);
268 trace("found font %s, height %ld\n", lf
.lfFaceName
, lf
.lfHeight
);
270 hfont
= create_font(lf
.lfFaceName
, &lf
);
271 old_hfont
= SelectObject(hdc
, hfont
);
272 ok(GetTextMetrics(hdc
, &tm
), "GetTextMetrics error %ld\n", GetLastError());
274 ok(tm
.tmWeight
== fd
[i
].weight
, "%s(%d): tm.tmWeight %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmWeight
, fd
[i
].weight
);
275 ok(tm
.tmHeight
== fd
[i
].height
, "%s(%d): tm.tmHeight %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmHeight
, fd
[i
].height
);
276 ok(tm
.tmAscent
== fd
[i
].ascent
, "%s(%d): tm.tmAscent %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmAscent
, fd
[i
].ascent
);
277 ok(tm
.tmDescent
== fd
[i
].descent
, "%s(%d): tm.tmDescent %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmDescent
, fd
[i
].descent
);
278 ok(tm
.tmInternalLeading
== fd
[i
].int_leading
, "%s(%d): tm.tmInternalLeading %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmInternalLeading
, fd
[i
].int_leading
);
279 ok(tm
.tmExternalLeading
== fd
[i
].ext_leading
, "%s(%d): tm.tmExternalLeading %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmExternalLeading
, fd
[i
].ext_leading
);
280 ok(tm
.tmAveCharWidth
== fd
[i
].ave_char_width
, "%s(%d): tm.tmAveCharWidth %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmAveCharWidth
, fd
[i
].ave_char_width
);
281 ok(tm
.tmMaxCharWidth
== fd
[i
].max_char_width
, "%s(%d): tm.tmMaxCharWidth %ld != %d\n", fd
[i
].face_name
, fd
[i
].height
, tm
.tmMaxCharWidth
, fd
[i
].max_char_width
);
283 SelectObject(hdc
, old_hfont
);
290 static void test_gdi_objects(void)
293 HDC hdc
= GetDC(NULL
);
298 /* SelectObject() with a NULL DC returns 0 and sets ERROR_INVALID_HANDLE.
299 * Note: Under XP at least invalid ptrs can also be passed, not just NULL;
300 * Don't test that here in case it crashes earlier win versions.
303 hp
= SelectObject(NULL
, GetStockObject(BLACK_PEN
));
304 ok(!hp
&& GetLastError() == ERROR_INVALID_HANDLE
,
305 "SelectObject(NULL DC) expected 0, ERROR_INVALID_HANDLE, got %p, 0x%08lx\n",
308 /* With a valid DC and a NULL object, the call returns 0 but does not SetLastError() */
310 hp
= SelectObject(hdc
, NULL
);
311 ok(!hp
&& !GetLastError(),
312 "SelectObject(NULL obj) expected 0, NO_ERROR, got %p, 0x%08lx\n",
315 /* The DC is unaffected by the NULL SelectObject */
317 hp
= SelectObject(hdc
, GetStockObject(BLACK_PEN
));
318 ok(hp
&& !GetLastError(),
319 "SelectObject(post NULL) expected non-null, NO_ERROR, got %p, 0x%08lx\n",
322 /* GetCurrentObject does not SetLastError() on a null object */
324 hp
= GetCurrentObject(NULL
, OBJ_PEN
);
325 ok(!hp
&& !GetLastError(),
326 "GetCurrentObject(NULL DC) expected 0, NO_ERROR, got %p, 0x%08lx\n",
329 /* DeleteObject does not SetLastError() on a null object */
330 ret
= DeleteObject(NULL
);
331 ok( !ret
&& !GetLastError(),
332 "DeleteObject(NULL obj), expected 0, NO_ERROR, got %d, 0x%08lx\n",
333 ret
, GetLastError());
335 /* GetObject does not SetLastError() on a null object */
337 i
= GetObjectA(NULL
, sizeof(buff
), buff
);
338 ok (!i
&& !GetLastError(),
339 "GetObject(NULL obj), expected 0, NO_ERROR, got %d, 0x%08lx\n",
342 /* GetObjectType does SetLastError() on a null object */
344 i
= GetObjectType(NULL
);
345 ok (!i
&& GetLastError() == ERROR_INVALID_HANDLE
,
346 "GetObjectType(NULL obj), expected 0, ERROR_INVALID_HANDLE, got %d, 0x%08lx\n",
349 /* UnrealizeObject does not SetLastError() on a null object */
351 i
= UnrealizeObject(NULL
);
352 ok (!i
&& !GetLastError(),
353 "UnrealizeObject(NULL obj), expected 0, NO_ERROR, got %d, 0x%08lx\n",
356 ReleaseDC(NULL
, hdc
);
359 static void test_GdiGetCharDimensions(void)
365 LONG avgwidth
, height
;
366 static const char szAlphabet
[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
367 typedef LONG (WINAPI
*fnGdiGetCharDimensions
)(HDC hdc
, LPTEXTMETRICW lptm
, LONG
*height
);
368 fnGdiGetCharDimensions GdiGetCharDimensions
= (fnGdiGetCharDimensions
)GetProcAddress(LoadLibrary("gdi32"), "GdiGetCharDimensions");
369 if (!GdiGetCharDimensions
) return;
371 hdc
= CreateCompatibleDC(NULL
);
373 GetTextExtentPoint(hdc
, szAlphabet
, strlen(szAlphabet
), &size
);
374 avgwidth
= ((size
.cx
/ 26) + 1) / 2;
376 ret
= GdiGetCharDimensions(hdc
, &tm
, &height
);
377 ok(ret
== avgwidth
, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth
, ret
);
378 ok(height
== tm
.tmHeight
, "GdiGetCharDimensions should have set height to %ld instead of %ld\n", tm
.tmHeight
, height
);
380 ret
= GdiGetCharDimensions(hdc
, &tm
, NULL
);
381 ok(ret
== avgwidth
, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth
, ret
);
383 ret
= GdiGetCharDimensions(hdc
, NULL
, NULL
);
384 ok(ret
== avgwidth
, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth
, ret
);
387 ret
= GdiGetCharDimensions(hdc
, NULL
, &height
);
388 ok(ret
== avgwidth
, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth
, ret
);
389 ok(height
== size
.cy
, "GdiGetCharDimensions should have set height to %ld instead of %ld\n", size
.cy
, height
);
394 static void test_text_extents(void)
402 memset(&lf
, 0, sizeof(lf
));
403 strcpy(lf
.lfFaceName
, "Arial");
406 hfont
= CreateFontIndirectA(&lf
);
408 hfont
= SelectObject(hdc
, hfont
);
409 GetTextMetricsA(hdc
, &tm
);
410 GetTextExtentPointA(hdc
, "o", 1, &sz
);
411 ok(sz
.cy
== tm
.tmHeight
, "cy %ld tmHeight %ld\n", sz
.cy
, tm
.tmHeight
);
413 SelectObject(hdc
, hfont
);
415 ReleaseDC(NULL
, hdc
);
427 static DWORD WINAPI
thread_proc(void *param
)
430 struct hgdiobj_event
*hgdiobj_event
= (struct hgdiobj_event
*)param
;
432 hgdiobj_event
->hdc
= CreateDC("display", NULL
, NULL
, NULL
);
433 ok(hgdiobj_event
->hdc
!= NULL
, "CreateDC error %ld\n", GetLastError());
435 hgdiobj_event
->hgdiobj1
= CreatePen(PS_DASHDOTDOT
, 17, RGB(1, 2, 3));
436 ok(hgdiobj_event
->hgdiobj1
!= 0, "Failed to create pen\n");
438 hgdiobj_event
->hgdiobj2
= CreateRectRgn(0, 1, 12, 17);
439 ok(hgdiobj_event
->hgdiobj2
!= 0, "Failed to create pen\n");
441 SetEvent(hgdiobj_event
->ready_event
);
442 ok(WaitForSingleObject(hgdiobj_event
->stop_event
, INFINITE
) == WAIT_OBJECT_0
,
443 "WaitForSingleObject error %ld\n", GetLastError());
445 ok(!GetObject(hgdiobj_event
->hgdiobj1
, sizeof(lp
), &lp
), "GetObject should fail\n");
447 ok(!GetDeviceCaps(hgdiobj_event
->hdc
, TECHNOLOGY
), "GetDeviceCaps(TECHNOLOGY) should fail\n");
452 static void test_thread_objects(void)
457 struct hgdiobj_event hgdiobj_event
;
460 hgdiobj_event
.stop_event
= CreateEvent(NULL
, 0, 0, NULL
);
461 ok(hgdiobj_event
.stop_event
!= NULL
, "CreateEvent error %ld\n", GetLastError());
462 hgdiobj_event
.ready_event
= CreateEvent(NULL
, 0, 0, NULL
);
463 ok(hgdiobj_event
.ready_event
!= NULL
, "CreateEvent error %ld\n", GetLastError());
465 hthread
= CreateThread(NULL
, 0, thread_proc
, &hgdiobj_event
, 0, &tid
);
466 ok(hthread
!= NULL
, "CreateThread error %ld\n", GetLastError());
468 ok(WaitForSingleObject(hgdiobj_event
.ready_event
, INFINITE
) == WAIT_OBJECT_0
,
469 "WaitForSingleObject error %ld\n", GetLastError());
471 ok(GetObject(hgdiobj_event
.hgdiobj1
, sizeof(lp
), &lp
) == sizeof(lp
),
472 "GetObject error %ld\n", GetLastError());
473 ok(lp
.lopnStyle
== PS_DASHDOTDOT
, "wrong pen style %d\n", lp
.lopnStyle
);
474 ok(lp
.lopnWidth
.x
== 17, "wrong pen width.y %ld\n", lp
.lopnWidth
.x
);
475 ok(lp
.lopnWidth
.y
== 0, "wrong pen width.y %ld\n", lp
.lopnWidth
.y
);
476 ok(lp
.lopnColor
== RGB(1, 2, 3), "wrong pen width.y %08lx\n", lp
.lopnColor
);
478 ret
= GetDeviceCaps(hgdiobj_event
.hdc
, TECHNOLOGY
);
479 ok(ret
== DT_RASDISPLAY
, "GetDeviceCaps(TECHNOLOGY) should return DT_RASDISPLAY not %d\n", ret
);
481 ok(DeleteObject(hgdiobj_event
.hgdiobj1
), "DeleteObject error %ld\n", GetLastError());
482 ok(DeleteDC(hgdiobj_event
.hdc
), "DeleteDC error %ld\n", GetLastError());
484 type
= GetObjectType(hgdiobj_event
.hgdiobj2
);
485 ok(type
== OBJ_REGION
, "GetObjectType returned %lu\n", type
);
487 SetEvent(hgdiobj_event
.stop_event
);
488 ok(WaitForSingleObject(hthread
, INFINITE
) == WAIT_OBJECT_0
,
489 "WaitForSingleObject error %ld\n", GetLastError());
490 CloseHandle(hthread
);
492 type
= GetObjectType(hgdiobj_event
.hgdiobj2
);
493 ok(type
== OBJ_REGION
, "GetObjectType returned %lu\n", type
);
494 ok(DeleteObject(hgdiobj_event
.hgdiobj2
), "DeleteObject error %ld\n", GetLastError());
496 CloseHandle(hgdiobj_event
.stop_event
);
497 CloseHandle(hgdiobj_event
.ready_event
);
500 static void test_GetCurrentObject(void)
515 hdc
= CreateCompatibleDC(0);
518 type
= GetObjectType(hdc
);
519 ok(type
== OBJ_MEMDC
, "GetObjectType returned %lu\n", type
);
521 hpen
= CreatePen(PS_SOLID
, 10, RGB(10, 20, 30));
523 SelectObject(hdc
, hpen
);
524 hobj
= GetCurrentObject(hdc
, OBJ_PEN
);
525 ok(hobj
== hpen
, "OBJ_PEN is wrong: %p\n", hobj
);
526 hobj
= GetCurrentObject(hdc
, OBJ_EXTPEN
);
527 ok(hobj
== hpen
, "OBJ_EXTPEN is wrong: %p\n", hobj
);
529 hbrush
= CreateSolidBrush(RGB(10, 20, 30));
531 SelectObject(hdc
, hbrush
);
532 hobj
= GetCurrentObject(hdc
, OBJ_BRUSH
);
533 ok(hobj
== hbrush
, "OBJ_BRUSH is wrong: %p\n", hobj
);
535 hpal
= CreateHalftonePalette(hdc
);
537 SelectPalette(hdc
, hpal
, FALSE
);
538 hobj
= GetCurrentObject(hdc
, OBJ_PAL
);
539 ok(hobj
== hpal
, "OBJ_PAL is wrong: %p\n", hobj
);
541 hfont
= CreateFontA(10, 5, 0, 0, FW_DONTCARE
, 0, 0, 0, ANSI_CHARSET
,
542 OUT_DEFAULT_PRECIS
, CLIP_DEFAULT_PRECIS
, DEFAULT_QUALITY
,
543 DEFAULT_PITCH
, "MS Sans Serif");
545 SelectObject(hdc
, hfont
);
546 hobj
= GetCurrentObject(hdc
, OBJ_FONT
);
547 ok(hobj
== hfont
, "OBJ_FONT is wrong: %p\n", hobj
);
549 hbmp
= CreateBitmap(100, 100, 1, 1, NULL
);
551 SelectObject(hdc
, hbmp
);
552 hobj
= GetCurrentObject(hdc
, OBJ_BITMAP
);
553 ok(hobj
== hbmp
, "OBJ_BITMAP is wrong: %p\n", hobj
);
555 assert(GetObject(hbrush
, sizeof(lb
), &lb
) == sizeof(lb
));
556 hpen
= ExtCreatePen(PS_GEOMETRIC
| PS_SOLID
| PS_ENDCAP_SQUARE
| PS_JOIN_BEVEL
,
559 SelectObject(hdc
, hpen
);
560 hobj
= GetCurrentObject(hdc
, OBJ_PEN
);
561 ok(hobj
== hpen
, "OBJ_PEN is wrong: %p\n", hobj
);
562 hobj
= GetCurrentObject(hdc
, OBJ_EXTPEN
);
563 ok(hobj
== hpen
, "OBJ_EXTPEN is wrong: %p\n", hobj
);
565 hcs
= GetColorSpace(hdc
);
568 trace("current color space is not NULL\n");
569 ok(GetLogColorSpaceA(hcs
, &lcs
, sizeof(lcs
)), "GetLogColorSpace failed\n");
570 hcs
= CreateColorSpaceA(&lcs
);
571 ok(hcs
!= 0, "CreateColorSpace failed\n");
572 SelectObject(hdc
, hcs
);
573 hobj
= GetCurrentObject(hdc
, OBJ_COLORSPACE
);
574 ok(hobj
== hcs
, "OBJ_COLORSPACE is wrong: %p\n", hobj
);
577 hrgn
= CreateRectRgn(1, 1, 100, 100);
579 SelectObject(hdc
, hrgn
);
580 hobj
= GetCurrentObject(hdc
, OBJ_REGION
);
581 ok(!hobj
, "OBJ_REGION is wrong: %p\n", hobj
);
586 static void test_logpen(void)
597 { PS_SOLID
, -123, RGB(0x12,0x34,0x56), PS_SOLID
, 123, RGB(0x12,0x34,0x56) },
598 { PS_SOLID
, 0, RGB(0x12,0x34,0x56), PS_SOLID
, 0, RGB(0x12,0x34,0x56) },
599 { PS_SOLID
, 123, RGB(0x12,0x34,0x56), PS_SOLID
, 123, RGB(0x12,0x34,0x56) },
600 { PS_DASH
, 123, RGB(0x12,0x34,0x56), PS_DASH
, 123, RGB(0x12,0x34,0x56) },
601 { PS_DOT
, 123, RGB(0x12,0x34,0x56), PS_DOT
, 123, RGB(0x12,0x34,0x56) },
602 { PS_DASHDOT
, 123, RGB(0x12,0x34,0x56), PS_DASHDOT
, 123, RGB(0x12,0x34,0x56) },
603 { PS_DASHDOTDOT
, 123, RGB(0x12,0x34,0x56), PS_DASHDOTDOT
, 123, RGB(0x12,0x34,0x56) },
604 { PS_NULL
, -123, RGB(0x12,0x34,0x56), PS_NULL
, 1, 0 },
605 { PS_NULL
, 123, RGB(0x12,0x34,0x56), PS_NULL
, 1, 0 },
606 { PS_INSIDEFRAME
, 123, RGB(0x12,0x34,0x56), PS_INSIDEFRAME
, 123, RGB(0x12,0x34,0x56) },
607 { PS_USERSTYLE
, 123, RGB(0x12,0x34,0x56), PS_SOLID
, 123, RGB(0x12,0x34,0x56) },
608 { PS_ALTERNATE
, 123, RGB(0x12,0x34,0x56), PS_SOLID
, 123, RGB(0x12,0x34,0x56) }
615 DWORD obj_type
, user_style
[2] = { 0xabc, 0xdef };
619 DWORD style_data
[10];
622 for (i
= 0; i
< sizeof(pen
)/sizeof(pen
[0]); i
++)
624 trace("testing style %u\n", pen
[i
].style
);
626 /********************** cosmetic pens **********************/
627 /* CreatePenIndirect behaviour */
628 lp
.lopnStyle
= pen
[i
].style
,
629 lp
.lopnWidth
.x
= pen
[i
].width
;
630 lp
.lopnWidth
.y
= 11; /* just in case */
631 lp
.lopnColor
= pen
[i
].color
;
632 SetLastError(0xdeadbeef);
633 hpen
= CreatePenIndirect(&lp
);
634 ok(hpen
!= 0, "CreatePen error %ld\n", GetLastError());
636 obj_type
= GetObjectType(hpen
);
637 ok(obj_type
== OBJ_PEN
, "wrong object type %lu\n", obj_type
);
639 memset(&lp
, 0xb0, sizeof(lp
));
640 SetLastError(0xdeadbeef);
641 size
= GetObject(hpen
, sizeof(lp
), &lp
);
642 ok(size
== sizeof(lp
), "GetObject returned %d, error %ld\n", size
, GetLastError());
644 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
645 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
646 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
647 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
651 /* CreatePen behaviour */
652 SetLastError(0xdeadbeef);
653 hpen
= CreatePen(pen
[i
].style
, pen
[i
].width
, pen
[i
].color
);
654 ok(hpen
!= 0, "CreatePen error %ld\n", GetLastError());
656 obj_type
= GetObjectType(hpen
);
657 ok(obj_type
== OBJ_PEN
, "wrong object type %lu\n", obj_type
);
659 /* check what's the real size of the object */
660 size
= GetObject(hpen
, 0, NULL
);
661 ok(size
== sizeof(lp
), "GetObject returned %d, error %ld\n", size
, GetLastError());
663 /* ask for truncated data */
664 memset(&lp
, 0xb0, sizeof(lp
));
665 SetLastError(0xdeadbeef);
666 size
= GetObject(hpen
, sizeof(lp
.lopnStyle
), &lp
);
667 ok(!size
, "GetObject should fail: size %d, error %ld\n", size
, GetLastError());
669 /* see how larger buffer sizes are handled */
670 memset(&lp
, 0xb0, sizeof(lp
));
671 SetLastError(0xdeadbeef);
672 size
= GetObject(hpen
, sizeof(lp
) * 2, &lp
);
673 ok(size
== sizeof(lp
), "GetObject returned %d, error %ld\n", size
, GetLastError());
675 /* see how larger buffer sizes are handled */
676 memset(&elp
, 0xb0, sizeof(elp
));
677 SetLastError(0xdeadbeef);
678 size
= GetObject(hpen
, sizeof(elp
) * 2, &elp
);
679 ok(size
== sizeof(lp
), "GetObject returned %d, error %ld\n", size
, GetLastError());
681 memset(&lp
, 0xb0, sizeof(lp
));
682 SetLastError(0xdeadbeef);
683 size
= GetObject(hpen
, sizeof(lp
), &lp
);
684 ok(size
== sizeof(lp
), "GetObject returned %d, error %ld\n", size
, GetLastError());
686 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
687 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
688 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
689 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
691 memset(&elp
, 0xb0, sizeof(elp
));
692 SetLastError(0xdeadbeef);
693 size
= GetObject(hpen
, sizeof(elp
), &elp
);
695 /* for some reason XP differentiates PS_NULL here */
696 if (pen
[i
].style
== PS_NULL
)
698 ok(size
== sizeof(EXTLOGPEN
), "GetObject returned %d, error %ld\n", size
, GetLastError());
699 ok(elp
.elpPenStyle
== pen
[i
].ret_style
, "expected %u, got %lu\n", pen
[i
].ret_style
, elp
.elpPenStyle
);
700 ok(elp
.elpWidth
== 0, "expected 0, got %lu\n", elp
.elpWidth
);
701 ok(elp
.elpColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, elp
.elpColor
);
702 ok(elp
.elpBrushStyle
== BS_SOLID
, "expected BS_SOLID, got %u\n", elp
.elpBrushStyle
);
703 ok(elp
.elpHatch
== 0, "expected 0, got %p\n", (void *)elp
.elpHatch
);
704 ok(elp
.elpNumEntries
== 0, "expected 0, got %lx\n", elp
.elpNumEntries
);
708 ok(size
== sizeof(LOGPEN
), "GetObject returned %d, error %ld\n", size
, GetLastError());
709 memcpy(&lp
, &elp
, sizeof(lp
));
710 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
711 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
712 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
713 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
718 /********** cosmetic pens created by ExtCreatePen ***********/
719 lb
.lbStyle
= BS_SOLID
;
720 lb
.lbColor
= pen
[i
].color
;
721 lb
.lbHatch
= HS_CROSS
; /* just in case */
722 SetLastError(0xdeadbeef);
723 hpen
= ExtCreatePen(pen
[i
].style
, pen
[i
].width
, &lb
, 2, user_style
);
724 if (pen
[i
].style
!= PS_USERSTYLE
)
726 ok(hpen
== 0, "ExtCreatePen should fail\n");
727 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
728 "wrong last error value %ld\n", GetLastError());
729 SetLastError(0xdeadbeef);
730 hpen
= ExtCreatePen(pen
[i
].style
, pen
[i
].width
, &lb
, 0, NULL
);
731 if (pen
[i
].style
!= PS_NULL
)
733 ok(hpen
== 0, "ExtCreatePen with width != 1 should fail\n");
734 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
735 "wrong last error value %ld\n", GetLastError());
737 SetLastError(0xdeadbeef);
738 hpen
= ExtCreatePen(pen
[i
].style
, 1, &lb
, 0, NULL
);
743 ok(hpen
== 0, "ExtCreatePen with width != 1 should fail\n");
744 ok(GetLastError() == ERROR_INVALID_PARAMETER
,
745 "wrong last error value %ld\n", GetLastError());
746 SetLastError(0xdeadbeef);
747 hpen
= ExtCreatePen(pen
[i
].style
, 1, &lb
, 2, user_style
);
749 if (pen
[i
].style
== PS_INSIDEFRAME
)
751 /* This style is applicable only for gemetric pens */
752 ok(hpen
== 0, "ExtCreatePen should fail\n");
753 goto test_geometric_pens
;
755 ok(hpen
!= 0, "ExtCreatePen error %ld\n", GetLastError());
757 obj_type
= GetObjectType(hpen
);
758 /* for some reason XP differentiates PS_NULL here */
759 if (pen
[i
].style
== PS_NULL
)
760 ok(obj_type
== OBJ_PEN
, "wrong object type %lu\n", obj_type
);
762 ok(obj_type
== OBJ_EXTPEN
, "wrong object type %lu\n", obj_type
);
764 /* check what's the real size of the object */
765 SetLastError(0xdeadbeef);
766 size
= GetObject(hpen
, 0, NULL
);
767 switch (pen
[i
].style
)
770 ok(size
== sizeof(LOGPEN
),
771 "GetObject returned %d, error %ld\n", size
, GetLastError());
775 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
) + sizeof(user_style
),
776 "GetObject returned %d, error %ld\n", size
, GetLastError());
780 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
),
781 "GetObject returned %d, error %ld\n", size
, GetLastError());
785 /* ask for truncated data */
786 memset(&elp
, 0xb0, sizeof(elp
));
787 SetLastError(0xdeadbeef);
788 size
= GetObject(hpen
, sizeof(elp
.elpPenStyle
), &elp
);
789 ok(!size
, "GetObject should fail: size %d, error %ld\n", size
, GetLastError());
791 /* see how larger buffer sizes are handled */
792 memset(&ext_pen
, 0xb0, sizeof(ext_pen
));
793 SetLastError(0xdeadbeef);
794 size
= GetObject(hpen
, sizeof(ext_pen
), &ext_pen
.elp
);
795 switch (pen
[i
].style
)
798 ok(size
== sizeof(LOGPEN
),
799 "GetObject returned %d, error %ld\n", size
, GetLastError());
800 memcpy(&lp
, &ext_pen
.elp
, sizeof(lp
));
801 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
802 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
803 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
804 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
806 /* for PS_NULL it also works this way */
807 memset(&elp
, 0xb0, sizeof(elp
));
808 SetLastError(0xdeadbeef);
809 size
= GetObject(hpen
, sizeof(elp
), &elp
);
810 ok(size
== sizeof(EXTLOGPEN
),
811 "GetObject returned %d, error %ld\n", size
, GetLastError());
812 ok(ext_pen
.elp
.elpHatch
== 0xb0b0b0b0, "expected 0xb0b0b0b0, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
813 ok(ext_pen
.elp
.elpNumEntries
== 0xb0b0b0b0, "expected 0xb0b0b0b0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
817 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
) + sizeof(user_style
),
818 "GetObject returned %d, error %ld\n", size
, GetLastError());
819 ok(ext_pen
.elp
.elpHatch
== HS_CROSS
, "expected HS_CROSS, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
820 ok(ext_pen
.elp
.elpNumEntries
== 2, "expected 0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
821 ok(ext_pen
.elp
.elpStyleEntry
[0] == 0xabc, "expected 0xabc, got %lx\n", ext_pen
.elp
.elpStyleEntry
[0]);
822 ok(ext_pen
.elp
.elpStyleEntry
[1] == 0xdef, "expected 0xabc, got %lx\n", ext_pen
.elp
.elpStyleEntry
[1]);
826 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
),
827 "GetObject returned %d, error %ld\n", size
, GetLastError());
828 ok(ext_pen
.elp
.elpHatch
== HS_CROSS
, "expected HS_CROSS, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
829 ok(ext_pen
.elp
.elpNumEntries
== 0, "expected 0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
833 if (pen
[i
].style
== PS_USERSTYLE
)
836 ok(ext_pen
.elp
.elpPenStyle
== pen
[i
].style
, "expected %x, got %lx\n", pen
[i
].style
, ext_pen
.elp
.elpPenStyle
);
839 ok(ext_pen
.elp
.elpPenStyle
== pen
[i
].style
, "expected %x, got %lx\n", pen
[i
].style
, ext_pen
.elp
.elpPenStyle
);
840 ok(ext_pen
.elp
.elpWidth
== 1, "expected 1, got %lx\n", ext_pen
.elp
.elpWidth
);
841 ok(ext_pen
.elp
.elpColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, ext_pen
.elp
.elpColor
);
842 ok(ext_pen
.elp
.elpBrushStyle
== BS_SOLID
, "expected BS_SOLID, got %x\n", ext_pen
.elp
.elpBrushStyle
);
847 /********************** geometric pens **********************/
848 lb
.lbStyle
= BS_SOLID
;
849 lb
.lbColor
= pen
[i
].color
;
850 lb
.lbHatch
= HS_CROSS
; /* just in case */
851 SetLastError(0xdeadbeef);
852 hpen
= ExtCreatePen(PS_GEOMETRIC
| pen
[i
].style
, pen
[i
].width
, &lb
, 2, user_style
);
853 if (pen
[i
].style
!= PS_USERSTYLE
)
855 ok(hpen
== 0, "ExtCreatePen should fail\n");
856 SetLastError(0xdeadbeef);
857 hpen
= ExtCreatePen(PS_GEOMETRIC
| pen
[i
].style
, pen
[i
].width
, &lb
, 0, NULL
);
859 if (pen
[i
].style
== PS_ALTERNATE
)
861 /* This style is applicable only for cosmetic pens */
862 ok(hpen
== 0, "ExtCreatePen should fail\n");
865 ok(hpen
!= 0, "ExtCreatePen error %ld\n", GetLastError());
867 obj_type
= GetObjectType(hpen
);
868 /* for some reason XP differentiates PS_NULL here */
869 if (pen
[i
].style
== PS_NULL
)
870 ok(obj_type
== OBJ_PEN
, "wrong object type %lu\n", obj_type
);
872 ok(obj_type
== OBJ_EXTPEN
, "wrong object type %lu\n", obj_type
);
874 /* check what's the real size of the object */
875 size
= GetObject(hpen
, 0, NULL
);
876 switch (pen
[i
].style
)
879 ok(size
== sizeof(LOGPEN
),
880 "GetObject returned %d, error %ld\n", size
, GetLastError());
884 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
) + sizeof(user_style
),
885 "GetObject returned %d, error %ld\n", size
, GetLastError());
889 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
),
890 "GetObject returned %d, error %ld\n", size
, GetLastError());
894 /* ask for truncated data */
895 memset(&lp
, 0xb0, sizeof(lp
));
896 SetLastError(0xdeadbeef);
897 size
= GetObject(hpen
, sizeof(lp
.lopnStyle
), &lp
);
898 ok(!size
, "GetObject should fail: size %d, error %ld\n", size
, GetLastError());
900 memset(&lp
, 0xb0, sizeof(lp
));
901 SetLastError(0xdeadbeef);
902 size
= GetObject(hpen
, sizeof(lp
), &lp
);
903 /* for some reason XP differenciates PS_NULL here */
904 if (pen
[i
].style
== PS_NULL
)
906 ok(size
== sizeof(LOGPEN
), "GetObject returned %d, error %ld\n", size
, GetLastError());
907 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
908 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
909 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
910 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
913 /* XP doesn't set last error here */
914 ok(!size
/*&& GetLastError() == ERROR_INVALID_PARAMETER*/,
915 "GetObject should fail: size %d, error %ld\n", size
, GetLastError());
917 memset(&ext_pen
, 0xb0, sizeof(ext_pen
));
918 SetLastError(0xdeadbeef);
919 /* buffer is too small for user styles */
920 size
= GetObject(hpen
, sizeof(elp
), &ext_pen
.elp
);
921 switch (pen
[i
].style
)
924 ok(size
== sizeof(EXTLOGPEN
),
925 "GetObject returned %d, error %ld\n", size
, GetLastError());
926 ok(ext_pen
.elp
.elpHatch
== 0, "expected 0, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
927 ok(ext_pen
.elp
.elpNumEntries
== 0, "expected 0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
929 /* for PS_NULL it also works this way */
930 SetLastError(0xdeadbeef);
931 size
= GetObject(hpen
, sizeof(ext_pen
), &lp
);
932 ok(size
== sizeof(LOGPEN
),
933 "GetObject returned %d, error %ld\n", size
, GetLastError());
934 ok(lp
.lopnStyle
== pen
[i
].ret_style
, "expected %u, got %u\n", pen
[i
].ret_style
, lp
.lopnStyle
);
935 ok(lp
.lopnWidth
.x
== pen
[i
].ret_width
, "expected %u, got %ld\n", pen
[i
].ret_width
, lp
.lopnWidth
.x
);
936 ok(lp
.lopnWidth
.y
== 0, "expected 0, got %ld\n", lp
.lopnWidth
.y
);
937 ok(lp
.lopnColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, lp
.lopnColor
);
941 ok(!size
/*&& GetLastError() == ERROR_INVALID_PARAMETER*/,
942 "GetObject should fail: size %d, error %ld\n", size
, GetLastError());
943 size
= GetObject(hpen
, sizeof(ext_pen
), &ext_pen
.elp
);
944 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
) + sizeof(user_style
),
945 "GetObject returned %d, error %ld\n", size
, GetLastError());
946 ok(ext_pen
.elp
.elpHatch
== HS_CROSS
, "expected HS_CROSS, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
947 ok(ext_pen
.elp
.elpNumEntries
== 2, "expected 0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
948 ok(ext_pen
.elp
.elpStyleEntry
[0] == 0xabc, "expected 0xabc, got %lx\n", ext_pen
.elp
.elpStyleEntry
[0]);
949 ok(ext_pen
.elp
.elpStyleEntry
[1] == 0xdef, "expected 0xabc, got %lx\n", ext_pen
.elp
.elpStyleEntry
[1]);
953 ok(size
== sizeof(EXTLOGPEN
) - sizeof(elp
.elpStyleEntry
),
954 "GetObject returned %d, error %ld\n", size
, GetLastError());
955 ok(ext_pen
.elp
.elpHatch
== HS_CROSS
, "expected HS_CROSS, got %p\n", (void *)ext_pen
.elp
.elpHatch
);
956 ok(ext_pen
.elp
.elpNumEntries
== 0, "expected 0, got %lx\n", ext_pen
.elp
.elpNumEntries
);
960 /* for some reason XP differenciates PS_NULL here */
961 if (pen
[i
].style
== PS_NULL
)
962 ok(ext_pen
.elp
.elpPenStyle
== pen
[i
].ret_style
, "expected %x, got %lx\n", pen
[i
].ret_style
, ext_pen
.elp
.elpPenStyle
);
965 if (pen
[i
].style
== PS_USERSTYLE
)
968 ok(ext_pen
.elp
.elpPenStyle
== (PS_GEOMETRIC
| pen
[i
].style
), "expected %x, got %lx\n", PS_GEOMETRIC
| pen
[i
].style
, ext_pen
.elp
.elpPenStyle
);
971 ok(ext_pen
.elp
.elpPenStyle
== (PS_GEOMETRIC
| pen
[i
].style
), "expected %x, got %lx\n", PS_GEOMETRIC
| pen
[i
].style
, ext_pen
.elp
.elpPenStyle
);
974 if (pen
[i
].style
== PS_NULL
)
975 ok(ext_pen
.elp
.elpWidth
== 0, "expected 0, got %lx\n", ext_pen
.elp
.elpWidth
);
977 ok(ext_pen
.elp
.elpWidth
== pen
[i
].ret_width
, "expected %u, got %lx\n", pen
[i
].ret_width
, ext_pen
.elp
.elpWidth
);
978 ok(ext_pen
.elp
.elpColor
== pen
[i
].ret_color
, "expected %08lx, got %08lx\n", pen
[i
].ret_color
, ext_pen
.elp
.elpColor
);
979 ok(ext_pen
.elp
.elpBrushStyle
== BS_SOLID
, "expected BS_SOLID, got %x\n", ext_pen
.elp
.elpBrushStyle
);
990 test_bitmap_font_metrics();
992 test_GdiGetCharDimensions();
994 test_thread_objects();
995 test_GetCurrentObject();