ReactOS  0.4.13-dev-92-gf251225
button.c
Go to the documentation of this file.
1 /* Unit test suite for Button control.
2  *
3  * Copyright 1999 Ove Kaaven
4  * Copyright 2003 Dimitrie O. Paun
5  * Copyright 2004, 2005 Dmitry Timoshkov
6  * Copyright 2014 Nikolay Sivov for CodeWeavers
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #ifdef __REACTOS__
24 #undef USE_WINE_TODOS
25 #endif
26 
27 #include <windows.h>
28 #include <commctrl.h>
29 
30 #include "wine/test.h"
31 #include "v6util.h"
32 #include "msg.h"
33 
34 #ifdef __REACTOS__
35 #define BS_PUSHBOX 0x0000000AL
36 #endif
37 
38 #define IS_WNDPROC_HANDLE(x) (((ULONG_PTR)(x) >> 16) == (~0u >> 16))
39 
40 static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
41 static BOOL (WINAPI *pRemoveWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR);
42 static LRESULT (WINAPI *pDefSubclassProc)(HWND, UINT, WPARAM, LPARAM);
43 static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
44 static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP);
45 static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
46 
47 /****************** button message test *************************/
48 #define ID_BUTTON 0x000e
49 
50 #define COMBINED_SEQ_INDEX 0
51 #define NUM_MSG_SEQUENCES 1
52 
54 
56 {
57  ULONG size;
58  DWORD res;
63 };
64 
65 /* returned pointer is valid as long as activation context is alive */
67 {
68  struct wndclass_redirect_data *wnddata;
69  ACTCTX_SECTION_KEYED_DATA data;
70  BOOL ret;
71 
72  memset(&data, 0, sizeof(data));
73  data.cbSize = sizeof(data);
74  ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, name, &data);
75  ok(ret, "Failed to find class redirection section, error %u\n", GetLastError());
76  wnddata = (struct wndclass_redirect_data*)data.lpData;
77  return (WCHAR*)((BYTE*)wnddata + wnddata->name_offset);
78 }
79 
80 static void init_functions(void)
81 {
82  HMODULE hmod = GetModuleHandleA("comctl32.dll");
83  ok(hmod != NULL, "got %p\n", hmod);
84 
85 #define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
89 #undef MAKEFUNC_ORD
90 
91 #define X(f) p##f = (void *)GetProcAddress(hmod, #f);
95 #undef X
96 }
97 
98 /* try to make sure pending X events have been processed before continuing */
99 static void flush_events(void)
100 {
101  MSG msg;
102  int diff = 200;
103  int min_timeout = 100;
104  DWORD time = GetTickCount() + diff;
105 
106  while (diff > 0)
107  {
108  if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
109  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
110  diff = time - GetTickCount();
111  }
112 }
113 
115 {
116  /* these are always ignored */
117  return (message >= 0xc000 ||
118  message == WM_GETICON ||
119  message == WM_GETOBJECT ||
120  message == WM_TIMECHANGE ||
121  message == WM_DISPLAYCHANGE ||
125  message == WM_GETTEXT);
126 }
127 
129 {
130  static LONG defwndproc_counter = 0;
131  struct message msg = { 0 };
132  LRESULT ret;
133 
134  if (ignore_message( message )) return pDefSubclassProc(hwnd, message, wParam, lParam);
135 
136  switch (message)
137  {
138  case WM_SYNCPAINT:
139  break;
140  case BM_SETSTATE:
141  if (GetCapture())
142  ok(GetCapture() == hwnd, "GetCapture() = %p\n", GetCapture());
143  /* fall through */
144  default:
145  msg.message = message;
146  msg.flags = sent|wparam|lparam;
147  if (defwndproc_counter) msg.flags |= defwinproc;
148  msg.wParam = wParam;
149  msg.lParam = lParam;
151  }
152 
153  if (message == WM_NCDESTROY)
154  pRemoveWindowSubclass(hwnd, button_subclass_proc, 0);
155 
156  defwndproc_counter++;
157  ret = pDefSubclassProc(hwnd, message, wParam, lParam);
158  defwndproc_counter--;
159 
160  return ret;
161 }
162 
164 {
165  static LONG defwndproc_counter = 0;
166  static LONG beginpaint_counter = 0;
167  struct message msg = { 0 };
168  LRESULT ret;
169 
170  if (ignore_message( message )) return 0;
171 
177  {
178  msg.message = message;
179  msg.flags = sent|parent|wparam|lparam;
180  if (defwndproc_counter) msg.flags |= defwinproc;
181  if (beginpaint_counter) msg.flags |= beginpaint;
182  msg.wParam = wParam;
183  msg.lParam = lParam;
185  }
186 
187  if (message == WM_PAINT)
188  {
189  PAINTSTRUCT ps;
190  beginpaint_counter++;
191  BeginPaint( hwnd, &ps );
192  beginpaint_counter--;
193  EndPaint( hwnd, &ps );
194  return 0;
195  }
196 
197  defwndproc_counter++;
199  defwndproc_counter--;
200 
201  return ret;
202 }
203 
204 static const struct message setfocus_seq[] =
205 {
208  { BM_GETSTATE, sent|optional }, /* when touchscreen is present */
209  { WM_SETFOCUS, sent|wparam },
211  { WM_APP, sent|wparam|lparam },
212  { WM_PAINT, sent },
213  { 0 }
214 };
215 
216 static const struct message killfocus_seq[] =
217 {
218  { WM_KILLFOCUS, sent|wparam, 0 },
222  { WM_APP, sent|wparam|lparam, 0, 0 },
223  { WM_PAINT, sent },
224  { 0 }
225 };
226 
227 static const struct message setfocus_static_seq[] =
228 {
231  { BM_GETSTATE, sent|optional }, /* when touchscreen is present */
232  { WM_SETFOCUS, sent|wparam, 0 },
234  { WM_COMMAND, sent|wparam|parent|optional, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, /* radio button */
235  { WM_APP, sent|wparam|lparam, 0, 0 },
236  { WM_PAINT, sent },
237  { 0 }
238 };
239 
240 static const struct message setfocus_groupbox_seq[] =
241 {
244  { BM_GETSTATE, sent|optional }, /* when touchscreen is present */
245  { WM_SETFOCUS, sent|wparam, 0 },
247  { WM_COMMAND, sent|wparam|parent|optional, MAKEWPARAM(ID_BUTTON, BN_CLICKED) }, /* radio button */
248  { WM_APP, sent|wparam|lparam, 0, 0 },
249  { WM_PAINT, sent },
250  { 0 }
251 };
252 
253 static const struct message killfocus_static_seq[] =
254 {
255  { WM_KILLFOCUS, sent|wparam, 0 },
259  { WM_APP, sent|wparam|lparam, 0, 0 },
260  { WM_PAINT, sent },
261  { 0 }
262 };
263 
264 static const struct message setfocus_ownerdraw_seq[] =
265 {
268  { BM_GETSTATE, sent|optional }, /* when touchscreen is present */
269  { WM_SETFOCUS, sent|wparam, 0 },
272  { WM_APP, sent|wparam|lparam, 0, 0 },
274  { 0 }
275 };
276 
277 static const struct message killfocus_ownerdraw_seq[] =
278 {
279  { WM_KILLFOCUS, sent|wparam, 0 },
283  { WM_APP, sent|wparam|lparam, 0, 0 },
284  { WM_PAINT, sent },
286  { 0 }
287 };
288 
289 static const struct message lbuttondown_seq[] =
290 {
291  { WM_LBUTTONDOWN, sent|wparam|lparam, 0, 0 },
294  { BM_GETSTATE, sent|defwinproc|optional }, /* when touchscreen is present */
297  { 0 }
298 };
299 
300 static const struct message lbuttonup_seq[] =
301 {
302  { WM_LBUTTONUP, sent|wparam|lparam, 0, 0 },
306  { 0 }
307 };
308 
309 static const struct message setfont_seq[] =
310 {
311  { WM_SETFONT, sent },
312  { 0 }
313 };
314 
315 static const struct message setstyle_seq[] =
316 {
317  { BM_SETSTYLE, sent },
318  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
319  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
320  { WM_APP, sent|wparam|lparam, 0, 0 },
321  { WM_PAINT, sent },
322  { WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */
324  { WM_PAINT, sent|optional },
325  { 0 }
326 };
327 
328 static const struct message setstyle_static_seq[] =
329 {
330  { BM_SETSTYLE, sent },
331  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
332  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
333  { WM_APP, sent|wparam|lparam, 0, 0 },
334  { WM_PAINT, sent },
335  { WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */
337  { 0 }
338 };
339 
340 static const struct message setstyle_user_seq[] =
341 {
342  { BM_SETSTYLE, sent },
343  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
344  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
345  { WM_APP, sent|wparam|lparam, 0, 0 },
346  { WM_PAINT, sent },
347  { WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */
349  { 0 }
350 };
351 
352 static const struct message setstyle_ownerdraw_seq[] =
353 {
354  { BM_SETSTYLE, sent },
355  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
356  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
357  { WM_APP, sent|wparam|lparam, 0, 0 },
358  { WM_PAINT, sent },
359  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
362  { 0 }
363 };
364 
365 static const struct message setstate_seq[] =
366 {
367  { BM_SETSTATE, sent },
368  { WM_APP, sent|wparam|lparam, 0, 0 },
369  { WM_PAINT, sent },
370  { WM_PAINT, sent|optional },
371  { 0 }
372 };
373 
374 static const struct message setstate_static_seq[] =
375 {
376  { BM_SETSTATE, sent },
377  { WM_APP, sent|wparam|lparam, 0, 0 },
378  { WM_PAINT, sent },
379  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
381  { 0 }
382 };
383 
384 static const struct message setstate_user_seq[] =
385 {
386  { BM_SETSTATE, sent },
388  { WM_APP, sent|wparam|lparam, 0, 0 },
389  { WM_PAINT, sent },
390  { 0 }
391 };
392 
393 static const struct message setstate_ownerdraw_seq[] =
394 {
395  { BM_SETSTATE, sent },
396  { WM_APP, sent|wparam|lparam, 0, 0 },
397  { WM_PAINT, sent },
398  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
401  { 0 }
402 };
403 
404 static const struct message clearstate_seq[] =
405 {
406  { BM_SETSTATE, sent },
408  { WM_APP, sent|wparam|lparam, 0, 0 },
409  { WM_PAINT, sent },
410  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
412  { 0 }
413 };
414 
415 static const struct message clearstate_ownerdraw_seq[] =
416 {
417  { BM_SETSTATE, sent },
418  { WM_APP, sent|wparam|lparam, 0, 0 },
419  { WM_PAINT, sent },
420  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
423  { 0 }
424 };
425 
426 static const struct message setcheck_ignored_seq[] =
427 {
428  { BM_SETCHECK, sent },
429  { WM_APP, sent|wparam|lparam, 0, 0 },
430  { WM_PAINT, sent|optional },
431  { 0 }
432 };
433 
434 static const struct message setcheck_static_seq[] =
435 {
436  { BM_SETCHECK, sent },
437  { WM_APP, sent|wparam|lparam, 0, 0 },
438  { WM_PAINT, sent },
439  { WM_NCPAINT, sent|optional }, /* FIXME: Wine sends it */
441  { 0 }
442 };
443 
444 static const struct message setcheck_radio_seq[] =
445 {
446  { BM_SETCHECK, sent },
447  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
448  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
449  { WM_APP, sent|wparam|lparam, 0, 0 },
450  { 0 }
451 };
452 
453 static const struct message setcheck_radio_redraw_seq[] =
454 {
455  { BM_SETCHECK, sent },
456  { WM_STYLECHANGING, sent|wparam|defwinproc, GWL_STYLE },
457  { WM_STYLECHANGED, sent|wparam|defwinproc, GWL_STYLE },
458  { WM_APP, sent|wparam|lparam, 0, 0 },
459  { WM_PAINT, sent },
460  { WM_NCPAINT, sent|defwinproc|optional }, /* FIXME: Wine sends it */
461  { 0 }
462 };
463 
465 {
466  HMENU menuid = 0;
467  HWND hwnd;
468 
469  if (parent)
470  {
472  menuid = (HMENU)ID_BUTTON;
473  }
474  hwnd = CreateWindowExA(0, WC_BUTTONA, "test", style, 0, 0, 50, 14, parent, menuid, 0, NULL);
475  ok(hwnd != NULL, "failed to create a button, 0x%08x, %p\n", style, parent);
476  pSetWindowSubclass(hwnd, button_subclass_proc, 0, 0);
477  return hwnd;
478 }
479 
480 static void test_button_messages(void)
481 {
482  static const struct
483  {
484  DWORD style;
485  DWORD dlg_code;
486  const struct message *setfocus;
487  const struct message *killfocus;
488  const struct message *setstyle;
489  const struct message *setstate;
490  const struct message *clearstate;
491  const struct message *setcheck;
492  } button[] = {
538  };
539  LOGFONTA logfont = { 0 };
540  const struct message *seq;
541  HFONT zfont, hfont2;
542  unsigned int i;
543  HWND hwnd, parent;
544  DWORD dlg_code;
545  BOOL todo;
546 
547  /* selection with VK_SPACE should capture button window */
549  ok(hwnd != 0, "Failed to create button window\n");
550  ReleaseCapture();
551  SetFocus(hwnd);
553  ok(GetCapture() == hwnd, "Should be captured on VK_SPACE WM_KEYDOWN\n");
556 
557  parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
558  100, 100, 200, 200, 0, 0, 0, NULL);
559  ok(parent != 0, "Failed to create parent window\n");
560 
561  logfont.lfHeight = -12;
562  logfont.lfWeight = FW_NORMAL;
563  strcpy(logfont.lfFaceName, "Tahoma");
564 
565  hfont2 = CreateFontIndirectA(&logfont);
566  ok(hfont2 != NULL, "Failed to create Tahoma font\n");
567 
568  for (i = 0; i < ARRAY_SIZE(button); i++)
569  {
570  HFONT prevfont, hfont;
571  MSG msg;
572  DWORD style, state;
573  HDC hdc;
574 
575  hwnd = create_button(button[i].style, parent);
576  ok(hwnd != NULL, "Failed to create a button.\n");
577 
579  style &= ~(WS_CHILD | BS_NOTIFY);
580  /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
581  if (button[i].style == BS_USERBUTTON)
582  ok(style == BS_PUSHBUTTON, "expected style BS_PUSHBUTTON got %x\n", style);
583  else
584  ok(style == button[i].style, "expected style %x got %x\n", button[i].style, style);
585 
586  dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
587  if (button[i].style == BS_SPLITBUTTON ||
588  button[i].style == BS_DEFSPLITBUTTON ||
589  button[i].style == BS_COMMANDLINK ||
590  button[i].style == BS_DEFCOMMANDLINK)
591  {
592  ok(dlg_code == button[i].dlg_code || broken(dlg_code == DLGC_BUTTON) /* WinXP */, "%u: wrong dlg_code %08x\n", i, dlg_code);
593  }
594  else
595  ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code);
596 
599  SetFocus(0);
600  flush_events();
601  SetFocus(0);
603 
604  todo = button[i].style != BS_OWNERDRAW;
605  ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
606  SetFocus(hwnd);
607  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
608  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
609  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setfocus, "SetFocus(hwnd) on a button", todo);
610 
611  todo = button[i].style == BS_OWNERDRAW;
612  SetFocus(0);
613  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
614  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
615  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].killfocus, "SetFocus(0) on a button", todo);
616  ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
617 
619  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
620  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
621  todo = button[i].style == BS_OWNERDRAW;
622  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", todo);
623 
626  /* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */
627  ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
628 
630  ok(state == 0, "expected state 0, got %04x\n", state);
631 
633 
635  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
636  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
637  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstate, "BM_SETSTATE/TRUE on a button", FALSE);
638 
640  ok(state == BST_PUSHED, "expected state 0x0004, got %04x\n", state);
641 
644  ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
645 
647 
649  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
650  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
651  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].clearstate, "BM_SETSTATE/FALSE on a button", FALSE);
652 
654  ok(state == 0, "expected state 0, got %04x\n", state);
655 
658  ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
659 
661  ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
662 
664 
665  if (button[i].style == BS_RADIOBUTTON ||
666  button[i].style == BS_AUTORADIOBUTTON)
667  {
668  seq = setcheck_radio_seq;
669  }
670  else
671  seq = setcheck_ignored_seq;
672 
674  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
675  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
676  ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", FALSE);
677 
679  ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
680 
683  ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
684 
686 
688  SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
689  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
690  ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setcheck, "BM_SETCHECK on a button", FALSE);
691 
693  if (button[i].style == BS_PUSHBUTTON ||
694  button[i].style == BS_DEFPUSHBUTTON ||
695  button[i].style == BS_GROUPBOX ||
696  button[i].style == BS_USERBUTTON ||
697  button[i].style == BS_OWNERDRAW ||
698  button[i].style == BS_SPLITBUTTON ||
699  button[i].style == BS_DEFSPLITBUTTON ||
700  button[i].style == BS_COMMANDLINK ||
701  button[i].style == BS_DEFCOMMANDLINK)
702  {
703  ok(state == BST_UNCHECKED, "expected check BST_UNCHECKED, got %04x\n", state);
704  }
705  else
706  ok(state == BST_CHECKED, "expected check BST_CHECKED, got %04x\n", state);
707 
710  if (button[i].style == BS_RADIOBUTTON ||
711  button[i].style == BS_AUTORADIOBUTTON)
712  ok(style == (button[i].style | WS_TABSTOP), "expected style %04x | WS_TABSTOP got %04x\n", button[i].style, style);
713  else
714  ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
715 
716  /* Test that original font is not selected back after painting */
718  ok(hfont == NULL, "Unexpected control font.\n");
719 
721 
722  hdc = CreateCompatibleDC(0);
723 
724  prevfont = SelectObject(hdc, hfont2);
726  ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT) || broken(hfont2 == GetCurrentObject(hdc, OBJ_FONT)) /* WinXP */,
727  "button[%u]: unexpected font selected after WM_PRINTCLIENT\n", i);
728  SelectObject(hdc, prevfont);
729 
730  prevfont = SelectObject(hdc, hfont2);
732  ok(hfont2 != GetCurrentObject(hdc, OBJ_FONT) || broken(hfont2 == GetCurrentObject(hdc, OBJ_FONT)) /* WinXP */,
733  "button[%u]: unexpected font selected after WM_PAINT\n", i);
734  SelectObject(hdc, prevfont);
735 
736  DeleteDC(hdc);
737 
739  }
740 
741  DeleteObject(hfont2);
743 
745 
747  flush_events();
748 
750  SetFocus(0);
752 
754  ok_sequence(sequences, COMBINED_SEQ_INDEX, lbuttondown_seq, "WM_LBUTTONDOWN on a button", FALSE);
755 
757  ok_sequence(sequences, COMBINED_SEQ_INDEX, lbuttonup_seq, "WM_LBUTTONUP on a button", TRUE);
758 
760  zfont = GetStockObject(SYSTEM_FONT);
763  ok_sequence(sequences, COMBINED_SEQ_INDEX, setfont_seq, "WM_SETFONT on a button", FALSE);
764 
766 }
767 
768 static void test_button_class(void)
769 {
770  static const WCHAR testW[] = {'t','e','s','t',0};
771  WNDCLASSEXW exW, ex2W;
772  WNDCLASSEXA exA;
773  char buffA[100];
774  WCHAR *nameW;
775  HWND hwnd;
776  BOOL ret;
777  int len;
778 
780  ok(ret, "got %d\n", ret);
781  ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc);
782  ok(exA.cbClsExtra == 0, "Unexpected class bytes %d.\n", exA.cbClsExtra);
783  ok(exA.cbWndExtra == sizeof(void *), "Unexpected window bytes %d.\n", exA.cbWndExtra);
784 
786  ok(ret, "got %d\n", ret);
787  ok(!IS_WNDPROC_HANDLE(exW.lpfnWndProc), "got %p\n", exW.lpfnWndProc);
788  ok(exW.cbClsExtra == 0, "Unexpected class bytes %d.\n", exW.cbClsExtra);
789  ok(exW.cbWndExtra == sizeof(void *), "Unexpected window bytes %d.\n", exW.cbWndExtra);
790 
791  /* check that versioned class is also accessible */
793  ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));
794 
795  ret = GetClassInfoExW(NULL, nameW, &ex2W);
796  ok(ret, "got %d\n", ret);
797  ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc);
798 
799  /* Check reported class name */
801  len = GetClassNameA(hwnd, buffA, sizeof(buffA));
802  ok(len == strlen(buffA), "got %d\n", len);
803  ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
804 
805  len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
806  ok(len == strlen(buffA), "got %d\n", len);
807  ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
809 
810  /* explicitly create with versioned class name */
811  hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL);
812  ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
813 
814  len = GetClassNameA(hwnd, buffA, sizeof(buffA));
815  ok(len == strlen(buffA), "got %d\n", len);
816  ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
817 
818  len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
819  ok(len == strlen(buffA), "got %d\n", len);
820  ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
821 
823 }
824 
825 static void test_note(void)
826 {
827  HWND hwnd;
828  BOOL ret;
829  WCHAR test_w[] = {'t', 'e', 's', 't', 0};
830  WCHAR tes_w[] = {'t', 'e', 's', 0};
831  WCHAR deadbeef_w[] = {'d', 'e', 'a', 'd', 'b', 'e', 'e', 'f', 0};
832  WCHAR buffer_w[10];
833  DWORD size;
834  DWORD error;
835  INT type;
836 
838  ok(hwnd != NULL, "Expect hwnd not null\n");
839  SetLastError(0xdeadbeef);
840  size = ARRAY_SIZE(buffer_w);
841  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
842  error = GetLastError();
843  if (!ret && error == 0xdeadbeef)
844  {
845  win_skip("BCM_GETNOTE message is unavailable. Skipping note tests\n"); /* xp or 2003 */
847  return;
848  }
850 
852  {
854  {
856  ok(hwnd != NULL, "Expect hwnd not null\n");
857 
858  /* Get note when note hasn't been not set yet */
859  SetLastError(0xdeadbeef);
860  lstrcpyW(buffer_w, deadbeef_w);
861  size = ARRAY_SIZE(buffer_w);
862  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
863  error = GetLastError();
864  ok(!ret, "Expect BCM_GETNOTE return false\n");
865  ok(!lstrcmpW(buffer_w, deadbeef_w), "Expect note: %s, got: %s\n",
866  wine_dbgstr_w(deadbeef_w), wine_dbgstr_w(buffer_w));
867  ok(size == ARRAY_SIZE(buffer_w), "Got: %d\n", size);
868  ok(error == ERROR_INVALID_PARAMETER, "Expect last error: 0x%08x, got: 0x%08x\n",
870 
871  /* Get note length when note is not set */
873  ok(ret == 0, "Expect note length: %d, got: %d\n", 0, ret);
874 
875  /* Successful set note, get note and get note length */
876  SetLastError(0xdeadbeef);
878  ok(ret, "Expect BCM_SETNOTE return true\n");
879  error = GetLastError();
880  ok(error == NO_ERROR, "Expect last error: 0x%08x, got: 0x%08x\n", NO_ERROR, error);
881 
882  SetLastError(0xdeadbeef);
883  lstrcpyW(buffer_w, deadbeef_w);
884  size = ARRAY_SIZE(buffer_w);
885  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
886  ok(ret, "Expect BCM_GETNOTE return true\n");
887  ok(!lstrcmpW(buffer_w, test_w), "Expect note: %s, got: %s\n", wine_dbgstr_w(test_w),
888  wine_dbgstr_w(buffer_w));
889  ok(size == ARRAY_SIZE(buffer_w), "Got: %d\n", size);
890  error = GetLastError();
891  ok(error == NO_ERROR, "Expect last error: 0x%08x, got: 0x%08x\n", NO_ERROR, error);
892 
894  ok(ret == ARRAY_SIZE(test_w) - 1, "Got: %d\n", ret);
895 
896  /* Insufficient buffer, return partial string */
897  SetLastError(0xdeadbeef);
898  lstrcpyW(buffer_w, deadbeef_w);
899  size = ARRAY_SIZE(test_w) - 1;
900  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
901  ok(!ret, "Expect BCM_GETNOTE return false\n");
902  ok(!lstrcmpW(buffer_w, tes_w), "Expect note: %s, got: %s\n", wine_dbgstr_w(tes_w),
903  wine_dbgstr_w(buffer_w));
904  ok(size == ARRAY_SIZE(test_w), "Got: %d\n", size);
905  error = GetLastError();
906  ok(error == ERROR_INSUFFICIENT_BUFFER, "Expect last error: 0x%08x, got: 0x%08x\n",
908 
909  /* Set note with NULL buffer */
910  SetLastError(0xdeadbeef);
911  ret = SendMessageA(hwnd, BCM_SETNOTE, 0, 0);
912  ok(ret, "Expect BCM_SETNOTE return false\n");
913  error = GetLastError();
914  ok(error == NO_ERROR, "Expect last error: 0x%08x, got: 0x%08x\n", NO_ERROR, error);
915 
916  /* Check that set note with NULL buffer make note empty */
917  SetLastError(0xdeadbeef);
918  lstrcpyW(buffer_w, deadbeef_w);
919  size = ARRAY_SIZE(buffer_w);
920  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
921  ok(ret, "Expect BCM_GETNOTE return true\n");
922  ok(lstrlenW(buffer_w) == 0, "Expect note length 0\n");
923  ok(size == ARRAY_SIZE(buffer_w), "Got: %d\n", size);
924  error = GetLastError();
925  ok(error == NO_ERROR, "Expect last error: 0x%08x, got: 0x%08x\n", NO_ERROR, error);
927  ok(ret == 0, "Expect note length: %d, got: %d\n", 0, ret);
928 
929  /* Get note with NULL buffer */
930  SetLastError(0xdeadbeef);
931  size = ARRAY_SIZE(buffer_w);
933  ok(!ret, "Expect BCM_SETNOTE return false\n");
934  ok(size == ARRAY_SIZE(buffer_w), "Got: %d\n", size);
935  error = GetLastError();
936  ok(error == ERROR_INVALID_PARAMETER, "Expect last error: 0x%08x, got: 0x%08x\n",
938 
939  /* Get note with NULL size */
940  SetLastError(0xdeadbeef);
941  lstrcpyW(buffer_w, deadbeef_w);
942  ret = SendMessageA(hwnd, BCM_GETNOTE, 0, (LPARAM)buffer_w);
943  ok(!ret, "Expect BCM_SETNOTE return false\n");
944  ok(!lstrcmpW(buffer_w, deadbeef_w), "Expect note: %s, got: %s\n",
945  wine_dbgstr_w(deadbeef_w), wine_dbgstr_w(buffer_w));
946  error = GetLastError();
947  ok(error == ERROR_INVALID_PARAMETER, "Expect last error: 0x%08x, got: 0x%08x\n",
949 
950  /* Get note with zero size */
951  SetLastError(0xdeadbeef);
952  size = 0;
953  lstrcpyW(buffer_w, deadbeef_w);
954  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
955  ok(!ret, "Expect BCM_GETNOTE return false\n");
956  ok(!lstrcmpW(buffer_w, deadbeef_w), "Expect note: %s, got: %s\n",
957  wine_dbgstr_w(deadbeef_w), wine_dbgstr_w(buffer_w));
958  ok(size == 1, "Got: %d\n", size);
959  error = GetLastError();
960  ok(error == ERROR_INSUFFICIENT_BUFFER, "Expect last error: 0x%08x, got: 0x%08x\n",
962 
964  }
965  else
966  {
968  ok(hwnd != NULL, "Expect hwnd not null\n");
969  SetLastError(0xdeadbeef);
970  size = ARRAY_SIZE(buffer_w);
971  ret = SendMessageA(hwnd, BCM_GETNOTE, (WPARAM)&size, (LPARAM)buffer_w);
972  ok(!ret, "Expect BCM_GETNOTE return false\n");
973  error = GetLastError();
974  ok(error == ERROR_NOT_SUPPORTED, "Expect last error: 0x%08x, got: 0x%08x\n",
977  }
978  }
979 }
980 
981 static void test_bm_get_set_image(void)
982 {
983  HWND hwnd;
984  HDC hdc;
985  HBITMAP hbmp1x1;
986  HBITMAP hbmp2x2;
987  HBITMAP hmask2x2;
988  ICONINFO icon_info2x2;
989  HICON hicon2x2;
990  HBITMAP hbmp;
991  HICON hicon;
992  ICONINFO icon_info;
993  BITMAP bm;
994  static const DWORD default_style = BS_PUSHBUTTON | WS_TABSTOP | WS_POPUP | WS_VISIBLE;
995 
996  hdc = GetDC(0);
997  hbmp1x1 = CreateCompatibleBitmap(hdc, 1, 1);
998  hbmp2x2 = CreateCompatibleBitmap(hdc, 2, 2);
999  ZeroMemory(&bm, sizeof(bm));
1000  ok(GetObjectW(hbmp1x1, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1001  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1002  bm.bmWidth, bm.bmHeight);
1003  ZeroMemory(&bm, sizeof(bm));
1004  ok(GetObjectW(hbmp2x2, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1005  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1006  bm.bmWidth, bm.bmHeight);
1007 
1008  hmask2x2 = CreateCompatibleBitmap(hdc, 2, 2);
1009  ZeroMemory(&icon_info2x2, sizeof(icon_info2x2));
1010  icon_info2x2.fIcon = TRUE;
1011  icon_info2x2.hbmMask = hmask2x2;
1012  icon_info2x2.hbmColor = hbmp2x2;
1013  hicon2x2 = CreateIconIndirect(&icon_info2x2);
1014  ok(hicon2x2 !=NULL, "Expect CreateIconIndirect() success\n");
1015 
1016  ZeroMemory(&icon_info, sizeof(icon_info));
1017  ok(GetIconInfo(hicon2x2, &icon_info), "Expect GetIconInfo() success\n");
1018  ZeroMemory(&bm, sizeof(bm));
1019  ok(GetObjectW(icon_info.hbmColor, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1020  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1021  bm.bmWidth, bm.bmHeight);
1022  DeleteObject(icon_info.hbmColor);
1023  DeleteObject(icon_info.hbmMask);
1024 
1025  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_BITMAP, 0, 0, 100, 100, 0, 0,
1026  0, 0);
1027  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1028  /* Get image when image is not set */
1030  ok(hbmp == 0, "Expect hbmp == 0\n");
1031  /* Set image */
1033  ok(hbmp == 0, "Expect hbmp == 0\n");
1035  ok(hbmp != 0, "Expect hbmp != 0\n");
1036  /* Set null resets image */
1038  ok(hbmp != 0, "Expect hbmp != 0\n");
1040  ok(hbmp == 0, "Expect hbmp == 0\n");
1042 
1043  /* Set bitmap with BS_BITMAP */
1044  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_BITMAP, 0, 0, 100, 100, 0, 0,
1045  0, 0);
1046  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1048  ok(hbmp == 0, "Expect hbmp == 0\n");
1050  ok(hbmp != 0, "Expect hbmp != 0\n");
1051  ZeroMemory(&bm, sizeof(bm));
1052  ok(GetObjectW(hbmp, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1053  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1054  bm.bmWidth, bm.bmHeight);
1056 
1057  /* Set bitmap without BS_BITMAP */
1058  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style, 0, 0, 100, 100, 0, 0, 0, 0);
1059  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1061  ok(hbmp == 0, "Expect hbmp == 0\n");
1063  if (hbmp == 0)
1064  {
1065  /* on xp or 2003*/
1066  win_skip("Show both image and text is not supported. Skip following tests.\n");
1068  goto done;
1069  }
1070  ok(hbmp != 0, "Expect hbmp != 0\n");
1071  ZeroMemory(&bm, sizeof(bm));
1072  ok(GetObjectW(hbmp, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1073  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1074  bm.bmWidth, bm.bmHeight);
1076 
1077  /* Set icon with BS_ICON */
1078  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_ICON, 0, 0, 100, 100, 0, 0, 0,
1079  0);
1080  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1081  hicon = (HICON)SendMessageA(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hicon2x2);
1082  ok(hicon == 0, "Expect hicon == 0\n");
1083  hicon = (HICON)SendMessageA(hwnd, BM_GETIMAGE, IMAGE_ICON, 0);
1084  ok(hicon != 0, "Expect hicon != 0\n");
1085  ZeroMemory(&icon_info, sizeof(icon_info));
1086  ok(GetIconInfo(hicon, &icon_info), "Expect GetIconInfo() success\n");
1087  ZeroMemory(&bm, sizeof(bm));
1088  ok(GetObjectW(icon_info.hbmColor, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1089  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1090  bm.bmWidth, bm.bmHeight);
1091  DeleteObject(icon_info.hbmColor);
1092  DeleteObject(icon_info.hbmMask);
1094 
1095  /* Set icon without BS_ICON */
1096  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style, 0, 0, 100, 100, 0, 0, 0, 0);
1097  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1098  hicon = (HICON)SendMessageA(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hicon2x2);
1099  ok(hicon == 0, "Expect hicon == 0\n");
1100  hicon = (HICON)SendMessageA(hwnd, BM_GETIMAGE, IMAGE_ICON, 0);
1101  ok(hicon != 0, "Expect hicon != 0\n");
1102  ZeroMemory(&icon_info, sizeof(icon_info));
1103  ok(GetIconInfo(hicon, &icon_info), "Expect GetIconInfo() success\n");
1104  ZeroMemory(&bm, sizeof(bm));
1105  ok(GetObjectW(icon_info.hbmColor, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1106  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1107  bm.bmWidth, bm.bmHeight);
1108  DeleteObject(icon_info.hbmColor);
1109  DeleteObject(icon_info.hbmMask);
1111 
1112  /* Set icon with BS_BITMAP */
1113  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_BITMAP, 0, 0, 100, 100, 0, 0,
1114  0, 0);
1115  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1116  hicon = (HICON)SendMessageA(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hicon2x2);
1117  ok(hicon == 0, "Expect hicon == 0\n");
1118  hicon = (HICON)SendMessageA(hwnd, BM_GETIMAGE, IMAGE_ICON, 0);
1119  ok(hicon != 0, "Expect hicon != 0\n");
1120  ZeroMemory(&icon_info, sizeof(icon_info));
1121  ok(GetIconInfo(hicon, &icon_info), "Expect GetIconInfo() success\n");
1122  ZeroMemory(&bm, sizeof(bm));
1123  ok(GetObjectW(icon_info.hbmColor, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1124  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1125  bm.bmWidth, bm.bmHeight);
1126  DeleteObject(icon_info.hbmColor);
1127  DeleteObject(icon_info.hbmMask);
1129 
1130  /* Set bitmap with BS_ICON */
1131  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_ICON, 0, 0, 100, 100, 0, 0, 0,
1132  0);
1133  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1135  ok(hbmp == 0, "Expect hbmp == 0\n");
1137  ok(hbmp != 0, "Expect hbmp != 0\n");
1138  ZeroMemory(&bm, sizeof(bm));
1139  ok(GetObjectW(hbmp, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1140  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1141  bm.bmWidth, bm.bmHeight);
1143 
1144  /* Set bitmap with BS_BITMAP and IMAGE_ICON*/
1145  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_BITMAP, 0, 0, 100, 100, 0, 0,
1146  0, 0);
1147  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1149  ok(hbmp == 0, "Expect hbmp == 0\n");
1151  ok(hbmp != 0, "Expect hbmp != 0\n");
1152  ZeroMemory(&bm, sizeof(bm));
1153  ok(GetObjectW(hbmp, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1154  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1155  bm.bmWidth, bm.bmHeight);
1157 
1158  /* Set icon with BS_ICON and IMAGE_BITMAP */
1159  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_ICON, 0, 0, 100, 100, 0, 0, 0,
1160  0);
1161  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1162  hicon = (HICON)SendMessageA(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hicon2x2);
1163  ok(hicon == 0, "Expect hicon == 0\n");
1165  ok(hicon != 0, "Expect hicon != 0\n");
1166  ZeroMemory(&icon_info, sizeof(icon_info));
1167  ok(GetIconInfo(hicon, &icon_info), "Expect GetIconInfo() success\n");
1168  ZeroMemory(&bm, sizeof(bm));
1169  ok(GetObjectW(icon_info.hbmColor, sizeof(BITMAP), &bm), "Expect GetObjectW() success\n");
1170  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1171  bm.bmWidth, bm.bmHeight);
1172  DeleteObject(icon_info.hbmColor);
1173  DeleteObject(icon_info.hbmMask);
1175 
1176  /* Set bitmap with BS_ICON and IMAGE_ICON */
1177  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_ICON, 0, 0, 100, 100, 0, 0, 0, 0);
1178  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1180  ok(hbmp == 0, "Expect hbmp == 0\n");
1182  ok(hbmp != 0, "Expect hbmp != 0\n");
1183  ZeroMemory(&bm, sizeof(bm));
1184  ok(GetObjectW(hbmp, sizeof(bm), &bm), "Expect GetObjectW() success\n");
1185  ok(bm.bmWidth == 1 && bm.bmHeight == 1, "Expect bitmap size: %d,%d, got: %d,%d\n", 1, 1,
1186  bm.bmWidth, bm.bmHeight);
1188 
1189  /* Set icon with BS_BITMAP and IMAGE_BITMAP */
1190  hwnd = CreateWindowA(WC_BUTTONA, "test", default_style | BS_BITMAP, 0, 0, 100, 100, 0, 0, 0, 0);
1191  ok(hwnd != NULL, "Expect hwnd to be not NULL\n");
1192  hicon = (HICON)SendMessageA(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hicon2x2);
1193  ok(hicon == 0, "Expect hicon == 0\n");
1195  ok(hicon != 0, "Expect hicon != 0\n");
1196  ZeroMemory(&icon_info, sizeof(icon_info));
1197  ok(GetIconInfo(hicon, &icon_info), "Expect GetIconInfo() success\n");
1198  ZeroMemory(&bm, sizeof(bm));
1199  ok(GetObjectW(icon_info.hbmColor, sizeof(BITMAP), &bm), "Expect GetObjectW() success\n");
1200  ok(bm.bmWidth == 2 && bm.bmHeight == 2, "Expect bitmap size: %d,%d, got: %d,%d\n", 2, 2,
1201  bm.bmWidth, bm.bmHeight);
1202  DeleteObject(icon_info.hbmColor);
1203  DeleteObject(icon_info.hbmMask);
1205 
1206 done:
1207  DestroyIcon(hicon2x2);
1208  DeleteObject(hmask2x2);
1209  DeleteObject(hbmp2x2);
1210  DeleteObject(hbmp1x1);
1211  ReleaseDC(0, hdc);
1212 }
1213 
1214 static void register_parent_class(void)
1215 {
1216  WNDCLASSA cls;
1217 
1218  cls.style = 0;
1220  cls.cbClsExtra = 0;
1221  cls.cbWndExtra = 0;
1222  cls.hInstance = GetModuleHandleA(0);
1223  cls.hIcon = 0;
1224  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
1226  cls.lpszMenuName = NULL;
1227  cls.lpszClassName = "TestParentClass";
1228  RegisterClassA(&cls);
1229 }
1230 
1231 static void test_button_data(void)
1232 {
1233  static const DWORD styles[] =
1234  {
1235  BS_PUSHBUTTON,
1237  BS_CHECKBOX,
1240  BS_3STATE,
1241  BS_AUTO3STATE,
1242  BS_GROUPBOX,
1243  BS_USERBUTTON,
1245  BS_OWNERDRAW,
1250  };
1251 
1252  struct button_desc
1253  {
1254  HWND self;
1255  HWND parent;
1256  LONG style;
1257  };
1258  unsigned int i;
1259  HWND parent;
1260 
1261  parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
1262  100, 100, 200, 200, 0, 0, 0, NULL);
1263  ok(parent != 0, "Failed to create parent window\n");
1264 
1265  for (i = 0; i < ARRAY_SIZE(styles); i++)
1266  {
1267  struct button_desc *desc;
1268  HWND hwnd;
1269 
1270  hwnd = create_button(styles[i], parent);
1271  ok(hwnd != NULL, "Failed to create a button.\n");
1272 
1273  desc = (void *)GetWindowLongPtrA(hwnd, 0);
1274  ok(desc != NULL, "Expected window data.\n");
1275 
1276  if (desc)
1277  {
1278  ok(desc->self == hwnd, "Unexpected 'self' field.\n");
1279  ok(desc->parent == parent, "Unexpected 'parent' field.\n");
1280  ok(desc->style == (WS_CHILD | BS_NOTIFY | styles[i]), "Unexpected 'style' field.\n");
1281  }
1282 
1284  }
1285 
1287 }
1288 
1289 static void test_get_set_imagelist(void)
1290 {
1291  HWND hwnd;
1292  HIMAGELIST himl;
1293  BUTTON_IMAGELIST biml = {0};
1294  HDC hdc;
1295  HBITMAP hbmp;
1296  INT width = 16;
1297  INT height = 16;
1298  INT index;
1299  DWORD type;
1300  BOOL ret;
1301 
1302  hdc = GetDC(0);
1304  ok(hbmp != NULL, "Expect hbmp not null\n");
1305 
1306  himl = pImageList_Create(width, height, ILC_COLOR, 1, 0);
1307  ok(himl != NULL, "Expect himl not null\n");
1308  index = pImageList_Add(himl, hbmp, NULL);
1309  ok(index == 0, "Expect index == 0\n");
1310  DeleteObject(hbmp);
1311  ReleaseDC(0, hdc);
1312 
1314  {
1316  ok(hwnd != NULL, "Expect hwnd not null\n");
1317 
1318  /* Get imagelist when imagelist is unset yet */
1319  ret = SendMessageA(hwnd, BCM_GETIMAGELIST, 0, (LPARAM)&biml);
1320  ok(ret, "Expect BCM_GETIMAGELIST return true\n");
1321  ok(biml.himl == 0 && IsRectEmpty(&biml.margin) && biml.uAlign == 0,
1322  "Expect BUTTON_IMAGELIST is empty\n");
1323 
1324  /* Set imagelist with himl null */
1325  biml.himl = 0;
1326  biml.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
1327  ret = SendMessageA(hwnd, BCM_SETIMAGELIST, 0, (LPARAM)&biml);
1328  ok(ret || broken(!ret), /* xp or 2003 */
1329  "Expect BCM_SETIMAGELIST return true\n");
1330 
1331  /* Set imagelist with uAlign invalid */
1332  biml.himl = himl;
1333  biml.uAlign = -1;
1334  ret = SendMessageA(hwnd, BCM_SETIMAGELIST, 0, (LPARAM)&biml);
1335  ok(ret, "Expect BCM_SETIMAGELIST return true\n");
1336 
1337  /* Successful get and set imagelist */
1338  biml.himl = himl;
1339  biml.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
1340  ret = SendMessageA(hwnd, BCM_SETIMAGELIST, 0, (LPARAM)&biml);
1341  ok(ret, "Expect BCM_SETIMAGELIST return true\n");
1342  ret = SendMessageA(hwnd, BCM_GETIMAGELIST, 0, (LPARAM)&biml);
1343  ok(ret, "Expect BCM_GETIMAGELIST return true\n");
1344  ok(biml.himl == himl, "Expect himl to be same\n");
1345  ok(biml.uAlign == BUTTON_IMAGELIST_ALIGN_CENTER, "Expect uAlign to be %x\n",
1347 
1348  /* BCM_SETIMAGELIST null pointer handling */
1350  ok(!ret, "Expect BCM_SETIMAGELIST return false\n");
1351  ret = SendMessageA(hwnd, BCM_GETIMAGELIST, 0, (LPARAM)&biml);
1352  ok(ret, "Expect BCM_GETIMAGELIST return true\n");
1353  ok(biml.himl == himl, "Expect himl to be same\n");
1354 
1355  /* BCM_GETIMAGELIST null pointer handling */
1356  biml.himl = himl;
1357  biml.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
1358  ret = SendMessageA(hwnd, BCM_SETIMAGELIST, 0, (LPARAM)&biml);
1359  ok(ret, "Expect BCM_SETIMAGELIST return true\n");
1361  ok(!ret, "Expect BCM_GETIMAGELIST return false\n");
1362 
1364  }
1365 
1366  pImageList_Destroy(himl);
1367 }
1368 
1369 static void test_get_set_textmargin(void)
1370 {
1371  HWND hwnd;
1372  RECT margin_in;
1373  RECT margin_out;
1374  BOOL ret;
1375  DWORD type;
1376 
1377  SetRect(&margin_in, 2, 1, 3, 4);
1379  {
1381  ok(hwnd != NULL, "Expect hwnd not null\n");
1382 
1383  /* Get text margin when it is unset */
1384  ret = SendMessageA(hwnd, BCM_GETTEXTMARGIN, 0, (LPARAM)&margin_out);
1385  ok(ret, "Expect ret to be true\n");
1386  ok(IsRectEmpty(&margin_out), "Expect margin empty\n");
1387 
1388  /* Successful get and set text margin */
1389  ret = SendMessageA(hwnd, BCM_SETTEXTMARGIN, 0, (LPARAM)&margin_in);
1390  ok(ret, "Expect ret to be true\n");
1391  SetRectEmpty(&margin_out);
1392  ret = SendMessageA(hwnd, BCM_GETTEXTMARGIN, 0, (LPARAM)&margin_out);
1393  ok(ret, "Expect ret to be true\n");
1394  ok(EqualRect(&margin_in, &margin_out), "Expect margins to be equal\n");
1395 
1396  /* BCM_SETTEXTMARGIN null pointer handling */
1398  ok(!ret, "Expect ret to be false\n");
1399  SetRectEmpty(&margin_out);
1400  ret = SendMessageA(hwnd, BCM_GETTEXTMARGIN, 0, (LPARAM)&margin_out);
1401  ok(ret, "Expect ret to be true\n");
1402  ok(EqualRect(&margin_in, &margin_out), "Expect margins to be equal\n");
1403 
1404  /* BCM_GETTEXTMARGIN null pointer handling */
1405  ret = SendMessageA(hwnd, BCM_SETTEXTMARGIN, 0, (LPARAM)&margin_in);
1406  ok(ret, "Expect ret to be true\n");
1408  ok(!ret, "Expect ret to be true\n");
1409 
1411  }
1412 }
1413 
1414 static void test_state(void)
1415 {
1416  HWND hwnd;
1417  DWORD type;
1418  LONG state;
1419 
1420  /* Initial button state */
1422  {
1424  state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
1425  ok(state == BST_UNCHECKED, "Expect state 0x%08x, got 0x%08x\n", BST_UNCHECKED, state);
1427  }
1428 }
1429 
1430 static void test_bcm_get_ideal_size(void)
1431 {
1432  static const char *button_text2 = "WWWW\nWWWW";
1433  static const char *button_text = "WWWW";
1434  static const DWORD imagelist_aligns[] = {BUTTON_IMAGELIST_ALIGN_LEFT, BUTTON_IMAGELIST_ALIGN_RIGHT,
1437  static const DWORD aligns[] = {0, BS_TOP, BS_LEFT, BS_RIGHT, BS_BOTTOM,
1439  DWORD default_style = WS_TABSTOP | WS_POPUP | WS_VISIBLE;
1440  const LONG client_width = 400, client_height = 200;
1441  LONG image_width, height, line_count, text_width;
1442  HFONT hfont, prev_font;
1443  DWORD style, type;
1444  BOOL ret;
1445  HWND hwnd;
1446  HDC hdc;
1447  LOGFONTA lf;
1448  TEXTMETRICA tm;
1449  SIZE size;
1450  HBITMAP hmask, hbmp;
1451  ICONINFO icon_info;
1452  HICON hicon;
1453  HIMAGELIST himl;
1454  BUTTON_IMAGELIST biml = {0};
1455  RECT rect;
1456  INT i, j;
1457 
1458  /* Check for NULL pointer handling */
1459  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_PUSHBUTTON | default_style, 0, 0, client_width, client_height,
1460  NULL, NULL, 0, NULL);
1462  ok(!ret, "Expect BCM_GETIDEALSIZE message to return false.\n");
1463 
1464  /* Set font so that the test is consistent on Wine and Windows */
1465  ZeroMemory(&lf, sizeof(lf));
1466  lf.lfWeight = FW_NORMAL;
1467  lf.lfHeight = 20;
1468  lstrcpyA(lf.lfFaceName, "Tahoma");
1469  hfont = CreateFontIndirectA(&lf);
1470  ok(hfont != NULL, "Failed to create test font.\n");
1471 
1472  /* Get tmHeight */
1473  hdc = GetDC(hwnd);
1474  prev_font = SelectObject(hdc, hfont);
1475  GetTextMetricsA(hdc, &tm);
1476  SelectObject(hdc, prev_font);
1477  DrawTextA(hdc, button_text, -1, &rect, DT_CALCRECT);
1478  text_width = rect.right - rect.left;
1479  ReleaseDC(hwnd, hdc);
1481 
1482  /* XP and 2003 doesn't support command links, getting ideal size with button having only text returns client size on these platforms. */
1483  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_DEFCOMMANDLINK | default_style, 0, 0, client_width, client_height, NULL,
1484  NULL, 0, NULL);
1485  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1487  ZeroMemory(&size, sizeof(size));
1489  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1490  if (size.cx == client_width && size.cy == client_height)
1491  {
1492  /* on XP and 2003, buttons with image are not supported */
1493  win_skip("Skipping further tests on XP and 2003\n");
1494  return;
1495  }
1496 
1497  /* Tests for image placements */
1498  /* Prepare bitmap */
1499  image_width = 48;
1500  height = 48;
1501  hdc = GetDC(0);
1504 
1505  /* Only bitmap for push button, ideal size should be enough for image and text */
1506  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_DEFPUSHBUTTON | BS_BITMAP | default_style, 0, 0, client_width,
1507  client_height, NULL, NULL, 0, NULL);
1508  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1511  ZeroMemory(&size, sizeof(size));
1513  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1514  /* Ideal size contains text rect even show bitmap only */
1515  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1516  "Expect ideal cx %d >= %d and ideal cy %d >= %d\n", size.cx, image_width + text_width,
1517  size.cy, max(height, tm.tmHeight));
1519 
1520  /* Image alignments when button has bitmap and text*/
1521  for (i = 0; i < ARRAY_SIZE(aligns); i++)
1522  for (j = 0; j < ARRAY_SIZE(aligns); j++)
1523  {
1524  style = BS_DEFPUSHBUTTON | default_style | aligns[i] | aligns[j];
1525  hwnd = CreateWindowA(WC_BUTTONA, button_text, style, 0, 0, client_width, client_height, NULL, NULL, 0, NULL);
1526  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1529  ZeroMemory(&size, sizeof(size));
1531  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1532  if (!(style & (BS_CENTER | BS_VCENTER)) || ((style & BS_CENTER) && (style & BS_CENTER) != BS_CENTER)
1533  || !(style & BS_VCENTER) || (style & BS_VCENTER) == BS_VCENTER)
1534  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1535  "Style: 0x%08x expect ideal cx %d >= %d and ideal cy %d >= %d\n", style, size.cx,
1536  image_width + text_width, size.cy, max(height, tm.tmHeight));
1537  else
1538  ok((size.cx >= max(text_width, height) && size.cy >= height + tm.tmHeight),
1539  "Style: 0x%08x expect ideal cx %d >= %d and ideal cy %d >= %d\n", style, size.cx,
1540  max(text_width, height), size.cy, height + tm.tmHeight);
1542  }
1543 
1544  /* Image list alignments */
1545  himl = pImageList_Create(image_width, height, ILC_COLOR, 1, 1);
1546  pImageList_Add(himl, hbmp, 0);
1547  biml.himl = himl;
1548  for (i = 0; i < ARRAY_SIZE(imagelist_aligns); i++)
1549  {
1550  biml.uAlign = imagelist_aligns[i];
1551  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_DEFPUSHBUTTON | default_style, 0, 0, client_width,
1552  client_height, NULL, NULL, 0, NULL);
1553  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1556  ZeroMemory(&size, sizeof(size));
1558  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1559  if (biml.uAlign == BUTTON_IMAGELIST_ALIGN_TOP || biml.uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM)
1560  ok((size.cx >= max(text_width, height) && size.cy >= height + tm.tmHeight),
1561  "Align:%d expect ideal cx %d >= %d and ideal cy %d >= %d\n", biml.uAlign, size.cx,
1562  max(text_width, height), size.cy, height + tm.tmHeight);
1563  else if (biml.uAlign == BUTTON_IMAGELIST_ALIGN_LEFT || biml.uAlign == BUTTON_IMAGELIST_ALIGN_RIGHT)
1564  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1565  "Align:%d expect ideal cx %d >= %d and ideal cy %d >= %d\n", biml.uAlign, size.cx,
1566  image_width + text_width, size.cy, max(height, tm.tmHeight));
1567  else
1568  ok(size.cx >= image_width && size.cy >= height, "Align:%d expect ideal cx %d >= %d and ideal cy %d >= %d\n",
1569  biml.uAlign, size.cx, image_width, size.cy, height);
1571  }
1572 
1573  /* Icon as image */
1574  /* Create icon from bitmap */
1575  ZeroMemory(&icon_info, sizeof(icon_info));
1576  icon_info.fIcon = TRUE;
1577  icon_info.hbmMask = hmask;
1578  icon_info.hbmColor = hbmp;
1579  hicon = CreateIconIndirect(&icon_info);
1580 
1581  /* Only icon, ideal size should be enough for image and text */
1582  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_DEFPUSHBUTTON | BS_ICON | default_style, 0, 0, client_width,
1583  client_height, NULL, NULL, 0, NULL);
1584  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1587  ZeroMemory(&size, sizeof(size));
1589  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1590  /* Ideal size contains text rect even show icons only */
1591  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1592  "Expect ideal cx %d >= %d and ideal cy %d >= %d\n", size.cx, image_width + text_width, size.cy,
1593  max(height, tm.tmHeight));
1595 
1596  /* Show icon and text */
1597  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_DEFPUSHBUTTON | default_style, 0, 0, client_width,
1598  client_height, NULL, NULL, 0, NULL);
1599  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1602  ZeroMemory(&size, sizeof(size));
1604  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1605  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1606  "Expect ideal cx %d >= %d and ideal cy %d >= %d\n", size.cx, image_width + text_width, size.cy,
1607  max(height, tm.tmHeight));
1609 
1610  /* Checkbox */
1611  /* Both bitmap and text for checkbox, ideal size is only enough for text because it doesn't support image(but not image list)*/
1612  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_AUTOCHECKBOX | default_style, 0, 0, client_width, client_height,
1613  NULL, NULL, 0, NULL);
1614  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1617  ZeroMemory(&size, sizeof(size));
1619  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1620  ok((size.cx <= image_width + text_width && size.cx >= text_width && size.cy <= max(height, tm.tmHeight)
1621  && size.cy >= tm.tmHeight),
1622  "Expect ideal cx %d within range (%d, %d ) and ideal cy %d within range (%d, %d )\n", size.cx,
1623  text_width, image_width + text_width, size.cy, tm.tmHeight, max(height, tm.tmHeight));
1625 
1626  /* Both image list and text for checkbox, ideal size should have enough for image list and text */
1628  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_AUTOCHECKBOX | BS_BITMAP | default_style, 0, 0, client_width,
1629  client_height, NULL, NULL, 0, NULL);
1630  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1633  ZeroMemory(&size, sizeof(size));
1635  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1636  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1637  "Expect ideal cx %d >= %d and ideal cy %d >= %d\n", size.cx, image_width + text_width, size.cy,
1638  max(height, tm.tmHeight));
1640 
1641  /* Only bitmap for checkbox, ideal size should have enough for image and text */
1642  hwnd = CreateWindowA(WC_BUTTONA, button_text, BS_AUTOCHECKBOX | BS_BITMAP | default_style, 0, 0, client_width,
1643  client_height, NULL, NULL, 0, NULL);
1644  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1647  ZeroMemory(&size, sizeof(size));
1649  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1650  ok((size.cx >= image_width + text_width && size.cy >= max(height, tm.tmHeight)),
1651  "Expect ideal cx %d >= %d and ideal cy %d >= %d\n", size.cx, image_width + text_width, size.cy,
1652  max(height, tm.tmHeight));
1654 
1655  /* Test button with only text */
1656  /* No text */
1658  {
1659  style = type | default_style;
1660  hwnd = CreateWindowA(WC_BUTTONA, "", style, 0, 0, client_width, client_height, NULL, NULL, 0, NULL);
1661  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1663 
1664  ZeroMemory(&size, sizeof(size));
1666  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1667 
1669  {
1670  todo_wine ok((size.cx == 0 && size.cy > 0), "Style 0x%08x expect ideal cx %d >= %d and ideal cy %d >= %d\n",
1671  style, size.cx, 0, size.cy, 0);
1672  }
1673  else
1674  {
1675  ok(size.cx == client_width && size.cy == client_height,
1676  "Style 0x%08x expect size.cx == %d and size.cy == %d, got size.cx: %d size.cy: %d\n", style,
1677  client_width, client_height, size.cx, size.cy);
1678  }
1680  }
1681 
1682  /* Single line and multiple lines text */
1683  for (line_count = 1; line_count <= 2; line_count++)
1684  {
1686  {
1687  style = line_count > 1 ? type | BS_MULTILINE : type;
1688  style |= default_style;
1689 
1690  hwnd = CreateWindowA(WC_BUTTONA, (line_count == 2 ? button_text2 : button_text), style, 0, 0, client_width,
1691  client_height, NULL, NULL, 0, NULL);
1692  ok(hwnd != NULL, "Expect hwnd not NULL\n");
1694  ZeroMemory(&size, sizeof(size));
1696  ok(ret, "Expect BCM_GETIDEALSIZE message to return true\n");
1697 
1698  if (type == BS_3STATE || type == BS_AUTO3STATE || type == BS_GROUPBOX || type == BS_PUSHBOX
1699  || type == BS_OWNERDRAW)
1700  {
1701  ok(size.cx == client_width && size.cy == client_height,
1702  "Style 0x%08x expect ideal size (%d,%d), got (%d,%d)\n", style, client_width, client_height, size.cx,
1703  size.cy);
1704  }
1705  else if (type == BS_COMMANDLINK || type == BS_DEFCOMMANDLINK)
1706  {
1707  todo_wine ok((size.cx == 0 && size.cy > 0),
1708  "Style 0x%08x expect ideal cx %d >= %d and ideal cy %d >= %d\n", style, size.cx, 0,
1709  size.cy, 0);
1710  }
1711  else
1712  {
1713  height = line_count == 2 ? 2 * tm.tmHeight : tm.tmHeight;
1714  ok(size.cx >= 0 && size.cy >= height, "Style 0x%08x expect ideal cx %d >= 0 and ideal cy %d >= %d\n",
1715  style, size.cx, size.cy, height);
1716  }
1718  }
1719  }
1720 
1721  pImageList_Destroy(himl);
1722  DestroyIcon(hicon);
1723  DeleteObject(hbmp);
1724  DeleteObject(hmask);
1725  ReleaseDC(0, hdc);
1727 }
1728 
1729 START_TEST(button)
1730 {
1731  ULONG_PTR ctx_cookie;
1732  HANDLE hCtx;
1733 
1734  if (!load_v6_module(&ctx_cookie, &hCtx))
1735  return;
1736 
1738 
1739  init_functions();
1741 
1744  test_note();
1745  test_button_data();
1749  test_state();
1751 
1752  unload_v6_module(ctx_cookie, hCtx);
1753 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define BS_NOTIFY
Definition: winuser.h:268
#define WM_SYNCPAINT
Definition: winuser.h:1672
HIMAGELIST himl
Definition: commctrl.h:4606
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define BS_3STATE
Definition: pedump.c:656
#define BS_LEFT
Definition: winuser.h:265
static const struct message setstate_user_seq[]
Definition: button.c:384
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const struct message setstate_static_seq[]
Definition: button.c:374
#define BM_SETSTATE
Definition: winuser.h:1884
#define WM_IME_NOTIFY
Definition: winuser.h:1806
GLint GLint GLsizei width
Definition: gl.h:1546
static const struct message setstate_seq[]
Definition: button.c:365
return
Definition: dirsup.c:529
#define max(a, b)
Definition: svc.c:63
#define BS_OWNERDRAW
Definition: pedump.c:661
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
Definition: tftpd.h:59
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2570
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
#define IMAGE_ICON
Definition: winuser.h:212
static void test_button_data(void)
Definition: button.c:1231
static const struct message lbuttonup_seq[]
Definition: button.c:300
#define BS_DEFCOMMANDLINK
Definition: commctrl.h:4644
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
int cbWndExtra
Definition: winuser.h:3173
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
WNDPROC lpfnWndProc
Definition: winuser.h:3156
#define error(str)
Definition: mkdosfs.c:1605
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:413
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4620
static LRESULT(WINAPI *pDefSubclassProc)(HWND
#define BS_DEFSPLITBUTTON
Definition: commctrl.h:4642
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define BS_RIGHT
Definition: winuser.h:274
#define BS_RADIOBUTTON
Definition: pedump.c:655
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define BM_GETSTATE
Definition: winuser.h:1881
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WM_GETTEXT
Definition: winuser.h:1600
static const struct message setstyle_static_seq[]
Definition: button.c:328
Definition: msg.h:39
#define IS_WNDPROC_HANDLE(x)
Definition: button.c:38
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4622
#define WM_CAPTURECHANGED
Definition: winuser.h:1784
static void test_get_set_textmargin(void)
Definition: button.c:1369
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static HDC
Definition: imagelist.c:92
#define DLGC_RADIOBUTTON
Definition: winuser.h:2571
#define CALLBACK
Definition: compat.h:27
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL todo
Definition: filedlg.c:313
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
int cbClsExtra
Definition: winuser.h:3118
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define BUTTON_IMAGELIST_ALIGN_TOP
Definition: commctrl.h:4601
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LPCSTR lpszMenuName
Definition: winuser.h:3124
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
#define WHITE_BRUSH
Definition: wingdi.h:901
static const struct message setfocus_ownerdraw_seq[]
Definition: button.c:264
HWND WINAPI SetFocus(_In_opt_ HWND)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
UINT_PTR WPARAM
Definition: windef.h:207
HBRUSH hbrBackground
Definition: winuser.h:3123
#define WS_CHILD
Definition: pedump.c:617
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
static LRESULT WINAPI test_parent_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: button.c:163
static HWND create_button(DWORD style, HWND parent)
Definition: button.c:464
#define BS_CENTER
Definition: winuser.h:260
#define NO_ERROR
Definition: dderror.h:5
#define lstrlenW
Definition: compat.h:407
#define BM_GETIMAGE
Definition: winuser.h:1880
#define WS_EX_RIGHT
Definition: winuser.h:400
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define BM_SETIMAGE
Definition: winuser.h:1883
int32_t INT
Definition: typedefs.h:56
static const struct message setstyle_seq[]
Definition: button.c:315
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
#define BS_GROUPBOX
Definition: pedump.c:658
#define BN_UNHILITE
Definition: winuser.h:1895
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_PRINTCLIENT
Definition: richedit.h:70
static DWORD_PTR
Definition: button.c:40
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define WM_NCPAINT
Definition: winuser.h:1669
#define NUM_MSG_SEQUENCES
Definition: button.c:51
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:156
int cbWndExtra
Definition: winuser.h:3119
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
static const struct message setstate_ownerdraw_seq[]
Definition: button.c:393
static void test_bm_get_set_image(void)
Definition: button.c:981
#define BCM_SETNOTE
Definition: commctrl.h:4628
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
static BOOL(WINAPI *pSetWindowSubclass)(HWND
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
HWND WINAPI SetActiveWindow(_In_ HWND)
#define DT_CALCRECT
Definition: winuser.h:526
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
#define WM_PARENTNOTIFY
Definition: winuser.h:1779
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define COMBINED_SEQ_INDEX
Definition: button.c:50
LONG lfHeight
Definition: dimm.idl:42
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define BUTTON_IMAGELIST_ALIGN_CENTER
Definition: commctrl.h:4603
HBITMAP hbmMask
Definition: winuser.h:3079
HWND WINAPI GetCapture(void)
Definition: message.c:2879
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ILC_COLOR
Definition: commctrl.h:337
static const struct message setstyle_ownerdraw_seq[]
Definition: button.c:352
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
int image_width
HCURSOR hCursor
Definition: winuser.h:3122
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
static const struct message setstyle_user_seq[]
Definition: button.c:340
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static int
Definition: button.c:43
LONG lfWeight
Definition: dimm.idl:46
UINT WINAPI RealGetWindowClassA(_In_ HWND hwnd, _Out_writes_to_(cchClassNameMax, return) LPSTR ptszClassName, _In_ UINT cchClassNameMax)
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
#define WC_BUTTONA
Definition: commctrl.h:4594
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
static const struct message setcheck_static_seq[]
Definition: button.c:434
static const struct message clearstate_seq[]
Definition: button.c:404
#define BS_CHECKBOX
Definition: pedump.c:653
#define BS_AUTO3STATE
Definition: pedump.c:657
#define SYSTEM_FONT
Definition: wingdi.h:910
#define WM_KEYDOWN
Definition: winuser.h:1691
LONG_PTR LPARAM
Definition: windef.h:208
static void test_state(void)
Definition: button.c:1414
HBITMAP hbmColor
Definition: winuser.h:3080
static const struct message setcheck_ignored_seq[]
Definition: button.c:426
int cbClsExtra
Definition: winuser.h:3172
#define BM_GETCHECK
Definition: winuser.h:1879
#define BCM_GETNOTE
Definition: commctrl.h:4629
static BOOL ignore_message(UINT message)
Definition: button.c:114
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1496
GLuint index
Definition: glext.h:6031
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
static const struct message setfocus_seq[]
Definition: button.c:204
static HFONT hfont
Definition: msg.h:41
static LRESULT CALLBACK button_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data)
Definition: button.c:128
#define BN_HILITE
Definition: winuser.h:1890
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 GLint GLint j
Definition: glfuncs.h:250
static void test_get_set_imagelist(void)
Definition: button.c:1289
static const WCHAR nameW[]
Definition: main.c:46
static const struct message lbuttondown_seq[]
Definition: button.c:289
#define GetWindowLongPtrA
Definition: winuser.h:4697
HBITMAP hbmp
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1261
static const struct message killfocus_static_seq[]
Definition: button.c:253
BOOL fIcon
Definition: winuser.h:3076
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2569
#define BM_SETCHECK
Definition: winuser.h:1882
#define WM_ENTERIDLE
Definition: winuser.h:1725
#define BS_COMMANDLINK
Definition: commctrl.h:4643
#define WM_KILLFOCUS
Definition: winuser.h:1596
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2659
#define BS_MULTILINE
Definition: winuser.h:267
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BM_SETSTYLE
Definition: winuser.h:1885
#define BST_PUSHED
Definition: winuser.h:201
#define WM_IME_SETCONTEXT
Definition: winuser.h:1805
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2546
#define WM_NCDESTROY
Definition: winuser.h:1666
#define WINAPI
Definition: msvc.h:8
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
#define BS_TOP
Definition: winuser.h:277
#define WM_KEYUP
Definition: winuser.h:1692
#define BN_CLICKED
Definition: winuser.h:1886
unsigned long DWORD
Definition: ntddk_ex.h:95
int cbWndExtra
Definition: winuser.h:3158
#define SetLastError(x)
Definition: compat.h:409
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define OBJ_FONT
Definition: objidl.idl:1414
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define BCM_GETNOTELENGTH
Definition: commctrl.h:4630
#define WAIT_TIMEOUT
Definition: dderror.h:14
static LPARAM
Definition: button.c:42
#define BN_KILLFOCUS
Definition: winuser.h:1891
#define WM_PAINT
Definition: winuser.h:1602
#define MAKEFUNC_ORD(f, ord)
static HIMAGELIST(WINAPI *pImageList_Create)(int
#define BS_SPLITBUTTON
Definition: commctrl.h:4641
#define X(f)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
static void test_note(void)
Definition: button.c:825
static const struct message setcheck_radio_seq[]
Definition: button.c:444
int ret
#define BUTTON_IMAGELIST_ALIGN_LEFT
Definition: commctrl.h:4599
#define BS_ICON
Definition: winuser.h:264
#define index(s, c)
Definition: various.h:29
Definition: msg.h:34
#define BCM_GETIMAGELIST
Definition: commctrl.h:4617
#define todo_wine
Definition: test.h:154
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)
HDC hdc
Definition: main.c:9
static const struct message setfont_seq[]
Definition: button.c:309
#define BS_BITMAP
Definition: winuser.h:258
static int state
Definition: maze.c:121
static void flush_events(void)
Definition: button.c:99
#define WM_CANCELMODE
Definition: winuser.h:1617
static SUBCLASSPROC
Definition: button.c:40
GLenum GLsizei len
Definition: glext.h:6722
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
unsigned char BYTE
Definition: mem.h:68
#define WM_APP
Definition: eventvwr.h:70
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define WS_TABSTOP
Definition: pedump.c:634
Definition: time.h:76
#define WM_COMMAND
Definition: winuser.h:1716
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3125
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define BS_VCENTER
Definition: winuser.h:279
#define BST_UNCHECKED
Definition: winuser.h:199
static UINT_PTR
Definition: button.c:40
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: button.c:53
#define BS_PUSHBUTTON
Definition: pedump.c:651
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
WNDPROC lpfnWndProc
Definition: winuser.h:3171
#define broken(x)
Definition: _sntprintf.h:21
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
static const struct message setfocus_static_seq[]
Definition: button.c:227
UINT style
Definition: winuser.h:3116
#define GWL_STYLE
Definition: winuser.h:846
#define BUTTON_IMAGELIST_ALIGN_BOTTOM
Definition: commctrl.h:4602
#define ID_BUTTON
Definition: button.c:48
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define BN_SETFOCUS
Definition: winuser.h:1894
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
INT WINAPI DrawTextA(HDC hdc, LPCSTR str, INT count, LPRECT rect, UINT flags)
Definition: font.c:373
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
int cbClsExtra
Definition: winuser.h:3157
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
static void init_functions(void)
Definition: button.c:80
static WCHAR test_w[]
Definition: pager.c:33
BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID)
Definition: commctrl.c:1390
#define lstrcpyW
Definition: compat.h:406
BOOL WINAPI DeleteDC(_In_ HDC)
HINSTANCE hInstance
Definition: winuser.h:3120
#define add_message(msg)
Definition: msg.c:2142
#define ARRAY_SIZE(a)
Definition: main.h:24
#define WC_BUTTONW
Definition: commctrl.h:4595
static void register_parent_class(void)
Definition: button.c:1214
#define DLGC_BUTTON
Definition: winuser.h:2574
#define QS_ALLINPUT
Definition: winuser.h:874
#define WM_LBUTTONUP
Definition: winuser.h:1753
Definition: bl.h:1331
static const struct message killfocus_seq[]
Definition: button.c:216
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static const struct message setcheck_radio_redraw_seq[]
Definition: button.c:453
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
#define VK_SPACE
Definition: winuser.h:2173
#define BS_BOTTOM
Definition: winuser.h:259
#define IMAGE_BITMAP
Definition: winuser.h:211
#define BST_CHECKED
Definition: winuser.h:197
#define WM_SETFONT
Definition: winuser.h:1632
#define WM_DEVICECHANGE
Definition: winuser.h:1787
#define FW_NORMAL
Definition: wingdi.h:372
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define BUTTON_IMAGELIST_ALIGN_RIGHT
Definition: commctrl.h:4600
#define WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
START_TEST(button)
Definition: button.c:925
static void test_bcm_get_ideal_size(void)
Definition: button.c:1430
HWND WINAPI GetFocus(void)
Definition: window.c:1875
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
Definition: name.c:36
static const struct message setfocus_groupbox_seq[]
Definition: button.c:240
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
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 WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
Definition: msg.h:40
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4611
static HBITMAP
Definition: button.c:44
static void test_button_messages(void)
Definition: button.c:480
#define BS_USERBUTTON
Definition: pedump.c:659
#define PM_REMOVE
Definition: winuser.h:1182
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_SETFOCUS
Definition: winuser.h:1595
LONG_PTR LRESULT
Definition: windef.h:209
static WCHAR * get_versioned_classname(const WCHAR *name)
Definition: button.c:66
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define BCM_SETIMAGELIST
Definition: commctrl.h:4614
#define memset(x, y, z)
Definition: compat.h:39
static WPARAM
Definition: button.c:42
#define BS_RIGHTBUTTON
Definition: winuser.h:275
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define win_skip
Definition: test.h:141
static const struct message killfocus_ownerdraw_seq[]
Definition: button.c:277
LPARAM lParam
Definition: combotst.c:139
static void test_button_class(void)
Definition: button.c:768
#define WM_DWMNCRENDERINGCHANGED
Definition: winuser.h:1846
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define DLGC_WANTARROWS
Definition: winuser.h:2564
#define DLGC_STATIC
Definition: winuser.h:2573
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:439
static const WCHAR testW[]
Definition: jsregexp.c:44
static UINT WPARAM wparam
Definition: combo.c:716
HICON hIcon
Definition: winuser.h:3121
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
static const struct message clearstate_ownerdraw_seq[]
Definition: button.c:415
#define WM_TIMECHANGE
Definition: winuser.h:1616
static UINT
Definition: button.c:42