35{
40 static CHAR text[] =
"Example text for testing DrawText in "
41 "MM_HIENGLISH mode";
42 static WCHAR textW[] = {
'W',
'i',
'd',
'e',
' ',
'c',
'h',
'a',
'r',
' ',
43 's','t','r','i','n','g','\0'};
44 static CHAR emptystring[] =
"";
46 static CHAR wordbreak_text[] =
"line1 line2";
47 static WCHAR wordbreak_textW[] = {
'l',
'i',
'n',
'e',
'1',
' ',
'l',
'i',
'n',
'e',
'2',0};
48 static WCHAR wordbreak_text_colonW[] = {
'l',
'i',
'n',
'e',
'1',
' ',
'l',
'i',
'n',
'e',
'2',
' ',
':',0};
49 static WCHAR wordbreak_text_csbW[] = {
'l',
'i',
'n',
'e',
'1',
' ',
'l',
'i',
'n',
'e',
'2',
' ',
']',0};
50 static char tabstring[] = "one\ttwo";
51 INT textlen, textheight, heightcheck;
56
57
59 0, 0, 200, 200, 0, 0, 0,
NULL);
65
66
67 memset(&lf, 0,
sizeof(lf));
74
75
79 ok(
hFont != 0,
"CreateFontIndirectA error %lu\n",
82
87
88 trace(
"MM_HIENGLISH rect.bottom %ld\n",
rect.bottom);
89 ok(
rect.bottom < 0,
"In MM_HIENGLISH, DrawText with "
90 "DT_CALCRECT should return a negative rectangle bottom. "
91 "(bot=%ld)\n",
rect.bottom);
92
96
97
98
103 ok(
hFont != 0,
"CreateFontIndirectA error %lu\n",
106
111
112 trace(
"MM_TEXT rect.bottom %ld\n",
rect.bottom);
113 ok(
rect.bottom > 0,
"In MM_TEXT, DrawText with DT_CALCRECT "
114 "should return a positive rectangle bottom. (bot=%ld)\n",
116
117
118
123 ok(textheight==0,
"Got textheight from DrawTextExA\n");
124
129 if (conform_xp)
130 ok(textheight==0,
"Got textheight from DrawTextA\n");
131 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
132
137 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
138
142 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
143 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
144
149 if (!textheight)
150 {
151 if (conform_xp)
152 win_skip(
"XP conformity failed, skipping XP tests. Probably winNT\n");
154 }
155 else
156 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
157
161 if (conform_xp)
162 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
163 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
164
169 if (conform_xp)
170 ok(textheight==0,
"Got textheight from DrawTextExA\n");
171
176 if (conform_xp)
177 ok(textheight==0,
"Got textheight from DrawTextA\n");
178 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
179
180
181
186 if (conform_xp)
187 ok(textheight==0,
"Got textheight from DrawTextExA\n");
188
193 if (conform_xp)
194 ok(textheight==0,
"Got textheight from DrawTextA\n");
195 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
196
202 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
203
208 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
209 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
210
216 if (conform_xp)
217 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
218
223 if (conform_xp)
224 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
225 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
226
231 if (conform_xp)
232 ok(textheight==0,
"Got textheight from DrawTextExA\n");
233
238 if (conform_xp)
239 ok(textheight==0,
"Got textheight from DrawTextA\n");
240 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
241
242
244 if (conform_xp)
245 ok(textheight==0,
"Got textheight from DrawTextA\n");
247 if (conform_xp)
248 ok(textheight==0,
"Got textheight from DrawTextExA\n");
249 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
251 if (conform_xp)
252 ok(textheight==0,
"Got textheight from DrawTextA\n");
254 if (conform_xp)
255 ok(textheight==0,
"Got textheight from DrawTextExA\n");
256 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
258 if (conform_xp)
259 ok(textheight==0,
"Got textheight from DrawTextA\n");
261 if (conform_xp)
262 ok(textheight==0,
"Got textheight from DrawTextExA\n");
263 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
265 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
267 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
268 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
270 if (conform_xp)
271 ok(textheight!=0,
"Failed to get textheight from DrawTextA\n");
273 if (conform_xp)
274 ok(textheight!=0,
"Failed to get textheight from DrawTextExA\n");
275 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
277 ok(textheight==0,
"Got textheight from DrawTextA\n");
279 ok(textheight==0,
"Got textheight from DrawTextA\n");
280 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
281
282
285 ok(textheight == 1,
"Expect returned height:1 got:%d\n", textheight);
286
289 ok(textheight == 1,
"Expect returned height:1 got:%d\n", textheight);
290
293
296 ok(textheight == 1,
"Expect returned height:1 got:%d\n", textheight);
297
298
302 ok(textheight==0,
"Got textheight from DrawTextExA\n");
306 ok(textheight==0,
"Got textheight from DrawTextExA\n");
310 ok(textheight==0,
"Got textheight from DrawTextExA\n");
314 ok(textheight==0,
"Got textheight from DrawTextExA\n");
318 ok(textheight==0,
"Got textheight from DrawTextExA\n");
320
321
327 textlen =
rect.right;
337
338
345 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
346
351 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
352 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
353
357 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
358
362 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
363 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
364
369 if (textheight)
370 {
371 if (conform_xp)
372 win_skip(
"XP conformity failed, skipping XP tests. Probably win 2000\n");
374 }
375 else
376 ok(textheight==0,
"Got textheight from DrawTextExW\n");
377
382 if (conform_xp)
383 ok(textheight==0,
"Got textheight from DrawTextW\n");
384 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
385
386 if (conform_xp) {
387
392 ok(textheight==0,
"Got textheight from DrawTextExW\n");
393
398 ok(textheight==0,
"Got textheight from DrawTextW\n");
399 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
400 }
401
402
403
404
408 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
409
414 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
415 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
416
421 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
422
427 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
428 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
429
430 if (conform_xp) {
431
436 ok(textheight==0,
"Got textheight from DrawTextExW\n");
437
442 ok(textheight==0,
"Got textheight from DrawTextW\n");
443 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
444 }
445
450 if (conform_xp)
451 ok(textheight==0,
"Got textheight from DrawTextExW\n");
452
457 if (conform_xp)
458 ok(textheight==0,
"Got textheight from DrawTextW\n");
459 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
460
461
463 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
465 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
466 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
468 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
470 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
471 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
473 if (conform_xp)
474 ok(textheight==0,
"Got textheight from DrawTextW\n");
476 if (conform_xp)
477 ok(textheight==0,
"Got textheight from DrawTextExW\n");
478 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
480 ok(textheight!=0,
"Failed to get textheight from DrawTextW\n");
482 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
483 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
484 if (conform_xp) {
485
487 ok(textheight==0,
"Got textheight from DrawTextW\n");
489 ok(textheight==0,
"Got textheight from DrawTextExW\n");
490 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
492 ok(textheight==0,
"Got textheight from DrawTextW\n");
494 ok(textheight==0,
"Got textheight from DrawTextW\n");
495 ok(textheight == heightcheck,
"DrawTextEx and DrawText differ in return\n");
496 }
497
501 ok(textheight!=0,
"Failed to get textheight from DrawTextExW\n");
505 if (conform_xp)
506 ok(textheight==0,
"Got textheight from DrawTextExW\n");
510 if (conform_xp)
511 ok(textheight==0,
"Got textheight from DrawTextExW\n");
515 ok(textheight==0,
"Got textheight from DrawTextExW\n");
517 if (conform_xp) {
518
521 ok(textheight==0,
"Got textheight from DrawTextExW\n");
523 }
524
525
526
527#ifdef __REACTOS__
528 if (is_reactos()) {
529 ok(
FALSE,
"FIXME: invalid pointer tests crash on ReactOS.\n");
530 } else {
531#endif
534 ok(textheight == 0,
"Got textheight from DrawTextExW\n");
536
539 ok(textheight == 0,
"Got textheight from DrawTextExW\n");
541
544 ok(textheight == 0,
"Got textheight from DrawTextExA\n");
546#ifdef __REACTOS__
547 }
548#endif
549
550 if (0)
551 {
552
554 }
555 }
556
557
561 ok(0 ==
rect.left,
"expected 0, got %ld\n",
rect.left);
562 ok(0 ==
rect.right,
"expected 0, got %ld\n",
rect.right);
563 ok(0 ==
rect.top,
"expected 0, got %ld\n",
rect.top);
564 ok(
rect.bottom,
"rect.bottom should not be 0\n");
565
569 {
570 win_skip(
"DrawTextW not implemented\n" );
571 }
572 else
573 {
575 ok(0 ==
rect.left,
"expected 0, got %ld\n",
rect.left);
576 ok(0 ==
rect.right,
"expected 0, got %ld\n",
rect.right);
577 ok(0 ==
rect.top,
"expected 0, got %ld\n",
rect.top);
578 ok(
rect.bottom,
"rect.bottom should not be 0\n");
579 }
580
585 ok(textheight == heightcheck * 2,
"Got unexpected textheight %d, expected %d.\n",
586 textheight, heightcheck * 2);
589 ok(textheight >= heightcheck * 6,
"Got unexpected textheight %d, expected at least %d.\n",
590 textheight, heightcheck * 6);
591
596 ok(textheight == heightcheck * 2,
"Got unexpected textheight %d, expected %d.\n",
597 textheight, heightcheck * 2);
600 ok(textheight >= heightcheck * 6,
"Got unexpected textheight %d, expected at least %d.\n",
601 textheight, heightcheck * 6);
602
603
606 ok(textheight == heightcheck,
"Got unexpected textheight %d, expected %d.\n",
607 textheight, heightcheck);
608
611
613 ok(textheight == heightcheck * 2,
"Got unexpected textheight %d, expected %d.\n",
614 textheight, heightcheck * 2);
615 ok(
rect.right >
rect2.
right - 10,
"Got unexpected textwdith %ld, expected larger than %ld.\n",
617
620 ok(textheight == heightcheck,
"Got unexpected textheight %d, expected %d.\n",
621 textheight, heightcheck);
622
625
627 ok(textheight == heightcheck * 2,
"Got unexpected textheight %d, expected %d.\n",
628 textheight, heightcheck * 2);
629 ok(
rect.right >
rect2.
right - 10,
"Got unexpected textwdith %ld, expected larger than %ld.\n",
631
632
633
636 ok(textheight >= heightcheck,
"Got unexpected textheight %d\n", textheight);
637
639 memset(&dtp, 0,
sizeof(dtp));
642 ok(textheight >= heightcheck,
"Got unexpected textheight %d\n", textheight);
644
646 memset(&dtp, 0,
sizeof(dtp));
649 ok(textheight >= heightcheck,
"Got unexpected textheight %d\n", textheight);
653
655 memset(&dtp, 0,
sizeof(dtp));
659 ok(textheight >= heightcheck,
"Got unexpected textheight %d\n", textheight);
662
666
667
671
672
677}
static const char * wine_dbgstr_rect(const RECT *prc)
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define ERROR_INVALID_HANDLE
static const WCHAR emptystringW[]
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
static const WCHAR textW[]
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
CHAR lfFaceName[LF_FACESIZE]
INT WINAPI DrawTextA(HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags)
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
#define CLIP_DEFAULT_PRECIS
#define DT_EXTERNALLEADING
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
int WINAPI DrawTextExA(_In_ HDC hdc, _Inout_updates_opt_(cchText) LPSTR lpchText, _In_ int cchText, _Inout_ LPRECT lprc, _In_ UINT format, _In_opt_ LPDRAWTEXTPARAMS lpdtp)
int WINAPI DrawTextExW(_In_ HDC hdc, _Inout_updates_opt_(cchText) LPWSTR lpchText, _In_ int cchText, _Inout_ LPRECT lprc, _In_ UINT format, _In_opt_ LPDRAWTEXTPARAMS lpdtp)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)