1 /* Unit test suite for tab control.
3 * Copyright 2003 Vitaliy Margolen
4 * Copyright 2007 Hagop Hagopian
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.
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.
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
26 #include "wine/test.h"
29 #define DEFAULT_MIN_TAB_WIDTH 54
30 #define TAB_PADDING_X 6
31 #define EXTRA_ICON_PADDING 3
34 #define NUM_MSG_SEQUENCES 2
35 #define PARENT_SEQ_INDEX 0
36 #define TAB_SEQ_INDEX 1
38 #define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
39 #define expect_str(expected, got)\
40 ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)
42 #define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
44 #define TabCheckSetSize(hwnd, SetWidth, SetHeight, ExpWidth, ExpHeight, Msg)\
45 SendMessage (hwnd, TCM_SETITEMSIZE, 0,\
46 (LPARAM) MAKELPARAM((SetWidth >= 0) ? SetWidth:0, (SetHeight >= 0) ? SetHeight:0));\
47 if (winetest_interactive) RedrawWindow (hwnd, NULL, 0, RDW_UPDATENOW);\
48 CheckSize(hwnd, ExpWidth, ExpHeight, Msg);
50 #define CheckSize(hwnd,width,height,msg)\
51 SendMessage (hwnd, TCM_GETITEMRECT, 0, (LPARAM) &rTab);\
52 if ((width >= 0) && (height < 0))\
53 ok (width == rTab.right - rTab.left, "%s: Expected width [%d] got [%d]\n",\
54 msg, (int)width, rTab.right - rTab.left);\
55 else if ((height >= 0) && (width < 0))\
56 ok (height == rTab.bottom - rTab.top, "%s: Expected height [%d] got [%d]\n",\
57 msg, (int)height, rTab.bottom - rTab.top);\
59 ok ((width == rTab.right - rTab.left) &&\
60 (height == rTab.bottom - rTab.top ),\
61 "%s: Expected [%d,%d] got [%d,%d]\n", msg, (int)width, (int)height,\
62 rTab.right - rTab.left, rTab.bottom - rTab.top);
64 static HFONT hFont = 0;
66 static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
68 static const struct message create_parent_wnd_seq[] = {
69 { WM_GETMINMAXINFO, sent },
70 { WM_NCCREATE, sent },
71 { WM_NCCALCSIZE, sent|wparam, 0 },
73 { WM_SHOWWINDOW, sent|wparam, 1 },
74 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
75 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
76 { WM_ACTIVATEAPP, sent|wparam, 1 },
77 { WM_NCACTIVATE, sent|wparam, 1 },
78 { WM_ACTIVATE, sent|wparam, 1 },
79 { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
80 { WM_IME_NOTIFY, sent|defwinproc|optional },
81 { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
82 /* Win9x adds SWP_NOZORDER below */
83 { WM_WINDOWPOSCHANGED, sent},
84 { WM_NCCALCSIZE, sent|wparam|optional, 1 },
90 static const struct message add_tab_to_parent[] = {
91 { TCM_INSERTITEMA, sent },
92 { TCM_INSERTITEMA, sent|optional },
93 { WM_NOTIFYFORMAT, sent|defwinproc },
94 { WM_QUERYUISTATE, sent|wparam|lparam|defwinproc|optional, 0, 0 },
95 { WM_PARENTNOTIFY, sent|defwinproc },
96 { TCM_INSERTITEMA, sent },
97 { TCM_INSERTITEMA, sent },
98 { TCM_INSERTITEMA, sent },
99 { TCM_INSERTITEMA, sent|optional },
103 static const struct message add_tab_to_parent_interactive[] = {
104 { TCM_INSERTITEMA, sent },
105 { TCM_INSERTITEMA, sent },
106 { WM_NOTIFYFORMAT, sent|defwinproc },
107 { WM_QUERYUISTATE, sent|wparam|lparam|defwinproc, 0, 0 },
108 { WM_PARENTNOTIFY, sent|defwinproc },
109 { TCM_INSERTITEMA, sent },
110 { TCM_INSERTITEMA, sent },
111 { TCM_INSERTITEMA, sent },
112 { WM_SHOWWINDOW, sent},
113 { WM_WINDOWPOSCHANGING, sent},
114 { WM_WINDOWPOSCHANGING, sent},
115 { WM_NCACTIVATE, sent},
116 { WM_ACTIVATE, sent},
117 { WM_IME_SETCONTEXT, sent|defwinproc|optional},
118 { WM_IME_NOTIFY, sent|defwinproc|optional},
119 { WM_SETFOCUS, sent|defwinproc},
120 { WM_WINDOWPOSCHANGED, sent},
126 static const struct message add_tab_control_parent_seq[] = {
127 { WM_NOTIFYFORMAT, sent },
128 { WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
132 static const struct message add_tab_control_parent_seq_interactive[] = {
133 { WM_NOTIFYFORMAT, sent },
134 { WM_QUERYUISTATE, sent|wparam|lparam, 0, 0 },
135 { WM_WINDOWPOSCHANGING, sent|optional},
136 { WM_NCACTIVATE, sent},
137 { WM_ACTIVATE, sent},
138 { WM_WINDOWPOSCHANGING, sent|optional},
139 { WM_KILLFOCUS, sent},
140 { WM_IME_SETCONTEXT, sent|optional},
141 { WM_IME_NOTIFY, sent|optional},
145 static const struct message empty_sequence[] = {
149 static const struct message set_min_tab_width_seq[] = {
150 { TCM_SETMINTABWIDTH, sent|wparam, 0 },
151 { TCM_SETMINTABWIDTH, sent|wparam, 0 },
155 static const struct message get_item_count_seq[] = {
156 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
160 static const struct message get_row_count_seq[] = {
161 { TCM_GETROWCOUNT, sent|wparam|lparam, 0, 0 },
165 static const struct message get_item_rect_seq[] = {
166 { TCM_GETITEMRECT, sent },
167 { TCM_GETITEMRECT, sent },
171 static const struct message getset_cur_focus_seq[] = {
172 { TCM_SETCURFOCUS, sent|lparam, 0 },
173 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
174 { TCM_SETCURFOCUS, sent|lparam, 0 },
175 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
176 { TCM_SETCURSEL, sent|lparam, 0 },
177 { TCM_SETCURFOCUS, sent|lparam, 0 },
178 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
182 static const struct message getset_cur_sel_seq[] = {
183 { TCM_SETCURSEL, sent|lparam, 0 },
184 { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
185 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
186 { TCM_SETCURSEL, sent|lparam, 0 },
187 { TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
188 { TCM_SETCURSEL, sent|lparam, 0 },
189 { TCM_SETCURSEL, sent|lparam, 0 },
190 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
194 static const struct message getset_extended_style_seq[] = {
195 { TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
196 { TCM_SETEXTENDEDSTYLE, sent },
197 { TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
198 { TCM_SETEXTENDEDSTYLE, sent },
199 { TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
203 static const struct message getset_unicode_format_seq[] = {
204 { CCM_SETUNICODEFORMAT, sent|lparam, 0 },
205 { CCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0 },
206 { CCM_SETUNICODEFORMAT, sent|lparam, 0 },
207 { CCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0 },
208 { CCM_SETUNICODEFORMAT, sent|lparam, 0 },
212 static const struct message getset_item_seq[] = {
213 { TCM_SETITEMA, sent },
214 { TCM_GETITEMA, sent },
215 { TCM_GETITEMA, sent },
219 static const struct message getset_tooltip_seq[] = {
220 { WM_NOTIFYFORMAT, sent|optional },
221 { WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
222 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
223 { WM_NOTIFYFORMAT, sent|optional },
224 { TCM_SETTOOLTIPS, sent|lparam, 0 },
225 { TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
226 { TCM_SETTOOLTIPS, sent|lparam, 0 },
227 { TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
231 static const struct message getset_tooltip_parent_seq[] = {
232 { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
236 static const struct message insert_focus_seq[] = {
237 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
238 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
239 { TCM_INSERTITEM, sent|wparam, 1 },
240 { WM_NOTIFYFORMAT, sent|defwinproc|optional },
241 { WM_QUERYUISTATE, sent|defwinproc|optional },
242 { WM_PARENTNOTIFY, sent|defwinproc|optional },
243 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
244 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
245 { TCM_INSERTITEM, sent|wparam, 2 },
246 { WM_NOTIFYFORMAT, sent|defwinproc|optional },
247 { WM_QUERYUISTATE, sent|defwinproc|optional, },
248 { WM_PARENTNOTIFY, sent|defwinproc|optional },
249 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
250 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
251 { TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
252 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
253 { TCM_INSERTITEM, sent|wparam, 3 },
254 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
258 static const struct message delete_focus_seq[] = {
259 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
260 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
261 { TCM_DELETEITEM, sent|wparam|lparam, 1, 0 },
262 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
263 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
264 { TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
265 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
266 { TCM_DELETEITEM, sent|wparam|lparam, 0, 0 },
267 { TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
268 { TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
274 create_tabcontrol (DWORD style, DWORD mask)
278 static char text1[] = "Tab 1",
279 text2[] = "Wide Tab 2",
282 handle = CreateWindow (
285 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style,
287 NULL, NULL, NULL, 0);
291 SetWindowLong(handle, GWL_STYLE, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style);
292 SendMessage (handle, WM_SETFONT, 0, (LPARAM) hFont);
294 tcNewTab.mask = mask;
295 tcNewTab.pszText = text1;
297 SendMessage (handle, TCM_INSERTITEM, 0, (LPARAM) &tcNewTab);
298 tcNewTab.pszText = text2;
300 SendMessage (handle, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
301 tcNewTab.pszText = text3;
303 SendMessage (handle, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);
305 if (winetest_interactive)
307 ShowWindow (handle, SW_SHOW);
308 RedrawWindow (handle, NULL, 0, RDW_UPDATENOW);
315 static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
317 static LONG defwndproc_counter = 0;
321 /* do not log painting messages */
322 if (message != WM_PAINT &&
323 message != WM_ERASEBKGND &&
324 message != WM_NCPAINT &&
325 message != WM_NCHITTEST &&
326 message != WM_GETTEXT &&
327 message != WM_GETICON &&
328 message != WM_DEVICECHANGE)
330 trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
332 msg.message = message;
333 msg.flags = sent|wparam|lparam;
334 if (defwndproc_counter) msg.flags |= defwinproc;
337 add_message(sequences, PARENT_SEQ_INDEX, &msg);
340 defwndproc_counter++;
341 ret = DefWindowProcA(hwnd, message, wParam, lParam);
342 defwndproc_counter--;
347 static BOOL registerParentWindowClass(void)
352 cls.lpfnWndProc = parentWindowProcess;
355 cls.hInstance = GetModuleHandleA(NULL);
357 cls.hCursor = LoadCursorA(0, IDC_ARROW);
358 cls.hbrBackground = GetStockObject(WHITE_BRUSH);
359 cls.lpszMenuName = NULL;
360 cls.lpszClassName = "Tab test parent class";
361 return RegisterClassA(&cls);
364 static HWND createParentWindow(void)
366 if (!registerParentWindowClass())
369 return CreateWindowEx(0, "Tab test parent class",
370 "Tab test parent window",
371 WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
372 WS_MAXIMIZEBOX | WS_VISIBLE,
374 GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
377 static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
379 WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
380 static LONG defwndproc_counter = 0;
384 /* do not log painting messages */
385 if (message != WM_PAINT &&
386 message != WM_ERASEBKGND &&
387 message != WM_NCPAINT &&
388 message != WM_NCHITTEST &&
389 message != WM_GETTEXT &&
390 message != WM_GETICON &&
391 message != WM_DEVICECHANGE)
393 trace("tab: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
395 msg.message = message;
396 msg.flags = sent|wparam|lparam;
397 if (defwndproc_counter) msg.flags |= defwinproc;
400 add_message(sequences, TAB_SEQ_INDEX, &msg);
403 defwndproc_counter++;
404 ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
405 defwndproc_counter--;
410 static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
418 GetClientRect(parent_wnd, &rect);
420 tabHandle = CreateWindow (
423 WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style,
424 0, 0, rect.right, rect.bottom,
425 parent_wnd, NULL, NULL, 0);
429 oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
430 SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
432 tcNewTab.mask = mask;
434 for (i = 0; i < nTabs; i++)
436 char tabName[MAX_TABLEN];
438 sprintf(tabName, "Tab %d", i+1);
439 tcNewTab.pszText = tabName;
441 SendMessage (tabHandle, TCM_INSERTITEM, i, (LPARAM) &tcNewTab);
444 if (winetest_interactive)
446 ShowWindow (tabHandle, SW_SHOW);
447 RedrawWindow (tabHandle, NULL, 0, RDW_UPDATENOW);
454 static HWND create_tooltip (HWND hTab, char toolTipText[])
459 LPTSTR lptstr = toolTipText;
462 /* Creating a tooltip window*/
463 hwndTT = CreateWindowEx(
467 WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
468 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
469 hTab, NULL, 0, NULL);
475 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
477 GetClientRect (hTab, &rect);
479 /* Initialize members of toolinfo*/
480 ti.cbSize = sizeof(TOOLINFO);
481 ti.uFlags = TTF_SUBCLASS;
485 ti.lpszText = lptstr;
489 /* Add toolinfo structure to the tooltip control */
490 SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) &ti);
495 static void test_tab(INT nMinTabWidth)
499 HIMAGELIST himl = ImageList_Create(21, 21, ILC_COLOR, 3, 4);
505 hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
506 SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
507 /* Get System default MinTabWidth */
508 if (nMinTabWidth < 0)
509 nMinTabWidth = SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
512 dpi = GetDeviceCaps(hdc, LOGPIXELSX);
513 hOldFont = SelectObject(hdc, (HFONT)SendMessage(hwTab, WM_GETFONT, 0, 0));
514 GetTextExtentPoint32A(hdc, "Tab 1", strlen("Tab 1"), &size);
515 trace("Tab1 text size: size.cx=%d size.cy=%d\n", size.cx, size.cy);
516 SelectObject(hdc, hOldFont);
517 ReleaseDC(hwTab, hdc);
519 trace (" TCS_FIXEDWIDTH tabs no icon...\n");
520 CheckSize(hwTab, dpi, -1, "default width");
521 TabCheckSetSize(hwTab, 50, 20, 50, 20, "set size");
522 TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
524 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
526 trace (" TCS_FIXEDWIDTH tabs with icon...\n");
527 TabCheckSetSize(hwTab, 50, 30, 50, 30, "set size > icon");
528 TabCheckSetSize(hwTab, 20, 20, 25, 20, "set size < icon");
529 TabCheckSetSize(hwTab, 0, 1, 25, 1, "min size");
531 DestroyWindow (hwTab);
533 hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BUTTONS, TCIF_TEXT|TCIF_IMAGE);
534 SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
537 dpi = GetDeviceCaps(hdc, LOGPIXELSX);
538 ReleaseDC(hwTab, hdc);
539 trace (" TCS_FIXEDWIDTH buttons no icon...\n");
540 CheckSize(hwTab, dpi, -1, "default width");
541 TabCheckSetSize(hwTab, 20, 20, 20, 20, "set size 1");
542 TabCheckSetSize(hwTab, 10, 50, 10, 50, "set size 2");
543 TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
545 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
547 trace (" TCS_FIXEDWIDTH buttons with icon...\n");
548 TabCheckSetSize(hwTab, 50, 30, 50, 30, "set size > icon");
549 TabCheckSetSize(hwTab, 20, 20, 25, 20, "set size < icon");
550 TabCheckSetSize(hwTab, 0, 1, 25, 1, "min size");
551 SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4,4));
552 TabCheckSetSize(hwTab, 0, 1, 25, 1, "set padding, min size");
554 DestroyWindow (hwTab);
556 hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BOTTOM, TCIF_TEXT|TCIF_IMAGE);
557 SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
560 dpi = GetDeviceCaps(hdc, LOGPIXELSX);
561 ReleaseDC(hwTab, hdc);
562 trace (" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...\n");
563 CheckSize(hwTab, dpi, -1, "no icon, default width");
565 TabCheckSetSize(hwTab, 20, 20, 20, 20, "no icon, set size 1");
566 TabCheckSetSize(hwTab, 10, 50, 10, 50, "no icon, set size 2");
567 TabCheckSetSize(hwTab, 0, 1, 0, 1, "no icon, min size");
569 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
571 TabCheckSetSize(hwTab, 50, 30, 50, 30, "with icon, set size > icon");
572 TabCheckSetSize(hwTab, 20, 20, 25, 20, "with icon, set size < icon");
573 TabCheckSetSize(hwTab, 0, 1, 25, 1, "with icon, min size");
574 SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4,4));
575 TabCheckSetSize(hwTab, 0, 1, 25, 1, "set padding, min size");
577 DestroyWindow (hwTab);
579 hwTab = create_tabcontrol(0, TCIF_TEXT|TCIF_IMAGE);
580 SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
582 trace (" non fixed width, with text...\n");
583 exp = max(size.cx +TAB_PADDING_X*2, (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth);
584 SendMessage( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
585 ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
586 "no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
590 INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
592 SendMessage(hwTab, TCM_SETIMAGELIST, 0, 0);
593 SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i,i));
595 TabCheckSetSize(hwTab, 50, 20, max(size.cx + i*2, nTabWidth), 20, "no icon, set size");
596 TabCheckSetSize(hwTab, 0, 1, max(size.cx + i*2, nTabWidth), 1, "no icon, min size");
598 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
599 nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 3) : nMinTabWidth;
601 TabCheckSetSize(hwTab, 50, 30, max(size.cx + 21 + i*3, nTabWidth), 30, "with icon, set size > icon");
602 TabCheckSetSize(hwTab, 20, 20, max(size.cx + 21 + i*3, nTabWidth), 20, "with icon, set size < icon");
603 TabCheckSetSize(hwTab, 0, 1, max(size.cx + 21 + i*3, nTabWidth), 1, "with icon, min size");
605 DestroyWindow (hwTab);
607 hwTab = create_tabcontrol(0, TCIF_IMAGE);
608 SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
610 trace (" non fixed width, no text...\n");
611 exp = (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth;
612 SendMessage( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
613 ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
614 "no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
618 INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
620 SendMessage(hwTab, TCM_SETIMAGELIST, 0, 0);
621 SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i,i));
623 TabCheckSetSize(hwTab, 50, 20, nTabWidth, 20, "no icon, set size");
624 TabCheckSetSize(hwTab, 0, 1, nTabWidth, 1, "no icon, min size");
626 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
627 if (i > 1 && nMinTabWidth > 0 && nMinTabWidth < DEFAULT_MIN_TAB_WIDTH)
628 nTabWidth += EXTRA_ICON_PADDING *(i-1);
630 TabCheckSetSize(hwTab, 50, 30, nTabWidth, 30, "with icon, set size > icon");
631 TabCheckSetSize(hwTab, 20, 20, nTabWidth, 20, "with icon, set size < icon");
632 TabCheckSetSize(hwTab, 0, 1, nTabWidth, 1, "with icon, min size");
635 DestroyWindow (hwTab);
637 ImageList_Destroy(himl);
641 static void test_getters_setters(HWND parent_wnd, INT nTabs)
650 ok(parent_wnd != NULL, "no parent window!\n");
651 flush_sequences(sequences, NUM_MSG_SEQUENCES);
653 hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
654 ok(hTab != NULL, "Failed to create tab control\n");
656 if(!winetest_interactive)
657 ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent,
658 "Tab sequence, after adding tab control to parent", TRUE);
660 ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent_interactive,
661 "Tab sequence, after adding tab control to parent", TRUE);
663 if(!winetest_interactive)
664 ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq,
665 "Parent after sequence, adding tab control to parent", TRUE);
667 ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq_interactive,
668 "Parent after sequence, adding tab control to parent", TRUE);
670 flush_sequences(sequences, NUM_MSG_SEQUENCES);
671 ok(SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0,"TCM_SETMINTABWIDTH returned < 0\n");
672 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE);
674 /* Testing GetItemCount */
675 flush_sequences(sequences, NUM_MSG_SEQUENCES);
676 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
677 expect(nTabs, nTabsRetrieved);
678 ok_sequence(sequences, TAB_SEQ_INDEX, get_item_count_seq, "Get itemCount test sequence", FALSE);
679 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset itemCount test parent sequence", FALSE);
681 /* Testing GetRowCount */
682 flush_sequences(sequences, NUM_MSG_SEQUENCES);
683 rowCount = SendMessage(hTab, TCM_GETROWCOUNT, 0, 0);
685 ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE);
686 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE);
688 /* Testing GetItemRect */
689 flush_sequences(sequences, NUM_MSG_SEQUENCES);
690 ok(SendMessage(hTab, TCM_GETITEMRECT, 0, (LPARAM) &rTab), "GetItemRect failed.\n");
693 dpi = GetDeviceCaps(hdc, LOGPIXELSX);
694 ReleaseDC(hTab, hdc);
695 CheckSize(hTab, dpi, -1 , "Default Width");
696 ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE);
697 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE);
699 /* Testing CurFocus */
703 flush_sequences(sequences, NUM_MSG_SEQUENCES);
705 /* Testing CurFocus with largest appropriate value */
706 SendMessage(hTab, TCM_SETCURFOCUS, nTabs-1, 0);
707 focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
708 expect(nTabs-1, focusIndex);
710 /* Testing CurFocus with negative value */
711 SendMessage(hTab, TCM_SETCURFOCUS, -10, 0);
712 focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
713 expect(-1, focusIndex);
715 /* Testing CurFocus with value larger than number of tabs */
716 focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
718 expect(-1, focusIndex);
721 SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0);
722 focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
723 expect(1, focusIndex);
725 ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Getset curFoc test sequence", FALSE);
734 flush_sequences(sequences, NUM_MSG_SEQUENCES);
736 /* Testing CurSel with largest appropriate value */
737 selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs-1, 0);
738 expect(1, selectionIndex);
739 selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
740 expect(nTabs-1, selectionIndex);
742 /* Focus should switch with selection */
743 focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
744 expect(nTabs-1, focusIndex);
746 /* Testing CurSel with negative value */
747 SendMessage(hTab, TCM_SETCURSEL, -10, 0);
748 selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
749 expect(-1, selectionIndex);
751 /* Testing CurSel with value larger than number of tabs */
752 selectionIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
753 expect(-1, selectionIndex);
755 selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0);
756 expect(-1, selectionIndex);
757 selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
758 expect(1, selectionIndex);
760 ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE);
761 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE);
763 /* selected item should have TCIS_BUTTONPRESSED state
764 It doesn't depend on button state */
765 memset(&tcItem, 0, sizeof(TCITEM));
766 tcItem.mask = TCIF_STATE;
767 tcItem.dwStateMask = TCIS_BUTTONPRESSED;
768 selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
769 SendMessage(hTab, TCM_GETITEM, selectionIndex, (LPARAM) &tcItem);
770 ok (tcItem.dwState & TCIS_BUTTONPRESSED || broken(tcItem.dwState == 0), /* older comctl32 */
771 "Selected item should have TCIS_BUTTONPRESSED\n");
774 /* Testing ExtendedStyle */
776 DWORD prevExtendedStyle;
779 flush_sequences(sequences, NUM_MSG_SEQUENCES);
781 /* Testing Flat Separators */
782 extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
783 prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_FLATSEPARATORS);
784 expect(extendedStyle, prevExtendedStyle);
786 extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
787 expect(TCS_EX_FLATSEPARATORS, extendedStyle);
789 /* Testing Register Drop */
790 prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_REGISTERDROP);
791 expect(extendedStyle, prevExtendedStyle);
793 extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
795 expect(TCS_EX_REGISTERDROP, extendedStyle);
798 ok_sequence(sequences, TAB_SEQ_INDEX, getset_extended_style_seq, "Getset extendedStyle test sequence", FALSE);
799 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset extendedStyle test parent sequence", FALSE);
802 /* Testing UnicodeFormat */
806 flush_sequences(sequences, NUM_MSG_SEQUENCES);
808 unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
810 expect(0, unicodeFormat);
812 unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0);
813 expect(1, unicodeFormat);
815 unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, FALSE, 0);
816 expect(1, unicodeFormat);
817 unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0);
818 expect(0, unicodeFormat);
820 unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
821 expect(0, unicodeFormat);
823 ok_sequence(sequences, TAB_SEQ_INDEX, getset_unicode_format_seq, "Getset unicodeFormat test sequence", FALSE);
824 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset unicodeFormat test parent sequence", FALSE);
827 /* Testing GetSet Item */
831 char szText[32] = "New Label";
833 /* passing invalid index should result in initialization to zero
834 for members mentioned in mask requested */
836 /* valid range here is [0,4] */
837 memset(&tcItem, 0xcc, sizeof(tcItem));
838 tcItem.mask = TCIF_PARAM;
839 ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
841 ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
843 memset(&tcItem, 0xcc, sizeof(tcItem));
844 tcItem.mask = TCIF_IMAGE;
845 ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
847 expect(0, tcItem.iImage);
849 memset(&tcItem, 0xcc, sizeof(tcItem));
850 tcItem.mask = TCIF_TEXT;
851 tcItem.pszText = szText;
853 ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
855 expect('a', szText[0]);
857 memset(&tcItem, 0xcc, sizeof(tcItem));
858 tcItem.mask = TCIF_STATE;
859 tcItem.dwStateMask = 0;
860 tcItem.dwState = TCIS_BUTTONPRESSED;
861 ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
863 ok(tcItem.dwState == 0, "Expected zero dwState, got %u\n", tcItem.dwState);
865 memset(&tcItem, 0xcc, sizeof(tcItem));
866 tcItem.mask = TCIF_STATE;
867 tcItem.dwStateMask = TCIS_BUTTONPRESSED;
868 tcItem.dwState = TCIS_BUTTONPRESSED;
869 ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
871 ok(tcItem.dwState == 0, "Expected zero dwState\n");
873 /* check with negative index to be sure */
874 memset(&tcItem, 0xcc, sizeof(tcItem));
875 tcItem.mask = TCIF_PARAM;
876 ret = SendMessage(hTab, TCM_GETITEM, -1, (LPARAM)&tcItem);
878 ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
880 memset(&tcItem, 0xcc, sizeof(tcItem));
881 tcItem.mask = TCIF_PARAM;
882 ret = SendMessage(hTab, TCM_GETITEM, -2, (LPARAM)&tcItem);
884 ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
886 flush_sequences(sequences, NUM_MSG_SEQUENCES);
888 tcItem.mask = TCIF_TEXT;
889 tcItem.pszText = &szText[0];
890 tcItem.cchTextMax = sizeof(szText);
892 strcpy(szText, "New Label");
893 ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
894 ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
895 expect_str("New Label", tcItem.pszText);
897 ok ( SendMessage(hTab, TCM_GETITEM, 1, (LPARAM) &tcItem), "Getting item failed.\n");
898 expect_str("Tab 2", tcItem.pszText);
900 ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE);
901 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE);
903 /* TCIS_BUTTONPRESSED doesn't depend on tab style */
904 memset(&tcItem, 0, sizeof(tcItem));
905 tcItem.mask = TCIF_STATE;
906 tcItem.dwStateMask = TCIS_BUTTONPRESSED;
907 tcItem.dwState = TCIS_BUTTONPRESSED;
908 ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
910 ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
913 ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
914 /* next highlight item, test that dwStateMask actually masks */
915 tcItem.mask = TCIF_STATE;
916 tcItem.dwStateMask = TCIS_HIGHLIGHTED;
917 tcItem.dwState = TCIS_HIGHLIGHTED;
918 ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
920 ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
921 ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n");
922 tcItem.mask = TCIF_STATE;
923 tcItem.dwStateMask = TCIS_BUTTONPRESSED;
925 ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
926 ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
928 else win_skip( "Item state mask not supported\n" );
931 /* Testing GetSet ToolTip */
934 char toolTipText[32] = "ToolTip Text Test";
936 flush_sequences(sequences, NUM_MSG_SEQUENCES);
938 toolTip = create_tooltip(hTab, toolTipText);
939 SendMessage(hTab, TCM_SETTOOLTIPS, (LPARAM) toolTip, 0);
940 ok (toolTip == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
942 SendMessage(hTab, TCM_SETTOOLTIPS, 0, 0);
943 ok (NULL == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
945 ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE);
946 ok_sequence(sequences, PARENT_SEQ_INDEX, getset_tooltip_parent_seq, "Getset tooltip test parent sequence", TRUE);
952 static void test_adjustrect(HWND parent_wnd)
957 ok(parent_wnd != NULL, "no parent window!\n");
959 hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, 0, 0);
960 ok(hTab != NULL, "Failed to create tab control\n");
962 r = SendMessage(hTab, TCM_ADJUSTRECT, FALSE, 0);
965 r = SendMessage(hTab, TCM_ADJUSTRECT, TRUE, 0);
968 static void test_insert_focus(HWND parent_wnd)
974 DWORD mask = TCIF_TEXT|TCIF_IMAGE;
975 static char tabName[] = "TAB";
976 tcNewTab.mask = mask;
977 tcNewTab.pszText = tabName;
979 ok(parent_wnd != NULL, "no parent window!\n");
981 hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, mask, 0);
982 ok(hTab != NULL, "Failed to create tab control\n");
984 flush_sequences(sequences, NUM_MSG_SEQUENCES);
986 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
987 expect(0, nTabsRetrieved);
989 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
993 r = SendMessage(hTab, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
996 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
997 expect(1, nTabsRetrieved);
999 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1002 tcNewTab.iImage = 2;
1003 r = SendMessage(hTab, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);
1006 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
1007 expect(2, nTabsRetrieved);
1009 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1012 r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0);
1015 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1018 tcNewTab.iImage = 3;
1019 r = SendMessage(hTab, TCM_INSERTITEM, 3, (LPARAM) &tcNewTab);
1022 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1025 ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", FALSE);
1026 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", FALSE);
1028 DestroyWindow(hTab);
1031 static void test_delete_focus(HWND parent_wnd)
1037 ok(parent_wnd != NULL, "no parent window!\n");
1039 hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, 2);
1040 ok(hTab != NULL, "Failed to create tab control\n");
1042 flush_sequences(sequences, NUM_MSG_SEQUENCES);
1044 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
1045 expect(2, nTabsRetrieved);
1047 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1050 r = SendMessage(hTab, TCM_DELETEITEM, 1, 0);
1053 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
1054 expect(1, nTabsRetrieved);
1056 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1059 r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0);
1062 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1065 r = SendMessage(hTab, TCM_DELETEITEM, 0, 0);
1068 nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
1069 expect(0, nTabsRetrieved);
1071 r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
1074 ok_sequence(sequences, TAB_SEQ_INDEX, delete_focus_seq, "delete_focus test sequence", FALSE);
1075 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", FALSE);
1077 DestroyWindow(hTab);
1080 static void test_removeimage(HWND parent_wnd)
1082 static const BYTE bits[32];
1087 HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR, 3, 4);
1089 hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
1090 ImageList_AddIcon(himl, hicon);
1091 ImageList_AddIcon(himl, hicon);
1092 ImageList_AddIcon(himl, hicon);
1094 hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
1095 SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
1097 memset(&item, 0, sizeof(TCITEM));
1098 item.mask = TCIF_IMAGE;
1100 for(i = 0; i < 3; i++) {
1101 SendMessage(hwTab, TCM_GETITEM, i, (LPARAM)&item);
1102 expect(i, item.iImage);
1105 /* remove image middle image */
1106 SendMessage(hwTab, TCM_REMOVEIMAGE, 1, 0);
1107 expect(2, ImageList_GetImageCount(himl));
1109 SendMessage(hwTab, TCM_GETITEM, 0, (LPARAM)&item);
1110 expect(0, item.iImage);
1112 SendMessage(hwTab, TCM_GETITEM, 1, (LPARAM)&item);
1113 expect(-1, item.iImage);
1115 SendMessage(hwTab, TCM_GETITEM, 2, (LPARAM)&item);
1116 expect(1, item.iImage);
1117 /* remove first image */
1118 SendMessage(hwTab, TCM_REMOVEIMAGE, 0, 0);
1119 expect(1, ImageList_GetImageCount(himl));
1121 SendMessage(hwTab, TCM_GETITEM, 0, (LPARAM)&item);
1122 expect(-1, item.iImage);
1124 SendMessage(hwTab, TCM_GETITEM, 1, (LPARAM)&item);
1125 expect(-1, item.iImage);
1127 SendMessage(hwTab, TCM_GETITEM, 2, (LPARAM)&item);
1128 expect(0, item.iImage);
1129 /* remove the last one */
1130 SendMessage(hwTab, TCM_REMOVEIMAGE, 0, 0);
1131 expect(0, ImageList_GetImageCount(himl));
1132 for(i = 0; i < 3; i++) {
1134 SendMessage(hwTab, TCM_GETITEM, i, (LPARAM)&item);
1135 expect(-1, item.iImage);
1138 DestroyWindow(hwTab);
1139 ImageList_Destroy(himl);
1148 lstrcpyA(logfont.lfFaceName, "Arial");
1149 memset(&logfont, 0, sizeof(logfont));
1150 logfont.lfHeight = -12;
1151 logfont.lfWeight = FW_NORMAL;
1152 logfont.lfCharSet = ANSI_CHARSET;
1153 hFont = CreateFontIndirectA(&logfont);
1155 InitCommonControls();
1157 trace ("Testing with default MinWidth\n");
1159 trace ("Testing with MinWidth set to -3\n");
1161 trace ("Testing with MinWidth set to 24\n");
1163 trace ("Testing with MinWidth set to 54\n");
1165 trace ("Testing with MinWidth set to 94\n");
1168 init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
1170 parent_wnd = createParentWindow();
1171 ok(parent_wnd != NULL, "Failed to create parent window!\n");
1173 /* Testing getters and setters with 5 tabs */
1174 test_getters_setters(parent_wnd, 5);
1176 test_adjustrect(parent_wnd);
1178 test_insert_focus(parent_wnd);
1179 test_delete_focus(parent_wnd);
1180 test_removeimage(parent_wnd);
1182 DestroyWindow(parent_wnd);