ReactOS 0.4.16-dev-2491-g3dc6630
edit.c
Go to the documentation of this file.
1/* Unit test suite for edit control.
2 *
3 * Copyright 2004 Vitaliy Margolen
4 * Copyright 2005 C. Scott Ananian
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <assert.h>
22#include <windows.h>
23#include <commctrl.h>
24
25#include "wine/test.h"
26
27#ifndef ES_COMBO
28#define ES_COMBO 0x200
29#endif
30
31#define ID_EDITTESTDBUTTON 0x123
32#define ID_EDITTEST2 99
33#define MAXLEN 200
34
36{
38 while (1)
39 {
42 return ret;
43 if (GetTickCount() - start > 100)
44 {
45 char classname[256];
46 DWORD le = GetLastError();
47 HWND clipwnd = GetOpenClipboardWindow();
48 /* Provide a hint as to the source of interference:
49 * - The class name would typically be CLIPBRDWNDCLASS if the
50 * clipboard was opened by a Windows application using the
51 * ole32 API.
52 * - And it would be __wine_clipboard_manager if it was opened in
53 * response to a native application.
54 */
56 trace("%p (%s) opened the clipboard\n", clipwnd, classname);
57 SetLastError(le);
58 return ret;
59 }
60 Sleep(15);
61 }
62}
63
64struct edit_notify {
66};
67
69
71{
72 static int num_ok_commands = 0;
73 switch (msg)
74 {
75 case WM_INITDIALOG:
76 {
77 HWND hedit = GetDlgItem(hdlg, 1000);
78 SetFocus(hedit);
79 switch (lparam)
80 {
81 /* test cases related to bug 12319 */
82 case 0:
83 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
84 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
85 break;
86 case 1:
87 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
88 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
89 break;
90 case 2:
91 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
92 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
93 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
94 break;
95
96 /* test cases for pressing enter */
97 case 3:
98 num_ok_commands = 0;
99 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
100 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
101 break;
102
103 default:
104 break;
105 }
106 break;
107 }
108
109 case WM_COMMAND:
110 if (HIWORD(wparam) != BN_CLICKED)
111 break;
112
113 switch (LOWORD(wparam))
114 {
115 case IDOK:
116 num_ok_commands++;
117 break;
118
119 default:
120 break;
121 }
122 break;
123
124 case WM_USER:
125 {
126 HWND hfocus = GetFocus();
127 HWND hedit = GetDlgItem(hdlg, 1000);
128 HWND hedit2 = GetDlgItem(hdlg, 1001);
129 HWND hedit3 = GetDlgItem(hdlg, 1002);
130
131 if (wparam != 0xdeadbeef)
132 break;
133
134 switch (lparam)
135 {
136 case 0:
137 if (hfocus == hedit)
138 EndDialog(hdlg, 1111);
139 else if (hfocus == hedit2)
140 EndDialog(hdlg, 2222);
141 else if (hfocus == hedit3)
142 EndDialog(hdlg, 3333);
143 else
144 EndDialog(hdlg, 4444);
145 break;
146 case 1:
147 if ((hfocus == hedit) && (num_ok_commands == 0))
148 EndDialog(hdlg, 11);
149 else
150 EndDialog(hdlg, 22);
151 break;
152 default:
153 EndDialog(hdlg, 5555);
154 }
155 break;
156 }
157
158 case WM_CLOSE:
159 EndDialog(hdlg, 333);
160 break;
161
162 default:
163 break;
164 }
165
166 return FALSE;
167}
168
170{
171 switch (msg)
172 {
173 case WM_INITDIALOG:
174 {
175 HWND hedit = GetDlgItem(hdlg, 1000);
176 SetFocus(hedit);
177 switch (lparam)
178 {
179 /* from bug 11841 */
180 case 0:
181 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
182 break;
183 case 1:
184 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
185 break;
186 case 2:
187 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
188 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
189 break;
190
191 /* more test cases for WM_CHAR */
192 case 3:
193 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
194 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
195 break;
196 case 4:
197 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
198 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
199 break;
200 case 5:
201 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
202 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
203 break;
204
205 /* more test cases for WM_KEYDOWN + WM_CHAR */
206 case 6:
207 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
208 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
209 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
210 break;
211 case 7:
212 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
213 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
214 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
215 break;
216 case 8:
217 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
218 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
219 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
220 break;
221
222 /* multiple tab tests */
223 case 9:
224 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
225 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
226 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
227 break;
228 case 10:
229 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
230 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
231 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
232 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
233 break;
234
235 default:
236 break;
237 }
238 break;
239 }
240
241 case WM_COMMAND:
242 if (HIWORD(wparam) != BN_CLICKED)
243 break;
244
245 switch (LOWORD(wparam))
246 {
247 case IDOK:
248 EndDialog(hdlg, 111);
249 break;
250
251 case IDCANCEL:
252 EndDialog(hdlg, 222);
253 break;
254
255 default:
256 break;
257 }
258 break;
259
260 case WM_USER:
261 {
262 int len;
263 HWND hok = GetDlgItem(hdlg, IDOK);
264 HWND hcancel = GetDlgItem(hdlg, IDCANCEL);
265 HWND hedit = GetDlgItem(hdlg, 1000);
266 HWND hfocus = GetFocus();
267
268 if (wparam != 0xdeadbeef)
269 break;
270
271 switch (lparam)
272 {
273 case 0:
274 len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
275 if (len == 0)
276 EndDialog(hdlg, 444);
277 else
278 EndDialog(hdlg, 555);
279 break;
280
281 case 1:
282 len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
283 if ((hfocus == hok) && len == 0)
284 EndDialog(hdlg, 444);
285 else
286 EndDialog(hdlg, 555);
287 break;
288
289 case 2:
290 if (hfocus == hok)
291 EndDialog(hdlg, 11);
292 else if (hfocus == hcancel)
293 EndDialog(hdlg, 22);
294 else if (hfocus == hedit)
295 EndDialog(hdlg, 33);
296 else
297 EndDialog(hdlg, 44);
298 break;
299
300 default:
301 EndDialog(hdlg, 555);
302 }
303 break;
304 }
305
306 case WM_CLOSE:
307 EndDialog(hdlg, 333);
308 break;
309
310 default:
311 break;
312 }
313
314 return FALSE;
315}
316
318{
319 switch (msg)
320 {
321 case WM_INITDIALOG:
322 {
323 HWND hedit = GetDlgItem(hdlg, 1000);
324 SetFocus(hedit);
325 switch (lparam)
326 {
327 /* test cases for WM_KEYDOWN */
328 case 0:
329 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
330 break;
331 case 1:
332 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
333 break;
334 case 2:
335 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
336 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
337 break;
338
339 /* test cases for WM_CHAR */
340 case 3:
341 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
342 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
343 break;
344 case 4:
345 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
346 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
347 break;
348 case 5:
349 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
350 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
351 break;
352
353 /* test cases for WM_KEYDOWN + WM_CHAR */
354 case 6:
355 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
356 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
357 break;
358 case 7:
359 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
360 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
361 break;
362 case 8:
363 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
364 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
365 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
366 break;
367
368 default:
369 break;
370 }
371 break;
372 }
373
374 case WM_COMMAND:
375 if (HIWORD(wparam) != BN_CLICKED)
376 break;
377
378 switch (LOWORD(wparam))
379 {
380 case IDOK:
381 EndDialog(hdlg, 111);
382 break;
383
384 case IDCANCEL:
385 EndDialog(hdlg, 222);
386 break;
387
388 default:
389 break;
390 }
391 break;
392
393 case WM_USER:
394 {
395 HWND hok = GetDlgItem(hdlg, IDOK);
396 HWND hedit = GetDlgItem(hdlg, 1000);
397 HWND hfocus = GetFocus();
398 int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
399
400 if (wparam != 0xdeadbeef)
401 break;
402
403 switch (lparam)
404 {
405 case 0:
406 if ((hfocus == hedit) && len == 0)
407 EndDialog(hdlg, 444);
408 else
409 EndDialog(hdlg, 555);
410 break;
411
412 case 1:
413 if ((hfocus == hok) && len == 0)
414 EndDialog(hdlg, 444);
415 else
416 EndDialog(hdlg, 555);
417 break;
418
419 default:
420 EndDialog(hdlg, 55);
421 }
422 break;
423 }
424
425 case WM_CLOSE:
426 EndDialog(hdlg, 333);
427 break;
428
429 default:
430 break;
431 }
432
433 return FALSE;
434}
435
437{
438 switch (msg)
439 {
440 case WM_INITDIALOG:
441 {
442 HWND hedit = GetDlgItem(hdlg, 1000);
443 SetFocus(hedit);
444 switch (lparam)
445 {
446 /* test cases for WM_KEYDOWN */
447 case 0:
448 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
449 break;
450 case 1:
451 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
452 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
453 break;
454 case 2:
455 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
456 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
457 break;
458
459 /* test cases for WM_CHAR */
460 case 3:
461 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
462 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
463 break;
464 case 4:
465 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
466 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
467 break;
468 case 5:
469 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
470 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
471 break;
472
473 /* test cases for WM_KEYDOWN + WM_CHAR */
474 case 6:
475 PostMessageA(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
476 PostMessageA(hedit, WM_CHAR, VK_ESCAPE, 0x10001);
477 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 0);
478 break;
479 case 7:
480 PostMessageA(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
481 PostMessageA(hedit, WM_CHAR, VK_RETURN, 0x1c0001);
482 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 2);
483 break;
484 case 8:
485 PostMessageA(hedit, WM_KEYDOWN, VK_TAB, 0xf0001);
486 PostMessageA(hedit, WM_CHAR, VK_TAB, 0xf0001);
487 PostMessageA(hdlg, WM_USER, 0xdeadbeef, 1);
488 break;
489
490 default:
491 break;
492 }
493 break;
494 }
495
496 case WM_COMMAND:
497 if (HIWORD(wparam) != BN_CLICKED)
498 break;
499
500 switch (LOWORD(wparam))
501 {
502 case IDOK:
503 EndDialog(hdlg, 111);
504 break;
505
506 case IDCANCEL:
507 EndDialog(hdlg, 222);
508 break;
509
510 default:
511 break;
512 }
513 break;
514
515 case WM_USER:
516 {
517 HWND hok = GetDlgItem(hdlg, IDOK);
518 HWND hedit = GetDlgItem(hdlg, 1000);
519 HWND hfocus = GetFocus();
520 int len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0);
521
522 if (wparam != 0xdeadbeef)
523 break;
524
525 switch (lparam)
526 {
527 case 0:
528 if ((hfocus == hedit) && len == 0)
529 EndDialog(hdlg, 444);
530 else
531 EndDialog(hdlg, 555);
532 break;
533
534 case 1:
535 if ((hfocus == hok) && len == 0)
536 EndDialog(hdlg, 444);
537 else
538 EndDialog(hdlg, 555);
539 break;
540
541 case 2:
542 if ((hfocus == hedit) && len == 2)
543 EndDialog(hdlg, 444);
544 else
545 EndDialog(hdlg, 555);
546 break;
547
548 default:
549 EndDialog(hdlg, 55);
550 }
551 break;
552 }
553
554 case WM_CLOSE:
555 EndDialog(hdlg, 333);
556 break;
557
558 default:
559 break;
560 }
561
562 return FALSE;
563}
564
567static const char szEditTest2Class[] = "EditTest2Class";
568static const char szEditTest3Class[] = "EditTest3Class";
569static const char szEditTest4Class[] = "EditTest4Class";
570static const char szEditTextPositionClass[] = "EditTextPositionWindowClass";
571
573{
574 HWND handle;
575
576 handle = CreateWindowExA(exstyle,
577 "EDIT",
578 "Test Text",
579 style,
580 10, 10, 300, 300,
581 NULL, NULL, hinst, NULL);
582 ok (handle != NULL, "CreateWindow EDIT Control failed\n");
583 assert (handle);
586 return handle;
587}
588
590{
591 static const WCHAR testtextW[] = {'T','e','s','t',' ','t','e','x','t',0};
592 static const WCHAR editW[] = {'E','d','i','t',0};
593 HWND handle;
594
595 handle = CreateWindowExW(exstyle, editW, testtextW, style, 10, 10, 300, 300,
596 NULL, NULL, hinst, NULL);
597 ok(handle != NULL, "Failed to create Edit control.\n");
598 return handle;
599}
600
602{
603 HWND parentWnd;
604 HWND editWnd;
605 RECT rect;
606 BOOL b;
607 SetRect(&rect, 0, 0, 300, 300);
609 ok(b, "AdjustWindowRect failed\n");
610
611 parentWnd = CreateWindowExA(0,
613 "Edit Test",
616 rect.right - rect.left, rect.bottom - rect.top,
617 NULL, NULL, hinst, NULL);
618 ok (parentWnd != NULL, "CreateWindow EDIT Test failed\n");
619 assert(parentWnd);
620
621 editWnd = CreateWindowExA(exstyle,
622 "EDIT",
623 "Test Text",
624 WS_CHILD | style,
625 0, 0, 300, 300,
626 parentWnd, NULL, hinst, NULL);
627 ok (editWnd != NULL, "CreateWindow EDIT Test Text failed\n");
628 assert(editWnd);
630 ShowWindow (parentWnd, SW_SHOW);
631 return editWnd;
632}
633
635{
636 if (GetParent(hwndEdit))
638 else {
639 trace("Edit control has no parent!\n");
641 }
642}
643
645{
646 return GetWindowLongA( hwnd, GWL_STYLE ) & (
647 ES_LEFT |
648/* FIXME: not implemented
649 ES_CENTER |
650 ES_RIGHT |
651 ES_OEMCONVERT |
652*/
660 ES_COMBO |
664 );
665}
666
667static void set_client_height(HWND Wnd, unsigned Height)
668{
669 RECT ClientRect, WindowRect;
670
671 GetWindowRect(Wnd, &WindowRect);
672 GetClientRect(Wnd, &ClientRect);
673 SetWindowPos(Wnd, NULL, 0, 0,
674 WindowRect.right - WindowRect.left,
675 Height + (WindowRect.bottom - WindowRect.top) -
676 (ClientRect.bottom - ClientRect.top),
678
679 /* Workaround for a bug in Windows' edit control
680 (multi-line mode) */
681 GetWindowRect(Wnd, &WindowRect);
682 SetWindowPos(Wnd, NULL, 0, 0,
683 WindowRect.right - WindowRect.left + 1,
684 WindowRect.bottom - WindowRect.top + 1,
686 SetWindowPos(Wnd, NULL, 0, 0,
687 WindowRect.right - WindowRect.left,
688 WindowRect.bottom - WindowRect.top,
690
691 GetClientRect(Wnd, &ClientRect);
692 ok(ClientRect.bottom - ClientRect.top == Height,
693 "The client height should be %d, but is %ld\n",
694 Height, ClientRect.bottom - ClientRect.top);
695}
696
697static void test_edit_control_1(void)
698{
699 HWND hwEdit;
700 MSG msMessage;
701 int i;
702 LONG r;
703
704 msMessage.message = WM_KEYDOWN;
705
706 trace("EDIT: Single line\n");
708 r = get_edit_style(hwEdit);
709 ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%lx\n", r);
710 for (i=0;i<65535;i++)
711 {
712 msMessage.wParam = i;
713 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
715 "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
716 }
717 DestroyWindow (hwEdit);
718
719 trace("EDIT: Single line want returns\n");
721 r = get_edit_style(hwEdit);
722 ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%lx\n", r);
723 for (i=0;i<65535;i++)
724 {
725 msMessage.wParam = i;
726 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
728 "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
729 }
730 DestroyWindow (hwEdit);
731
732 trace("EDIT: Multiline line\n");
734 r = get_edit_style(hwEdit);
735 ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%lx\n", r);
736 for (i=0;i<65535;i++)
737 {
738 msMessage.wParam = i;
739 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
741 "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
742 }
743 DestroyWindow (hwEdit);
744
745 trace("EDIT: Multi line want returns\n");
747 r = get_edit_style(hwEdit);
748 ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%lx\n", r);
749 for (i=0;i<65535;i++)
750 {
751 msMessage.wParam = i;
752 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
754 "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
755 }
756 DestroyWindow (hwEdit);
757}
758
759/* WM_SETTEXT is implemented by selecting all text, and then replacing the
760 * selection. This test checks that the first 'select all' doesn't generate
761 * an UPDATE message which can escape and (via a handler) change the
762 * selection, which would cause WM_SETTEXT to break. This old bug
763 * was fixed 18-Mar-2005; we check here to ensure it doesn't regress.
764 */
765static void test_edit_control_2(void)
766{
767 HWND hwndMain, phwnd;
768 char szLocalString[MAXLEN];
769 LONG r, w = 150, h = 50;
770 POINT cpos;
771
772 /* Create main and edit windows. */
774 0, 0, 200, 200, NULL, NULL, hinst, NULL);
778
779 hwndET2 = CreateWindowA("EDIT", NULL,
781 0, 0, w, h, /* important this not be 0 size. */
786
787 trace("EDIT: SETTEXT atomicity\n");
788 /* Send messages to "type" in the word 'foo'. */
789 r = SendMessageA(hwndET2, WM_CHAR, 'f', 1);
790 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
791 r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
792 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
793 r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
794 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
795 /* 'foo' should have been changed to 'bar' by the UPDATE handler. */
796 GetWindowTextA(hwndET2, szLocalString, MAXLEN);
797 ok(strcmp(szLocalString, "bar")==0,
798 "Wrong contents of edit: %s\n", szLocalString);
799
800 /* try setting the caret before it's visible */
801 r = SetCaretPos(0, 0);
802 todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %ld\n", r);
803 phwnd = SetFocus(hwndET2);
804 ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n");
805 r = SetCaretPos(0, 0);
806 ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
807 r = GetCaretPos(&cpos);
808 ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
809 ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%ld,%ld)\n", cpos.x, cpos.y);
810 r = SetCaretPos(-1, -1);
811 ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
812 r = GetCaretPos(&cpos);
813 ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
814 ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%ld,%ld)\n", cpos.x, cpos.y);
815 r = SetCaretPos(w << 1, h << 1);
816 ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
817 r = GetCaretPos(&cpos);
818 ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
819 ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w << 1, h << 1, cpos.x, cpos.y);
820 r = SetCaretPos(w, h);
821 ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
822 r = GetCaretPos(&cpos);
823 ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
824 ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w, h, cpos.x, cpos.y);
825 r = SetCaretPos(w - 1, h - 1);
826 ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
827 r = GetCaretPos(&cpos);
828 ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
829 ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w - 1, h - 1, cpos.x, cpos.y);
830
831 /* OK, done! */
834}
835
836static void ET2_check_change(void) {
837 char szLocalString[MAXLEN];
838 /* This EN_UPDATE handler changes any 'foo' to 'bar'. */
839 GetWindowTextA(hwndET2, szLocalString, MAXLEN);
840 if (strcmp(szLocalString, "foo")==0) {
841 strcpy(szLocalString, "bar");
842 SendMessageA(hwndET2, WM_SETTEXT, 0, (LPARAM) szLocalString);
843 }
844 /* always leave the cursor at the end. */
846}
847static void ET2_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
848{
849 if (id==ID_EDITTEST2 && codeNotify == EN_UPDATE)
851}
853{
854 switch (iMsg) {
855 case WM_COMMAND:
857 break;
858 }
859 return DefWindowProcA(hwnd, iMsg, wParam, lParam);
860}
861
862static void zero_notify(void)
863{
864 notifications.en_change = 0;
865 notifications.en_maxtext = 0;
866 notifications.en_update = 0;
867}
868
869#define test_notify(enchange, enmaxtext, enupdate) \
870do { \
871 ok(notifications.en_change == enchange, "expected %d EN_CHANGE notifications, " \
872 "got %d\n", enchange, notifications.en_change); \
873 ok(notifications.en_maxtext == enmaxtext, "expected %d EN_MAXTEXT notifications, " \
874 "got %d\n", enmaxtext, notifications.en_maxtext); \
875 ok(notifications.en_update == enupdate, "expected %d EN_UPDATE notifications, " \
876 "got %d\n", enupdate, notifications.en_update); \
877} while(0)
878
879
881{
882 switch (msg) {
883 case WM_COMMAND:
884 switch (HIWORD(wParam)) {
885 case EN_MAXTEXT:
886 notifications.en_maxtext++;
887 break;
888 case EN_UPDATE:
889 notifications.en_update++;
890 break;
891 case EN_CHANGE:
892 notifications.en_change++;
893 break;
894 }
895 break;
896 }
898}
899
900/* Test behaviour of WM_SETTEXT, WM_REPLACESEL and notifications sent in response
901 * to these messages.
902 */
903static void test_edit_control_3(void)
904{
905 HWND hWnd;
906 HWND hParent;
907 HDC hDC;
908 int len, dpi;
909 static const char *str = "this is a long string.";
910 static const char *str2 = "this is a long string.\r\nthis is a long string.\r\nthis is a long string.\r\nthis is a long string.";
911
912 hDC = GetDC(NULL);
915
916 trace("EDIT: Test notifications\n");
917
918 hParent = CreateWindowExA(0,
920 NULL,
921 0,
923 NULL, NULL, NULL, NULL);
924 assert(hParent);
925
926 trace("EDIT: Single line, no ES_AUTOHSCROLL\n");
928 "EDIT",
929 NULL,
930 0,
931 10, 10, 50, 50,
932 hParent, NULL, NULL, NULL);
933 assert(hWnd);
934
935 zero_notify();
938 if (len == lstrlenA(str)) /* Win 8 */
939 test_notify(1, 0, 1);
940 else
941 test_notify(1, 1, 1);
942
944 zero_notify();
947 ok(1 == len, "wrong text length, expected 1, got %d\n", len);
948 test_notify(1, 0, 1);
949
950 zero_notify();
953 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
954 test_notify(1, 0, 1);
955
956 len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
957 ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
958 ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
959 SendMessageA(hParent, WM_SETFOCUS, 0, (LPARAM)hWnd);
960 len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
961 ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
962 ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
963
965
967 zero_notify();
970 ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
971 test_notify(1, 1, 1);
972
973 zero_notify();
976 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
977 test_notify(1, 0, 1);
978
980
981 trace("EDIT: Single line, ES_AUTOHSCROLL\n");
983 "EDIT",
984 NULL,
986 10, 10, 50, 50,
987 hParent, NULL, NULL, NULL);
988 assert(hWnd);
989
990 zero_notify();
993 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
994 test_notify(1, 0, 1);
995
996 zero_notify();
999 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1000 test_notify(1, 0, 1);
1001
1003 zero_notify();
1006 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1007 test_notify(1, 0, 1);
1008
1009 zero_notify();
1012 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1013 test_notify(1, 0, 1);
1014
1016
1018 zero_notify();
1021 ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1022 test_notify(1, 1, 1);
1023
1024 zero_notify();
1027 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1028 test_notify(1, 0, 1);
1029
1031
1032 trace("EDIT: Multline, no ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1034 "EDIT",
1035 NULL,
1037 10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1038 hParent, NULL, NULL, NULL);
1039 assert(hWnd);
1040
1041 zero_notify();
1044 if (len == lstrlenA(str)) /* Win 8 */
1045 test_notify(1, 0, 1);
1046 else
1047 {
1048 ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1049 test_notify(1, 1, 1);
1050 }
1051
1053 zero_notify();
1056 ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1057 test_notify(1, 0, 1);
1058
1059 zero_notify();
1062 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1063 test_notify(0, 0, 0);
1064
1066
1068 zero_notify();
1071 ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1072 test_notify(1, 1, 1);
1073
1074 zero_notify();
1077 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1078 test_notify(0, 0, 0);
1079
1081
1082 trace("EDIT: Multline, ES_AUTOHSCROLL, no ES_AUTOVSCROLL\n");
1084 "EDIT",
1085 NULL,
1087 10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
1088 hParent, NULL, NULL, NULL);
1089 assert(hWnd);
1090
1091 zero_notify();
1094 ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
1095 test_notify(1, 1, 1);
1096
1098 zero_notify();
1101 ok(1 == SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0), "wrong text length, expected 1, got %d\n", len);
1102 test_notify(1, 0, 1);
1103
1104 zero_notify();
1107 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1108 test_notify(0, 0, 0);
1109
1111
1113 zero_notify();
1116 ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1117 test_notify(1, 1, 1);
1118
1119 zero_notify();
1122 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1123 test_notify(0, 0, 0);
1124
1126
1127 trace("EDIT: Multline, ES_AUTOHSCROLL and ES_AUTOVSCROLL\n");
1129 "EDIT",
1130 NULL,
1132 10, 10, 50, 50,
1133 hParent, NULL, NULL, NULL);
1134 assert(hWnd);
1135
1136 zero_notify();
1139 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1140 test_notify(1, 0, 1);
1141
1142 zero_notify();
1145 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1146 test_notify(0, 0, 0);
1147
1149
1151 zero_notify();
1154 ok(5 == len, "text should have been truncated to limit, expected 5, got %d\n", len);
1155 test_notify(1, 1, 1);
1156
1157 zero_notify();
1160 ok(lstrlenA(str2) == len, "text shouldn't have been truncated\n");
1161 test_notify(0, 0, 0);
1162
1164}
1165
1166/* Test EM_CHARFROMPOS and EM_POSFROMCHAR
1167 */
1168static void test_char_from_pos(void)
1169{
1170 HWND hwEdit;
1171 int lo, hi, mid;
1172 int ret;
1173 int i;
1174 HDC dc;
1175 SIZE size;
1176
1177 trace("EDIT: Test EM_CHARFROMPOS and EM_POSFROMCHAR\n");
1179 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1180 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1181 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1182 mid = lo + (hi - lo + 1) / 2;
1183
1184 for (i = lo; i < mid; i++) {
1185 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1186 ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
1187 }
1188 for (i = mid; i <= hi; i++) {
1189 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1190 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1191 }
1192 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1193 ok(-1 == ret, "expected -1 got %d\n", ret);
1194 DestroyWindow(hwEdit);
1195
1197 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1198 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1199 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1200 mid = lo + (hi - lo + 1) / 2;
1201
1202 for (i = lo; i < mid; i++) {
1203 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1204 ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
1205 }
1206 for (i = mid; i <= hi; i++) {
1207 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1208 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1209 }
1210 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1211 ok(-1 == ret, "expected -1 got %d\n", ret);
1212 DestroyWindow(hwEdit);
1213
1215 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1216 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1217 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1218 mid = lo + (hi - lo + 1) / 2;
1219
1220 for (i = lo; i < mid; i++) {
1221 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1222 ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
1223 }
1224 for (i = mid; i <= hi; i++) {
1225 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1226 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1227 }
1228 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1229 ok(-1 == ret, "expected -1 got %d\n", ret);
1230 DestroyWindow(hwEdit);
1231
1233 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1234 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1235 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1236 mid = lo + (hi - lo + 1) / 2;
1237
1238 for (i = lo; i < mid; i++) {
1239 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1240 ok(0 == ret || 1 == ret /* Vista */,
1241 "%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
1242 }
1243 for (i = mid; i <= hi; i++) {
1244 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1245#ifdef __REACTOS__
1246 ok(1 == ret || broken(0 == ret) /* Vista */, "%d/%d/%d: expected 0 or 1 got %d\n", mid, i, hi, ret);
1247#else
1248 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1249#endif
1250 }
1251 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1252 ok(-1 == ret, "expected -1 got %d\n", ret);
1253 DestroyWindow(hwEdit);
1254
1256 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1257 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1258 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1259 mid = lo + (hi - lo + 1) / 2;
1260
1261 for (i = lo; i < mid; i++) {
1262 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1263 ok(0 == ret || 1 == ret /* Vista */,
1264 "%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
1265 }
1266 for (i = mid; i <= hi; i++) {
1267 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1268#ifdef __REACTOS__
1269 ok(1 == ret || broken(0 == ret) /* Vista */, "%d/%d/%d: expected 0 or 1 got %d\n", mid, i, hi, ret);
1270#else
1271 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1272#endif
1273 }
1274 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1275 ok(-1 == ret, "expected -1 got %d\n", ret);
1276 DestroyWindow(hwEdit);
1277
1279 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
1280 lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
1281 hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
1282 mid = lo + (hi - lo + 2) / 2;
1283
1284 for (i = lo; i < mid; i++) {
1285 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1286 ok(0 == ret || 1 == ret /* Vista */,
1287 "%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
1288 }
1289 for (i = mid; i <= hi; i++) {
1290 ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
1291 ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
1292 }
1293 ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
1294 ok(-1 == ret, "expected -1 got %d\n", ret);
1295 DestroyWindow(hwEdit);
1296
1297 /* Scrolled to the right with partially visible line, position on next line. */
1299
1300 dc = GetDC(hwEdit);
1301 GetTextExtentPoint32A(dc, "w", 1, &size);
1302 ReleaseDC(hwEdit, dc);
1303
1304 SetWindowPos(hwEdit, NULL, 0, 0, size.cx * 15, size.cy * 5, SWP_NOMOVE | SWP_NOZORDER);
1305 SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"wwwwwwwwwwwwwwwwwwww\r\n\r\n");
1306 SendMessageA(hwEdit, EM_SETSEL, 40, 40);
1307
1308 lo = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 22, 0);
1309 ret = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 20, 0);
1310 ret -= 20 * size.cx; /* Calculate expected position, 20 characters back. */
1311 ok(ret == lo, "Unexpected position %d vs %d.\n", lo, ret);
1312
1313 DestroyWindow(hwEdit);
1314}
1315
1316/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL
1317 * truncates text that doesn't fit.
1318 */
1319static void test_edit_control_5(void)
1320{
1321 static const char *str = "test\r\ntest";
1322 HWND parentWnd;
1323 HWND hWnd;
1324 int len;
1325 RECT rc1 = { 10, 10, 11, 11};
1326 RECT rc;
1327
1328 /* first show that a non-child won't do for this test */
1330 "EDIT",
1331 str,
1332 0,
1333 10, 10, 1, 1,
1334 NULL, NULL, NULL, NULL);
1335 assert(hWnd);
1336 /* size of non-child edit control is (much) bigger than requested */
1337 GetWindowRect( hWnd, &rc);
1338 ok( rc.right - rc.left > 20, "size of the window (%ld) is smaller than expected\n",
1339 rc.right - rc.left);
1341 /* so create a parent, and give it edit controls children to test with */
1342 parentWnd = CreateWindowExA(0,
1344 "Edit Test", WS_VISIBLE |
1347 250, 250,
1348 NULL, NULL, hinst, NULL);
1349 assert(parentWnd);
1350 ShowWindow( parentWnd, SW_SHOW);
1351 /* single line */
1353 "EDIT",
1355 WS_CHILD,
1356 rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1357 parentWnd, NULL, NULL, NULL);
1358 assert(hWnd);
1359 GetClientRect( hWnd, &rc);
1360 ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1361 "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1363 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1365 /* multi line */
1367 "EDIT",
1368 str,
1370 rc1.left, rc1.top, rc1.right - rc1.left, rc1.bottom - rc1.top,
1371 parentWnd, NULL, NULL, NULL);
1372 assert(hWnd);
1373 GetClientRect( hWnd, &rc);
1374 ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
1375 "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
1377 ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
1379 DestroyWindow(parentWnd);
1380}
1381
1382/* Test WM_GETTEXT processing
1383 * after destroy messages
1384 */
1385static void test_edit_control_6(void)
1386{
1387 static const char *str = "test\r\ntest";
1388 char buf[MAXLEN];
1389 LONG ret;
1390 HWND hWnd;
1391
1393 "EDIT",
1394 "Test",
1395 0,
1396 10, 10, 1, 1,
1397 NULL, NULL, hinst, NULL);
1398 assert(hWnd);
1399
1401 ok(ret == TRUE, "Expected %d, got %ld\n", TRUE, ret);
1403 ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
1404 ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1405 buf[0] = 0;
1406 ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
1407 ok(ret == 0, "Expected 0, got %ld\n", ret);
1409 ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
1410 ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
1411 buf[0] = 0;
1413 ok(ret == 0, "Expected 0, got %ld\n", ret);
1415 ok(ret == 0, "Expected 0, got len %ld\n", ret);
1416 ok(!strcmp(buf, ""), "Expected empty string, got %s\n", buf);
1417
1419}
1420
1422{
1423 HWND hwEdit;
1424 DWORD r;
1425
1426 /* Test default limit for single-line control */
1427 trace("EDIT: buffer limit for single-line\n");
1429 r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1430 ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
1431 SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1432 r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1433 ok( r == 2147483646, "got limit %lu (expected 2147483646)\n", r);
1434 DestroyWindow(hwEdit);
1435
1436 /* Test default limit for multi-line control */
1437 trace("EDIT: buffer limit for multi-line\n");
1439 r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1440 ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
1441 SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
1442 r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
1443 ok( r == 4294967295U, "got limit %lu (expected 4294967295)\n", r);
1444 DestroyWindow(hwEdit);
1445}
1446
1447/* Test EM_SCROLL */
1449{
1450 static const char *single_line_str = "a";
1451 static const char *multiline_str = "Test\r\nText";
1452 HWND hwEdit;
1453 LONG ret;
1454
1455 /* Check the return value when EM_SCROLL doesn't scroll
1456 * anything. Should not return true unless any lines were actually
1457 * scrolled. */
1458 hwEdit = CreateWindowA(
1459 "EDIT",
1460 single_line_str,
1462 1, 1, 100, 100,
1463 NULL, NULL, hinst, NULL);
1464
1465 assert(hwEdit);
1466
1467 ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1468 ok(!ret, "Returned %lx, expected 0.\n", ret);
1469
1470 ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
1471 ok(!ret, "Returned %lx, expected 0.\n", ret);
1472
1473 ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEUP, 0);
1474 ok(!ret, "Returned %lx, expected 0.\n", ret);
1475
1476 ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
1477 ok(!ret, "Returned %lx, expected 0.\n", ret);
1478
1479 DestroyWindow (hwEdit);
1480
1481 /* SB_PAGEDOWN while at the beginning of a buffer with few lines
1482 should not cause EM_SCROLL to return a negative value of
1483 scrolled lines that would put us "before" the beginning. */
1484 hwEdit = CreateWindowA(
1485 "EDIT",
1486 multiline_str,
1488 0, 0, 100, 100,
1489 NULL, NULL, hinst, NULL);
1490 assert(hwEdit);
1491
1492 ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
1493 ok(!ret, "Returned %lx, expected 0.\n", ret);
1494
1495 DestroyWindow (hwEdit);
1496}
1497
1499{
1500 switch (GdiGetCodePage(dc)) {
1501 case 932: case 936: case 949: case 950: case 1361:
1502 return TRUE;
1503 default:
1504 return FALSE;
1505 }
1506}
1507
1509{
1510 HWND hwnd;
1511 HDC hdc;
1513 SIZE size;
1514 LOGFONTA lf;
1515 HFONT hfont;
1516 RECT rect;
1517 INT margins, threshold, expect, empty_expect;
1518 const UINT small_margins = MAKELONG(1, 5);
1519
1520 memset(&lf, 0, sizeof(lf));
1521 lf.lfHeight = -11;
1522 lf.lfWeight = FW_NORMAL;
1523 lf.lfCharSet = charset;
1524 strcpy(lf.lfFaceName, "Tahoma");
1525
1527 ok(hfont != NULL, "got %p\n", hfont);
1528
1529 /* Big window rectangle */
1530 hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL);
1531 ok(hwnd != NULL, "got %p\n", hwnd);
1533 ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1534
1535 hdc = GetDC(hwnd);
1537 size.cx = GdiGetCharDimensions( hdc, &tm, &size.cy );
1538 if ((charset != tm.tmCharSet && charset != DEFAULT_CHARSET) ||
1539 !(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR))) {
1540 skip("%s for charset %d isn't available\n", lf.lfFaceName, charset);
1542 ReleaseDC(hwnd, hdc);
1545 return;
1546 }
1547 expect = MAKELONG(size.cx / 2, size.cx / 2);
1549 ReleaseDC(hwnd, hdc);
1550
1552 ok(margins == 0, "got %x\n", margins);
1557
1558 threshold = HIWORD(expect) + LOWORD(expect) + size.cx * 2;
1559 empty_expect = threshold > 80 ? small_margins : expect;
1560
1561 /* Size below the threshold, margins remain unchanged */
1562 hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, threshold - 1, 100, NULL, NULL, NULL, NULL);
1563 ok(hwnd != NULL, "got %p\n", hwnd);
1565 ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1566
1568 ok(margins == 0, "got %x\n", margins);
1569
1574 ok(margins == small_margins, "%d: got %d, %d\n", charset, HIWORD(margins), LOWORD(margins));
1576
1577 /* Size at the threshold, margins become non-zero */
1578 hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, threshold, 100, NULL, NULL, NULL, NULL);
1579 ok(hwnd != NULL, "got %p\n", hwnd);
1581 ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1582
1584 ok(margins == 0, "got %x\n", margins);
1585
1590 ok(margins == expect, "%d: got %d, %d\n", charset, HIWORD(margins), LOWORD(margins));
1592
1593 /* Empty rect */
1594 hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
1595 ok(hwnd != NULL, "got %p\n", hwnd);
1597 ok(IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1598
1600 ok(margins == 0, "got %x\n", margins);
1601
1606 ok(margins == empty_expect, "%d: got %d, %d\n", charset, HIWORD(margins), LOWORD(margins));
1608
1610}
1611
1613{
1616 return (GetTextCharsetInfo(dc, &fs, 0) != DEFAULT_CHARSET &&
1617 (fs.fsCsb[0] & FS_DBCS_MASK));
1618}
1619
1621{
1622 INT margin;
1623 if (side_bearing < 0)
1624 margin = min(-side_bearing, width/2);
1625 else
1626 margin = 0;
1627 return margin;
1628}
1629
1631{
1632 ABC abc[256];
1633 SHORT left, right;
1634 UINT i;
1635
1636 left = right = 0;
1637 if (unicode) {
1638 if (!GetCharABCWidthsW(hdc, 0, 255, abc))
1639 return 0;
1640 }
1641 else {
1642 if (!GetCharABCWidthsA(hdc, 0, 255, abc))
1643 return 0;
1644 }
1645 for (i = 0; i < ARRAY_SIZE(abc); i++) {
1646 if (-abc[i].abcA > right) right = -abc[i].abcA;
1647 if (-abc[i].abcC > left) left = -abc[i].abcC;
1648 }
1649 return MAKELONG(left, right);
1650}
1651
1652static void test_margins_default(const char* facename, UINT charset)
1653{
1654 HWND hwnd;
1655 HDC hdc;
1657 SIZE size;
1658 BOOL cjk_charset, cjk_font;
1659 LOGFONTA lf;
1660 HFONT hfont;
1661 RECT rect;
1662 INT margins, expect, font_expect;
1663 const UINT small_margins = MAKELONG(1, 5);
1664 const WCHAR EditW[] = {'E','d','i','t',0}, strW[] = {'W',0};
1665 struct char_width_info {
1666 INT lsb, rsb, unknown;
1667 } info;
1669 BOOL (WINAPI *pGetCharWidthInfo)(HDC, struct char_width_info *);
1670
1671 hgdi32 = GetModuleHandleA("gdi32.dll");
1672 pGetCharWidthInfo = (void *)GetProcAddress(hgdi32, "GetCharWidthInfo");
1673
1674 memset(&lf, 0, sizeof(lf));
1675 lf.lfHeight = -11;
1676 lf.lfWeight = FW_NORMAL;
1677 lf.lfCharSet = charset;
1678 strcpy(lf.lfFaceName, facename);
1679
1681 ok(hfont != NULL, "got %p\n", hfont);
1682
1683 /* Unicode version */
1684 hwnd = CreateWindowExW(0, EditW, strW, WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL);
1685 ok(hwnd != NULL, "got %p\n", hwnd);
1687 ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1688
1689 hdc = GetDC(hwnd);
1691 size.cx = GdiGetCharDimensions( hdc, &tm, &size.cy );
1692 if ((charset != tm.tmCharSet && charset != DEFAULT_CHARSET) ||
1693 !(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR))) {
1694 skip("%s for charset %d isn't available\n", lf.lfFaceName, charset);
1696 ReleaseDC(hwnd, hdc);
1699 return;
1700 }
1701 cjk_charset = is_cjk_charset(hdc);
1702 cjk_font = is_cjk_font(hdc);
1703 if ((cjk_charset || cjk_font) &&
1704 pGetCharWidthInfo && pGetCharWidthInfo(hdc, &info)) {
1705 short left, right;
1706
1710
1711 font_expect = get_cjk_font_margins(hdc, TRUE);
1712 if (!font_expect)
1713 /* In this case, margins aren't updated */
1714 font_expect = small_margins;
1715 }
1716 else
1717 font_expect = expect = MAKELONG(size.cx / 2, size.cx / 2);
1718
1720 ReleaseDC(hwnd, hdc);
1721
1723 ok(margins == 0, "got %x\n", margins);
1727 ok(margins == font_expect, "%s:%d: expected %d, %d, got %d, %d\n", facename, charset, HIWORD(font_expect), LOWORD(font_expect), HIWORD(margins), LOWORD(margins));
1731 ok(margins == expect, "%s:%d: expected %d, %d, got %d, %d\n", facename, charset, HIWORD(expect), LOWORD(expect), HIWORD(margins), LOWORD(margins));
1733
1734 /* ANSI version */
1735 hwnd = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 5000, 1000, NULL, NULL, NULL, NULL);
1736 ok(hwnd != NULL, "got %p\n", hwnd);
1738 ok(!IsRectEmpty(&rect), "got rect %s\n", wine_dbgstr_rect(&rect));
1739
1740 if (cjk_charset) {
1741 hdc = GetDC(hwnd);
1743 font_expect = get_cjk_font_margins(hdc, FALSE);
1744 if (!font_expect)
1745 /* In this case, margins aren't updated */
1746 font_expect = small_margins;
1748 ReleaseDC(hwnd, hdc);
1749 }
1750 else
1751 /* we expect EC_USEFONTINFO size */
1752 font_expect = expect;
1753
1755 ok(margins == 0, "got %x\n", margins);
1759 ok(margins == font_expect, "%s:%d: expected %d, %d, got %d, %d\n", facename, charset, HIWORD(font_expect), LOWORD(font_expect), HIWORD(margins), LOWORD(margins));
1763 ok(margins == expect, "%s:%d: expected %d, %d, got %d, %d\n", facename, charset, HIWORD(expect), LOWORD(expect), HIWORD(margins), LOWORD(margins));
1765
1767}
1768
1770{
1771 return 0;
1772}
1773
1774static BOOL is_font_installed(const char*name)
1775{
1776 HDC hdc = GetDC(NULL);
1777 BOOL ret = FALSE;
1778
1780 ret = TRUE;
1781
1782 ReleaseDC(NULL, hdc);
1783 return ret;
1784}
1785
1787
1789{
1790 RECT rect;
1791 LRESULT result, r;
1792
1793 switch (message)
1794 {
1795 case WM_NCCREATE:
1797
1798 memset(&rect, 0, sizeof(rect));
1800 ok(!rect.right && !rect.bottom, "Invalid size after NCCREATE: %ld x %ld\n", rect.right, rect.bottom);
1801
1802 /* test that messages between WM_NCCREATE and WM_CREATE
1803 don't crash or cause unexpected behavior */
1804 r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
1805 ok(r == 1, "Returned %Id, expected 1.\n", r);
1806 r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
1807 todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
1808 r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
1809 ok(r == 1, "Returned %Id, expected 1.\n", r);
1810
1811 return result;
1812
1813 case WM_CREATE:
1814 /* test that messages between WM_NCCREATE and WM_CREATE
1815 don't crash or cause unexpected behavior */
1816 r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
1817 ok(r == 1, "Returned %Id, expected 1.\n", r);
1818 r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
1819 todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
1820 r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
1821 ok(r == 1, "Returned %Id, expected 1.\n", r);
1822
1823 break;
1824 }
1825
1827}
1828
1829static void test_initialization(void)
1830{
1831 BOOL ret;
1832 ATOM atom;
1833 HWND hwEdit;
1834 WNDCLASSA cls;
1835
1836#ifdef __REACTOS__
1837 if (is_reactos()) {
1838 ok(FALSE, "FIXME: ReactOS crashes on this test!\n");
1839 return;
1840 }
1841#endif
1842 ret = GetClassInfoA(NULL, "Edit", &cls);
1843 ok(ret, "Failed to get class info.\n");
1844
1847 cls.lpszClassName = "TestClassName";
1848
1849 atom = RegisterClassA(&cls);
1850 ok(atom != 0, "Failed to register class.\n");
1851
1852 hwEdit = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atom), "Text Text",
1854 10, 10, 300, 300, NULL, NULL, hinst, NULL);
1855 ok(hwEdit != NULL, "Failed to create a window.\n");
1856
1857 DestroyWindow(hwEdit);
1859}
1860
1861static void test_margins(void)
1862{
1863 HWND hwEdit;
1864 RECT old_rect, new_rect;
1865 INT old_right_margin;
1866 DWORD old_margins, new_margins;
1867
1869
1870 old_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
1871 old_right_margin = HIWORD(old_margins);
1872
1873 /* Check if setting the margins works */
1874
1876 new_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
1877 ok(LOWORD(new_margins) == 10, "Wrong left margin: %d\n", LOWORD(new_margins));
1878 ok(HIWORD(new_margins) == old_right_margin, "Wrong right margin: %d\n", HIWORD(new_margins));
1879
1881 new_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
1882 ok(LOWORD(new_margins) == 10, "Wrong left margin: %d\n", LOWORD(new_margins));
1883 ok(HIWORD(new_margins) == 10, "Wrong right margin: %d\n", HIWORD(new_margins));
1884
1885 /* The size of the rectangle must decrease if we increase the margin */
1886
1888 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
1890 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1891 ok(new_rect.left == old_rect.left + 10, "The left border of the rectangle is wrong\n");
1892 ok(new_rect.right == old_rect.right - 15, "The right border of the rectangle is wrong\n");
1893 ok(new_rect.top == old_rect.top, "The top border of the rectangle must not change\n");
1894 ok(new_rect.bottom == old_rect.bottom, "The bottom border of the rectangle must not change\n");
1895
1896 /* If we set the margin to same value as the current margin,
1897 the rectangle must not change */
1898
1900 SetRect(&old_rect, 1, 1, 99, 99);
1901 SendMessageA(hwEdit, EM_SETRECT, 0, (LPARAM)&old_rect);
1902 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
1904 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1905 ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
1906
1907 /* The lParam argument of the WM_SIZE message should be ignored. */
1908
1909 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
1910 SendMessageA(hwEdit, WM_SIZE, SIZE_RESTORED, 0);
1911 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1912 ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
1913 SendMessageA(hwEdit, WM_SIZE, SIZE_MINIMIZED, 0);
1914 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1915 ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
1916 SendMessageA(hwEdit, WM_SIZE, SIZE_MAXIMIZED, 0);
1917 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1918 ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
1919 SendMessageA(hwEdit, WM_SIZE, SIZE_RESTORED, MAKELONG(10, 10));
1920 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
1921 ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
1922
1923 DestroyWindow (hwEdit);
1924
1927
1931 /* Don't test JOHAB_CHARSET. Treated as CJK by Win 8,
1932 but not by < Win 8 and Win 10. */
1933
1935
1938
1941
1942 if (is_font_installed("MS PGothic")) {
1944 test_margins_default("MS PGothic", GREEK_CHARSET);
1945 }
1946 else
1947 skip("MS PGothic is not available, skipping some margin tests\n");
1948
1949 if (is_font_installed("Ume P Gothic")) {
1950 test_margins_default("Ume P Gothic", SHIFTJIS_CHARSET);
1951 test_margins_default("Ume P Gothic", GREEK_CHARSET);
1952 }
1953 else
1954 skip("Ume P Gothic is not available, skipping some margin tests\n");
1955
1956 if (is_font_installed("SimSun")) {
1959 }
1960 else
1961 skip("SimSun is not available, skipping some margin tests\n");
1962}
1963
1965{
1966 HWND hwEdit;
1967 DWORD margins, font_margins;
1968 LOGFONTA lf;
1969 HFONT hfont, hfont2;
1970
1971 if (!is_font_installed("Arial"))
1972 {
1973 skip("Arial not found - skipping font change margin tests\n");
1974 return;
1975 }
1976
1977 hwEdit = create_child_editcontrol(0, 0);
1978
1979 SetWindowPos(hwEdit, NULL, 10, 10, 1000, 100, SWP_NOZORDER | SWP_NOACTIVATE);
1980
1981 memset(&lf, 0, sizeof(lf));
1982 strcpy(lf.lfFaceName, "Arial");
1983 lf.lfHeight = 16;
1984 lf.lfCharSet = GREEK_CHARSET; /* to avoid associated charset feature */
1986 lf.lfHeight = 30;
1987 hfont2 = CreateFontIndirectA(&lf);
1988
1989 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
1990 font_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
1991 ok(LOWORD(font_margins) != 0, "got %d\n", LOWORD(font_margins));
1992 ok(HIWORD(font_margins) != 0, "got %d\n", HIWORD(font_margins));
1993
1994 /* With 'small' edit controls, test that the margin doesn't get set */
1995 SetWindowPos(hwEdit, NULL, 10, 10, 16, 100, SWP_NOZORDER | SWP_NOACTIVATE);
1997 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
1998 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
1999 ok(LOWORD(margins) == 0,
2000 "got %d\n", LOWORD(margins));
2001 ok(HIWORD(margins) == 0,
2002 "got %d\n", HIWORD(margins));
2003
2005 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
2006 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2007 ok(LOWORD(margins) == 1,
2008 "got %d\n", LOWORD(margins));
2009 ok(HIWORD(margins) == 0,
2010 "got %d\n", HIWORD(margins));
2011
2013 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
2014 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2015 ok(LOWORD(margins) == 1,
2016 "got %d\n", LOWORD(margins));
2017 ok(HIWORD(margins) == 1,
2018 "got %d\n", HIWORD(margins));
2019
2021 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2022 ok(LOWORD(margins) == 1,
2023 "got %d\n", LOWORD(margins));
2024 ok(HIWORD(margins) == 1,
2025 "got %d\n", HIWORD(margins));
2026
2027 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont2, 0);
2028 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2029 ok(LOWORD(margins) == 1,
2030 "got %d\n", LOWORD(margins));
2031 ok(HIWORD(margins) == 1,
2032 "got %d\n", HIWORD(margins));
2033
2034 /* Above a certain size threshold then the margin is updated */
2035 SetWindowPos(hwEdit, NULL, 10, 10, 1000, 100, SWP_NOZORDER | SWP_NOACTIVATE);
2037 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
2038 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2039 ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
2040 ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
2041
2043 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
2044 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2045 ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
2046 ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
2047
2049 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
2050 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2051 ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
2052 ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
2053 SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont2, 0);
2054 margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
2055 ok(LOWORD(margins) != LOWORD(font_margins),
2056 "got %d\n", LOWORD(margins));
2057 ok(HIWORD(margins) != HIWORD(font_margins), "got %d\n", HIWORD(margins));
2058
2059 SendMessageA(hwEdit, WM_SETFONT, 0, 0);
2060
2061 DeleteObject(hfont2);
2064
2065}
2066
2067#define edit_pos_ok(exp, got, txt) edit_pos_ok_(__LINE__, exp, got, #txt)
2068static inline void edit_pos_ok_(unsigned line, DWORD exp, DWORD got, const char* txt)
2069{
2070 ok_(__FILE__, line)(exp == got, "wrong %s expected %ld got %ld\n", txt, exp, got);
2071}
2072
2073#define check_pos(hwEdit, set_height, test_top, test_height, test_left) \
2074do { \
2075 RECT format_rect; \
2076 int left_margin; \
2077 set_client_height(hwEdit, set_height); \
2078 SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM) &format_rect); \
2079 left_margin = LOWORD(SendMessageA(hwEdit, EM_GETMARGINS, 0, 0)); \
2080 edit_pos_ok(test_top, format_rect.top, vertical position); \
2081 edit_pos_ok((int)test_height, format_rect.bottom - format_rect.top, height); \
2082 edit_pos_ok(test_left, format_rect.left - left_margin, left); \
2083} while(0)
2084
2086{
2087 HWND hwEdit;
2088 HFONT font, oldFont;
2089 HDC dc;
2091 INT b, bm, b2, b3;
2092 BOOL xb, single_line = !(style & ES_MULTILINE);
2093
2095 b2 = 2 * b;
2096 b3 = 3 * b;
2097 bm = b2 - 1;
2098
2099 /* Get a stock font for which we can determine the metrics */
2101 ok (font != NULL, "GetStockObject SYSTEM_FONT failed\n");
2102 dc = GetDC(NULL);
2103 ok (dc != NULL, "GetDC() failed\n");
2104 oldFont = SelectObject(dc, font);
2105 xb = GetTextMetricsA(dc, &metrics);
2106 ok (xb, "GetTextMetrics failed\n");
2107 SelectObject(dc, oldFont);
2108 ReleaseDC(NULL, dc);
2109
2110 /* Windows' edit control has some bugs in multi-line mode:
2111 * - Sometimes the format rectangle doesn't get updated
2112 * (see workaround in set_client_height())
2113 * - If the height of the control is smaller than the height of a text
2114 * line, the format rectangle is still as high as a text line
2115 * (higher than the client rectangle) and the caret is not shown
2116 */
2117
2118 /* Edit controls that are in a parent window */
2119
2122 if (single_line)
2123 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 0);
2124 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 0);
2125 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 0);
2126 check_pos(hwEdit, metrics.tmHeight + 2, 0, metrics.tmHeight , 0);
2127 check_pos(hwEdit, metrics.tmHeight + 10, 0, metrics.tmHeight , 0);
2129
2132 if (single_line)
2133 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, b);
2134 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , b);
2135 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , b);
2136 check_pos(hwEdit, metrics.tmHeight + bm, 0, metrics.tmHeight , b);
2137 check_pos(hwEdit, metrics.tmHeight + b2, b, metrics.tmHeight , b);
2138 check_pos(hwEdit, metrics.tmHeight + b3, b, metrics.tmHeight , b);
2140
2143 if (single_line)
2144 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
2145 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
2146 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 1);
2147 check_pos(hwEdit, metrics.tmHeight + 2, 1, metrics.tmHeight , 1);
2148 check_pos(hwEdit, metrics.tmHeight + 10, 1, metrics.tmHeight , 1);
2150
2153 if (single_line)
2154 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
2155 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
2156 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 1);
2157 check_pos(hwEdit, metrics.tmHeight + 2, 1, metrics.tmHeight , 1);
2158 check_pos(hwEdit, metrics.tmHeight + 10, 1, metrics.tmHeight , 1);
2160
2161
2162 /* Edit controls that are popup windows */
2163
2164 hwEdit = create_editcontrol(style | WS_POPUP, 0);
2166 if (single_line)
2167 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 0);
2168 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 0);
2169 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 0);
2170 check_pos(hwEdit, metrics.tmHeight + 2, 0, metrics.tmHeight , 0);
2171 check_pos(hwEdit, metrics.tmHeight + 10, 0, metrics.tmHeight , 0);
2172 DestroyWindow(hwEdit);
2173
2174 hwEdit = create_editcontrol(style | WS_POPUP | WS_BORDER, 0);
2176 if (single_line)
2177 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, b);
2178 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , b);
2179 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , b);
2180 check_pos(hwEdit, metrics.tmHeight + bm, 0, metrics.tmHeight , b);
2181 check_pos(hwEdit, metrics.tmHeight + b2, b, metrics.tmHeight , b);
2182 check_pos(hwEdit, metrics.tmHeight + b3, b, metrics.tmHeight , b);
2183 DestroyWindow(hwEdit);
2184
2187 if (single_line)
2188 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
2189 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
2190 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 1);
2191 check_pos(hwEdit, metrics.tmHeight + 2, 1, metrics.tmHeight , 1);
2192 check_pos(hwEdit, metrics.tmHeight + 10, 1, metrics.tmHeight , 1);
2193 DestroyWindow(hwEdit);
2194
2197 if (single_line)
2198 check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
2199 check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
2200 check_pos(hwEdit, metrics.tmHeight + 1, 0, metrics.tmHeight , 1);
2201 check_pos(hwEdit, metrics.tmHeight + 2, 1, metrics.tmHeight , 1);
2202 check_pos(hwEdit, metrics.tmHeight + 10, 1, metrics.tmHeight , 1);
2203 DestroyWindow(hwEdit);
2204}
2205
2206static void test_text_position(void)
2207{
2208 trace("EDIT: Text position (Single line)\n");
2210 trace("EDIT: Text position (Multi line)\n");
2212}
2213
2214static void test_espassword(void)
2215{
2216 HWND hwEdit;
2217 LONG r;
2218 char buffer[1024];
2219 const char* password = "secret";
2220
2221 hwEdit = create_editcontrol(ES_PASSWORD, 0);
2222 r = get_edit_style(hwEdit);
2223 ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
2224 /* set text */
2225 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) password);
2226 ok(r == TRUE, "Expected: %d, got: %ld\n", TRUE, r);
2227
2228 /* select all, cut (ctrl-x) */
2229 SendMessageA(hwEdit, EM_SETSEL, 0, -1);
2230 r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
2231 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2232
2233 /* get text */
2234 r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
2235 ok(r == strlen(password), "Expected: %s, got len %ld\n", password, r);
2236 ok(strcmp(buffer, password) == 0, "expected %s, got %s\n", password, buffer);
2237
2238 r = open_clipboard(hwEdit);
2239 ok(r == TRUE, "expected %d, got %ld le=%lu\n", TRUE, r, GetLastError());
2240 r = EmptyClipboard();
2241 ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
2242 r = CloseClipboard();
2243 ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
2244
2245 /* select all, copy (ctrl-c) and paste (ctrl-v) */
2246 SendMessageA(hwEdit, EM_SETSEL, 0, -1);
2247 r = SendMessageA(hwEdit, WM_CHAR, 3, 0);
2248 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2249 r = SendMessageA(hwEdit, WM_CHAR, 22, 0);
2250 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2251
2252 /* get text */
2253 buffer[0] = 0;
2254 r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
2255 ok(r == 0, "Expected: 0, got: %ld\n", r);
2256 ok(strcmp(buffer, "") == 0, "expected empty string, got %s\n", buffer);
2257
2258 DestroyWindow (hwEdit);
2259}
2260
2261static void test_undo(void)
2262{
2263 HWND hwEdit;
2264 LONG r;
2265 DWORD cpMin, cpMax;
2266 char buffer[1024];
2267 const char* text = "undo this";
2268
2269 hwEdit = create_editcontrol(0, 0);
2270 r = get_edit_style(hwEdit);
2271 ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
2272
2273 /* set text */
2274 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) text);
2275 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2276
2277 /* select all, */
2278 cpMin = cpMax = 0xdeadbeef;
2279 SendMessageA(hwEdit, EM_SETSEL, 0, -1);
2280 r = SendMessageA(hwEdit, EM_GETSEL, (WPARAM) &cpMin, (LPARAM) &cpMax);
2281 ok((strlen(text) << 16) == r, "Unexpected length %ld\n", r);
2282 ok(0 == cpMin, "Expected: %d, got %ld\n", 0, cpMin);
2283 ok(9 == cpMax, "Expected: %d, got %ld\n", 9, cpMax);
2284
2285 /* cut (ctrl-x) */
2286 r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
2287 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2288
2289 /* get text */
2290 buffer[0] = 0;
2291 r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
2292 ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
2293 ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
2294
2295 /* undo (ctrl-z) */
2296 r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
2297 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2298
2299 /* get text */
2300 buffer[0] = 0;
2301 r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
2302 ok(strlen(text) == r, "Unexpected length %ld\n", r);
2303 ok(0 == strcmp(buffer, text), "expected %s, got %s\n", text, buffer);
2304
2305 /* undo again (ctrl-z) */
2306 r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
2307 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2308
2309 /* get text */
2310 buffer[0] = 0;
2311 r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
2312 ok(r == 0, "Expected: %d, got len %ld\n", 0, r);
2313 ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
2314
2315 DestroyWindow (hwEdit);
2316}
2317
2318static void test_enter(void)
2319{
2320 HWND hwEdit;
2321 LONG r;
2322 char buffer[16];
2323
2324 /* multiline */
2325 hwEdit = create_editcontrol(ES_MULTILINE, 0);
2326 r = get_edit_style(hwEdit);
2327 ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
2328
2329 /* set text */
2330 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2331 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2332
2333 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
2334 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2335
2336 /* get text */
2337 buffer[0] = 0;
2338 r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2339 ok(2 == r, "Expected: %d, got len %ld\n", 2, r);
2340 ok(0 == strcmp(buffer, "\r\n"), "expected \"\\r\\n\", got \"%s\"\n", buffer);
2341
2342 DestroyWindow (hwEdit);
2343
2344 /* single line */
2345 hwEdit = create_editcontrol(0, 0);
2346 r = get_edit_style(hwEdit);
2347 ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
2348
2349 /* set text */
2350 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2351 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2352
2353 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
2354 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2355
2356 /* get text */
2357 buffer[0] = 0;
2358 r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2359 ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
2360 ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
2361
2362 DestroyWindow (hwEdit);
2363
2364 /* single line with ES_WANTRETURN */
2365 hwEdit = create_editcontrol(ES_WANTRETURN, 0);
2366 r = get_edit_style(hwEdit);
2367 ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%lx\n", r);
2368
2369 /* set text */
2370 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2371 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2372
2373 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
2374 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2375
2376 /* get text */
2377 buffer[0] = 0;
2378 r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2379 ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
2380 ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
2381
2382 DestroyWindow (hwEdit);
2383}
2384
2385static void test_tab(void)
2386{
2387 HWND hwEdit;
2388 LONG r;
2389 char buffer[16];
2390
2391 /* multiline */
2392 hwEdit = create_editcontrol(ES_MULTILINE, 0);
2393 r = get_edit_style(hwEdit);
2394 ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
2395
2396 /* set text */
2397 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2398 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2399
2400 r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
2401 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2402
2403 /* get text */
2404 buffer[0] = 0;
2405 r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2406 ok(1 == r, "Expected: %d, got len %ld\n", 1, r);
2407 ok(0 == strcmp(buffer, "\t"), "expected \"\\t\", got \"%s\"\n", buffer);
2408
2409 DestroyWindow (hwEdit);
2410
2411 /* single line */
2412 hwEdit = create_editcontrol(0, 0);
2413 r = get_edit_style(hwEdit);
2414 ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
2415
2416 /* set text */
2417 r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
2418 ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
2419
2420 r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
2421 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2422
2423 /* get text */
2424 buffer[0] = 0;
2425 r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
2426 ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
2427 ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
2428
2429 DestroyWindow (hwEdit);
2430}
2431
2432static void test_edit_dialog(void)
2433{
2434 int r;
2435
2436 /* from bug 11841 */
2437 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 0);
2438 ok(333 == r, "Expected %d, got %d\n", 333, r);
2439 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 1);
2440 ok(111 == r, "Expected %d, got %d\n", 111, r);
2441 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 2);
2442 ok(444 == r, "Expected %d, got %d\n", 444, r);
2443
2444 /* more tests for WM_CHAR */
2445 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 3);
2446 ok(444 == r, "Expected %d, got %d\n", 444, r);
2447 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 4);
2448 ok(444 == r, "Expected %d, got %d\n", 444, r);
2449 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 5);
2450 ok(444 == r, "Expected %d, got %d\n", 444, r);
2451
2452 /* more tests for WM_KEYDOWN + WM_CHAR */
2453 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 6);
2454 ok(444 == r, "Expected %d, got %d\n", 444, r);
2455 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 7);
2456 ok(444 == r, "Expected %d, got %d\n", 444, r);
2457 r = DialogBoxParamA(hinst, "EDIT_READONLY_DIALOG", NULL, edit_dialog_proc, 8);
2458 ok(444 == r, "Expected %d, got %d\n", 444, r);
2459
2460 /* tests with an editable edit control */
2461 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 0);
2462 ok(333 == r, "Expected %d, got %d\n", 333, r);
2463 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 1);
2464 ok(111 == r, "Expected %d, got %d\n", 111, r);
2465 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 2);
2466 ok(444 == r, "Expected %d, got %d\n", 444, r);
2467
2468 /* tests for WM_CHAR */
2469 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 3);
2470 ok(444 == r, "Expected %d, got %d\n", 444, r);
2471 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 4);
2472 ok(444 == r, "Expected %d, got %d\n", 444, r);
2473 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 5);
2474 ok(444 == r, "Expected %d, got %d\n", 444, r);
2475
2476 /* tests for WM_KEYDOWN + WM_CHAR */
2477 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 6);
2478 ok(444 == r, "Expected %d, got %d\n", 444, r);
2479 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 7);
2480 ok(444 == r, "Expected %d, got %d\n", 444, r);
2481 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 8);
2482 ok(444 == r, "Expected %d, got %d\n", 444, r);
2483
2484 /* multiple tab tests */
2485 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 9);
2486 ok(22 == r, "Expected %d, got %d\n", 22, r);
2487 r = DialogBoxParamA(hinst, "EDIT_DIALOG", NULL, edit_dialog_proc, 10);
2488 ok(33 == r, "Expected %d, got %d\n", 33, r);
2489}
2490
2491static void test_multi_edit_dialog(void)
2492{
2493 int r;
2494
2495 /* test for multiple edit dialogs (bug 12319) */
2496 r = DialogBoxParamA(hinst, "MULTI_EDIT_DIALOG", NULL, multi_edit_dialog_proc, 0);
2497 ok(2222 == r, "Expected %d, got %d\n", 2222, r);
2498 r = DialogBoxParamA(hinst, "MULTI_EDIT_DIALOG", NULL, multi_edit_dialog_proc, 1);
2499 ok(1111 == r, "Expected %d, got %d\n", 1111, r);
2500 r = DialogBoxParamA(hinst, "MULTI_EDIT_DIALOG", NULL, multi_edit_dialog_proc, 2);
2501 ok(2222 == r, "Expected %d, got %d\n", 2222, r);
2502 r = DialogBoxParamA(hinst, "MULTI_EDIT_DIALOG", NULL, multi_edit_dialog_proc, 3);
2503 ok(11 == r, "Expected %d, got %d\n", 11, r);
2504}
2505
2507{
2508 int r;
2509
2510 /* tests for WM_KEYDOWN */
2511 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 0);
2512 ok(333 == r, "Expected %d, got %d\n", 333, r);
2513 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 1);
2514 ok(444 == r, "Expected %d, got %d\n", 444, r);
2515 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 2);
2516 ok(444 == r, "Expected %d, got %d\n", 444, r);
2517
2518 /* tests for WM_CHAR */
2519 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 3);
2520 ok(444 == r, "Expected %d, got %d\n", 444, r);
2521 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 4);
2522 ok(444 == r, "Expected %d, got %d\n", 444, r);
2523 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 5);
2524 ok(444 == r, "Expected %d, got %d\n", 444, r);
2525
2526 /* tests for WM_KEYDOWN + WM_CHAR */
2527 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 6);
2528 ok(444 == r, "Expected %d, got %d\n", 444, r);
2529 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 7);
2530 ok(444 == r, "Expected %d, got %d\n", 444, r);
2531 r = DialogBoxParamA(hinst, "EDIT_WANTRETURN_DIALOG", NULL, edit_wantreturn_dialog_proc, 8);
2532 ok(444 == r, "Expected %d, got %d\n", 444, r);
2533}
2534
2536{
2537 int r;
2538
2539 /* tests for WM_KEYDOWN */
2540 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 0);
2541 ok(222 == r, "Expected %d, got %d\n", 222, r);
2542 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 1);
2543 ok(111 == r, "Expected %d, got %d\n", 111, r);
2544 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 2);
2545 ok(444 == r, "Expected %d, got %d\n", 444, r);
2546
2547 /* tests for WM_CHAR */
2548 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 3);
2549 ok(444 == r, "Expected %d, got %d\n", 444, r);
2550 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 4);
2551 ok(444 == r, "Expected %d, got %d\n", 444, r);
2552 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 5);
2553 ok(444 == r, "Expected %d, got %d\n", 444, r);
2554
2555 /* tests for WM_KEYDOWN + WM_CHAR */
2556 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 6);
2557 ok(222 == r, "Expected %d, got %d\n", 222, r);
2558 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 7);
2559 ok(111 == r, "Expected %d, got %d\n", 111, r);
2560 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_DIALOG", NULL, edit_singleline_dialog_proc, 8);
2561 ok(444 == r, "Expected %d, got %d\n", 444, r);
2562
2563 /* tests for WM_KEYDOWN */
2564 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 0);
2565 ok(222 == r, "Expected %d, got %d\n", 222, r);
2566 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 1);
2567 ok(111 == r, "Expected %d, got %d\n", 111, r);
2568 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 2);
2569 ok(444 == r, "Expected %d, got %d\n", 444, r);
2570
2571 /* tests for WM_CHAR */
2572 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 3);
2573 ok(444 == r, "Expected %d, got %d\n", 444, r);
2574 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 4);
2575 ok(444 == r, "Expected %d, got %d\n", 444, r);
2576 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 5);
2577 ok(444 == r, "Expected %d, got %d\n", 444, r);
2578
2579 /* tests for WM_KEYDOWN + WM_CHAR */
2580 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 6);
2581 ok(222 == r, "Expected %d, got %d\n", 222, r);
2582 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 7);
2583 ok(111 == r, "Expected %d, got %d\n", 111, r);
2584 r = DialogBoxParamA(hinst, "EDIT_SINGLELINE_WANTRETURN_DIALOG", NULL, edit_singleline_dialog_proc, 8);
2585 ok(444 == r, "Expected %d, got %d\n", 444, r);
2586}
2587
2590{
2591 switch (msg)
2592 {
2593 case WM_DESTROY:
2594 case WM_NCDESTROY:
2595 break;
2596
2597 default:
2599 break;
2600 }
2601
2602 return FALSE;
2603}
2604
2606{
2607 HWND hwEdit, hwParent;
2608 int r;
2609
2610 hwEdit = create_child_editcontrol(0, 0);
2611 hwParent = GetParent(hwEdit);
2613 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
2614 ok(1 == r, "expected 1, got %d\n", r);
2617}
2618
2621static LRESULT (CALLBACK *p_edit_proc)(HWND, UINT, WPARAM, LPARAM);
2622
2624{
2625 switch (msg) {
2626 case WM_COMMAND:
2627 switch (HIWORD(wParam)) {
2628 case EN_SETFOCUS:
2630 break;
2631 }
2632 break;
2633 case WM_CAPTURECHANGED:
2634 if (hWnd != (HWND)lParam)
2635 {
2637 EndMenu();
2638 }
2639 break;
2640 }
2641 return DefWindowProcA(hWnd, msg, wParam, lParam);
2642}
2643
2645{
2646 switch (msg) {
2647 case WM_ENTERIDLE: {
2648 MENUBARINFO mbi;
2649 BOOL ret;
2650 HWND ctx_menu = (HWND)lParam;
2651
2652 memset(&mbi, 0, sizeof(mbi));
2653 mbi.cbSize = sizeof(mbi);
2654 SetLastError(0xdeadbeef);
2655 ret = GetMenuBarInfo(ctx_menu, OBJID_CLIENT, 0, &mbi);
2656 ok(ret, "GetMenuBarInfo failed\n");
2657 if (ret)
2658 {
2659 ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
2660 ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
2661 ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
2662 ok(mbi.fFocused, "mbi.fFocused = FALSE\n");
2663 }
2664
2665 memset(&mbi, 0, sizeof(mbi));
2666 mbi.cbSize = sizeof(mbi);
2667 SetLastError(0xdeadbeef);
2668 ret = GetMenuBarInfo(ctx_menu, OBJID_CLIENT, 1, &mbi);
2669 ok(ret, "GetMenuBarInfo failed\n");
2670 if (ret)
2671 {
2672 ok(mbi.hMenu != NULL, "mbi.hMenu = NULL\n");
2673 ok(!mbi.hwndMenu, "mbi.hwndMenu != NULL\n");
2674 ok(mbi.fBarFocused, "mbi.fBarFocused = FALSE\n");
2675 ok(!mbi.fFocused, "mbi.fFocused = TRUE\n");
2676 }
2677
2678 EndMenu();
2679 break;
2680 }
2681 }
2682 return p_edit_proc(hWnd, msg, wParam, lParam);
2683}
2684
2686{
2687 unsigned int wm_command, em_setsel;
2688};
2689
2691
2693{
2694 switch (msg) {
2695 case WM_ENTERIDLE:
2696 if (wParam == MSGF_MENU) {
2697 HWND hwndMenu = (HWND)lParam;
2698 MENUBARINFO mbi = { sizeof(MENUBARINFO) };
2699 if (GetMenuBarInfo(hwndMenu, OBJID_CLIENT, 0, &mbi)) {
2700 MENUITEMINFOA mii = { sizeof(MENUITEMINFOA), MIIM_STATE };
2701 if (GetMenuItemInfoA(mbi.hMenu, EM_SETSEL, FALSE, &mii)) {
2702 if (mii.fState & MFS_HILITE) {
2704 PostMessageA(hwnd, WM_KEYUP, VK_RETURN, 0x1c0001);
2705 }
2706 else {
2707 PostMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0x500001);
2708 PostMessageA(hwnd, WM_KEYUP, VK_DOWN, 0x500001);
2709 }
2710 }
2711 }
2712 }
2713 break;
2714 case WM_COMMAND:
2715 menu_messages.wm_command++;
2716 break;
2717 case EM_SETSEL:
2718 menu_messages.em_setsel++;
2719 break;
2720 }
2721 return CallWindowProcA(p_edit_proc, hwnd, msg, wParam, lParam);
2722}
2723
2724static void test_contextmenu(void)
2725{
2727 MSG msg;
2728
2730 0, 0, 200, 200, NULL, NULL, hinst, NULL);
2732
2733 hwndEdit = CreateWindowA("EDIT", NULL,
2735 0, 0, 150, 50, /* important this not be 0 size. */
2738
2739 SetFocus(NULL);
2742 ok(got_en_setfocus, "edit box didn't get focused\n");
2743 ok(got_wm_capturechanged, "main window capture did not change\n");
2744
2747
2749
2750 hwndEdit = CreateWindowA("EDIT", "Test Text",
2752 0, 0, 100, 100,
2753 hwndMain, NULL, hinst, NULL);
2754 memset(&menu_messages, 0, sizeof(menu_messages));
2755 p_edit_proc = (void*)SetWindowLongPtrA(hwndEdit, GWLP_WNDPROC,
2757
2762 ok(menu_messages.wm_command == 0,
2763 "Expected no WM_COMMAND messages, got %d\n", menu_messages.wm_command);
2764 ok(menu_messages.em_setsel == 1,
2765 "Expected 1 EM_SETSEL message, got %d\n", menu_messages.em_setsel);
2766
2769}
2770
2772{
2776 WNDCLASSA text_position;
2777
2778 test2.style = 0;
2779 test2.lpfnWndProc = ET2_WndProc;
2780 test2.cbClsExtra = 0;
2781 test2.cbWndExtra = 0;
2782 test2.hInstance = hinst;
2783 test2.hIcon = NULL;
2784 test2.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2785 test2.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2786 test2.lpszMenuName = NULL;
2787 test2.lpszClassName = szEditTest2Class;
2788 if (!RegisterClassA(&test2)) return FALSE;
2789
2790 test3.style = 0;
2791 test3.lpfnWndProc = edit3_wnd_procA;
2792 test3.cbClsExtra = 0;
2793 test3.cbWndExtra = 0;
2794 test3.hInstance = hinst;
2795 test3.hIcon = 0;
2796 test3.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
2797 test3.hbrBackground = GetStockObject(WHITE_BRUSH);
2798 test3.lpszMenuName = NULL;
2799 test3.lpszClassName = szEditTest3Class;
2800 if (!RegisterClassA(&test3)) return FALSE;
2801
2802 test4.style = 0;
2803 test4.lpfnWndProc = edit4_wnd_procA;
2804 test4.cbClsExtra = 0;
2805 test4.cbWndExtra = 0;
2806 test4.hInstance = hinst;
2807 test4.hIcon = NULL;
2808 test4.hCursor = LoadCursorA (NULL, (LPCSTR)IDC_ARROW);
2809 test4.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2810 test4.lpszMenuName = NULL;
2811 test4.lpszClassName = szEditTest4Class;
2812 if (!RegisterClassA(&test4)) return FALSE;
2813
2814 text_position.style = CS_HREDRAW | CS_VREDRAW;
2815 text_position.cbClsExtra = 0;
2816 text_position.cbWndExtra = 0;
2817 text_position.hInstance = hinst;
2818 text_position.hIcon = NULL;
2819 text_position.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
2820 text_position.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
2821 text_position.lpszMenuName = NULL;
2822 text_position.lpszClassName = szEditTextPositionClass;
2823 text_position.lpfnWndProc = DefWindowProcA;
2824 if (!RegisterClassA(&text_position)) return FALSE;
2825
2826 return TRUE;
2827}
2828
2829static void UnregisterWindowClasses (void)
2830{
2835}
2836
2837static void test_fontsize(void)
2838{
2839 HWND hwEdit;
2840 HFONT hfont;
2841 HDC hDC;
2842 LOGFONTA lf;
2843 LONG r;
2844 char szLocalString[MAXLEN];
2845 int dpi;
2846
2847 hDC = GetDC(NULL);
2849 ReleaseDC(NULL, hDC);
2850
2851 memset(&lf,0,sizeof(LOGFONTA));
2852 strcpy(lf.lfFaceName,"Arial");
2853 lf.lfHeight = -300; /* taller than the edit box */
2854 lf.lfWeight = 500;
2856
2857 trace("EDIT: Oversized font (Multi line)\n");
2859 0, 0, (150 * dpi) / 96, (50 * dpi) / 96, NULL, NULL,
2860 hinst, NULL);
2861
2863
2865 ShowWindow (hwEdit, SW_SHOW);
2866
2867 r = SendMessageA(hwEdit, WM_CHAR, 'A', 1);
2868 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2869 r = SendMessageA(hwEdit, WM_CHAR, 'B', 1);
2870 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2871 r = SendMessageA(hwEdit, WM_CHAR, 'C', 1);
2872 ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
2873
2874 GetWindowTextA(hwEdit, szLocalString, MAXLEN);
2875 ok(strcmp(szLocalString, "ABC")==0,
2876 "Wrong contents of edit: %s\n", szLocalString);
2877
2878 r = SendMessageA(hwEdit, EM_POSFROMCHAR,0,0);
2879 ok(r != -1,"EM_POSFROMCHAR failed index 0\n");
2880 r = SendMessageA(hwEdit, EM_POSFROMCHAR,1,0);
2881 ok(r != -1,"EM_POSFROMCHAR failed index 1\n");
2882 r = SendMessageA(hwEdit, EM_POSFROMCHAR,2,0);
2883 ok(r != -1,"EM_POSFROMCHAR failed index 2\n");
2884 r = SendMessageA(hwEdit, EM_POSFROMCHAR,3,0);
2885 ok(r == -1,"EM_POSFROMCHAR succeeded index 3\n");
2886
2887 DestroyWindow (hwEdit);
2889}
2890
2892{
2894};
2895
2897
2898static void zero_dm_messages(void)
2899{
2900 dm_messages.wm_command = 0;
2901 dm_messages.wm_close = 0;
2902 dm_messages.wm_getdefid = 0;
2903 dm_messages.wm_nextdlgctl = 0;
2904}
2905
2906#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl) \
2907 ok(dm_messages.wm_command == wmcommand, "expected %d WM_COMMAND messages, " \
2908 "got %d\n", wmcommand, dm_messages.wm_command); \
2909 ok(dm_messages.wm_close == wmclose, "expected %d WM_CLOSE messages, " \
2910 "got %d\n", wmclose, dm_messages.wm_close); \
2911 ok(dm_messages.wm_getdefid == wmgetdefid, "expected %d WM_GETDIFID messages, " \
2912 "got %d\n", wmgetdefid, dm_messages.wm_getdefid);\
2913 ok(dm_messages.wm_nextdlgctl == wmnextdlgctl, "expected %d WM_NEXTDLGCTL messages, " \
2914 "got %d\n", wmnextdlgctl, dm_messages.wm_nextdlgctl)
2915
2917{
2918 switch (iMsg)
2919 {
2920 case WM_COMMAND:
2921 dm_messages.wm_command++;
2922 break;
2923 case DM_GETDEFID:
2924 dm_messages.wm_getdefid++;
2926 case WM_NEXTDLGCTL:
2927 dm_messages.wm_nextdlgctl++;
2928 break;
2929 case WM_CLOSE:
2930 dm_messages.wm_close++;
2931 break;
2932 }
2933
2934 return DefWindowProcA(hwnd, iMsg, wParam, lParam);
2935}
2936
2937static void test_dialogmode(void)
2938{
2939 HWND hwEdit, hwParent, hwButton;
2940 MSG msg= {0};
2941 int len, r;
2943
2944 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2945 ok(1 == r, "expected 1, got %d\n", r);
2946 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2947 ok(11 == len, "expected 11, got %d\n", len);
2948
2949 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, 0);
2950 ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2951
2952 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2953 ok(1 == r, "expected 1, got %d\n", r);
2954 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2955 ok(13 == len, "expected 13, got %d\n", len);
2956
2957 r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
2958 ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2959 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2960 ok(1 == r, "expected 1, got %d\n", r);
2961 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2962 ok(13 == len, "expected 13, got %d\n", len);
2963
2964 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2965 ok(1 == r, "expected 1, got %d\n", r);
2966 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2967 ok(13 == len, "expected 13, got %d\n", len);
2968
2970
2971 hwEdit = create_editcontrol(ES_MULTILINE, 0);
2972
2973 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2974 ok(1 == r, "expected 1, got %d\n", r);
2975 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2976 ok(11 == len, "expected 11, got %d\n", len);
2977
2978 msg.hwnd = hwEdit;
2979 msg.message = WM_KEYDOWN;
2980 msg.wParam = VK_BACK;
2981 msg.lParam = 0xe0001;
2983 ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
2984
2985 r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
2986 ok(1 == r, "expected 1, got %d\n", r);
2987 len = SendMessageA(hwEdit, WM_GETTEXTLENGTH, 0, 0);
2988 ok(11 == len, "expected 11, got %d\n", len);
2989
2990 DestroyWindow(hwEdit);
2991
2992 hwEdit = create_child_editcontrol(0, 0);
2993 hwParent = GetParent(hwEdit);
2995
2997 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
2998 ok(1 == r, "expected 1, got %d\n", r);
2999 test_dm_messages(0, 0, 0, 0);
3001
3002 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
3003 ok(1 == r, "expected 1, got %d\n", r);
3004 test_dm_messages(0, 0, 0, 0);
3006
3007 msg.hwnd = hwEdit;
3008 msg.message = WM_KEYDOWN;
3009 msg.wParam = VK_TAB;
3010 msg.lParam = 0xf0001;
3012 ok(0x89 == r, "expected 0x89, got 0x%x\n", r);
3013 test_dm_messages(0, 0, 0, 0);
3015
3016 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
3017 ok(1 == r, "expected 1, got %d\n", r);
3018 test_dm_messages(0, 0, 0, 0);
3020
3022
3024 hwParent = GetParent(hwEdit);
3026
3027 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
3028 ok(1 == r, "expected 1, got %d\n", r);
3029 test_dm_messages(0, 0, 0, 0);
3031
3032 msg.hwnd = hwEdit;
3033 msg.message = WM_KEYDOWN;
3034 msg.wParam = VK_ESCAPE;
3035 msg.lParam = 0x10001;
3037 ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
3038 test_dm_messages(0, 0, 0, 0);
3040
3041 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_ESCAPE, 0x10001);
3042 ok(1 == r, "expected 1, got %d\n", r);
3043 test_dm_messages(0, 0, 0, 0);
3045
3046 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_TAB, 0xf0001);
3047 ok(1 == r, "expected 1, got %d\n", r);
3048 test_dm_messages(0, 0, 0, 1);
3050
3051 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
3052 ok(1 == r, "expected 1, got %d\n", r);
3053 test_dm_messages(0, 0, 1, 0);
3055
3056 hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
3057 100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
3058 ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
3059
3060 r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
3061 ok(1 == r, "expected 1, got %d\n", r);
3062 test_dm_messages(0, 0, 1, 1);
3064
3065 DestroyWindow(hwButton);
3067}
3068
3069static void test_EM_GETHANDLE(void)
3070{
3071 static const char str0[] = "untouched";
3072 static const char str1[] = "1111+1111+1111#";
3073 static const char str1_1[] = "2111+1111+1111#";
3074 static const char str2[] = "2222-2222-2222-2222#";
3075 static const char str3[] = "3333*3333*3333*3333*3333#";
3076 CHAR current[42];
3077 HWND hEdit;
3078 HLOCAL hmem;
3079 HLOCAL hmem2;
3080 HLOCAL halloc;
3081 char *buffer;
3082 int len;
3083 int r;
3084
3085 trace("EDIT: EM_GETHANDLE\n");
3086
3087 /* EM_GETHANDLE is not supported for a single line edit control */
3089 ok(hEdit != NULL, "got %p (expected != NULL)\n", hEdit);
3090
3091 hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
3092 ok(hmem == NULL, "got %p (expected NULL)\n", hmem);
3094
3095
3096 /* EM_GETHANDLE needs a multiline edit control */
3098 ok(hEdit != NULL, "got %p (expected != NULL)\n", hEdit);
3099
3100 /* set some text */
3103 ok((r == 1) && (len == lstrlenA(str1)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str1));
3104
3105 lstrcpyA(current, str0);
3107 ok((r == lstrlenA(str1)) && !lstrcmpA(current, str1),
3108 "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1), str1);
3109
3110 hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
3111 ok(hmem != NULL, "got %p (expected != NULL)\n", hmem);
3112 /* The buffer belongs to the app now. According to MSDN, the app has to LocalFree the
3113 buffer, LocalAlloc a new buffer and pass it to the edit control with EM_SETHANDLE. */
3114
3115 buffer = LocalLock(hmem);
3116 ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
3117 len = lstrlenA(buffer);
3118 ok((len == lstrlenA(str1)) && !lstrcmpA(buffer, str1),
3119 "got %d and \"%s\" (expected %d and \"%s\")\n", len, buffer, lstrlenA(str1), str1);
3120 LocalUnlock(hmem);
3121
3122 /* See if WM_GETTEXTLENGTH/WM_GETTEXT still work. */
3124 ok(len == lstrlenA(str1), "Unexpected text length %d.\n", len);
3125
3126 lstrcpyA(current, str0);
3128 ok((r == lstrlenA(str1)) && !lstrcmpA(current, str1),
3129 "Unexpected retval %d and text \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1), str1);
3130
3131 /* Application altered buffer contents, see if WM_GETTEXTLENGTH/WM_GETTEXT pick that up. */
3132 buffer = LocalLock(hmem);
3133 ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
3134 buffer[0] = '2';
3135 LocalUnlock(hmem);
3136
3138 ok(len == lstrlenA(str1_1), "Unexpected text length %d.\n", len);
3139
3140 lstrcpyA(current, str0);
3142 ok((r == lstrlenA(str1_1)) && !lstrcmpA(current, str1_1),
3143 "Unexpected retval %d and text \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str1_1), str1_1);
3144
3145 /* See if WM_SETTEXT/EM_REPLACESEL work. */
3147 ok(r, "Failed to set text.\n");
3148
3149 buffer = LocalLock(hmem);
3150 ok(buffer != NULL && buffer[0] == '1', "Unexpected buffer contents\n");
3151 LocalUnlock(hmem);
3152
3153 r = SendMessageA(hEdit, EM_REPLACESEL, 0, (LPARAM)str1_1);
3154 ok(r, "Failed to replace selection.\n");
3155
3156 buffer = LocalLock(hmem);
3157 ok(buffer != NULL && buffer[0] == '2', "Unexpected buffer contents\n");
3158 LocalUnlock(hmem);
3159
3160 /* use LocalAlloc first to get a different handle */
3161 halloc = LocalAlloc(LMEM_MOVEABLE, 42);
3162 ok(halloc != NULL, "got %p (expected != NULL)\n", halloc);
3163 /* prepare our new memory */
3164 buffer = LocalLock(halloc);
3165 ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
3167 LocalUnlock(halloc);
3168
3169 /* LocalFree the old memory handle before EM_SETHANDLE the new handle */
3170 LocalFree(hmem);
3171 /* use LocalAlloc after the LocalFree to likely consume the handle */
3172 hmem2 = LocalAlloc(LMEM_MOVEABLE, 42);
3173 ok(hmem2 != NULL, "got %p (expected != NULL)\n", hmem2);
3174
3175 SendMessageA(hEdit, EM_SETHANDLE, (WPARAM)halloc, 0);
3176
3178 ok(len == lstrlenA(str2), "got %d (expected %d)\n", len, lstrlenA(str2));
3179
3180 lstrcpyA(current, str0);
3182 ok((r == lstrlenA(str2)) && !lstrcmpA(current, str2),
3183 "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str2), str2);
3184
3185 /* set a different text */
3186 r = SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)str3);
3188 ok((r == 1) && (len == lstrlenA(str3)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str3));
3189
3190 lstrcpyA(current, str0);
3192 ok((r == lstrlenA(str3)) && !lstrcmpA(current, str3),
3193 "got %d and \"%s\" (expected %d and \"%s\")\n", r, current, lstrlenA(str3), str3);
3194
3195 LocalFree(hmem2);
3197
3198 /* Some apps have bugs ... */
3200
3201 /* set some text */
3204 ok((r == 1) && (len == lstrlenA(str1)), "got %d and %d (expected 1 and %d)\n", r, len, lstrlenA(str1));
3205
3206 /* everything is normal up to EM_GETHANDLE */
3207 hmem = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
3208 /* Some messages still work while other messages fail.
3209 After LocalFree the memory handle, messages can crash the app */
3210
3211 /* A buggy editor used EM_GETHANDLE twice */
3212 hmem2 = (HGLOBAL) SendMessageA(hEdit, EM_GETHANDLE, 0, 0);
3213 ok(hmem2 == hmem, "got %p (expected %p)\n", hmem2, hmem);
3214
3215 /* Let the edit control free the memory handle */
3217
3219}
3220
3221/* In Windows 10+, the WM_PASTE message isn't always successful.
3222 * So retry in case of failure.
3223 */
3224#define check_paste(a, b) _check_paste(__LINE__, (a), (b))
3225static void _check_paste(unsigned int line, HWND hedit, const char *content)
3226{
3227 /* only retry on windows platform */
3228 int tries = strcmp(winetest_platform, "wine") ? 3 : 1;
3229 int len = 0;
3230
3231 SendMessageA(hedit, WM_SETTEXT, 0, (LPARAM)"");
3232 do
3233 {
3234 SendMessageA(hedit, WM_PASTE, 0, 0);
3235 if ((len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0))) break;
3236 Sleep(1);
3237 } while (--tries > 0);
3238 ok_(__FILE__, line)(len == strlen(content), "Unexpected len %u in edit\n", len);
3239}
3240
3241static void test_paste(void)
3242{
3243 HWND hEdit, hMultilineEdit;
3244 HANDLE hmem, hmem_ret;
3245 char *buffer;
3246 int r;
3247 static const char *str = "this is a simple text";
3248 static const char *str2 = "first line\r\nsecond line";
3249
3252
3253 /* Prepare clipboard data with simple text */
3254 hmem = GlobalAlloc(GMEM_MOVEABLE, 255);
3255 ok(hmem != NULL, "got %p (expected != NULL)\n", hmem);
3256 buffer = GlobalLock(hmem);
3257 ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
3258 strcpy(buffer, str);
3259 GlobalUnlock(hmem);
3260
3262 ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
3263 r = EmptyClipboard();
3264 ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
3265 hmem_ret = SetClipboardData(CF_TEXT, hmem);
3266 ok(hmem_ret == hmem, "expected %p, got %p\n", hmem, hmem_ret);
3267 r = CloseClipboard();
3268 ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
3269
3270 /* Paste single line */
3272
3273 /* Prepare clipboard data with multiline text */
3274 hmem = GlobalAlloc(GMEM_MOVEABLE, 255);
3275 ok(hmem != NULL, "got %p (expected != NULL)\n", hmem);
3276 buffer = GlobalLock(hmem);
3277 ok(buffer != NULL, "got %p (expected != NULL)\n", buffer);
3278 strcpy(buffer, str2);
3279 GlobalUnlock(hmem);
3280
3282 ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
3283 r = EmptyClipboard();
3284 ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
3285 hmem_ret = SetClipboardData(CF_TEXT, hmem);
3286 ok(hmem_ret == hmem, "expected %p, got %p\n", hmem, hmem_ret);
3287 r = CloseClipboard();
3288 ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
3289
3290 /* Paste multiline text in singleline edit - should be cut */
3291 check_paste(hEdit, "first line");
3292
3293 /* Paste multiline text in multiline edit */
3294 check_paste(hMultilineEdit, str2);
3295
3296 /* Cleanup */
3298 DestroyWindow(hMultilineEdit);
3299}
3300
3301static void test_EM_GETLINE(void)
3302{
3303 HWND hwnd[2];
3304 int i;
3305
3308
3309 for (i = 0; i < ARRAY_SIZE(hwnd); i++)
3310 {
3311 static const WCHAR strW[] = {'t','e','x','t',0};
3312 static const char *str = "text";
3313 WCHAR buffW[16];
3314 char buff[16];
3315 int r;
3316
3317 if (i == 0)
3318 ok(!IsWindowUnicode(hwnd[i]), "Expected ansi window.\n");
3319 else
3320 ok(IsWindowUnicode(hwnd[i]), "Expected unicode window.\n");
3321
3323
3324 memset(buff, 0, sizeof(buff));
3325 *(WORD *)buff = sizeof(buff);
3327 ok(r == strlen(str), "Failed to get a line %d.\n", r);
3328 ok(!strcmp(buff, str), "Unexpected line data %s.\n", buff);
3329
3330 memset(buff, 0, sizeof(buff));
3331 *(WORD *)buff = sizeof(buff);
3333 ok(r == strlen(str), "Failed to get a line %d.\n", r);
3334 ok(!strcmp(buff, str), "Unexpected line data %s.\n", buff);
3335
3336 memset(buffW, 0, sizeof(buffW));
3337 *(WORD *)buffW = ARRAY_SIZE(buffW);
3338 r = SendMessageW(hwnd[i], EM_GETLINE, 0, (LPARAM)buffW);
3339 ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
3340 ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
3341
3342 memset(buffW, 0, sizeof(buffW));
3343 *(WORD *)buffW = ARRAY_SIZE(buffW);
3344 r = SendMessageW(hwnd[i], EM_GETLINE, 1, (LPARAM)buffW);
3345 ok(r == lstrlenW(strW), "Failed to get a line %d.\n", r);
3346 ok(!lstrcmpW(buffW, strW), "Unexpected line data %s.\n", wine_dbgstr_w(buffW));
3347
3349 }
3350}
3351
3352static int CALLBACK test_wordbreak_procA(char *text, int current, int length, int code)
3353{
3354 return -1;
3355}
3356
3357static void test_wordbreak_proc(void)
3358{
3360 LRESULT ret;
3361 HWND hwnd;
3362
3364
3365 proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
3366 ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
3367
3369 ok(ret == 1, "Unexpected return value %Id.\n", ret);
3370
3371 proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
3372 ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc);
3373
3375 ok(ret == 1, "Unexpected return value %Id.\n", ret);
3376
3377 proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
3378 ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
3379
3381}
3382
3383static void test_dbcs_WM_CHAR(void)
3384{
3385 HKL hkl;
3386 UINT cp;
3387 WCHAR textW[] = { 0x4e00, 0x4e8c, 0x4e09, 0 }; /* one, two, three */
3388 unsigned char bytes[7];
3389 BOOL hasdefault;
3390 HWND hwnd[2];
3391 int i;
3392
3393 hkl = GetKeyboardLayout( 0 );
3394 if (!GetLocaleInfoW(LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR)))
3395 cp = CP_ACP;
3396
3398 if (hasdefault || !IsDBCSLeadByteEx(cp, bytes[0]))
3399 {
3400 skip("Skipping DBCS WM_CHAR test in the %d codepage\n", cp);
3401 return;
3402 }
3405
3406 for (i = 0; i < ARRAY_SIZE(hwnd); i++)
3407 {
3408 const unsigned char* p;
3409 WCHAR strW[4];
3410 char str[7];
3411 MSG msg;
3412 BOOL r;
3413 int n;
3414
3415 winetest_push_context("%c", i ? 'W' : 'A');
3416
3417 r = SetWindowTextA(hwnd[i], "");
3418 ok(r, "SetWindowText failed\n");
3419
3420 /* sending the lead byte separately works for DBCS locales */
3421 for (p = bytes; *p; p++)
3422 PostMessageA(hwnd[i], WM_CHAR, *p, 1);
3423
3424 while (PeekMessageA(&msg, hwnd[i], 0, 0, PM_REMOVE))
3426
3428 ok(n > 0, "GetWindowTextW failed\n");
3429 ok(!wcscmp(strW, textW), "got %s, expected %s\n",
3431
3433 ok(n > 0, "GetWindowText failed\n");
3434 ok(!strcmp(str, (char*)bytes), "got %s, expected %s\n",
3436
3438
3440 }
3441}
3442
3443static void test_format_rect(void)
3444{
3445 HWND edit;
3446 RECT rect, old_rect;
3447
3448 static const struct
3449 {
3450 int style_ex;
3451 RECT input;
3452 int expected_equal;
3453 }
3454 tests[] =
3455 {
3456 {0, {0, 0, 0, 0}, 1},
3457 {0, {0, 0, 10, 10}, 1},
3458 {0, {1, 1, 10, 10}, 1},
3459 {0, {1, 1, 10, 250}, 1},
3460 {0, {1, 1, 250, 10}, 1},
3461 {0, {1, 1, 10, 1000}, 1},
3462 {0, {1, 1, 1000, 10}, 1},
3463 {0, {1, 1, 1000, 1000}, 0},
3464 {WS_EX_CLIENTEDGE, {0, 0, 0, 0}, 1},
3465 {WS_EX_CLIENTEDGE, {0, 0, 10, 10}, 1},
3466 {WS_EX_CLIENTEDGE, {1, 1, 10, 10}, 1},
3467 {WS_EX_CLIENTEDGE, {1, 1, 10, 250}, 1},
3468 {WS_EX_CLIENTEDGE, {1, 1, 250, 10}, 1},
3469 {WS_EX_CLIENTEDGE, {1, 1, 10, 1000}, 1},
3470 {WS_EX_CLIENTEDGE, {1, 1, 1000, 10}, 1},
3471 {WS_EX_CLIENTEDGE, {1, 1, 1000, 1000}, 0}
3472 };
3473
3474 for (int i = 0; i < ARRAY_SIZE(tests); i++)
3475 {
3476 edit = create_editcontrol(ES_MULTILINE | WS_VISIBLE, tests[i].style_ex);
3477
3478 SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&old_rect);
3479 SetWindowTextA(edit, "Test Test Test\r\n\r\nTest Test Test Test Test Test Test Test Test Test Test Test\r\n\r\nTest Test Test");
3480 SendMessageA(edit, EM_SETRECT, 0, (LPARAM)&tests[i].input);
3481 SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&rect);
3482
3483 if (tests[i].expected_equal)
3484 ok(EqualRect(&old_rect, &rect), "Expected format rectangle to be equal to client rectangle.\n");
3485 else
3486 ok((rect.right - rect.left) > (old_rect.right - old_rect.left), "Expected format rect to be larger than client rectangle.\n");
3487 DestroyWindow(edit);
3488 }
3489}
3490
3492{
3493 BOOL b;
3494
3497 ok (b, "RegisterWindowClasses failed\n");
3498 if (!b) return;
3499
3509 test_margins();
3513 test_undo();
3514 test_enter();
3515 test_tab();
3521 test_fontsize();
3525 test_paste();
3530
3532}
static HDC hDC
Definition: 3dtext.c:33
static HFONT hfont
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
Arabic default style
Definition: afstyles.h:94
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define CF_TEXT
Definition: constants.h:396
#define ARRAY_SIZE(A)
Definition: main.h:20
static RECT margins
Definition: print.c:55
CFF_Charset charset
Definition: cffcmap.c:137
WPARAM wParam
Definition: combotst.c:138
HWND hwndEdit
Definition: combotst.c:65
LPARAM lParam
Definition: combotst.c:139
HDC dc
Definition: cylfrac.c:34
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
content
Definition: atl_ax.c:994
static int get_cjk_fontinfo_margin(int width, int side_bearing)
Definition: edit.c:2770
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
#define WideCharToMultiByte
Definition: compat.h:111
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define lstrlenW
Definition: compat.h:750
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
BOOL WINAPI IsDBCSLeadByteEx(UINT codepage, BYTE testchar)
Definition: locale.c:2106
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
const WCHAR * text
Definition: package.c:1794
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
return ret
Definition: mutex.c:146
void test2()
Definition: ehthrow.cxx:284
void test4()
Definition: ehthrow.cxx:298
void test3()
Definition: ehthrow.cxx:291
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLdouble GLdouble right
Definition: glext.h:10859
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1616
BOOL NTAPI LocalUnlock(HLOCAL hMem)
Definition: heapmem.c:1805
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
#define fs
Definition: i386-dis.c:444
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
POINT cp
Definition: magnifier.c:59
const char * winetest_platform
int winetest_interactive
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
#define todo_wine
Definition: minitest.h:80
#define LMEM_MOVEABLE
Definition: minwinbase.h:82
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
struct task_struct * current
Definition: linux.c:32
static struct test_info tests[]
HDC hdc
Definition: main.c:9
static struct dialog_mode_messages dm_messages
Definition: edit.c:2761
static LRESULT CALLBACK ET2_WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:833
static void test_edit_control_limittext(void)
Definition: edit.c:1440
static void test_edit_dialog(void)
Definition: edit.c:2328
static INT_PTR CALLBACK child_edit_wmkeydown_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:2485
static HWND create_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:558
static const char szEditTest2Class[]
Definition: edit.c:553
static HWND create_child_editcontrol(DWORD style, DWORD exstyle)
Definition: edit.c:582
static LRESULT CALLBACK dialog_mode_wnd_proc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2781
static void test_margins_usefontinfo(UINT charset)
Definition: edit.c:1522
static void test_paste(void)
Definition: edit.c:3087
static struct context_menu_messages menu_messages
Definition: edit.c:2546
static void zero_notify(void)
Definition: edit.c:844
static HWND create_editcontrolW(DWORD style, DWORD exstyle)
Definition: edit.c:571
#define check_pos(hwEdit, set_height, test_top, test_height, test_left)
Definition: edit.c:1969
static void zero_dm_messages(void)
Definition: edit.c:2763
static void test_edit_control_3(void)
Definition: edit.c:946
static struct edit_notify notifications
Definition: edit.c:54
static void test_EM_GETLINE(void)
Definition: edit.c:3156
static HWND hwndET2
Definition: edit.c:552
static void UnregisterWindowClasses(void)
Definition: edit.c:2694
static LRESULT CALLBACK child_edit_menu_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2548
static LRESULT CALLBACK edit4_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2519
static void test_multi_edit_dialog(void)
Definition: edit.c:2387
static void test_wantreturn_edit_dialog(void)
Definition: edit.c:2402
static DWORD get_cjk_font_margins(HDC hdc)
Definition: edit.c:1636
static BOOL got_wm_capturechanged
Definition: edit.c:2516
static void test_edit_control_5(void)
Definition: edit.c:1349
static void test_margins_font_change(void)
Definition: edit.c:1874
static void test_edit_control_6(void)
Definition: edit.c:1405
static void test_contextmenu(void)
Definition: edit.c:2586
static void ET2_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: edit.c:827
static INT_PTR CALLBACK edit_wantreturn_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:422
static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:861
static void test_margins_default(const char *facename, UINT charset)
Definition: edit.c:1653
static BOOL got_en_setfocus
Definition: edit.c:2515
static void test_char_from_pos(void)
Definition: edit.c:1188
static void set_client_height(HWND Wnd, unsigned Height)
Definition: edit.c:646
static void test_dialogmode(void)
Definition: edit.c:2802
static const char szEditTextPositionClass[]
Definition: edit.c:556
static void test_wordbreak_proc(void)
Definition: edit.c:3209
static void test_edit_control_scroll(void)
Definition: edit.c:1467
static void destroy_child_editcontrol(HWND hwndEdit)
Definition: edit.c:613
static void test_singleline_wantreturn_edit_dialog(void)
Definition: edit.c:2431
static void test_espassword(void)
Definition: edit.c:2110
static const char szEditTest4Class[]
Definition: edit.c:555
static INT CALLBACK find_font_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lParam)
Definition: edit.c:1754
#define ID_EDITTESTDBUTTON
Definition: edit.c:32
static const char szEditTest3Class[]
Definition: edit.c:554
static void test_child_edit_wmkeydown(void)
Definition: edit.c:2501
static LONG get_edit_style(HWND hwnd)
Definition: edit.c:623
static void test_edit_control_1(void)
Definition: edit.c:676
#define test_notify(enchange, enmaxtext, enupdate)
Definition: edit.c:851
static INT_PTR CALLBACK multi_edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:56
static int CALLBACK test_wordbreak_procA(char *text, int current, int length, int code)
Definition: edit.c:3204
static void test_undo(void)
Definition: edit.c:2157
static void test_margins(void)
Definition: edit.c:1771
static INT_PTR CALLBACK edit_singleline_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:303
static void test_enter(void)
Definition: edit.c:2214
#define ID_EDITTEST2
Definition: edit.c:33
static void ET2_check_change(void)
Definition: edit.c:813
static BOOL is_font_installed(const char *name)
Definition: edit.c:1759
static void test_EM_GETHANDLE(void)
Definition: edit.c:2934
#define ES_COMBO
Definition: edit.c:29
static void test_text_position_style(DWORD style)
Definition: edit.c:1981
static int child_edit_wmkeydown_num_messages
Definition: edit.c:2484
static void test_text_position(void)
Definition: edit.c:2102
static INT_PTR CALLBACK edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: edit.c:155
static HINSTANCE hinst
Definition: edit.c:551
#define MAXLEN
Definition: edit.c:34
#define test_dm_messages(wmcommand, wmclose, wmgetdefid, wmnextdlgctl)
Definition: edit.c:2771
static void test_fontsize(void)
Definition: edit.c:2702
static void test_edit_control_2(void)
Definition: edit.c:744
static void test_tab(void)
Definition: edit.c:2281
static HDC
Definition: imagelist.c:88
static const WCHAR textW[]
Definition: itemdlg.c:1559
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:548
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:538
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
static HMODULE hgdi32
Definition: font.c:65
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define open_clipboard(hwnd)
Definition: editor.c:4816
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
WCHAR strW[12]
Definition: clipboard.c:2216
static const WCHAR testtextW[]
Definition: dialog.c:1458
static WNDPROC orig_class_proc
Definition: edit.c:1786
static LRESULT CALLBACK test_class_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: edit.c:1788
static BOOL is_cjk_charset(HDC dc)
Definition: edit.c:1498
#define check_paste(a, b)
Definition: edit.c:3224
static void _check_paste(unsigned int line, HWND hedit, const char *content)
Definition: edit.c:3225
static void test_initialization(void)
Definition: edit.c:1829
static void edit_pos_ok_(unsigned line, DWORD exp, DWORD got, const char *txt)
Definition: edit.c:2068
static void test_format_rect(void)
Definition: edit.c:3443
static BOOL is_cjk_font(HDC dc)
Definition: edit.c:1612
static LRESULT CALLBACK edit_proc_proxy(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:2644
static BOOL RegisterWindowClasses(void)
Definition: edit.c:2771
static void test_dbcs_WM_CHAR(void)
Definition: edit.c:3383
DWORD exp
Definition: msg.c:18625
static WCHAR password[]
Definition: url.c:33
#define min(a, b)
Definition: monoChain.cc:55
HKL hkl
Definition: msctf.idl:632
UINT_PTR HKL
Definition: msctf.idl:125
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
#define LRESULT
Definition: ole.h:14
#define HGLOBAL
Definition: ole.h:15
static HANDLE proc()
Definition: pdb.c:32
#define LOWORD(l)
Definition: pedump.c:82
#define ES_PASSWORD
Definition: pedump.c:670
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define ES_READONLY
Definition: pedump.c:675
#define ES_LOWERCASE
Definition: pedump.c:669
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_WANTRETURN
Definition: pedump.c:676
#define ES_UPPERCASE
Definition: pedump.c:668
#define WS_BORDER
Definition: pedump.c:625
#define ES_NOHIDESEL
Definition: pedump.c:673
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
#define ES_LEFT
Definition: pedump.c:664
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define ES_MULTILINE
Definition: pedump.c:667
#define EM_POSFROMCHAR
Definition: richedit.h:77
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define EM_CHARFROMPOS
Definition: richedit.h:78
#define EM_GETLIMITTEXT
Definition: richedit.h:74
WCHAR classname[128]
Definition: startup.c:15
const WCHAR * str
strcpy
Definition: string.h:131
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35
#define memset(x, y, z)
Definition: compat.h:39
static HWND hEdit
Definition: autocomplete.c:34
HWND hwndMain
Definition: solitaire.cpp:13
& rect
Definition: startmenu.cpp:1413
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
Definition: wingdi.h:1856
int abcA
Definition: wingdi.h:1857
int abcC
Definition: wingdi.h:1859
HBRUSH hbrBackground
Definition: winuser.h:3278
HICON hIcon
Definition: winuser.h:3276
HINSTANCE hInstance
Definition: winuser.h:3275
HCURSOR hCursor
Definition: winuser.h:3277
int cbWndExtra
Definition: winuser.h:3274
UINT style
Definition: winuser.h:3271
LPCSTR lpszMenuName
Definition: winuser.h:3279
LPCSTR lpszClassName
Definition: winuser.h:3280
WNDPROC lpfnWndProc
Definition: winuser.h:3272
int cbClsExtra
Definition: winuser.h:3273
Definition: inflate.c:139
unsigned int em_setsel
Definition: edit.c:2543
unsigned int wm_command
Definition: edit.c:2543
int en_maxtext
Definition: edit.c:51
int en_change
Definition: edit.c:51
int en_update
Definition: edit.c:51
Definition: ffs.h:70
Definition: parser.c:49
Definition: tftpd.h:60
Definition: name.c:39
BOOL fBarFocused
Definition: winuser.h:3838
DWORD cbSize
Definition: winuser.h:3834
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
#define GWLP_WNDPROC
Definition: treelist.c:66
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
#define MAKEWORD(a, b)
Definition: typedefs.h:248
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
#define dpi
Definition: sysparams.c:23
static const WCHAR editW[]
Definition: edit.c:5529
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1300
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define OBJID_CLIENT
Definition: winable.h:19
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MAKEINTATOM(i)
Definition: winbase.h:1220
#define GMEM_MOVEABLE
Definition: winbase.h:318
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define HANGUL_CHARSET
Definition: wingdi.h:388
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define FS_JOHAB
Definition: wingdi.h:574
BOOL WINAPI GetCharABCWidthsA(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
int WINAPI GetTextCharsetInfo(_In_ HDC, _Out_opt_ LPFONTSIGNATURE, _In_ DWORD)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FS_WANSUNG
Definition: wingdi.h:572
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2314
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define TMPF_TRUETYPE
Definition: wingdi.h:1313
#define GREEK_CHARSET
Definition: wingdi.h:391
#define WHITE_BRUSH
Definition: wingdi.h:902
int WINAPI EnumFontFamiliesA(_In_ HDC, _In_opt_ LPCSTR, _In_ FONTENUMPROCA, _In_ LPARAM)
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:390
#define TMPF_VECTOR
Definition: wingdi.h:1312
#define ANSI_CHARSET
Definition: wingdi.h:383
#define FS_JISJAPAN
Definition: wingdi.h:570
#define FS_CHINESETRAD
Definition: wingdi.h:573
#define FS_CHINESESIMP
Definition: wingdi.h:571
DWORD WINAPI GdiGetCodePage(HDC)
#define FW_NORMAL
Definition: wingdi.h:373
#define SYSTEM_FONT
Definition: wingdi.h:911
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define EASTEUROPE_CHARSET
Definition: wingdi.h:399
#define GB2312_CHARSET
Definition: wingdi.h:389
BOOL WINAPI GetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:45
HWND WINAPI GetFocus(void)
Definition: window.c:1863
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CS_VREDRAW
Definition: winuser.h:666
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI EndMenu(void)
#define SetWindowLongPtrA
Definition: winuser.h:5511
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define EM_GETRECT
Definition: winuser.h:2025
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
#define WM_CLOSE
Definition: winuser.h:1649
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define VK_TAB
Definition: winuser.h:2235
#define SB_LINEUP
Definition: winuser.h:564
#define WM_PASTE
Definition: winuser.h:1891
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define WM_KEYUP
Definition: winuser.h:1744
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define EM_GETWORDBREAKPROC
Definition: winuser.h:2028
#define COLOR_WINDOW
Definition: winuser.h:929
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
int(CALLBACK * EDITWORDBREAKPROCA)(LPSTR, int, int, int)
Definition: winuser.h:3012
#define EC_RIGHTMARGIN
Definition: winuser.h:2643
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDCANCEL
Definition: winuser.h:842
#define WM_CAPTURECHANGED
Definition: winuser.h:1836
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
struct tagMENUITEMINFOA MENUITEMINFOA
#define WM_CREATE
Definition: winuser.h:1636
#define DLGC_WANTCHARS
Definition: winuser.h:2660
#define EM_GETSEL
Definition: winuser.h:2026
#define EN_SETFOCUS
Definition: winuser.h:2056
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define EN_UPDATE
Definition: winuser.h:2057
#define WM_SIZE
Definition: winuser.h:1639
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define DLGC_WANTALLKEYS
Definition: winuser.h:2654
#define SWP_NOMOVE
Definition: winuser.h:1255
HWND WINAPI GetOpenClipboardWindow(void)
Definition: ntwrapper.h:214
#define WM_COMMAND
Definition: winuser.h:1768
#define CS_HREDRAW
Definition: winuser.h:661
#define EM_REPLACESEL
Definition: winuser.h:2035
#define EC_USEFONTINFO
Definition: winuser.h:2644
#define IDC_ARROW
Definition: winuser.h:695
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define EM_SETRECT
Definition: winuser.h:2045
#define DC_HASDEFID
Definition: winuser.h:2651
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_GETTEXT
Definition: winuser.h:1646
#define SIZE_MINIMIZED
Definition: winuser.h:2542
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define EN_MAXTEXT
Definition: winuser.h:2055
#define EM_LINESCROLL
Definition: winuser.h:2033
#define EM_GETHANDLE
Definition: winuser.h:2018
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define WM_NEXTDLGCTL
Definition: winuser.h:1671
#define WM_NCCREATE
Definition: winuser.h:1711
#define MIIM_STATE
Definition: winuser.h:732
struct tagMENUBARINFO MENUBARINFO
#define WM_SETTEXT
Definition: winuser.h:1645
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define SM_CYBORDER
Definition: winuser.h:976
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define EM_SETHANDLE
Definition: winuser.h:2038
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define VK_RETURN
Definition: winuser.h:2237
#define EM_GETLINE
Definition: winuser.h:2020
HWND WINAPI SetFocus(_In_opt_ HWND)
#define SIZE_MAXIMIZED
Definition: winuser.h:2543
#define EM_SETLIMITTEXT
Definition: winuser.h:2040
#define WM_SETFONT
Definition: winuser.h:1678
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define DLGC_WANTARROWS
Definition: winuser.h:2652
#define EM_SCROLL
Definition: winuser.h:2036
#define MSGF_MENU
Definition: winuser.h:1186
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
#define SB_PAGEDOWN
Definition: winuser.h:569
#define EM_SETWORDBREAKPROC
Definition: winuser.h:2049
BOOL WINAPI GetCaretPos(_Out_ LPPOINT)
#define VK_BACK
Definition: winuser.h:2234
HDC WINAPI GetDC(_In_opt_ HWND)
#define SB_LINEDOWN
Definition: winuser.h:565
#define EM_SETSEL
Definition: winuser.h:2047
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
#define ES_NUMBER
Definition: winuser.h:301
#define WM_CHAR
Definition: winuser.h:1745
#define CW_USEDEFAULT
Definition: winuser.h:225
HWND WINAPI GetParent(_In_ HWND)
#define WM_NCDESTROY
Definition: winuser.h:1712
#define SIZE_RESTORED
Definition: winuser.h:2541
#define VK_DOWN
Definition: winuser.h:2263
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_USER
Definition: winuser.h:1923
#define EM_GETMARGINS
Definition: winuser.h:2022
#define BN_CLICKED
Definition: winuser.h:1954
BOOL WINAPI GetMenuItemInfoA(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOA)
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WM_KEYDOWN
Definition: winuser.h:1743
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define EC_LEFTMARGIN
Definition: winuser.h:2642
#define DM_GETDEFID
Definition: winuser.h:2134
#define SWP_NOZORDER
Definition: winuser.h:1258
#define GWL_STYLE
Definition: winuser.h:863
#define EM_SETMARGINS
Definition: winuser.h:2041
#define VK_ESCAPE
Definition: winuser.h:2250
#define WM_ENTERIDLE
Definition: winuser.h:1777
#define DLGC_HASSETSEL
Definition: winuser.h:2656
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI GetMenuBarInfo(_In_ HWND, _In_ LONG, _In_ LONG, _Inout_ PMENUBARINFO)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define MFS_HILITE
Definition: winuser.h:763
int WINAPI GetSystemMetrics(_In_ int)
#define SB_PAGEUP
Definition: winuser.h:568
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETDLGCODE
Definition: winuser.h:1717
INT_PTR WINAPI DialogBoxParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
#define COLOR_BTNFACE
Definition: winuser.h:939
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EN_CHANGE
Definition: winuser.h:2051
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175