ReactOS  0.4.14-dev-98-gb0d4763
button.c File Reference
#include "wine/test.h"
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <uxtheme.h>
#include <undocuser.h>
#include <msgtrace.h>
#include <user32testhelpers.h>
Include dependency graph for button.c:

Go to the source code of this file.

Macros

#define ok_rect(rc, l, r, t, b)   ok((rc.left == (l)) && (rc.right == (r)) && (rc.top == (t)) && (rc.bottom == (b)), "Wrong rect. expected %d, %d, %d, %d got %ld, %ld, %ld, %ld\n", l,t,r,b, rc.left, rc.top, rc.right, rc.bottom)
 
#define ok_size(s, width, height)   ok((s.cx == (width) && s.cy == (height)), "Expected size (%lu,%lu) got (%lu,%lu)\n", (LONG)width, (LONG)height, s.cx, s.cy)
 
#define MOVE_CURSOR(x, y)
 

Functions

void Test_TextMargin ()
 
void Test_Imagelist ()
 
void Test_GetIdealSizeNoThemes ()
 
static int get_iwnd (HWND hWnd)
 
static LRESULT CALLBACK subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data)
 
static LRESULT CALLBACK TestProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void FlushMessages ()
 
void Test_MessagesNonThemed ()
 
void Test_MessagesThemed ()
 
 START_TEST (button)
 

Variables

HWND hWnd1
 
HWND hWnd2
 
MSG_ENTRY paint_sequence []
 
MSG_ENTRY paint_nonthemed_sequence []
 
MSG_ENTRY redraw_sequence []
 
MSG_ENTRY redraw_nonthemed_sequence []
 
MSG_ENTRY printclnt_nonthemed_sequence []
 
MSG_ENTRY printclnt_sequence []
 
MSG_ENTRY pseudomove_sequence []
 
MSG_ENTRY pseudomove_nonthemed_sequence []
 
MSG_ENTRY pseudohover_sequence []
 
MSG_ENTRY pseudoleave_sequence []
 
MSG_ENTRY mouseenter_sequence []
 
MSG_ENTRY mouseenter_nonthemed_sequence []
 
MSG_ENTRY mousemove_sequence []
 
MSG_ENTRY mouseleave_sequence []
 
MSG_ENTRY mouseleave_nonthemed_sequence []
 
MSG_ENTRY themechanged_sequence []
 
MSG_ENTRY enable_nonthemed_sequence []
 
MSG_ENTRY btndown_nonthemed_sequence []
 
MSG_ENTRY btndown_repeat_nonthemed_sequence []
 
MSG_ENTRY btnclick_nonthemed_sequence []
 
MSG_ENTRY btnup_stray_sequence []
 

Macro Definition Documentation

◆ MOVE_CURSOR

#define MOVE_CURSOR (   x,
  y 
)
Value:
#define MOUSEEVENTF_ABSOLUTE
Definition: winuser.h:1180
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void WINAPI mouse_event(_In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ ULONG_PTR)
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
int WINAPI GetSystemMetrics(_In_ int)
#define MOUSEEVENTF_MOVE
Definition: winuser.h:1169
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Definition at line 418 of file button.c.

◆ ok_rect

#define ok_rect (   rc,
  l,
  r,
  t,
  b 
)    ok((rc.left == (l)) && (rc.right == (r)) && (rc.top == (t)) && (rc.bottom == (b)), "Wrong rect. expected %d, %d, %d, %d got %ld, %ld, %ld, %ld\n", l,t,r,b, rc.left, rc.top, rc.right, rc.bottom)

Definition at line 17 of file button.c.

◆ ok_size

#define ok_size (   s,
  width,
  height 
)    ok((s.cx == (width) && s.cy == (height)), "Expected size (%lu,%lu) got (%lu,%lu)\n", (LONG)width, (LONG)height, s.cx, s.cy)

Definition at line 18 of file button.c.

Function Documentation

◆ FlushMessages()

static void FlushMessages ( )
static

Definition at line 489 of file button.c.

490 {
491  MSG msg;
492 
493  while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
494  {
495  int iwnd = get_iwnd(msg.hwnd);
496  if(iwnd)
497  {
498  if(msg.message <= WM_USER && iwnd != 0)
499  RECORD_MESSAGE(iwnd, msg.message, POST,0,0);
500  }
501  DispatchMessageW( &msg );
502  }
503 }
#define PeekMessage
Definition: winuser.h:5731
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
Definition: msgtrace.h:7
#define WM_USER
Definition: winuser.h:1877
#define msg(x)
Definition: auth_time.c:54
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
static int get_iwnd(HWND hWnd)
Definition: button.c:422
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

◆ get_iwnd()

static int get_iwnd ( HWND  hWnd)
static

Definition at line 422 of file button.c.

423 {
424  if(hWnd == hWnd1) return 1;
425  else if(hWnd == hWnd2) return 2;
426  else return 0;
427 }
HWND hWnd
Definition: settings.c:17
HWND hWnd1
Definition: button.c:416
HWND hWnd2
Definition: button.c:416

Referenced by FlushMessages(), subclass_proc(), and TestProc().

◆ START_TEST()

START_TEST ( button  )

Definition at line 925 of file button.c.

926 {
927  LoadLibraryW(L"comctl32.dll"); /* same as statically linking to comctl32 and doing InitCommonControls */
928  Test_TextMargin();
929  Test_Imagelist();
931 
933  if (IsThemeActive())
935  else
936  skip("No active theme, skipping Test_MessagesThemed\n");
937 
938 }
void Test_TextMargin()
Definition: button.c:20
void Test_Imagelist()
Definition: button.c:72
void Test_MessagesThemed()
Definition: button.c:829
void Test_MessagesNonThemed()
Definition: button.c:695
void Test_GetIdealSizeNoThemes()
Definition: button.c:108
#define LoadLibraryW(x)
Definition: compat.h:404
static const WCHAR L[]
Definition: oid.c:1250
#define skip(...)
Definition: atltest.h:64
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606

◆ subclass_proc()

static LRESULT CALLBACK subclass_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
UINT_PTR  id,
DWORD_PTR  ref_data 
)
static

Definition at line 429 of file button.c.

430 {
431  int iwnd = get_iwnd(hwnd);
432 
433  if(message > WM_USER || !iwnd )
435 
436  switch(message)
437  {
438  case WM_IME_SETCONTEXT:
439  case WM_IME_NOTIFY :
440  case WM_GETICON :
441  case WM_GETTEXT:
442  case WM_GETTEXTLENGTH:
443  break;
444  case WM_NOTIFY:
445  {
446  NMHDR* pnmhdr = (NMHDR*)lParam;
447  if (pnmhdr->code == NM_CUSTOMDRAW)
448  {
449  NMCUSTOMDRAW* pnmcd = (NMCUSTOMDRAW*)lParam;
450  RECORD_MESSAGE(iwnd, message, SENT, pnmhdr->code, pnmcd->dwDrawStage);
451  }
452  else
453  {
454  RECORD_MESSAGE(iwnd, message, SENT, pnmhdr->idFrom,pnmhdr->code);
455  }
456  break;
457  }
458  default:
459  RECORD_MESSAGE(iwnd, message, SENT, 0,0);
460  }
462 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_IME_NOTIFY
Definition: winuser.h:1812
Definition: tftpd.h:59
#define WM_GETTEXT
Definition: winuser.h:1600
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3133
UINT_PTR idFrom
Definition: winuser.h:3132
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1496
#define WM_IME_SETCONTEXT
Definition: winuser.h:1811
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_USER
Definition: winuser.h:1877
Definition: msgtrace.h:6
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
static int get_iwnd(HWND hWnd)
Definition: button.c:422
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

◆ Test_GetIdealSizeNoThemes()

void Test_GetIdealSizeNoThemes ( )

Definition at line 108 of file button.c.

109 {
110  HWND hwnd1, hwnd2;
111  BOOL ret;
112  SIZE s, textent;
113  HFONT font;
114  HDC hdc;
115  HANDLE hbmp;
117  BUTTON_IMAGELIST imlData;
118  RECT rc;
119  LOGFONTW lf;
120  DWORD i;
121 
122  hwnd2 = CreateWindowW(L"Static", L"", 0, 0, 0, 100, 100, 0, NULL, NULL, NULL);
123  ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n");
124 
125  hwnd1 = CreateWindowW(L"Button", L" ", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
126  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
127  SetWindowTheme(hwnd1, L"", L"");
128 
129  font = (HFONT)SendMessageW(hwnd1, WM_GETFONT, 0, 0);
130  hdc = GetDC(hwnd1);
132  GetTextExtentPoint32W(hdc, L" ", 1, &textent);
133 
134  memset(&s, 0, sizeof(s));
135  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
136  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
137  ok_size(s, textent.cx + 5 + 2,
138  textent.cy + 7 + 2); /* the last +2 is the text margin */
139 
140  DestroyWindow(hwnd1);
141 
142 
143  hwnd1 = CreateWindowW(L"Button", L" ", BS_USERBUTTON | WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
144  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
145  SetWindowTheme(hwnd1, L"", L"");
146 
147  memset(&s, 0, sizeof(s));
148  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
149  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
150  ok_size(s, textent.cx + 5 + 2,
151  textent.cy + 7 + 2); /* the last +2 is the text margin */
152 
153  DestroyWindow(hwnd1);
154 
155 
156 
157  hwnd1 = CreateWindowW(L"Button", L"", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
158  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
159  SetWindowTheme(hwnd1, L"", L"");
160 
161  s.cx = 1;
162  s.cy = 1;
163  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
164  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
165  ok_size(s, 100, 100);
166 
168  ok (hbmp != 0, "Expected LoadImage to succeed\n");
169 
171 
172  memset(&s, 0, sizeof(s));
173  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
174  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
175  ok_size(s, 100, 100);
176 
178  ok (himl != 0, "Expected ImageList_LoadImage to succeed\n");
179 
180  memset(&imlData, 0, sizeof(imlData));
181  imlData.himl = himl;
182  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
183  ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n"); /* This works in win10 */
184 
185  memset(&s, 0, sizeof(s));
186  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
187  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
188  ok_size(s, 100, 100);
189 
190  DestroyWindow(hwnd1);
191 
192 
193 
194 
195 
196  hwnd1 = CreateWindowW(L"Button", L"", WS_CHILD, 10, 10, 5, 5, hwnd2, NULL, NULL, NULL);
197  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
198  SetWindowTheme(hwnd1, L"", L"");
199 
200  memset(&s, 0, sizeof(s));
201  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
202  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
203  ok_size(s, 5, 5);
204 
205  DestroyWindow(hwnd1);
206 
207 
208 
209 
210  hwnd1 = CreateWindowW(L"Button", L" ", BS_BITMAP | WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
211  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
212  SetWindowTheme(hwnd1, L"", L"");
213 
215 
216  memset(&s, 0, sizeof(s));
217  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
218  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
219 
220  /* In xp and 2k3 the image is ignored, in vista+ its width is added to the text width */
221  ok_size(s, textent.cx + 5 + 2,
222  textent.cy + 7 + 2); /* the last +2 is the text margin */
223 
224  DestroyWindow(hwnd1);
225 
226 
227 
228  hwnd1 = CreateWindowW(L"Button", L" ", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
229  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
230  SetWindowTheme(hwnd1, L"", L"");
231 
232  SetRect(&rc, 0,0,0,0);
233  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
234  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
235 
236  memset(&s, 0, sizeof(s));
237  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
238  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
239  ok_size(s, textent.cx + 5,
240  textent.cy + 7);
241 
242  SetRect(&rc, 50,50,50,50);
243  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
244  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
245 
246  memset(&s, 0, sizeof(s));
247  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
248  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
249  ok_size(s, textent.cx + 5 + 100,
250  textent.cy + 7 + 100);
251 
252  SetRect(&rc, 1,1,1,1);
253  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
254  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
255 
256  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
257  ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n");
258 
259  memset(&s, 0, sizeof(s));
260  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
261  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
262  ok_size(s, textent.cx + 5 + 2 + 1, /* we get an extra pixel due to the iml */
263  textent.cy + 7 + 2);
264 
265  s.cx = 1;
266  s.cy = 1;
267  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
268  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
269  ok_size(s, textent.cx + 5 + 2 + 1,
270  textent.cy + 7 + 2);
271 
272  s.cx = 100;
273  s.cy = 100;
274  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
275  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
276  ok_size(s, textent.cx + 5 + 2 + 1,
277  textent.cy + 7 + 2);
278 
279  SetRect(&imlData.margin, 1,1,1,1);
280  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
281  ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n");
282 
283  memset(&s, 0, sizeof(s));
284  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
285  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
286  /* expected width = text width + hardcoded value + text margins + image width + image margins */
287  ok_size(s, textent.cx + 5 + 2 + 1 + 2,
288  textent.cy + 7 + 2);
289 
290  SetRect(&imlData.margin, 50,50,50,50);
291  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
292  ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n");
293 
294  memset(&s, 0, sizeof(s));
295  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
296  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
297  /* image + its margins is so big that the height is dictated by them */
298  ok_size(s, textent.cx + 5 + 2 + 1 + 100, (LONG)101);
299 
300  DestroyWindow(hwnd1);
301 
302 
303 
304 
305 
306 
307  hwnd1 = CreateWindowW(L"Button", L"Start", BS_VCENTER | WS_CHILD, 0, 0, 0, 0, hwnd2, NULL, NULL, NULL);
308  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
309  SetWindowTheme(hwnd1, L"", L"");
310 
311  font = (HFONT)SendMessageW(hwnd1, WM_GETFONT, 0, 0);
312  hdc = GetDC(hwnd1);
314  GetTextExtentPoint32W(hdc, L"Start", 5, &textent);
315 
316  SetRect(&rc, 0,0,0,0);
317  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
318  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
319 
320  memset(&s, 0, sizeof(s));
321  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
322  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
323  ok_size(s, textent.cx + 5, textent.cy + 7);
324 
325  DestroyWindow(hwnd1);
326 
327 
328 
329 
330  /* Test again with some real text to see if the formula is correct */
331  hwnd1 = CreateWindowW(L"Button", L"Some test text", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL);
332  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
333  SetWindowTheme(hwnd1, L"", L"");
334 
335  font = (HFONT)SendMessageW(hwnd1, WM_GETFONT, 0, 0);
336  hdc = GetDC(hwnd1);
338  GetTextExtentPoint32W(hdc, L"Some test text", 14, &textent);
339 
340  memset(&s, 0, sizeof(s));
341  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
342  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
343  ok_size(s, textent.cx + 5 + 2, /* the last +2 is the text margin */
344  textent.cy + 7 + 2);
345 
346  /* The hardcoded values are independent of the margin */
347  lf.lfHeight = 200;
348  lf.lfWidth = 200;
349  lf.lfWeight = FW_BOLD;
350  wcscpy(lf.lfFaceName, L"Arial");
351  font = CreateFontIndirectW(&lf);
352  ok(font != NULL, "\n");
354 
356  GetTextExtentPoint32W(hdc, L"Some test text", 14, &textent);
357 
358  memset(&s, 0, sizeof(s));
359  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
360  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
361  ok_size(s, textent.cx + 5 + 2, /* the last +2 is the text margin */
362  textent.cy + 7 + 2);
363 
364  DestroyWindow(hwnd1);
365 
366  for (i = BS_PUSHBUTTON; i <= BS_OWNERDRAW; i++)
367  {
368  if (i == BS_USERBUTTON)
369  continue;
370 
371  if (i >= BS_CHECKBOX)
372  {
373  hwnd1 = CreateWindowW(L"Button", L" ", i|WS_CHILD, 0, 0, 72, 72, hwnd2, NULL, NULL, NULL);
374  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
375  memset(&s, 0, sizeof(s));
376  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
377  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
378  ok_size(s, 72, 72);
379 
380  SetWindowTheme(hwnd1, L"", L"");
381  memset(&s, 0, sizeof(s));
382  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
383  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
384  ok_size(s, 72, 72);
385  DestroyWindow(hwnd1);
386 
387  hwnd1 = CreateWindowW(L"Button", L" ", i|WS_CHILD, 0, 0, 12, 12, hwnd2, NULL, NULL, NULL);
388  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
389  memset(&s, 0, sizeof(s));
390  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
391  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
392  ok_size(s, 12, 12);
393  DestroyWindow(hwnd1);
394  }
395 
396  hwnd1 = CreateWindowW(L"Button", L"", i|WS_CHILD, 0, 0, 72, 72, hwnd2, NULL, NULL, NULL);
397  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
398  memset(&s, 0, sizeof(s));
399  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
400  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
401  ok_size(s, 72, 72);
402  DestroyWindow(hwnd1);
403 
404  hwnd1 = CreateWindowW(L"Button", L"", i|WS_CHILD, 0, 0, 150, 72, hwnd2, NULL, NULL, NULL);
405  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
406  memset(&s, 0, sizeof(s));
407  ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s);
408  ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n");
409  ok_size(s, 150, 72);
410  DestroyWindow(hwnd1);
411  }
412  DestroyWindow(hwnd2);
413 }
HIMAGELIST himl
Definition: commctrl.h:4606
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BS_OWNERDRAW
Definition: pedump.c:661
#define TRUE
Definition: types.h:120
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4620
HDC WINAPI GetDC(_In_opt_ HWND)
Definition: mk_font.cpp:20
LONG lfHeight
Definition: dimm.idl:59
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define ImageList_LoadImage
Definition: commctrl.h:493
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define BM_SETIMAGE
Definition: winuser.h:1904
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
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
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
LONG lfWidth
Definition: dimm.idl:60
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WM_GETFONT
Definition: winuser.h:1633
#define BS_CHECKBOX
Definition: pedump.c:653
LONG cx
Definition: windef.h:319
LONG_PTR LPARAM
Definition: windef.h:208
HBITMAP hbmp
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define BS_BITMAP
Definition: winuser.h:258
GLdouble s
Definition: gl.h:2039
#define BS_VCENTER
Definition: winuser.h:279
#define BS_PUSHBUTTON
Definition: pedump.c:651
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define FW_BOLD
Definition: wingdi.h:377
#define GetModuleHandle
Definition: winbase.h:3651
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define LoadImage
Definition: winuser.h:5716
#define BCM_GETIDEALSIZE
Definition: commctrl.h:4611
#define BS_USERBUTTON
Definition: pedump.c:659
LONG lfWeight
Definition: dimm.idl:63
#define ok_size(s, width, height)
Definition: button.c:18
#define BCM_SETIMAGELIST
Definition: commctrl.h:4614
#define memset(x, y, z)
Definition: compat.h:39
LONG cy
Definition: windef.h:320
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

Referenced by START_TEST().

◆ Test_Imagelist()

void Test_Imagelist ( )

Definition at line 72 of file button.c.

73 {
74  HWND hwnd1;
75  BOOL ret;
76  BUTTON_IMAGELIST imlData;
77 
78  hwnd1 = CreateWindowW(L"Button", L"Test2", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL);
79  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
80 
81  ret = SendMessageW(hwnd1, BCM_GETIMAGELIST, 0, (LPARAM)&imlData);
82  ok (ret == TRUE, "Expected BCM_GETIMAGELIST to succeed\n");
83  ok (imlData.himl == 0, "Expected 0 himl\n");
84  ok (imlData.uAlign == 0, "Expected 0 uAlign\n");
85  ok_rect(imlData.margin, 0, 0, 0, 0);
86 
87  SetRect(&imlData.margin, 0,0,0,1);
88  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
89  ok (ret == FALSE, "Expected BCM_SETIMAGELIST to fail\n"); /* This works in win10 */
90 
91  imlData.himl = (HIMAGELIST)0xdead;
92  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
93  ok (ret == TRUE, "Expected BCM_SETIMAGELIST to fail\n");
94 
95  ret = SendMessageW(hwnd1, BCM_GETIMAGELIST, 0, (LPARAM)&imlData);
96  ok (ret == TRUE, "Expected BCM_GETIMAGELIST to succeed\n");
97  ok (imlData.himl == (HIMAGELIST)0xdead, "Expected 0 himl\n");
98  ok (imlData.uAlign == 0, "Expected 0 uAlign\n");
99  ok_rect(imlData.margin, 0, 0, 0, 1);
100 
101  imlData.himl = 0;
102  ret = SendMessageW(hwnd1, BCM_SETIMAGELIST, 0, (LPARAM)&imlData);
103  ok (ret == FALSE, "Expected BCM_SETIMAGELIST to fail\n"); /* This works in win10 */
104 
105  DestroyWindow(hwnd1);
106 }
HIMAGELIST himl
Definition: commctrl.h:4606
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ok_rect(rc, l, r, t, b)
Definition: button.c:17
static HIMAGELIST(WINAPI *pImageList_Create)(int
int ret
#define BCM_GETIMAGELIST
Definition: commctrl.h:4617
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define BCM_SETIMAGELIST
Definition: commctrl.h:4614

Referenced by START_TEST().

◆ Test_MessagesNonThemed()

void Test_MessagesNonThemed ( )

Definition at line 695 of file button.c.

696 {
697  DWORD state;
698 
699  MOVE_CURSOR(0,0);
700  EMPTY_CACHE();
701 
702  RegisterSimpleClass(TestProc, L"testClass");
703  hWnd1 = CreateWindowW(L"testClass", L"Test parent", WS_POPUP | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
704  ok (hWnd1 != NULL, "Expected CreateWindowW to succeed\n");
705  SetWindowTheme(hWnd1, L"", L"");
707 
708  hWnd2 = CreateWindowW(L"Button", L"test button", /*BS_RADIOBUTTON | */WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hWnd1, NULL, NULL, NULL);
709  ok (hWnd2 != NULL, "Expected CreateWindowW to succeed\n");
710  SetWindowTheme(hWnd2, L"", L"");
713 
714  FlushMessages();
715  EMPTY_CACHE();
716 
718  FlushMessages();
720  FlushMessages();
722 
724  FlushMessages();
726 
728  FlushMessages();
730 
732  FlushMessages();
734 
736  FlushMessages();
738 
740  FlushMessages();
742 
744  FlushMessages();
746 
748  FlushMessages();
750 
752  FlushMessages();
754 
756  ok(state == 0, "Expected state 0, got %lu\n", state);
757  EMPTY_CACHE();
758 
759  MOVE_CURSOR(150,150);
760  FlushMessages();
762 
764  ok(state == BST_HOT, "Expected state BST_HOT, got %lu\n", state);
765  EMPTY_CACHE();
766 
767  MOVE_CURSOR(151,151);
768  FlushMessages();
770 
772  ok(state == BST_HOT, "Expected state BST_HOT, got %lu\n", state);
773  EMPTY_CACHE();
774 
775  MOVE_CURSOR(0,0);
776  FlushMessages();
778  FlushMessages();
780 
782  ok(state == 0, "Expected state 0, got %lu\n", state);
783  EMPTY_CACHE();
784 
785  SendMessageW(hWnd2, WM_THEMECHANGED, 1, 0);
786  FlushMessages();
788 
790  FlushMessages();
792 
794  FlushMessages();
796 
798  ok(state == 0, "Expected state 0, got %lu\n", state);
799  EMPTY_CACHE();
800 
802  FlushMessages();
804 
806  ok(state == 0, "Expected state 0, got %lu\n", state);
807  EMPTY_CACHE();
808 
809  SendMessageW(hWnd2, BM_CLICK, 0, 0);
810  FlushMessages();
812 
814  ok(state == 0, "Expected state 0, got %lu\n", state);
815  EMPTY_CACHE();
816 
818  FlushMessages();
820 
822  ok(state == 0, "Expected state 0, got %lu\n", state);
823  EMPTY_CACHE();
824 
827 }
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
MSG_ENTRY pseudohover_sequence[]
Definition: button.c:578
MSG_ENTRY mouseenter_nonthemed_sequence[]
Definition: button.c:601
#define TRUE
Definition: types.h:120
MSG_ENTRY printclnt_nonthemed_sequence[]
Definition: button.c:539
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
static void FlushMessages()
Definition: button.c:489
static LRESULT CALLBACK TestProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: button.c:464
MSG_ENTRY themechanged_sequence[]
Definition: button.c:643
#define WM_MOUSEHOVER
Definition: commctrl.h:4945
#define BM_GETSTATE
Definition: winuser.h:1902
BOOL WINAPI UpdateWindow(_In_ HWND)
MSG_ENTRY btndown_repeat_nonthemed_sequence[]
Definition: button.c:672
#define WS_CHILD
Definition: pedump.c:617
#define RDW_FRAME
Definition: winuser.h:1198
HWND hWnd1
Definition: button.c:416
BOOL WINAPI DestroyWindow(_In_ HWND)
MSG_ENTRY btndown_nonthemed_sequence[]
Definition: button.c:661
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define BST_HOT
Definition: commctrl.h:4639
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
smooth NULL
Definition: ftsmooth.c:416
MSG_ENTRY redraw_nonthemed_sequence[]
Definition: button.c:531
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1261
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
static LRESULT CALLBACK subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data)
Definition: button.c:429
#define BM_CLICK
Definition: winuser.h:1899
#define PRF_ERASEBKGND
Definition: winuser.h:2501
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
HWND hWnd2
Definition: button.c:416
#define RDW_ERASE
Definition: winuser.h:1197
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
MSG_ENTRY paint_nonthemed_sequence[]
Definition: button.c:514
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
static int state
Definition: maze.c:121
#define EMPTY_CACHE()
Definition: msgtrace.h:59
MSG_ENTRY btnclick_nonthemed_sequence[]
Definition: button.c:677
MSG_ENTRY btnup_stray_sequence[]
Definition: button.c:691
MSG_ENTRY pseudomove_nonthemed_sequence[]
Definition: button.c:566
MSG_ENTRY pseudoleave_sequence[]
Definition: button.c:582
#define MOVE_CURSOR(x, y)
Definition: button.c:418
MSG_ENTRY enable_nonthemed_sequence[]
Definition: button.c:653
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define WM_LBUTTONUP
Definition: winuser.h:1759
MSG_ENTRY mouseleave_nonthemed_sequence[]
Definition: button.c:633
#define WS_POPUP
Definition: pedump.c:616
#define WM_MOUSEMOVE
Definition: winuser.h:1757
MSG_ENTRY mousemove_sequence[]
Definition: button.c:614
#define WS_VISIBLE
Definition: pedump.c:620
MSG_ENTRY empty_chain[]
Definition: msgtrace.c:20
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by START_TEST().

◆ Test_MessagesThemed()

void Test_MessagesThemed ( )

Definition at line 829 of file button.c.

830 {
831  DWORD state;
832 
833  MOVE_CURSOR(0,0);
834  EMPTY_CACHE();
835 
836  RegisterSimpleClass(TestProc, L"testClass");
837  hWnd1 = CreateWindowW(L"testClass", L"Test parent", WS_POPUP | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
838  ok (hWnd1 != NULL, "Expected CreateWindowW to succeed\n");
840 
841  hWnd2 = CreateWindowW(L"Button", L"test button", /*BS_RADIOBUTTON | */WS_CHILD | WS_VISIBLE, 0, 0, 100, 100, hWnd1, NULL, NULL, NULL);
842  ok (hWnd2 != NULL, "Expected CreateWindowW to succeed\n");
845 
846  FlushMessages();
847  EMPTY_CACHE();
848 
850  FlushMessages();
852  FlushMessages();
854 
856  FlushMessages();
858 
860  FlushMessages();
862 
864  FlushMessages();
866 
868  FlushMessages();
870 
872  FlushMessages();
874 
876  FlushMessages();
878 
880  FlushMessages();
882 
884  FlushMessages();
886 
888  FlushMessages();
890 
892  ok(state == 0, "Expected state 0, got %lu", state);
893  EMPTY_CACHE();
894 
895  MOVE_CURSOR(150,150);
896  FlushMessages();
898 
900  ok(state == BST_HOT, "Expected state BST_HOT, got %lu", state);
901  EMPTY_CACHE();
902 
903  MOVE_CURSOR(151,151);
904  FlushMessages();
906 
908  ok(state == BST_HOT, "Expected state BST_HOT, got %lu", state);
909  EMPTY_CACHE();
910 
911  MOVE_CURSOR(0,0);
912  FlushMessages();
914  FlushMessages();
916 
918  ok(state == 0, "Expected state 0, got %lu", state);
919  EMPTY_CACHE();
920 
923 }
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
MSG_ENTRY mouseleave_sequence[]
Definition: button.c:621
MSG_ENTRY pseudohover_sequence[]
Definition: button.c:578
static void FlushMessages()
Definition: button.c:489
MSG_ENTRY printclnt_sequence[]
Definition: button.c:546
static LRESULT CALLBACK TestProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: button.c:464
#define WM_MOUSEHOVER
Definition: commctrl.h:4945
#define BM_GETSTATE
Definition: winuser.h:1902
BOOL WINAPI UpdateWindow(_In_ HWND)
#define WS_CHILD
Definition: pedump.c:617
#define RDW_FRAME
Definition: winuser.h:1198
HWND hWnd1
Definition: button.c:416
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
#define WM_PRINTCLIENT
Definition: richedit.h:70
MSG_ENTRY redraw_sequence[]
Definition: button.c:521
#define BST_HOT
Definition: commctrl.h:4639
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
smooth NULL
Definition: ftsmooth.c:416
MSG_ENTRY pseudomove_sequence[]
Definition: button.c:552
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1261
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
static LRESULT CALLBACK subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data)
Definition: button.c:429
#define PRF_ERASEBKGND
Definition: winuser.h:2501
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
HWND hWnd2
Definition: button.c:416
#define RDW_ERASE
Definition: winuser.h:1197
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define RDW_INTERNALPAINT
Definition: winuser.h:1199
static int state
Definition: maze.c:121
#define EMPTY_CACHE()
Definition: msgtrace.h:59
MSG_ENTRY pseudoleave_sequence[]
Definition: button.c:582
#define MOVE_CURSOR(x, y)
Definition: button.c:418
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define WM_MOUSEMOVE
Definition: winuser.h:1757
MSG_ENTRY mousemove_sequence[]
Definition: button.c:614
MSG_ENTRY mouseenter_sequence[]
Definition: button.c:586
MSG_ENTRY paint_sequence[]
Definition: button.c:505
#define PRF_CLIENT
Definition: winuser.h:2500
#define WS_VISIBLE
Definition: pedump.c:620
MSG_ENTRY empty_chain[]
Definition: msgtrace.c:20
#define RDW_INVALIDATE
Definition: winuser.h:1200

Referenced by START_TEST().

◆ Test_TextMargin()

void Test_TextMargin ( )

Definition at line 20 of file button.c.

21 {
22  RECT rc;
23  BOOL ret;
24  HWND hwnd1;
25 
26  hwnd1 = CreateWindowW(L"Button", L"Test1", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL);
27  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
28  SetWindowTheme(hwnd1, L"", L"");
29 
30  ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
31  ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
32  ok_rect(rc, 1, 1, 1, 1);
33 
34  SetRect(&rc, 0,0,0,0);
35  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
36  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
37 
38  ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
39  ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
40  ok_rect(rc, 0, 0, 0, 0);
41 
42  SetRect(&rc, -1,-1,-1,-1);
43  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
44  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
45 
46  ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
47  ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
48  ok_rect(rc, -1, -1, -1, -1);
49 
50  SetRect(&rc, 1000,1000,1000,1000);
51  ret = SendMessageW(hwnd1, BCM_SETTEXTMARGIN, 0, (LPARAM)&rc);
52  ok (ret == TRUE, "Expected BCM_SETTEXTMARGIN to succeed\n");
53 
54  ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
55  ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
56  ok_rect(rc, 1000, 1000, 1000, 1000);
57 
58  DestroyWindow(hwnd1);
59 
60  hwnd1 = CreateWindowW(L"Button", L"Test1", BS_DEFPUSHBUTTON, 10, 10, 100, 100, 0, NULL, NULL, NULL);
61  ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n");
62  SetWindowTheme(hwnd1, L"", L"");
63 
64  ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc);
65  ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n");
66  ok_rect(rc, 1, 1, 1, 1);
67 
68  DestroyWindow(hwnd1);
69 
70 }
#define TRUE
Definition: types.h:120
#define BCM_SETTEXTMARGIN
Definition: commctrl.h:4620
#define BCM_GETTEXTMARGIN
Definition: commctrl.h:4622
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ok_rect(rc, l, r, t, b)
Definition: button.c:17
int ret
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ TestProc()

static LRESULT CALLBACK TestProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 464 of file button.c.

465 {
466  int iwnd = get_iwnd(hwnd);
467 
468  if (iwnd != 0 && message == WM_NOTIFY)
469  {
470  NMHDR* pnmhdr = (NMHDR*)lParam;
471  if (pnmhdr->code == NM_CUSTOMDRAW)
472  {
473  NMCUSTOMDRAW* pnmcd = (NMCUSTOMDRAW*)lParam;
474  RECORD_MESSAGE(iwnd, message, SENT, pnmhdr->code, pnmcd->dwDrawStage);
475  }
476  else
477  {
478  RECORD_MESSAGE(iwnd, message, SENT, pnmhdr->idFrom,pnmhdr->code);
479  }
480  }
481  else if (iwnd != 0 && message < WM_USER && message != WM_GETICON)
482  {
483  RECORD_MESSAGE(iwnd, message, SENT, 0,0);
484  }
485 
487 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3133
UINT_PTR idFrom
Definition: winuser.h:3132
#define DefWindowProc
Definition: ros2win.h:31
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_USER
Definition: winuser.h:1877
Definition: msgtrace.h:6
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
static int get_iwnd(HWND hWnd)
Definition: button.c:422
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

Variable Documentation

◆ btnclick_nonthemed_sequence

MSG_ENTRY btnclick_nonthemed_sequence[]
Initial value:
={
{2, BM_CLICK, SENT},
{2, BM_SETSTATE , SENT},
{2, WM_PAINT, POST},
{0,0}}
#define BM_SETSTATE
Definition: winuser.h:1905
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define WM_CAPTURECHANGED
Definition: winuser.h:1790
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define BM_CLICK
Definition: winuser.h:1899
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_LBUTTONUP
Definition: winuser.h:1759
Definition: msgtrace.h:6
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 677 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ btndown_nonthemed_sequence

MSG_ENTRY btndown_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define BM_SETSTATE
Definition: winuser.h:1905
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_SETFOCUS
Definition: winuser.h:1595
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 661 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ btndown_repeat_nonthemed_sequence

MSG_ENTRY btndown_repeat_nonthemed_sequence[]
Initial value:
={
{0,0}}
#define BM_SETSTATE
Definition: winuser.h:1905
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
Definition: msgtrace.h:6

Definition at line 672 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ btnup_stray_sequence

MSG_ENTRY btnup_stray_sequence[]
Initial value:
={
{0,0}}
#define WM_LBUTTONUP
Definition: winuser.h:1759
Definition: msgtrace.h:6

Definition at line 691 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ enable_nonthemed_sequence

MSG_ENTRY enable_nonthemed_sequence[]
Initial value:
={
{2, WM_ENABLE, SENT},
{0,0}}
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 653 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ hWnd1

◆ hWnd2

◆ mouseenter_nonthemed_sequence

MSG_ENTRY mouseenter_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_NCHITTEST
Definition: winuser.h:1668
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_SETCURSOR
Definition: winuser.h:1618
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define WM_MOUSEMOVE
Definition: winuser.h:1757
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 601 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ mouseenter_sequence

MSG_ENTRY mouseenter_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_NCHITTEST
Definition: winuser.h:1668
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_SETCURSOR
Definition: winuser.h:1618
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define WM_MOUSEMOVE
Definition: winuser.h:1757
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 586 of file button.c.

Referenced by Test_MessagesThemed().

◆ mouseleave_nonthemed_sequence

MSG_ENTRY mouseleave_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 633 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ mouseleave_sequence

MSG_ENTRY mouseleave_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 621 of file button.c.

Referenced by Test_MessagesThemed().

◆ mousemove_sequence

MSG_ENTRY mousemove_sequence[]
Initial value:
={
{0,0}}
#define WM_NCHITTEST
Definition: winuser.h:1668
#define WM_SETCURSOR
Definition: winuser.h:1618
Definition: msgtrace.h:7
#define WM_MOUSEMOVE
Definition: winuser.h:1757

Definition at line 614 of file button.c.

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

◆ paint_nonthemed_sequence

MSG_ENTRY paint_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 514 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ paint_sequence

MSG_ENTRY paint_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 505 of file button.c.

Referenced by Test_MessagesThemed().

◆ printclnt_nonthemed_sequence

MSG_ENTRY printclnt_nonthemed_sequence[]
Initial value:
={
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 539 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ printclnt_sequence

MSG_ENTRY printclnt_sequence[]
Initial value:
={
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:6
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 546 of file button.c.

Referenced by Test_MessagesThemed().

◆ pseudohover_sequence

MSG_ENTRY pseudohover_sequence[]
Initial value:
={
{0,0}}
#define WM_MOUSEHOVER
Definition: commctrl.h:4945

Definition at line 578 of file button.c.

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

◆ pseudoleave_sequence

MSG_ENTRY pseudoleave_sequence[]
Initial value:
={
{0,0}}
#define WM_MOUSELEAVE
Definition: commctrl.h:4946

Definition at line 582 of file button.c.

Referenced by Test_MessagesNonThemed(), and Test_MessagesThemed().

◆ pseudomove_nonthemed_sequence

MSG_ENTRY pseudomove_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define WM_MOUSEMOVE
Definition: winuser.h:1757
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 566 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ pseudomove_sequence

MSG_ENTRY pseudomove_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_MOUSELEAVE
Definition: commctrl.h:4946
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
#define WM_MOUSEMOVE
Definition: winuser.h:1757
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define BCN_HOTITEMCHANGE
Definition: commctrl.h:4637
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 552 of file button.c.

Referenced by Test_MessagesThemed().

◆ redraw_nonthemed_sequence

MSG_ENTRY redraw_nonthemed_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 531 of file button.c.

Referenced by Test_MessagesNonThemed().

◆ redraw_sequence

MSG_ENTRY redraw_sequence[]
Initial value:
={
{2, WM_PAINT, POST},
{0,0}}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 521 of file button.c.

Referenced by Test_MessagesThemed().

◆ themechanged_sequence

MSG_ENTRY themechanged_sequence[]
Initial value:
={
{2, WM_THEMECHANGED, SENT},
{2, WM_PAINT, POST},
{0,0}}
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define NM_THEMECHANGED
Definition: commctrl.h:147
#define WM_PAINT
Definition: winuser.h:1602
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msgtrace.h:7
#define CDDS_PREPAINT
Definition: commctrl.h:265
Definition: msgtrace.h:6
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Definition at line 643 of file button.c.

Referenced by Test_MessagesNonThemed().