ReactOS  0.4.13-dev-249-gcba1a2f
tab.c
Go to the documentation of this file.
1 /* Unit test suite for tab control.
2  *
3  * Copyright 2003 Vitaliy Margolen
4  * Copyright 2007 Hagop Hagopian
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <windows.h>
22 #include <commctrl.h>
23 #include <stdio.h>
24 
25 #include "wine/test.h"
26 #include "msg.h"
27 
28 #define DEFAULT_MIN_TAB_WIDTH 54
29 #define TAB_PADDING_X 6
30 #define EXTRA_ICON_PADDING 3
31 #define MAX_TABLEN 32
32 
33 #define NUM_MSG_SEQUENCES 2
34 #define PARENT_SEQ_INDEX 0
35 #define TAB_SEQ_INDEX 1
36 
37 #define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
38 #define expect_str(expected, got)\
39  ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)
40 
41 #define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
42 
43 static HIMAGELIST (WINAPI *pImageList_Create)(INT,INT,UINT,INT,INT);
44 static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
45 static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST);
46 static INT (WINAPI *pImageList_ReplaceIcon)(HIMAGELIST,INT,HICON);
47 
48 static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
49 {
50  RECT r;
51 
53  if (width >= 0 && height < 0)
54  ok_(__FILE__,line) (width == r.right - r.left, "%s: Expected width [%d] got [%d]\n",
55  msg, width, r.right - r.left);
56  else if (height >= 0 && width < 0)
57  ok_(__FILE__,line) (height == r.bottom - r.top, "%s: Expected height [%d] got [%d]\n",
58  msg, height, r.bottom - r.top);
59  else
60  ok_(__FILE__,line) ((width == r.right - r.left) && (height == r.bottom - r.top ),
61  "%s: Expected [%d,%d] got [%d,%d]\n", msg, width, height,
62  r.right - r.left, r.bottom - r.top);
63 }
64 
65 #define CHECKSIZE(hwnd,width,height,msg) CheckSize(hwnd,width,height,msg,__LINE__)
66 
67 static void TabCheckSetSize(HWND hwnd, INT set_width, INT set_height, INT exp_width,
68  INT exp_height, const char *msg, int line)
69 {
71  MAKELPARAM((set_width >= 0) ? set_width : 0, (set_height >= 0) ? set_height : 0));
73  CheckSize(hwnd, exp_width, exp_height, msg, line);
74 }
75 
76 #define TABCHECKSETSIZE(hwnd,set_width,set_height,exp_width,exp_height,msg) \
77  TabCheckSetSize(hwnd,set_width,set_height,exp_width,exp_height,msg,__LINE__)
78 
79 static HFONT hFont;
83 
85 
86 static const struct message empty_sequence[] = {
87  { 0 }
88 };
89 
90 static const struct message get_row_count_seq[] = {
91  { TCM_GETROWCOUNT, sent|wparam|lparam, 0, 0 },
92  { 0 }
93 };
94 
95 static const struct message getset_cur_focus_seq[] = {
96  { TCM_SETCURFOCUS, sent|lparam, 0 },
97  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
98  { TCM_SETCURFOCUS, sent|lparam, 0 },
99  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
100  { TCM_SETCURSEL, sent|lparam, 0 },
101  { TCM_SETCURFOCUS, sent|lparam, 0 },
102  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
103  { 0 }
104 };
105 
106 static const struct message getset_cur_sel_seq[] = {
107  { TCM_SETCURSEL, sent|lparam, 0 },
108  { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
109  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
110  { TCM_SETCURSEL, sent|lparam, 0 },
111  { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
112  { TCM_SETCURSEL, sent|lparam, 0 },
113  { TCM_SETCURSEL, sent|lparam, 0 },
114  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
115  { 0 }
116 };
117 
118 static const struct message getset_extended_style_seq[] = {
124  { 0 }
125 };
126 
127 static const struct message getset_unicode_format_seq[] = {
133  { 0 }
134 };
135 
136 static const struct message getset_item_seq[] = {
137  { TCM_SETITEMA, sent },
138  { TCM_GETITEMA, sent },
139  { TCM_GETITEMA, sent },
140  { 0 }
141 };
142 
143 static const struct message getset_tooltip_seq[] = {
144  { WM_NOTIFYFORMAT, sent|optional },
145  { WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
147  { WM_NOTIFYFORMAT, sent|optional },
148  { TCM_SETTOOLTIPS, sent|lparam, 0 },
149  { TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
150  { TCM_SETTOOLTIPS, sent|lparam, 0 },
151  { TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
152  { 0 }
153 };
154 
155 static const struct message getset_tooltip_parent_seq[] = {
157  { 0 }
158 };
159 
160 static const struct message insert_focus_seq[] = {
161  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
162  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
163  { TCM_INSERTITEMA, sent|wparam, 1 },
164  { WM_NOTIFYFORMAT, sent|defwinproc|optional },
165  { WM_QUERYUISTATE, sent|defwinproc|optional },
167  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
168  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
169  { TCM_INSERTITEMA, sent|wparam, 2 },
170  { WM_NOTIFYFORMAT, sent|defwinproc|optional },
171  { WM_QUERYUISTATE, sent|defwinproc|optional, },
173  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
174  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
175  { TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
176  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
177  { TCM_INSERTITEMA, sent|wparam, 3 },
178  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
179  { 0 }
180 };
181 
182 static const struct message delete_focus_seq[] = {
183  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
184  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
185  { TCM_DELETEITEM, sent|wparam|lparam, 1, 0 },
186  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
187  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
188  { TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
189  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
190  { TCM_DELETEITEM, sent|wparam|lparam, 0, 0 },
191  { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
192  { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
193  { 0 }
194 };
195 
196 static const struct message rbuttonup_seq[] = {
197  { WM_RBUTTONUP, sent|wparam|lparam, 0, 0 },
199  { 0 }
200 };
201 
202 static const struct message full_selchange_parent_seq[] = {
203  { WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGING },
204  { WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGE },
205  { 0 }
206 };
207 
208 static const struct message selchanging_parent_seq[] = {
209  { WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGING },
210  { 0 }
211 };
212 
213 static const struct message selchange_parent_seq[] = {
214  { WM_NOTIFY, sent|id, 0, 0, TCN_SELCHANGE },
215  { 0 }
216 };
217 
218 static const struct message setfocus_parent_seq[] = {
219  { WM_NOTIFY, sent|id, 0, 0, TCN_FOCUSCHANGE },
220  { 0 }
221 };
222 
223 static HWND
225 {
226  HWND handle;
227  TCITEMA tcNewTab;
228  static char text1[] = "Tab 1",
229  text2[] = "Wide Tab 2",
230  text3[] = "T 3";
231 
232  handle = CreateWindowA(WC_TABCONTROLA, "TestTab",
233  WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style, 10, 10, 300, 100, NULL,
234  NULL, NULL, 0);
235  ok(handle != NULL, "failed to create tab wnd\n");
236 
239 
240  tcNewTab.mask = mask;
241  tcNewTab.pszText = text1;
242  tcNewTab.iImage = 0;
243  SendMessageA(handle, TCM_INSERTITEMA, 0, (LPARAM)&tcNewTab);
244  tcNewTab.pszText = text2;
245  tcNewTab.iImage = 1;
246  SendMessageA(handle, TCM_INSERTITEMA, 1, (LPARAM)&tcNewTab);
247  tcNewTab.pszText = text3;
248  tcNewTab.iImage = 2;
249  SendMessageA(handle, TCM_INSERTITEMA, 2, (LPARAM)&tcNewTab);
250 
252  {
255  Sleep (1000);
256  }
257 
258  return handle;
259 }
260 
262 {
263  static LONG defwndproc_counter = 0;
264  struct message msg = { 0 };
265  LRESULT ret;
266 
267  /* do not log painting messages */
268  if (message != WM_PAINT &&
269  message != WM_ERASEBKGND &&
270  message != WM_NCPAINT &&
271  message != WM_NCHITTEST &&
272  message != WM_GETTEXT &&
273  message != WM_GETICON &&
275  {
276  msg.message = message;
277  msg.flags = sent|wparam|lparam;
278  if (defwndproc_counter) msg.flags |= defwinproc;
279  msg.wParam = wParam;
280  msg.lParam = lParam;
281  if (message == WM_NOTIFY && lParam)
282  msg.id = ((NMHDR*)lParam)->code;
284  }
285 
286  /* dump sent structure data */
287  if (message == WM_DRAWITEM)
289 
290  if (message == WM_NOTIFY)
291  {
292  NMHDR *nmhdr = (NMHDR *)lParam;
293  if (nmhdr && nmhdr->code == TCN_SELCHANGING)
294  return tcn_selchanging_result;
295  }
296 
297  defwndproc_counter++;
299  defwndproc_counter--;
300 
301  return ret;
302 }
303 
305 {
306  WNDCLASSA cls;
307 
308  cls.style = 0;
310  cls.cbClsExtra = 0;
311  cls.cbWndExtra = 0;
313  cls.hIcon = 0;
314  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
316  cls.lpszMenuName = NULL;
317  cls.lpszClassName = "Tab test parent class";
318  return RegisterClassA(&cls);
319 }
320 
322 {
324  return NULL;
325 
326  return CreateWindowExA(0, "Tab test parent class", "Tab test parent window",
329 }
330 
332 {
334  static LONG defwndproc_counter = 0;
335  struct message msg = { 0 };
336  LRESULT ret;
337 
338  /* do not log painting messages */
339  if (message != WM_PAINT &&
340  message != WM_ERASEBKGND &&
341  message != WM_NCPAINT &&
342  message != WM_NCHITTEST &&
343  message != WM_GETTEXT &&
344  message != WM_GETICON &&
346  {
347  msg.message = message;
348  msg.flags = sent|wparam|lparam;
349  if (defwndproc_counter) msg.flags |= defwinproc;
350  msg.wParam = wParam;
351  msg.lParam = lParam;
353  }
354 
355  defwndproc_counter++;
356  ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
357  defwndproc_counter--;
358 
359  return ret;
360 }
361 
363 {
364  HWND tabHandle;
365  TCITEMA tcNewTab;
366  WNDPROC oldproc;
367  RECT rect;
368  INT i;
369 
371 
372  tabHandle = CreateWindowA(WC_TABCONTROLA, "TestTab",
374  rect.bottom, parent_wnd, NULL, NULL, 0);
375  ok(tabHandle != NULL, "failed to create tab wnd\n");
376 
378  SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
379 
380  tcNewTab.mask = mask;
381 
382  for (i = 0; i < nTabs; i++)
383  {
384  char tabName[MAX_TABLEN];
385 
386  sprintf(tabName, "Tab %d", i+1);
387  tcNewTab.pszText = tabName;
388  tcNewTab.iImage = i;
389  SendMessageA(tabHandle, TCM_INSERTITEMA, i, (LPARAM)&tcNewTab);
390  }
391 
393  {
394  ShowWindow (tabHandle, SW_SHOW);
395  RedrawWindow (tabHandle, NULL, 0, RDW_UPDATENOW);
396  Sleep (1000);
397  }
398 
399  return tabHandle;
400 }
401 
402 static HWND create_tooltip (HWND hTab, char toolTipText[])
403 {
404  HWND hwndTT;
405 
406  TTTOOLINFOA ti;
407  LPSTR lptstr = toolTipText;
408  RECT rect;
409 
410  /* Creating a tooltip window*/
413  CW_USEDEFAULT, hTab, NULL, 0, NULL);
414 
415  SetWindowPos(
416  hwndTT,
417  HWND_TOPMOST,
418  0, 0, 0, 0,
420 
421  GetClientRect (hTab, &rect);
422 
423  /* Initialize members of toolinfo*/
424  ti.cbSize = sizeof(TTTOOLINFOA);
425  ti.uFlags = TTF_SUBCLASS;
426  ti.hwnd = hTab;
427  ti.hinst = 0;
428  ti.uId = 0;
429  ti.lpszText = lptstr;
430 
431  ti.rect = rect;
432 
433  /* Add toolinfo structure to the tooltip control */
434  SendMessageA(hwndTT, TTM_ADDTOOLA, 0, (LPARAM)&ti);
435 
436  return hwndTT;
437 }
438 
439 static void test_tab(INT nMinTabWidth)
440 {
441  HWND hwTab;
442  RECT rTab;
443  HIMAGELIST himl = pImageList_Create(21, 21, ILC_COLOR, 3, 4);
444  SIZE size;
445  HDC hdc;
446  HFONT hOldFont;
447  INT i, dpi, exp;
448 
450  SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
451  /* Get System default MinTabWidth */
452  if (nMinTabWidth < 0)
453  nMinTabWidth = SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
454 
455  hdc = GetDC(hwTab);
457  hOldFont = SelectObject(hdc, (HFONT)SendMessageA(hwTab, WM_GETFONT, 0, 0));
458  GetTextExtentPoint32A(hdc, "Tab 1", strlen("Tab 1"), &size);
459  trace("Tab1 text size: size.cx=%d size.cy=%d\n", size.cx, size.cy);
460  SelectObject(hdc, hOldFont);
461  ReleaseDC(hwTab, hdc);
462 
463  trace (" TCS_FIXEDWIDTH tabs no icon...\n");
464  CHECKSIZE(hwTab, dpi, -1, "default width");
465  TABCHECKSETSIZE(hwTab, 50, 20, 50, 20, "set size");
466  TABCHECKSETSIZE(hwTab, 0, 1, 0, 1, "min size");
467 
469 
470  trace (" TCS_FIXEDWIDTH tabs with icon...\n");
471  TABCHECKSETSIZE(hwTab, 50, 30, 50, 30, "set size > icon");
472  TABCHECKSETSIZE(hwTab, 20, 20, 25, 20, "set size < icon");
473  TABCHECKSETSIZE(hwTab, 0, 1, 25, 1, "min size");
474 
475  DestroyWindow (hwTab);
476 
478  SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
479 
480  hdc = GetDC(hwTab);
482  ReleaseDC(hwTab, hdc);
483  trace (" TCS_FIXEDWIDTH buttons no icon...\n");
484  CHECKSIZE(hwTab, dpi, -1, "default width");
485  TABCHECKSETSIZE(hwTab, 20, 20, 20, 20, "set size 1");
486  TABCHECKSETSIZE(hwTab, 10, 50, 10, 50, "set size 2");
487  TABCHECKSETSIZE(hwTab, 0, 1, 0, 1, "min size");
488 
490 
491  trace (" TCS_FIXEDWIDTH buttons with icon...\n");
492  TABCHECKSETSIZE(hwTab, 50, 30, 50, 30, "set size > icon");
493  TABCHECKSETSIZE(hwTab, 20, 20, 25, 20, "set size < icon");
494  TABCHECKSETSIZE(hwTab, 0, 1, 25, 1, "min size");
495  SendMessageA(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4, 4));
496  TABCHECKSETSIZE(hwTab, 0, 1, 25, 1, "set padding, min size");
497 
498  DestroyWindow (hwTab);
499 
501  SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
502 
503  hdc = GetDC(hwTab);
505  ReleaseDC(hwTab, hdc);
506  trace (" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...\n");
507  CHECKSIZE(hwTab, dpi, -1, "no icon, default width");
508 
509  TABCHECKSETSIZE(hwTab, 20, 20, 20, 20, "no icon, set size 1");
510  TABCHECKSETSIZE(hwTab, 10, 50, 10, 50, "no icon, set size 2");
511  TABCHECKSETSIZE(hwTab, 0, 1, 0, 1, "no icon, min size");
512 
514 
515  TABCHECKSETSIZE(hwTab, 50, 30, 50, 30, "with icon, set size > icon");
516  TABCHECKSETSIZE(hwTab, 20, 20, 25, 20, "with icon, set size < icon");
517  TABCHECKSETSIZE(hwTab, 0, 1, 25, 1, "with icon, min size");
518  SendMessageA(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4, 4));
519  TABCHECKSETSIZE(hwTab, 0, 1, 25, 1, "set padding, min size");
520 
521  DestroyWindow (hwTab);
522 
524  SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
525 
526  trace (" non fixed width, with text...\n");
527  exp = max(size.cx +TAB_PADDING_X*2, (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth);
528  SendMessageA( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
529  ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
530  "no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
531 
532  for (i=0; i<8; i++)
533  {
534  INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
535 
536  SendMessageA(hwTab, TCM_SETIMAGELIST, 0, 0);
537  SendMessageA(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i, i));
538 
539  TABCHECKSETSIZE(hwTab, 50, 20, max(size.cx + i*2, nTabWidth), 20, "no icon, set size");
540  TABCHECKSETSIZE(hwTab, 0, 1, max(size.cx + i*2, nTabWidth), 1, "no icon, min size");
541 
543  nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 3) : nMinTabWidth;
544 
545  TABCHECKSETSIZE(hwTab, 50, 30, max(size.cx + 21 + i*3, nTabWidth), 30, "with icon, set size > icon");
546  TABCHECKSETSIZE(hwTab, 20, 20, max(size.cx + 21 + i*3, nTabWidth), 20, "with icon, set size < icon");
547  TABCHECKSETSIZE(hwTab, 0, 1, max(size.cx + 21 + i*3, nTabWidth), 1, "with icon, min size");
548  }
549  DestroyWindow (hwTab);
550 
551  hwTab = create_tabcontrol(0, TCIF_IMAGE);
552  SendMessageA(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
553 
554  trace (" non fixed width, no text...\n");
555  exp = (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth;
556  SendMessageA( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
557  ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
558  "no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
559 
560  for (i=0; i<8; i++)
561  {
562  INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
563 
564  SendMessageA(hwTab, TCM_SETIMAGELIST, 0, 0);
565  SendMessageA(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i, i));
566 
567  TABCHECKSETSIZE(hwTab, 50, 20, nTabWidth, 20, "no icon, set size");
568  TABCHECKSETSIZE(hwTab, 0, 1, nTabWidth, 1, "no icon, min size");
569 
571  if (i > 1 && nMinTabWidth > 0 && nMinTabWidth < DEFAULT_MIN_TAB_WIDTH)
572  nTabWidth += EXTRA_ICON_PADDING *(i-1);
573 
574  TABCHECKSETSIZE(hwTab, 50, 30, nTabWidth, 30, "with icon, set size > icon");
575  TABCHECKSETSIZE(hwTab, 20, 20, nTabWidth, 20, "with icon, set size < icon");
576  TABCHECKSETSIZE(hwTab, 0, 1, nTabWidth, 1, "with icon, min size");
577  }
578 
579  DestroyWindow (hwTab);
580 
581  pImageList_Destroy(himl);
582 }
583 
584 static void test_width(void)
585 {
586  trace ("Testing with default MinWidth\n");
587  test_tab(-1);
588  trace ("Testing with MinWidth set to -3\n");
589  test_tab(-3);
590  trace ("Testing with MinWidth set to 24\n");
591  test_tab(24);
592  trace ("Testing with MinWidth set to 54\n");
593  test_tab(54);
594  trace ("Testing with MinWidth set to 94\n");
595  test_tab(94);
596 }
597 
598 static void test_curfocus(void)
599 {
600  const INT nTabs = 5;
601  INT ret;
602  HWND hTab;
603 
605  ok(hTab != NULL, "Failed to create tab control\n");
606 
608 
609  /* Testing CurFocus with largest appropriate value */
610  ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
611  ok(ret == 0, "Unexpected ret value %d.\n", ret);
612  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
613  ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
614 
615  /* Testing CurFocus with negative value */
616  ret = SendMessageA(hTab, TCM_SETCURFOCUS, -10, 0);
617  ok(ret == 0, "Unexpected ret value %d.\n", ret);
618  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
619  ok(ret == -1, "Unexpected focus index %d.\n", ret);
620 
621  /* Testing CurFocus with value larger than number of tabs */
622  ret = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
623  ok(ret == -1, "Unexpected focus index %d.\n", ret);
624 
625  ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs + 1, 0);
626  ok(ret == 0, "Unexpected ret value %d.\n", ret);
627  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
628  ok(ret == 1, "Unexpected focus index %d.\n", ret);
629 
630  ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Set focused tab sequence", FALSE);
631  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set focused tab parent sequence", TRUE);
632 
633  DestroyWindow(hTab);
634 
635  /* TCS_BUTTONS */
637  ok(hTab != NULL, "Failed to create tab control\n");
638 
640 
641  /* Testing CurFocus with largest appropriate value */
642  ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
643  ok(ret == 0, "Unexpected ret value %d.\n", ret);
644  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
645  ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
646 
647  /* Testing CurFocus with negative value */
648  ret = SendMessageA(hTab, TCM_SETCURFOCUS, -10, 0);
649  ok(ret == 0, "Unexpected ret value %d.\n", ret);
650  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
651 todo_wine
652  ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
653 
654  /* Testing CurFocus with value larger than number of tabs */
655  ret = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
656 todo_wine
657  ok(ret == 0, "Unexpected focus index %d.\n", ret);
658 
659  ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs + 1, 0);
660  ok(ret == 0, "Unexpected ret value %d.\n", ret);
661  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
662 todo_wine
663  ok(ret == nTabs - 1, "Unexpected focus index %d.\n", ret);
664 
665  ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "TCS_BUTTONS: set focused tab sequence", FALSE);
666  ok_sequence(sequences, PARENT_SEQ_INDEX, setfocus_parent_seq, "TCS_BUTTONS: set focused tab parent sequence", TRUE);
667 
668  DestroyWindow(hTab);
669 }
670 
671 static void test_cursel(void)
672 {
673  const INT nTabs = 5;
674  INT selectionIndex;
675  INT focusIndex;
676  TCITEMA tcItem;
677  HWND hTab;
678 
680  ok(hTab != NULL, "Failed to create tab control\n");
681 
683 
684  /* Testing CurSel with largest appropriate value */
685  selectionIndex = SendMessageA(hTab, TCM_SETCURSEL, nTabs - 1, 0);
686  expect(0, selectionIndex);
687  selectionIndex = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
688  expect(nTabs-1, selectionIndex);
689 
690  /* Focus should switch with selection */
691  focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
692  expect(nTabs-1, focusIndex);
693 
694  /* Testing CurSel with negative value */
695  SendMessageA(hTab, TCM_SETCURSEL, -10, 0);
696  selectionIndex = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
697  expect(-1, selectionIndex);
698 
699  /* Testing CurSel with value larger than number of tabs */
700  selectionIndex = SendMessageA(hTab, TCM_SETCURSEL, 1, 0);
701  expect(-1, selectionIndex);
702 
703  selectionIndex = SendMessageA(hTab, TCM_SETCURSEL, nTabs + 1, 0);
704  expect(-1, selectionIndex);
705  selectionIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
706  expect(1, selectionIndex);
707 
708  ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE);
709  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE);
710 
711  /* selected item should have TCIS_BUTTONPRESSED state
712  It doesn't depend on button state */
713  memset(&tcItem, 0, sizeof(TCITEMA));
714  tcItem.mask = TCIF_STATE;
716  selectionIndex = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
717  SendMessageA(hTab, TCM_GETITEMA, selectionIndex, (LPARAM)&tcItem);
718  ok (tcItem.dwState & TCIS_BUTTONPRESSED || broken(tcItem.dwState == 0), /* older comctl32 */
719  "Selected item should have TCIS_BUTTONPRESSED\n");
720 
721  /* now deselect all and check previously selected item state */
722  focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
723  ok(focusIndex == 1, "got %d\n", focusIndex);
724 
725  selectionIndex = SendMessageA(hTab, TCM_SETCURSEL, -1, 0);
726  ok(selectionIndex == 1, "got %d\n", selectionIndex);
727 
728  memset(&tcItem, 0, sizeof(TCITEMA));
729 
730  /* focus is reset too */
731  focusIndex = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
732  ok(focusIndex == -1, "got %d\n", focusIndex);
733 
734  tcItem.mask = TCIF_STATE;
735  tcItem.dwStateMask = TCIS_BUTTONPRESSED;
736  SendMessageA(hTab, TCM_GETITEMA, selectionIndex, (LPARAM)&tcItem);
737  ok(tcItem.dwState == 0, "got state %d\n", tcItem.dwState);
738 
739  DestroyWindow(hTab);
740 }
741 
742 static void test_extendedstyle(void)
743 {
744  const INT nTabs = 5;
745  DWORD prevExtendedStyle;
746  DWORD extendedStyle;
747  HWND hTab;
748 
750  ok(hTab != NULL, "Failed to create tab control\n");
751 
753 
754  /* Testing Flat Separators */
755  extendedStyle = SendMessageA(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
756  prevExtendedStyle = SendMessageA(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_FLATSEPARATORS);
757  expect(extendedStyle, prevExtendedStyle);
758 
759  extendedStyle = SendMessageA(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
760  expect(TCS_EX_FLATSEPARATORS, extendedStyle);
761 
762  /* Testing Register Drop */
763  prevExtendedStyle = SendMessageA(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_REGISTERDROP);
764  expect(extendedStyle, prevExtendedStyle);
765 
766  extendedStyle = SendMessageA(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
767  todo_wine{
768  expect(TCS_EX_REGISTERDROP, extendedStyle);
769  }
770 
771  ok_sequence(sequences, TAB_SEQ_INDEX, getset_extended_style_seq, "Getset extendedStyle test sequence", FALSE);
772  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset extendedStyle test parent sequence", FALSE);
773 
774  DestroyWindow(hTab);
775 }
776 
777 static void test_unicodeformat(void)
778 {
779  const INT nTabs = 5;
780  INT unicodeFormat;
781  HWND hTab;
782 
784  ok(hTab != NULL, "Failed to create tab control\n");
785 
787 
788  unicodeFormat = SendMessageA(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
789  todo_wine{
790  expect(0, unicodeFormat);
791  }
792  unicodeFormat = SendMessageA(hTab, TCM_GETUNICODEFORMAT, 0, 0);
793  expect(1, unicodeFormat);
794 
795  unicodeFormat = SendMessageA(hTab, TCM_SETUNICODEFORMAT, FALSE, 0);
796  expect(1, unicodeFormat);
797  unicodeFormat = SendMessageA(hTab, TCM_GETUNICODEFORMAT, 0, 0);
798  expect(0, unicodeFormat);
799 
800  unicodeFormat = SendMessageA(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
801  expect(0, unicodeFormat);
802 
803  ok_sequence(sequences, TAB_SEQ_INDEX, getset_unicode_format_seq, "Getset unicodeFormat test sequence", FALSE);
804  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset unicodeFormat test parent sequence", FALSE);
805 
806  DestroyWindow(hTab);
807 }
808 
809 static void test_getset_item(void)
810 {
811  char szText[32] = "New Label";
812  const INT nTabs = 5;
813  TCITEMA tcItem;
814  LPARAM lparam;
815  DWORD ret;
816  HWND hTab;
817 
818  hTab = CreateWindowA(
820  "TestTab",
822  10, 10, 300, 100,
823  parent_wnd, NULL, NULL, 0);
824 
825  ok(GetParent(hTab) == NULL, "got %p, expected null parent\n", GetParent(hTab));
826 
827  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, sizeof(LPARAM)-1, 0);
828  ok(ret == TRUE, "got %d\n", ret);
829 
830  /* set some item data */
831  tcItem.lParam = ~0;
832  tcItem.mask = TCIF_PARAM;
833 
834  ret = SendMessageA(hTab, TCM_INSERTITEMA, 0, (LPARAM)&tcItem);
835  ok(ret == 0, "got %d\n", ret);
836 
837  /* all sizeof(LPARAM) returned anyway when using sizeof(LPARAM)-1 size */
838  memset(&lparam, 0xaa, sizeof(lparam));
839  tcItem.lParam = lparam;
840  tcItem.mask = TCIF_PARAM;
841  ret = SendMessageA(hTab, TCM_GETITEMA, 0, (LPARAM)&tcItem);
842  expect(TRUE, ret);
843  /* everything higher specified size is preserved */
844  memset(&lparam, 0xff, sizeof(lparam)-1);
845  ok(tcItem.lParam == lparam, "Expected 0x%lx, got 0x%lx\n", lparam, tcItem.lParam);
846 
847  DestroyWindow(hTab);
848 
850  ok(hTab != NULL, "Failed to create tab control\n");
851 
852  /* passing invalid index should result in initialization to zero
853  for members mentioned in mask requested */
854 
855  /* valid range here is [0,4] */
856  memset(&tcItem, 0xcc, sizeof(tcItem));
857  tcItem.mask = TCIF_PARAM;
858  ret = SendMessageA(hTab, TCM_GETITEMA, 5, (LPARAM)&tcItem);
859  expect(FALSE, ret);
860  ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
861 
862  memset(&tcItem, 0xcc, sizeof(tcItem));
863  tcItem.mask = TCIF_IMAGE;
864  ret = SendMessageA(hTab, TCM_GETITEMA, 5, (LPARAM)&tcItem);
865  expect(FALSE, ret);
866  expect(0, tcItem.iImage);
867 
868  memset(&tcItem, 0xcc, sizeof(tcItem));
869  tcItem.mask = TCIF_TEXT;
870  tcItem.pszText = szText;
871  szText[0] = 'a';
872  ret = SendMessageA(hTab, TCM_GETITEMA, 5, (LPARAM)&tcItem);
873  expect(FALSE, ret);
874  expect('a', szText[0]);
875 
876  memset(&tcItem, 0xcc, sizeof(tcItem));
877  tcItem.mask = TCIF_STATE;
878  tcItem.dwStateMask = 0;
879  tcItem.dwState = TCIS_BUTTONPRESSED;
880  ret = SendMessageA(hTab, TCM_GETITEMA, 5, (LPARAM)&tcItem);
881  expect(FALSE, ret);
882  ok(tcItem.dwState == 0, "Expected zero dwState, got %u\n", tcItem.dwState);
883 
884  memset(&tcItem, 0xcc, sizeof(tcItem));
885  tcItem.mask = TCIF_STATE;
886  tcItem.dwStateMask = TCIS_BUTTONPRESSED;
887  tcItem.dwState = TCIS_BUTTONPRESSED;
888  ret = SendMessageA(hTab, TCM_GETITEMA, 5, (LPARAM)&tcItem);
889  expect(FALSE, ret);
890  ok(tcItem.dwState == 0, "Expected zero dwState\n");
891 
892  /* check with negative index to be sure */
893  memset(&tcItem, 0xcc, sizeof(tcItem));
894  tcItem.mask = TCIF_PARAM;
895  ret = SendMessageA(hTab, TCM_GETITEMA, -1, (LPARAM)&tcItem);
896  expect(FALSE, ret);
897  ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
898 
899  memset(&tcItem, 0xcc, sizeof(tcItem));
900  tcItem.mask = TCIF_PARAM;
901  ret = SendMessageA(hTab, TCM_GETITEMA, -2, (LPARAM)&tcItem);
902  expect(FALSE, ret);
903  ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
904 
906 
907  tcItem.mask = TCIF_TEXT;
908  tcItem.pszText = &szText[0];
909  tcItem.cchTextMax = sizeof(szText);
910 
911  strcpy(szText, "New Label");
912  ok(SendMessageA(hTab, TCM_SETITEMA, 0, (LPARAM)&tcItem), "Setting new item failed.\n");
913  ok(SendMessageA(hTab, TCM_GETITEMA, 0, (LPARAM)&tcItem), "Getting item failed.\n");
914  expect_str("New Label", tcItem.pszText);
915 
916  ok(SendMessageA(hTab, TCM_GETITEMA, 1, (LPARAM)&tcItem), "Getting item failed.\n");
917  expect_str("Tab 2", tcItem.pszText);
918 
919  ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE);
920  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE);
921 
922  /* TCIS_BUTTONPRESSED doesn't depend on tab style */
923  memset(&tcItem, 0, sizeof(tcItem));
924  tcItem.mask = TCIF_STATE;
925  tcItem.dwStateMask = TCIS_BUTTONPRESSED;
926  tcItem.dwState = TCIS_BUTTONPRESSED;
927  ok(SendMessageA(hTab, TCM_SETITEMA, 0, (LPARAM)&tcItem), "Setting new item failed.\n");
928  tcItem.dwState = 0;
929  ok(SendMessageA(hTab, TCM_GETITEMA, 0, (LPARAM)&tcItem), "Getting item failed.\n");
930  if (tcItem.dwState)
931  {
932  ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
933  /* next highlight item, test that dwStateMask actually masks */
934  tcItem.mask = TCIF_STATE;
935  tcItem.dwStateMask = TCIS_HIGHLIGHTED;
936  tcItem.dwState = TCIS_HIGHLIGHTED;
937  ok(SendMessageA(hTab, TCM_SETITEMA, 0, (LPARAM)&tcItem), "Setting new item failed.\n");
938  tcItem.dwState = 0;
939  ok(SendMessageA(hTab, TCM_GETITEMA, 0, (LPARAM)&tcItem), "Getting item failed.\n");
940  ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n");
941  tcItem.mask = TCIF_STATE;
942  tcItem.dwStateMask = TCIS_BUTTONPRESSED;
943  tcItem.dwState = 0;
944  ok(SendMessageA(hTab, TCM_GETITEMA, 0, (LPARAM)&tcItem), "Getting item failed.\n");
945  ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
946  }
947  else win_skip( "Item state mask not supported\n" );
948 
949  DestroyWindow(hTab);
950 }
951 
952 static void test_getset_tooltips(void)
953 {
954  char toolTipText[32] = "ToolTip Text Test";
955  HWND hTab, toolTip, hwnd;
956  const INT nTabs = 5;
957  int ret;
958 
960  ok(hTab != NULL, "Failed to create tab control\n");
961 
963 
964  toolTip = create_tooltip(hTab, toolTipText);
965  ret = SendMessageA(hTab, TCM_SETTOOLTIPS, (WPARAM)toolTip, 0);
966  ok(ret == 0, "Unexpected ret value %d.\n", ret);
967  hwnd = (HWND)SendMessageA(hTab, TCM_GETTOOLTIPS, 0, 0);
968  ok(toolTip == hwnd, "Unexpected tooltip window.\n");
969 
970  ret = SendMessageA(hTab, TCM_SETTOOLTIPS, 0, 0);
971  ok(ret == 0, "Unexpected ret value %d.\n", ret);
972  hwnd = (HWND)SendMessageA(hTab, TCM_GETTOOLTIPS, 0, 0);
973  ok(hwnd == NULL, "Unexpected tooltip window.\n");
974  ok(IsWindow(toolTip), "Expected tooltip window to be alive.\n");
975 
976  ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE);
977  ok_sequence(sequences, PARENT_SEQ_INDEX, getset_tooltip_parent_seq, "Getset tooltip test parent sequence", TRUE);
978 
979  DestroyWindow(hTab);
980  DestroyWindow(toolTip);
981 }
982 
983 static void test_adjustrect(void)
984 {
985  HWND hTab;
986  INT r;
987 
988  ok(parent_wnd != NULL, "no parent window!\n");
989 
991  ok(hTab != NULL, "Failed to create tab control\n");
992 
993  r = SendMessageA(hTab, TCM_ADJUSTRECT, FALSE, 0);
994  expect(-1, r);
995 
996  r = SendMessageA(hTab, TCM_ADJUSTRECT, TRUE, 0);
997  expect(-1, r);
998 }
999 
1000 static void test_insert_focus(void)
1001 {
1002  HWND hTab;
1003  INT nTabsRetrieved;
1004  INT r;
1005  TCITEMA tcNewTab;
1007  static char tabName[] = "TAB";
1008  tcNewTab.mask = mask;
1009  tcNewTab.pszText = tabName;
1010 
1011  ok(parent_wnd != NULL, "no parent window!\n");
1012 
1014  ok(hTab != NULL, "Failed to create tab control\n");
1015 
1016  r = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
1017  expect(-1, r);
1018 
1020 
1021  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1022  expect(0, nTabsRetrieved);
1023 
1024  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1025  expect(-1, r);
1026 
1027  tcNewTab.iImage = 1;
1028  r = SendMessageA(hTab, TCM_INSERTITEMA, 1, (LPARAM)&tcNewTab);
1029  expect(0, r);
1030 
1031  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1032  expect(1, nTabsRetrieved);
1033 
1034  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1035  expect(0, r);
1036 
1037  tcNewTab.iImage = 2;
1038  r = SendMessageA(hTab, TCM_INSERTITEMA, 2, (LPARAM)&tcNewTab);
1039  expect(1, r);
1040 
1041  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1042  expect(2, nTabsRetrieved);
1043 
1044  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1045  expect(0, r);
1046 
1047  r = SendMessageA(hTab, TCM_SETCURFOCUS, -1, 0);
1048  expect(0, r);
1049 
1050  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1051  expect(-1, r);
1052 
1053  tcNewTab.iImage = 3;
1054  r = SendMessageA(hTab, TCM_INSERTITEMA, 3, (LPARAM)&tcNewTab);
1055  expect(2, r);
1056 
1057  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1058  expect(2, r);
1059 
1060  ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", FALSE);
1061  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", TRUE);
1062 
1063  DestroyWindow(hTab);
1064 }
1065 
1066 static void test_delete_focus(void)
1067 {
1068  HWND hTab;
1069  INT nTabsRetrieved;
1070  INT r;
1071 
1072  ok(parent_wnd != NULL, "no parent window!\n");
1073 
1075  ok(hTab != NULL, "Failed to create tab control\n");
1076 
1078 
1079  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1080  expect(2, nTabsRetrieved);
1081 
1082  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1083  expect(0, r);
1084 
1085  r = SendMessageA(hTab, TCM_DELETEITEM, 1, 0);
1086  expect(1, r);
1087 
1088  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1089  expect(1, nTabsRetrieved);
1090 
1091  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1092  expect(0, r);
1093 
1094  r = SendMessageA(hTab, TCM_SETCURFOCUS, -1, 0);
1095  expect(0, r);
1096 
1097  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1098  expect(-1, r);
1099 
1100  r = SendMessageA(hTab, TCM_DELETEITEM, 0, 0);
1101  expect(1, r);
1102 
1103  nTabsRetrieved = SendMessageA(hTab, TCM_GETITEMCOUNT, 0, 0);
1104  expect(0, nTabsRetrieved);
1105 
1106  r = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1107  expect(-1, r);
1108 
1109  ok_sequence(sequences, TAB_SEQ_INDEX, delete_focus_seq, "delete_focus test sequence", FALSE);
1110  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", TRUE);
1111 
1112  DestroyWindow(hTab);
1113 }
1114 
1115 static void test_removeimage(void)
1116 {
1117  static const BYTE bits[32];
1118  HWND hwTab;
1119  INT i;
1120  TCITEMA item;
1121  HICON hicon;
1122  HIMAGELIST himl = pImageList_Create(16, 16, ILC_COLOR, 3, 4);
1123 
1124  hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
1125  pImageList_ReplaceIcon(himl, -1, hicon);
1126  pImageList_ReplaceIcon(himl, -1, hicon);
1127  pImageList_ReplaceIcon(himl, -1, hicon);
1128 
1131 
1132  memset(&item, 0, sizeof(TCITEMA));
1133  item.mask = TCIF_IMAGE;
1134 
1135  for(i = 0; i < 3; i++) {
1136  SendMessageA(hwTab, TCM_GETITEMA, i, (LPARAM)&item);
1137  expect(i, item.iImage);
1138  }
1139 
1140  /* remove image middle image */
1141  SendMessageA(hwTab, TCM_REMOVEIMAGE, 1, 0);
1142  i = pImageList_GetImageCount(himl);
1143  ok(i == 2, "Unexpected image count %d.\n", i);
1144  item.iImage = -1;
1145  SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
1146  expect(0, item.iImage);
1147  item.iImage = 0;
1148  SendMessageA(hwTab, TCM_GETITEMA, 1, (LPARAM)&item);
1149  expect(-1, item.iImage);
1150  item.iImage = 0;
1151  SendMessageA(hwTab, TCM_GETITEMA, 2, (LPARAM)&item);
1152  expect(1, item.iImage);
1153  /* remove first image */
1154  SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
1155  i = pImageList_GetImageCount(himl);
1156  ok(i == 1, "Unexpected image count %d.\n", i);
1157  item.iImage = 0;
1158  SendMessageA(hwTab, TCM_GETITEMA, 0, (LPARAM)&item);
1159  expect(-1, item.iImage);
1160  item.iImage = 0;
1161  SendMessageA(hwTab, TCM_GETITEMA, 1, (LPARAM)&item);
1162  expect(-1, item.iImage);
1163  item.iImage = -1;
1164  SendMessageA(hwTab, TCM_GETITEMA, 2, (LPARAM)&item);
1165  expect(0, item.iImage);
1166  /* remove the last one */
1167  SendMessageA(hwTab, TCM_REMOVEIMAGE, 0, 0);
1168  i = pImageList_GetImageCount(himl);
1169  ok(i == 0, "Unexpected image count %d.\n", i);
1170  for(i = 0; i < 3; i++) {
1171  item.iImage = 0;
1172  SendMessageA(hwTab, TCM_GETITEMA, i, (LPARAM)&item);
1173  expect(-1, item.iImage);
1174  }
1175 
1176  DestroyWindow(hwTab);
1177  pImageList_Destroy(himl);
1178  DestroyIcon(hicon);
1179 }
1180 
1181 static void test_delete_selection(void)
1182 {
1183  HWND hTab;
1184  INT ret;
1185 
1187  ok(hTab != NULL, "Failed to create tab control\n");
1188 
1189  ret = SendMessageA(hTab, TCM_SETCURSEL, 3, 0);
1190  expect(0, ret);
1191  ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
1192  expect(3, ret);
1193  /* delete selected item - selection goes to -1 */
1194  ret = SendMessageA(hTab, TCM_DELETEITEM, 3, 0);
1195  expect(TRUE, ret);
1196 
1197  ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
1198  expect(-1, ret);
1199 
1200  DestroyWindow(hTab);
1201 }
1202 
1203 static void test_TCM_SETITEMEXTRA(void)
1204 {
1205  HWND hTab;
1206  DWORD ret;
1207 
1208  hTab = CreateWindowA(
1210  "TestTab",
1212  10, 10, 300, 100,
1213  parent_wnd, NULL, NULL, 0);
1214 
1215  /* zero is valid size too */
1216  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 0, 0);
1217  if (ret == FALSE)
1218  {
1219  win_skip("TCM_SETITEMEXTRA not supported\n");
1220  DestroyWindow(hTab);
1221  return;
1222  }
1223 
1224  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, -1, 0);
1225  ok(ret == FALSE, "got %d\n", ret);
1226 
1227  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 2, 0);
1228  ok(ret == TRUE, "got %d\n", ret);
1229  DestroyWindow(hTab);
1230 
1231  /* it's not possible to change extra data size for control with tabs */
1233  ok(hTab != NULL, "Failed to create tab control\n");
1234 
1235  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, 2, 0);
1236  ok(ret == FALSE, "got %d\n", ret);
1237  DestroyWindow(hTab);
1238 }
1239 
1240 static void test_TCS_OWNERDRAWFIXED(void)
1241 {
1242  LPARAM lparam;
1243  ULONG_PTR itemdata, itemdata2;
1244  TCITEMA item;
1245  HWND hTab;
1246  BOOL ret;
1247 
1249  ok(hTab != NULL, "Failed to create tab control\n");
1250 
1251  ok(GetParent(hTab) == NULL, "got %p, expected null parent\n", GetParent(hTab));
1252 
1253  /* set some item data */
1254  memset(&lparam, 0xde, sizeof(LPARAM));
1255 
1256  item.mask = TCIF_PARAM;
1257  item.lParam = lparam;
1258  ret = SendMessageA(hTab, TCM_SETITEMA, 0, (LPARAM)&item);
1259  ok(ret == TRUE, "got %d\n", ret);
1260 
1261  memset(&g_drawitem, 0, sizeof(g_drawitem));
1262 
1263  ShowWindow(hTab, SW_SHOW);
1264  RedrawWindow(hTab, NULL, 0, RDW_UPDATENOW);
1265 
1266  itemdata = 0;
1267  memset(&itemdata, 0xde, 4);
1268  ok(g_drawitem.itemData == itemdata, "got 0x%lx, expected 0x%lx\n", g_drawitem.itemData, itemdata);
1269 
1270  DestroyWindow(hTab);
1271 
1272  /* now with custom extra data length */
1273  hTab = CreateWindowA(
1275  "TestTab",
1277  10, 10, 300, 100,
1278  parent_wnd, NULL, NULL, 0);
1279 
1280  ok(GetParent(hTab) == NULL, "got %p, expected null parent\n", GetParent(hTab));
1281 
1282  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, sizeof(LPARAM)+1, 0);
1283  ok(ret == TRUE, "got %d\n", ret);
1284 
1285  /* set some item data */
1286  memset(&lparam, 0xde, sizeof(LPARAM));
1287  item.mask = TCIF_PARAM;
1288  item.lParam = lparam;
1289 
1290  ret = SendMessageA(hTab, TCM_INSERTITEMA, 0, (LPARAM)&item);
1291  ok(ret == 0, "got %d\n", ret);
1292 
1293  memset(&g_drawitem, 0, sizeof(g_drawitem));
1294 
1295  ShowWindow(hTab, SW_SHOW);
1296  RedrawWindow(hTab, NULL, 0, RDW_UPDATENOW);
1297 
1298  memset(&itemdata, 0xde, sizeof(ULONG_PTR));
1299  ok(*(ULONG_PTR*)g_drawitem.itemData == itemdata, "got 0x%lx, expected 0x%lx\n", g_drawitem.itemData, itemdata);
1300 
1301  DestroyWindow(hTab);
1302 
1303  /* same thing, but size smaller than default */
1304  hTab = CreateWindowA(
1306  "TestTab",
1308  10, 10, 300, 100,
1309  parent_wnd, NULL, NULL, 0);
1310 
1311  ok(GetParent(hTab) == NULL, "got %p, expected null parent\n", GetParent(hTab));
1312 
1313  ret = SendMessageA(hTab, TCM_SETITEMEXTRA, sizeof(LPARAM)-1, 0);
1314  ok(ret == TRUE, "got %d\n", ret);
1315 
1316  memset(&lparam, 0xde, sizeof(lparam));
1317  item.mask = TCIF_PARAM;
1318  item.lParam = lparam;
1319 
1320  ret = SendMessageA(hTab, TCM_INSERTITEMA, 0, (LPARAM)&item);
1321  ok(ret == 0, "got %d\n", ret);
1322 
1323  memset(&g_drawitem, 0, sizeof(g_drawitem));
1324 
1325  ShowWindow(hTab, SW_SHOW);
1326  RedrawWindow(hTab, NULL, 0, RDW_UPDATENOW);
1327 
1328  itemdata = itemdata2 = 0;
1329  memset(&itemdata, 0xde, 4);
1330  memset(&itemdata2, 0xde, sizeof(LPARAM)-1);
1331  ok(g_drawitem.itemData == itemdata || broken(g_drawitem.itemData == itemdata2) /* win98 */,
1332  "got 0x%lx, expected 0x%lx\n", g_drawitem.itemData, itemdata);
1333 
1334  DestroyWindow(hTab);
1335 }
1336 
1337 static void test_WM_CONTEXTMENU(void)
1338 {
1339  HWND hTab;
1340 
1342  ok(hTab != NULL, "Failed to create tab control\n");
1343 
1345 
1346  SendMessageA(hTab, WM_RBUTTONUP, 0, 0);
1347 
1348  ok_sequence(sequences, TAB_SEQ_INDEX, rbuttonup_seq, "WM_RBUTTONUP response sequence", FALSE);
1349 
1350  DestroyWindow(hTab);
1351 }
1352 
1356 };
1357 
1358 static const struct tabcreate_style create_styles[] =
1359 {
1362  { 0 }
1363 };
1364 
1365 static void test_create(void)
1366 {
1367  const struct tabcreate_style *ptr = create_styles;
1368  DWORD style;
1369  HWND hTab;
1370 
1371  while (ptr->style)
1372  {
1373  hTab = CreateWindowA(WC_TABCONTROLA, "TestTab", ptr->style,
1374  10, 10, 300, 100, parent_wnd, NULL, NULL, 0);
1375  style = GetWindowLongA(hTab, GWL_STYLE);
1376  ok(style == ptr->act_style, "expected style 0x%08x, got style 0x%08x\n", ptr->act_style, style);
1377 
1378  DestroyWindow(hTab);
1379  ptr++;
1380  }
1381 }
1382 
1383 static void init_functions(void)
1384 {
1385  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
1386 
1387 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
1392 #undef X
1393 }
1394 
1395 static void test_TCN_SELCHANGING(void)
1396 {
1397  const INT nTabs = 5;
1398  HWND hTab;
1399  INT ret;
1400 
1402  ok(hTab != NULL, "Failed to create tab control\n");
1403 
1404  /* Initially first tab is focused. */
1405  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1406  ok(ret == 0, "Unexpected tab focus %d.\n", ret);
1407 
1409 
1410  /* Setting focus to currently focused item should do nothing. */
1411  ret = SendMessageA(hTab, TCM_SETCURFOCUS, 0, 0);
1412  ok(ret == 0, "Unexpected ret value %d.\n", ret);
1413 
1414  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set focus to focused tab sequence", FALSE);
1415 
1416  /* Allow selection change. */
1418 
1420  ret = SendMessageA(hTab, TCM_SETCURFOCUS, nTabs - 1, 0);
1421  ok(ret == 0, "Unexpected ret value %d.\n", ret);
1422 
1423  ok_sequence(sequences, PARENT_SEQ_INDEX, full_selchange_parent_seq, "Focus change allowed sequence", FALSE);
1424 
1425  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1426  ok(ret == nTabs - 1, "Unexpected focused tab %d.\n", ret);
1427  ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
1428  ok(ret == nTabs - 1, "Unexpected selected tab %d.\n", ret);
1429 
1430  /* Forbid selection change. */
1432 
1434  ret = SendMessageA(hTab, TCM_SETCURFOCUS, 0, 0);
1435  ok(ret == 0, "Unexpected ret value %d.\n", ret);
1436 
1437  ok_sequence(sequences, PARENT_SEQ_INDEX, selchanging_parent_seq, "Focus change disallowed sequence", FALSE);
1438 
1439  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1440 todo_wine
1441  ok(ret == nTabs - 1, "Unexpected focused tab %d.\n", ret);
1442  ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
1443 todo_wine
1444  ok(ret == nTabs - 1, "Unexpected selected tab %d.\n", ret);
1445 
1446  /* Removing focus sends only TCN_SELCHANGE */
1448 
1449  ret = SendMessageA(hTab, TCM_SETCURFOCUS, -1, 0);
1450  ok(ret == 0, "Unexpected ret value %d.\n", ret);
1451 
1452  ok_sequence(sequences, PARENT_SEQ_INDEX, selchange_parent_seq, "Remove focus sequence", FALSE);
1453 
1454  ret = SendMessageA(hTab, TCM_GETCURFOCUS, 0, 0);
1455  ok(ret == -1, "Unexpected focused tab %d.\n", ret);
1456 
1458 
1459  DestroyWindow(hTab);
1460 }
1461 
1462 static void test_TCM_GETROWCOUNT(void)
1463 {
1464  const INT nTabs = 5;
1465  HWND hTab;
1466  INT count;
1467 
1469 
1471  ok(hTab != NULL, "Failed to create tab control\n");
1472 
1474 
1475  count = SendMessageA(hTab, TCM_GETROWCOUNT, 0, 0);
1476  ok(count == 1, "Unexpected row count %d.\n", count);
1477 
1478  ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE);
1479  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE);
1480 
1481  DestroyWindow(hTab);
1482 }
1483 
1485 {
1486  LOGFONTA logfont;
1487 
1488  lstrcpyA(logfont.lfFaceName, "Arial");
1489  memset(&logfont, 0, sizeof(logfont));
1490  logfont.lfHeight = -12;
1491  logfont.lfWeight = FW_NORMAL;
1492  logfont.lfCharSet = ANSI_CHARSET;
1493  hFont = CreateFontIndirectA(&logfont);
1494 
1495  init_functions();
1496 
1498 
1500  ok(parent_wnd != NULL, "Failed to create parent window!\n");
1501 
1502  test_width();
1503  test_curfocus();
1504  test_cursel();
1507  test_getset_item();
1509  test_adjustrect();
1513  test_removeimage();
1517  test_create();
1520 
1522 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:1967
static const struct message selchanging_parent_seq[]
Definition: tab.c:208
#define TCM_GETCURSEL
Definition: commctrl.h:4034
static BOOL(WINAPI *pImageList_Destroy)(HIMAGELIST)
#define TCM_SETCURFOCUS
Definition: commctrl.h:4073
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2677
static const struct message getset_extended_style_seq[]
Definition: tab.c:118
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define trace(...)
Definition: kmt_test.h:217
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
GLint GLint GLsizei width
Definition: gl.h:1546
static const struct message get_row_count_seq[]
Definition: tab.c:90
#define max(a, b)
Definition: svc.c:63
#define LOGPIXELSX
Definition: wingdi.h:717
Definition: tftpd.h:59
static void test_TCS_OWNERDRAWFIXED(void)
Definition: tab.c:1240
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
#define TCM_GETCURFOCUS
Definition: commctrl.h:4071
static const struct message getset_cur_focus_seq[]
Definition: tab.c:95
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define TCM_SETUNICODEFORMAT
Definition: commctrl.h:4085
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TCS_EX_REGISTERDROP
Definition: commctrl.h:3932
#define ok_(x1, x2)
#define TABCHECKSETSIZE(hwnd, set_width, set_height, exp_width, exp_height, msg)
Definition: tab.c:76
#define TCM_SETITEMEXTRA
Definition: commctrl.h:4055
#define TCM_ADJUSTRECT
Definition: commctrl.h:4057
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
static void test_getset_item(void)
Definition: tab.c:809
static void test_tab(INT nMinTabWidth)
Definition: tab.c:439
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
Definition: tab.c:362
#define CHECKSIZE(hwnd, width, height, msg)
Definition: tab.c:65
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const struct message getset_tooltip_seq[]
Definition: tab.c:143
#define WM_GETTEXT
Definition: winuser.h:1600
Definition: msg.h:39
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static HDC
Definition: imagelist.c:92
static const struct message getset_unicode_format_seq[]
Definition: tab.c:127
static BOOL registerParentWindowClass(void)
Definition: tab.c:304
#define TabWidthPadded(padd_x, num)
Definition: tab.c:41
static INT
Definition: tab.c:43
#define TCS_BUTTONS
Definition: commctrl.h:3920
ULONG_PTR itemData
Definition: winuser.h:3046
HANDLE HWND
Definition: compat.h:13
static void test_delete_selection(void)
Definition: tab.c:1181
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
int cbClsExtra
Definition: winuser.h:3118
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define HWND_TOPMOST
Definition: winuser.h:1194
#define EXTRA_ICON_PADDING
Definition: tab.c:30
static HWND create_tooltip(HWND hTab, char toolTipText[])
Definition: tab.c:402
#define WHITE_BRUSH
Definition: wingdi.h:901
#define TCM_SETCURSEL
Definition: commctrl.h:4037
static void TabCheckSetSize(HWND hwnd, INT set_width, INT set_height, INT exp_width, INT exp_height, const char *msg, int line)
Definition: tab.c:67
BYTE lfCharSet
Definition: dimm.idl:50
#define WM_NCHITTEST
Definition: winuser.h:1668
#define TCM_SETPADDING
Definition: commctrl.h:4063
UINT_PTR WPARAM
Definition: windef.h:207
HBRUSH hbrBackground
Definition: winuser.h:3123
#define WS_CHILD
Definition: pedump.c:617
#define TCIF_TEXT
Definition: commctrl.h:3943
#define CCM_GETUNICODEFORMAT
Definition: commctrl.h:98
DWORD style
Definition: tab.c:1354
int winetest_interactive
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HINSTANCE hinst
Definition: commctrl.h:1705
#define TCIS_HIGHLIGHTED
Definition: commctrl.h:3950
char * LPSTR
Definition: xmlstorage.h:182
#define WS_CLIPCHILDREN
Definition: pedump.c:619
static void test_cursel(void)
Definition: tab.c:671
static const struct tabcreate_style create_styles[]
Definition: tab.c:1358
#define TCS_EX_FLATSEPARATORS
Definition: commctrl.h:3931
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
int32_t INT
Definition: typedefs.h:56
#define TCIF_STATE
Definition: commctrl.h:3947
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define TCM_GETROWCOUNT
Definition: commctrl.h:4065
static void test_insert_focus(void)
Definition: tab.c:1000
LPARAM lParam
Definition: commctrl.h:3988
#define TCM_SETITEMSIZE
Definition: commctrl.h:4059
#define PARENT_SEQ_INDEX
Definition: tab.c:34
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
static HFONT hFont
Definition: tab.c:79
static HIMAGELIST(WINAPI *pImageList_Create)(INT
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define TCS_FIXEDWIDTH
Definition: commctrl.h:3924
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
UINT code
Definition: winuser.h:3112
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define WM_NCPAINT
Definition: winuser.h:1669
DWORD act_style
Definition: tab.c:1355
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
GLenum GLint GLuint mask
Definition: glext.h:6028
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
Definition: tab.c:48
static const WCHAR szText[]
Definition: dialog.c:139
#define WM_PARENTNOTIFY
Definition: winuser.h:1779
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3949
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
LONG lfHeight
Definition: dimm.idl:42
LPSTR pszText
Definition: commctrl.h:3985
#define TCS_FOCUSNEVER
Definition: commctrl.h:3929
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ILC_COLOR
Definition: commctrl.h:337
#define TCM_DELETEITEM
Definition: commctrl.h:4025
static PVOID ptr
Definition: dispmode.c:27
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
HCURSOR hCursor
Definition: winuser.h:3122
static const struct message empty_sequence[]
Definition: tab.c:86
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
#define CW_USEDEFAULT
Definition: winuser.h:225
#define TAB_SEQ_INDEX
Definition: tab.c:35
#define GWLP_USERDATA
Definition: treelist.c:63
static void test_width(void)
Definition: tab.c:584
#define TCM_SETEXTENDEDSTYLE
Definition: commctrl.h:4081
LONG lfWeight
Definition: dimm.idl:46
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define TCM_SETMINTABWIDTH
Definition: commctrl.h:4075
static const struct message insert_focus_seq[]
Definition: tab.c:160
#define TCM_SETTOOLTIPS
Definition: commctrl.h:4069
static void init_functions(void)
Definition: tab.c:1383
static LRESULT WINAPI tab_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: tab.c:331
static void test_create(void)
Definition: tab.c:1365
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
static void test_TCM_SETITEMEXTRA(void)
Definition: tab.c:1203
#define TCM_GETITEMA
Definition: commctrl.h:4004
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define TCM_GETITEMRECT
Definition: commctrl.h:4031
Definition: msg.h:41
#define expect(expected, got)
Definition: tab.c:37
#define GetWindowLongPtrA
Definition: winuser.h:4697
#define WS_CAPTION
Definition: pedump.c:624
static void test_adjustrect(void)
Definition: tab.c:983
#define dpi
Definition: sysparams.c:22
#define TCN_SELCHANGE
Definition: commctrl.h:4104
#define expect_str(expected, got)
Definition: tab.c:38
GLsizeiptr size
Definition: glext.h:5919
static const struct message full_selchange_parent_seq[]
Definition: tab.c:202
#define TCIF_PARAM
Definition: commctrl.h:3946
#define TCS_BOTTOM
Definition: commctrl.h:3911
static const struct message getset_item_seq[]
Definition: tab.c:136
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE, _In_ int, _In_ int, _In_ BYTE, _In_ BYTE, _In_ const BYTE *, _In_ const BYTE *)
Definition: cursoricon.c:2364
#define WINAPI
Definition: msvc.h:8
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
#define TCM_GETUNICODEFORMAT
Definition: commctrl.h:4087
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_getset_tooltips(void)
Definition: tab.c:952
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: tab.c:261
static const struct message setfocus_parent_seq[]
Definition: tab.c:218
#define WM_RBUTTONUP
Definition: winuser.h:1756
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define TCS_OWNERDRAWFIXED
Definition: commctrl.h:3927
#define TAB_PADDING_X
Definition: tab.c:29
#define DEFAULT_MIN_TAB_WIDTH
Definition: tab.c:28
#define WM_PAINT
Definition: winuser.h:1602
int ret
Definition: msg.h:34
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define todo_wine
Definition: test.h:154
HDC hdc
Definition: main.c:9
static void test_extendedstyle(void)
Definition: tab.c:742
int iImage
Definition: commctrl.h:3987
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define SetWindowLongPtrA
Definition: winuser.h:5214
unsigned char BYTE
Definition: mem.h:68
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_EX_TOPMOST
Definition: pedump.c:647
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3125
#define TCS_VERTICAL
Definition: commctrl.h:3918
static void test_TCM_GETROWCOUNT(void)
Definition: tab.c:1462
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
static void test_unicodeformat(void)
Definition: tab.c:777
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
UINT_PTR uId
Definition: commctrl.h:1703
#define GWLP_WNDPROC
Definition: treelist.c:66
#define broken(x)
Definition: _sntprintf.h:21
static HWND create_tabcontrol(DWORD style, DWORD mask)
Definition: tab.c:224
UINT style
Definition: winuser.h:3116
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TCM_SETIMAGELIST
Definition: commctrl.h:3937
static const struct message getset_tooltip_parent_seq[]
Definition: tab.c:155
HWND WINAPI GetParent(_In_ HWND)
#define TCIF_IMAGE
Definition: commctrl.h:3944
static void test_removeimage(void)
Definition: tab.c:1115
static ATOM item
Definition: dde.c:856
static void test_TCN_SELCHANGING(void)
Definition: tab.c:1395
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HINSTANCE hInstance
Definition: winuser.h:3120
#define add_message(msg)
Definition: msg.c:2142
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
#define X(f)
#define CCM_SETUNICODEFORMAT
Definition: commctrl.h:97
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TCM_REMOVEIMAGE
Definition: commctrl.h:4061
#define TCN_FOCUSCHANGE
Definition: commctrl.h:4107
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
DWORD exp
Definition: msg.c:15681
static void test_curfocus(void)
Definition: tab.c:598
#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 WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define TCM_SETITEMA
Definition: commctrl.h:4011
static const struct message rbuttonup_seq[]
Definition: tab.c:196
START_TEST(tab)
Definition: tab.c:1484
#define msg(x)
Definition: auth_time.c:54
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define IDC_ARROW
Definition: winuser.h:682
#define MAX_TABLEN
Definition: tab.c:31
static const struct message selchange_parent_seq[]
Definition: tab.c:213
static HWND parent_wnd
Definition: tab.c:81
struct tagTOOLINFOA TTTOOLINFOA
static HICON
Definition: tab.c:46
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)
DWORD dwStateMask
Definition: commctrl.h:3984
GLenum GLuint id
Definition: glext.h:5579
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define TCS_MULTILINE
Definition: commctrl.h:3922
static void test_WM_CONTEXTMENU(void)
Definition: tab.c:1337
#define TCM_INSERTITEMA
Definition: commctrl.h:4018
static HWND createParentWindow(void)
Definition: tab.c:321
#define WM_ERASEBKGND
Definition: winuser.h:1607
static const struct message getset_cur_sel_seq[]
Definition: tab.c:106
#define ANSI_CHARSET
Definition: wingdi.h:382
#define TCM_GETEXTENDEDSTYLE
Definition: commctrl.h:4083
static DRAWITEMSTRUCT g_drawitem
Definition: tab.c:80
LONG_PTR LRESULT
Definition: windef.h:209
#define NUM_MSG_SEQUENCES
Definition: tab.c:33
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: tab.c:84
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
#define TCM_GETITEMCOUNT
Definition: commctrl.h:3940
static UINT
Definition: tab.c:43
UINT mask
Definition: commctrl.h:3982
static void test_delete_focus(void)
Definition: tab.c:1066
#define win_skip
Definition: test.h:141
#define TCN_SELCHANGING
Definition: commctrl.h:4105
LPARAM lParam
Definition: combotst.c:139
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define TTF_SUBCLASS
Definition: commctrl.h:1739
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define WM_NOTIFY
Definition: richedit.h:61
#define TCM_GETTOOLTIPS
Definition: commctrl.h:4067
static UINT WPARAM wparam
Definition: combo.c:716
#define WC_TABCONTROLA
Definition: commctrl.h:3906
static const struct message delete_focus_seq[]
Definition: tab.c:182
HICON hIcon
Definition: winuser.h:3121
LPSTR lpszText
Definition: commctrl.h:1706
static LRESULT tcn_selchanging_result
Definition: tab.c:82