ReactOS 0.4.16-dev-88-ga65b6ae
tab.c File Reference
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "wine/test.h"
#include "msg.h"
Include dependency graph for tab.c:

Go to the source code of this file.

Classes

struct  tabcreate_style
 

Macros

#define DEFAULT_MIN_TAB_WIDTH   54
 
#define TAB_PADDING_X   6
 
#define EXTRA_ICON_PADDING   3
 
#define MAX_TABLEN   32
 
#define NUM_MSG_SEQUENCES   2
 
#define PARENT_SEQ_INDEX   0
 
#define TAB_SEQ_INDEX   1
 
#define expect(expected, got)   ok ( expected == got, "Expected %d, got %d\n", expected, got)
 
#define expect_str(expected, got)    ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)
 
#define TabWidthPadded(padd_x, num)   (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
 
#define CHECKSIZE(hwnd, width, height, msg)   CheckSize(hwnd,width,height,msg,__LINE__)
 
#define TABCHECKSETSIZE(hwnd, set_width, set_height, exp_width, exp_height, msg)    TabCheckSetSize(hwnd,set_width,set_height,exp_width,exp_height,msg,__LINE__)
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static HIMAGELIST (WINAPI *pImageList_Create)(INT
 
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST)
 
static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST)
 
static void CheckSize (HWND hwnd, INT width, INT height, const char *msg, int line)
 
static void TabCheckSetSize (HWND hwnd, INT set_width, INT set_height, INT exp_width, INT exp_height, const char *msg, int line)
 
static HWND create_tabcontrol (DWORD style, DWORD mask)
 
static LRESULT WINAPI parent_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static BOOL registerParentWindowClass (void)
 
static HWND createParentWindow (void)
 
static LRESULT WINAPI tab_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static HWND createFilledTabControl (HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
 
static HWND create_tooltip (HWND hTab, char toolTipText[])
 
static void test_tab (INT nMinTabWidth)
 
static void test_width (void)
 
static void test_curfocus (void)
 
static void test_cursel (void)
 
static void test_extendedstyle (void)
 
static void test_unicodeformat (void)
 
static void test_getset_item (void)
 
static void test_getset_tooltips (void)
 
static void test_adjustrect (void)
 
static void test_insert_focus (void)
 
static void test_delete_focus (void)
 
static void test_removeimage (void)
 
static void test_delete_selection (void)
 
static void test_TCM_SETITEMEXTRA (void)
 
static void test_TCS_OWNERDRAWFIXED (void)
 
static void test_WM_CONTEXTMENU (void)
 
static void test_create (void)
 
static void init_functions (void)
 
static void test_TCN_SELCHANGING (void)
 
static void test_TCM_GETROWCOUNT (void)
 
 START_TEST (tab)
 

Variables

static INT
 
static UINT
 
static HICON
 
static HFONT hFont
 
static DRAWITEMSTRUCT g_drawitem
 
static HWND parent_wnd
 
static LRESULT tcn_selchanging_result
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static const struct message empty_sequence []
 
static const struct message get_row_count_seq []
 
static const struct message getset_cur_focus_seq []
 
static const struct message getset_cur_sel_seq []
 
static const struct message getset_extended_style_seq []
 
static const struct message getset_unicode_format_seq []
 
static const struct message getset_item_seq []
 
static const struct message getset_tooltip_seq []
 
static const struct message getset_tooltip_parent_seq []
 
static const struct message insert_focus_seq []
 
static const struct message delete_focus_seq []
 
static const struct message rbuttonup_seq []
 
static const struct message full_selchange_parent_seq []
 
static const struct message selchanging_parent_seq []
 
static const struct message selchange_parent_seq []
 
static const struct message setfocus_parent_seq []
 
static const struct tabcreate_style create_styles []
 

Macro Definition Documentation

◆ CHECKSIZE

#define CHECKSIZE (   hwnd,
  width,
  height,
  msg 
)    CheckSize(hwnd,width,height,msg,__LINE__)

Definition at line 65 of file tab.c.

◆ DEFAULT_MIN_TAB_WIDTH

#define DEFAULT_MIN_TAB_WIDTH   54

Definition at line 28 of file tab.c.

◆ expect

#define expect (   expected,
  got 
)    ok ( expected == got, "Expected %d, got %d\n", expected, got)

Definition at line 37 of file tab.c.

◆ expect_str

#define expect_str (   expected,
  got 
)     ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)

Definition at line 38 of file tab.c.

◆ EXTRA_ICON_PADDING

#define EXTRA_ICON_PADDING   3

Definition at line 30 of file tab.c.

◆ MAX_TABLEN

#define MAX_TABLEN   32

Definition at line 31 of file tab.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   2

Definition at line 33 of file tab.c.

◆ PARENT_SEQ_INDEX

#define PARENT_SEQ_INDEX   0

Definition at line 34 of file tab.c.

◆ TAB_PADDING_X

#define TAB_PADDING_X   6

Definition at line 29 of file tab.c.

◆ TAB_SEQ_INDEX

#define TAB_SEQ_INDEX   1

Definition at line 35 of file tab.c.

◆ TABCHECKSETSIZE

#define TABCHECKSETSIZE (   hwnd,
  set_width,
  set_height,
  exp_width,
  exp_height,
  msg 
)     TabCheckSetSize(hwnd,set_width,set_height,exp_width,exp_height,msg,__LINE__)

Definition at line 76 of file tab.c.

◆ TabWidthPadded

#define TabWidthPadded (   padd_x,
  num 
)    (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)

Definition at line 41 of file tab.c.

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pImageList_Destroy)
static

◆ CheckSize()

static void CheckSize ( HWND  hwnd,
INT  width,
INT  height,
const char msg,
int  line 
)
static

Definition at line 48 of file tab.c.

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}
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLsizei width
Definition: gl.h:1546
#define TCM_GETITEMRECT
Definition: commctrl.h:4064
Definition: parser.c:49
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TabCheckSetSize().

◆ create_tabcontrol()

static HWND create_tabcontrol ( DWORD  style,
DWORD  mask 
)
static

Definition at line 224 of file tab.c.

225{
226 HWND handle;
227 TCITEMA tcNewTab;
228 static char text1[] = "Tab 1",
229 text2[] = "Wide Tab 2",
230 text3[] = "T 3";
231
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}
Arabic default style
Definition: afstyles.h:94
#define ok(value,...)
Definition: atltest.h:57
HFONT hFont
Definition: main.c:53
#define NULL
Definition: types.h:112
GLenum GLint GLuint mask
Definition: glext.h:6028
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TCS_FOCUSNEVER
Definition: commctrl.h:3962
#define WC_TABCONTROLA
Definition: commctrl.h:3939
#define TCM_INSERTITEMA
Definition: commctrl.h:4051
int winetest_interactive
LPSTR pszText
Definition: commctrl.h:4018
UINT mask
Definition: commctrl.h:4015
int iImage
Definition: commctrl.h:4020
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define WM_SETFONT
Definition: winuser.h:1653
#define SW_SHOW
Definition: winuser.h:778
#define GWL_STYLE
Definition: winuser.h:855

Referenced by test_removeimage(), and test_tab().

◆ create_tooltip()

static HWND create_tooltip ( HWND  hTab,
char  toolTipText[] 
)
static

Definition at line 402 of file tab.c.

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
416 hwndTT,
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}
#define WS_POPUP
Definition: pedump.c:616
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define TTM_ADDTOOLA
Definition: commctrl.h:1791
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1708
#define TTF_SUBCLASS
Definition: commctrl.h:1767
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTS_NOPREFIX
Definition: commctrl.h:1758
struct tagTOOLINFOA TTTOOLINFOA
& rect
Definition: startmenu.cpp:1413
HINSTANCE hinst
Definition: commctrl.h:1733
LPSTR lpszText
Definition: commctrl.h:1734
UINT_PTR uId
Definition: commctrl.h:1731
#define SWP_NOACTIVATE
Definition: winuser.h:1245
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define HWND_TOPMOST
Definition: winuser.h:1211
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define SWP_NOSIZE
Definition: winuser.h:1248
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CW_USEDEFAULT
Definition: winuser.h:225
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_getset_tooltips().

◆ createFilledTabControl()

static HWND createFilledTabControl ( HWND  parent_wnd,
DWORD  style,
DWORD  mask,
INT  nTabs 
)
static

Definition at line 362 of file tab.c.

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}
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
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static LRESULT WINAPI tab_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: tab.c:331
static HWND parent_wnd
Definition: tab.c:81
#define MAX_TABLEN
Definition: tab.c:31
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtrA
Definition: winuser.h:5357
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909

Referenced by test_adjustrect(), test_curfocus(), test_cursel(), test_delete_focus(), test_delete_selection(), test_extendedstyle(), test_getset_item(), test_getset_tooltips(), test_insert_focus(), test_TCM_GETROWCOUNT(), test_TCM_SETITEMEXTRA(), test_TCN_SELCHANGING(), test_TCS_OWNERDRAWFIXED(), test_unicodeformat(), and test_WM_CONTEXTMENU().

◆ createParentWindow()

static HWND createParentWindow ( void  )
static

Definition at line 321 of file tab.c.

322{
324 return NULL;
325
326 return CreateWindowExA(0, "Tab test parent class", "Tab test parent window",
329}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static BOOL registerParentWindowClass(void)
Definition: tab.c:304
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628

Referenced by START_TEST().

◆ HIMAGELIST()

static HIMAGELIST ( WINAPI pImageList_Create)
static

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 1383 of file tab.c.

1384{
1385 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
1386
1387#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
1392#undef X
1393}
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2779
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define X(f)

Referenced by START_TEST().

◆ INT()

static INT ( WINAPI pImageList_GetImageCount)
static

◆ parent_wnd_proc()

static LRESULT WINAPI parent_wnd_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 261 of file tab.c.

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 &&
270 message != WM_NCPAINT &&
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)
295 }
296
297 defwndproc_counter++;
299 defwndproc_counter--;
300
301 return ret;
302}
@ sent
Definition: SystemMenu.c:27
@ defwinproc
Definition: SystemMenu.c:32
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define add_message(msg)
Definition: SystemMenu.c:98
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: tab.c:84
#define PARENT_SEQ_INDEX
Definition: tab.c:34
static LRESULT tcn_selchanging_result
Definition: tab.c:82
static DRAWITEMSTRUCT g_drawitem
Definition: tab.c:80
long LONG
Definition: pedump.c:60
#define TCN_SELCHANGING
Definition: commctrl.h:4138
#define WM_NOTIFY
Definition: richedit.h:61
Definition: tftpd.h:60
UINT message
Definition: SystemMenu.c:42
UINT code
Definition: winuser.h:3162
int ret
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_NCHITTEST
Definition: winuser.h:1689
#define WM_GETTEXT
Definition: winuser.h:1621
#define WM_DEVICECHANGE
Definition: winuser.h:1814
#define WM_DRAWITEM
Definition: winuser.h:1648
#define WM_NCPAINT
Definition: winuser.h:1690

Referenced by registerParentWindowClass().

◆ registerParentWindowClass()

static BOOL registerParentWindowClass ( void  )
static

Definition at line 304 of file tab.c.

305{
306 WNDCLASSA cls;
307
308 cls.style = 0;
310 cls.cbClsExtra = 0;
311 cls.cbWndExtra = 0;
313 cls.hIcon = 0;
316 cls.lpszMenuName = NULL;
317 cls.lpszClassName = "Tab test parent class";
318 return RegisterClassA(&cls);
319}
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: tab.c:261
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2134
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by createParentWindow().

◆ START_TEST()

START_TEST ( tab  )

Definition at line 1484 of file tab.c.

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
1496
1498
1500 ok(parent_wnd != NULL, "Failed to create parent window!\n");
1501
1502 test_width();
1503 test_curfocus();
1504 test_cursel();
1517 test_create();
1520
1522}
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:393
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static void test_cursel(void)
Definition: tab.c:671
static void test_curfocus(void)
Definition: tab.c:598
static void test_delete_selection(void)
Definition: tab.c:1181
static void test_extendedstyle(void)
Definition: tab.c:742
static void test_width(void)
Definition: tab.c:584
#define NUM_MSG_SEQUENCES
Definition: tab.c:33
static void test_TCS_OWNERDRAWFIXED(void)
Definition: tab.c:1240
static void test_create(void)
Definition: tab.c:1365
static void test_removeimage(void)
Definition: tab.c:1115
static void test_getset_tooltips(void)
Definition: tab.c:952
static void test_unicodeformat(void)
Definition: tab.c:777
static void test_getset_item(void)
Definition: tab.c:809
static void test_TCM_SETITEMEXTRA(void)
Definition: tab.c:1203
static void test_adjustrect(void)
Definition: tab.c:983
static HWND createParentWindow(void)
Definition: tab.c:321
static void test_TCM_GETROWCOUNT(void)
Definition: tab.c:1462
static void init_functions(void)
Definition: tab.c:1383
static void test_delete_focus(void)
Definition: tab.c:1066
static void test_TCN_SELCHANGING(void)
Definition: tab.c:1395
static void test_insert_focus(void)
Definition: tab.c:1000
static void test_WM_CONTEXTMENU(void)
Definition: tab.c:1337
#define memset(x, y, z)
Definition: compat.h:39
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
#define ANSI_CHARSET
Definition: wingdi.h:383
#define FW_NORMAL
Definition: wingdi.h:373
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ tab_subclass_proc()

static LRESULT WINAPI tab_subclass_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 331 of file tab.c.

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 &&
341 message != WM_NCPAINT &&
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++;
357 defwndproc_counter--;
358
359 return ret;
360}
#define TAB_SEQ_INDEX
Definition: tab.c:35
#define GetWindowLongPtrA
Definition: winuser.h:4831
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by createFilledTabControl().

◆ TabCheckSetSize()

static void TabCheckSetSize ( HWND  hwnd,
INT  set_width,
INT  set_height,
INT  exp_width,
INT  exp_height,
const char msg,
int  line 
)
static

Definition at line 67 of file tab.c.

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}
static void CheckSize(HWND hwnd, INT width, INT height, const char *msg, int line)
Definition: tab.c:48
#define TCM_SETITEMSIZE
Definition: commctrl.h:4092
#define MAKELPARAM(l, h)
Definition: winuser.h:4011

◆ test_adjustrect()

static void test_adjustrect ( void  )
static

Definition at line 983 of file tab.c.

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}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define expect(expected, got)
Definition: tab.c:37
static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
Definition: tab.c:362
#define TCS_FIXEDWIDTH
Definition: commctrl.h:3957
#define TCM_ADJUSTRECT
Definition: commctrl.h:4090

Referenced by START_TEST().

◆ test_create()

static void test_create ( void  )
static

Definition at line 1365 of file tab.c.

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);
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}
unsigned long DWORD
Definition: ntddk_ex.h:95
static PVOID ptr
Definition: dispmode.c:27
static const struct tabcreate_style create_styles[]
Definition: tab.c:1358
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)

Referenced by START_TEST().

◆ test_curfocus()

static void test_curfocus ( void  )
static

Definition at line 598 of file tab.c.

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);
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);
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);
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}
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:99
static const struct message getset_cur_focus_seq[]
Definition: tab.c:95
static const struct message setfocus_parent_seq[]
Definition: tab.c:218
static const struct message empty_sequence[]
Definition: tab.c:86
#define todo_wine
Definition: custom.c:89
#define TCM_GETCURFOCUS
Definition: commctrl.h:4104
#define TCM_SETCURSEL
Definition: commctrl.h:4070
#define TCS_BUTTONS
Definition: commctrl.h:3953
#define TCIF_TEXT
Definition: commctrl.h:3976
#define TCIF_IMAGE
Definition: commctrl.h:3977
#define TCM_SETCURFOCUS
Definition: commctrl.h:4106

Referenced by START_TEST().

◆ test_cursel()

static void test_cursel ( void  )
static

Definition at line 671 of file tab.c.

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;
736 SendMessageA(hTab, TCM_GETITEMA, selectionIndex, (LPARAM)&tcItem);
737 ok(tcItem.dwState == 0, "got state %d\n", tcItem.dwState);
738
739 DestroyWindow(hTab);
740}
#define broken(x)
Definition: atltest.h:178
static const struct message getset_cur_sel_seq[]
Definition: tab.c:106
#define TCIF_STATE
Definition: commctrl.h:3980
#define TCM_GETCURSEL
Definition: commctrl.h:4067
#define TCIS_BUTTONPRESSED
Definition: commctrl.h:3982
#define TCM_GETITEMA
Definition: commctrl.h:4037
DWORD dwState
Definition: commctrl.h:4016
DWORD dwStateMask
Definition: commctrl.h:4017

Referenced by START_TEST().

◆ test_delete_focus()

static void test_delete_focus ( void  )
static

Definition at line 1066 of file tab.c.

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}
static const struct message delete_focus_seq[]
Definition: tab.c:182
#define TCM_GETITEMCOUNT
Definition: commctrl.h:3973
#define TCM_DELETEITEM
Definition: commctrl.h:4058

Referenced by START_TEST().

◆ test_delete_selection()

static void test_delete_selection ( void  )
static

Definition at line 1181 of file tab.c.

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}

Referenced by START_TEST().

◆ test_extendedstyle()

static void test_extendedstyle ( void  )
static

Definition at line 742 of file tab.c.

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}
static const struct message getset_extended_style_seq[]
Definition: tab.c:118
#define TCS_EX_REGISTERDROP
Definition: commctrl.h:3965
#define TCS_EX_FLATSEPARATORS
Definition: commctrl.h:3964
#define TCM_SETEXTENDEDSTYLE
Definition: commctrl.h:4114
#define TCM_GETEXTENDEDSTYLE
Definition: commctrl.h:4116

Referenced by START_TEST().

◆ test_getset_item()

static void test_getset_item ( void  )
static

Definition at line 809 of file tab.c.

810{
811 char szText[32] = "New Label";
812 const INT nTabs = 5;
813 TCITEMA tcItem;
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;
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;
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;
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;
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;
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}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define expect_str(expected, got)
Definition: tab.c:38
static const struct message getset_item_seq[]
Definition: tab.c:136
#define TCS_OWNERDRAWFIXED
Definition: commctrl.h:3960
#define TCM_SETITEMA
Definition: commctrl.h:4044
#define TCIS_HIGHLIGHTED
Definition: commctrl.h:3983
#define TCIF_PARAM
Definition: commctrl.h:3979
#define TCM_SETITEMEXTRA
Definition: commctrl.h:4088
#define win_skip
Definition: test.h:163
LPARAM lParam
Definition: commctrl.h:4021
int cchTextMax
Definition: commctrl.h:4019
HWND WINAPI GetParent(_In_ HWND)

Referenced by START_TEST().

◆ test_getset_tooltips()

static void test_getset_tooltips ( void  )
static

Definition at line 952 of file tab.c.

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}
HANDLE HWND
Definition: compat.h:19
static HWND create_tooltip(HWND hTab, char toolTipText[])
Definition: tab.c:402
static const struct message getset_tooltip_parent_seq[]
Definition: tab.c:155
static const struct message getset_tooltip_seq[]
Definition: tab.c:143
#define TCM_GETTOOLTIPS
Definition: commctrl.h:4100
#define TCM_SETTOOLTIPS
Definition: commctrl.h:4102
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_insert_focus()

static void test_insert_focus ( void  )
static

Definition at line 1000 of file tab.c.

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}
static const struct message insert_focus_seq[]
Definition: tab.c:160

Referenced by START_TEST().

◆ test_removeimage()

static void test_removeimage ( void  )
static

Definition at line 1115 of file tab.c.

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++) {
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;
1173 expect(-1, item.iImage);
1174 }
1175
1176 DestroyWindow(hwTab);
1177 pImageList_Destroy(himl);
1178 DestroyIcon(hicon);
1179}
HIMAGELIST himl
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
static HICON
Definition: tab.c:46
static HWND create_tabcontrol(DWORD style, DWORD mask)
Definition: tab.c:224
static ATOM item
Definition: dde.c:856
#define TCM_SETIMAGELIST
Definition: commctrl.h:3970
#define TCM_REMOVEIMAGE
Definition: commctrl.h:4094
#define ILC_COLOR
Definition: commctrl.h:352
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE, _In_ int, _In_ int, _In_ BYTE, _In_ BYTE, _In_ const BYTE *, _In_ const BYTE *)
Definition: cursoricon.c:2439
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2097
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_tab()

static void test_tab ( INT  nMinTabWidth)
static

Definition at line 439 of file tab.c.

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);
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);
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}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define trace
Definition: atltest.h:70
#define EXTRA_ICON_PADDING
Definition: tab.c:143
#define DEFAULT_MIN_TAB_WIDTH
Definition: tab.c:141
GLsizeiptr size
Definition: glext.h:5919
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define TABCHECKSETSIZE(hwnd, set_width, set_height, exp_width, exp_height, msg)
Definition: tab.c:76
#define CHECKSIZE(hwnd, width, height, msg)
Definition: tab.c:65
#define TabWidthPadded(padd_x, num)
Definition: tab.c:41
#define TAB_PADDING_X
Definition: tab.c:29
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
DWORD exp
Definition: msg.c:16058
#define TCM_SETPADDING
Definition: commctrl.h:4096
#define TCM_SETMINTABWIDTH
Definition: commctrl.h:4108
#define TCS_BOTTOM
Definition: commctrl.h:3944
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
#define max(a, b)
Definition: svc.c:63
#define dpi
Definition: sysparams.c:23
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define LOGPIXELSX
Definition: wingdi.h:718
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1654
HDC WINAPI GetDC(_In_opt_ HWND)

◆ test_TCM_GETROWCOUNT()

static void test_TCM_GETROWCOUNT ( void  )
static

Definition at line 1462 of file tab.c.

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}
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const struct message get_row_count_seq[]
Definition: tab.c:90
#define TCM_GETROWCOUNT
Definition: commctrl.h:4098

Referenced by START_TEST().

◆ test_TCM_SETITEMEXTRA()

static void test_TCM_SETITEMEXTRA ( void  )
static

Definition at line 1203 of file tab.c.

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}

Referenced by START_TEST().

◆ test_TCN_SELCHANGING()

static void test_TCN_SELCHANGING ( void  )
static

Definition at line 1395 of file tab.c.

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);
1441 ok(ret == nTabs - 1, "Unexpected focused tab %d.\n", ret);
1442 ret = SendMessageA(hTab, TCM_GETCURSEL, 0, 0);
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
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}
static const struct message full_selchange_parent_seq[]
Definition: tab.c:202
static const struct message selchange_parent_seq[]
Definition: tab.c:213
static const struct message selchanging_parent_seq[]
Definition: tab.c:208
#define WS_CHILD
Definition: pedump.c:617

Referenced by START_TEST().

◆ test_TCS_OWNERDRAWFIXED()

static void test_TCS_OWNERDRAWFIXED ( void  )
static

Definition at line 1240 of file tab.c.

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
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
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}
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG_PTR itemData
Definition: winuser.h:3096
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by START_TEST().

◆ test_unicodeformat()

static void test_unicodeformat ( void  )
static

Definition at line 777 of file tab.c.

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}
static const struct message getset_unicode_format_seq[]
Definition: tab.c:127
#define TCM_GETUNICODEFORMAT
Definition: commctrl.h:4120
#define TCM_SETUNICODEFORMAT
Definition: commctrl.h:4118

Referenced by START_TEST().

◆ test_width()

static void test_width ( void  )
static

Definition at line 584 of file tab.c.

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}
static void test_tab(void)
Definition: edit.c:2281

Referenced by START_TEST().

◆ test_WM_CONTEXTMENU()

static void test_WM_CONTEXTMENU ( void  )
static

Definition at line 1337 of file tab.c.

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}
static const struct message rbuttonup_seq[]
Definition: tab.c:196
#define WM_RBUTTONUP
Definition: winuser.h:1783

Referenced by START_TEST().

Variable Documentation

◆ create_styles

const struct tabcreate_style create_styles[]
static
Initial value:

Definition at line 1358 of file tab.c.

Referenced by test_create().

◆ delete_focus_seq

const struct message delete_focus_seq[]
static
Initial value:

Definition at line 182 of file tab.c.

Referenced by test_delete_focus().

◆ empty_sequence

◆ full_selchange_parent_seq

const struct message full_selchange_parent_seq[]
static
Initial value:
= {
{ 0 }
}
GLuint id
Definition: glext.h:5910
#define TCN_SELCHANGE
Definition: commctrl.h:4137

Definition at line 202 of file tab.c.

Referenced by test_TCN_SELCHANGING().

◆ g_drawitem

DRAWITEMSTRUCT g_drawitem
static

Definition at line 80 of file tab.c.

Referenced by parent_wnd_proc(), and test_TCS_OWNERDRAWFIXED().

◆ get_row_count_seq

const struct message get_row_count_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 90 of file tab.c.

Referenced by test_TCM_GETROWCOUNT().

◆ getset_cur_focus_seq

const struct message getset_cur_focus_seq[]
static
Initial value:

Definition at line 95 of file tab.c.

Referenced by test_curfocus().

◆ getset_cur_sel_seq

const struct message getset_cur_sel_seq[]
static
Initial value:

Definition at line 106 of file tab.c.

Referenced by test_cursel().

◆ getset_extended_style_seq

const struct message getset_extended_style_seq[]
static
Initial value:

Definition at line 118 of file tab.c.

Referenced by test_extendedstyle().

◆ getset_item_seq

const struct message getset_item_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 136 of file tab.c.

Referenced by test_getset_item().

◆ getset_tooltip_parent_seq

const struct message getset_tooltip_parent_seq[]
static
Initial value:
= {
{ 0 }
}
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664

Definition at line 155 of file tab.c.

Referenced by test_getset_tooltips().

◆ getset_tooltip_seq

const struct message getset_tooltip_seq[]
static
Initial value:
= {
{ WM_NOTIFYFORMAT, sent|optional },
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
{ WM_NOTIFYFORMAT, sent|optional },
{ 0 }
}
@ optional
Definition: SystemMenu.c:34

Definition at line 143 of file tab.c.

Referenced by test_getset_tooltips().

◆ getset_unicode_format_seq

const struct message getset_unicode_format_seq[]
static
Initial value:
= {
{ 0 }
}
#define CCM_SETUNICODEFORMAT
Definition: commctrl.h:97
#define CCM_GETUNICODEFORMAT
Definition: commctrl.h:98

Definition at line 127 of file tab.c.

Referenced by test_unicodeformat().

◆ hFont

HFONT hFont
static

Definition at line 79 of file tab.c.

◆ HICON

HICON

Definition at line 46 of file tab.c.

Referenced by test_removeimage().

◆ insert_focus_seq

const struct message insert_focus_seq[]
static
Initial value:

Definition at line 160 of file tab.c.

Referenced by test_insert_focus().

◆ INT

INT

Definition at line 43 of file tab.c.

◆ parent_wnd

◆ rbuttonup_seq

const struct message rbuttonup_seq[]
static
Initial value:
= {
{ 0 }
}
#define WM_CONTEXTMENU
Definition: richedit.h:64

Definition at line 196 of file tab.c.

Referenced by test_WM_CONTEXTMENU().

◆ selchange_parent_seq

const struct message selchange_parent_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 213 of file tab.c.

Referenced by test_TCN_SELCHANGING().

◆ selchanging_parent_seq

const struct message selchanging_parent_seq[]
static
Initial value:
= {
{ 0 }
}

Definition at line 208 of file tab.c.

Referenced by test_TCN_SELCHANGING().

◆ sequences

◆ setfocus_parent_seq

const struct message setfocus_parent_seq[]
static
Initial value:
= {
{ 0 }
}
#define TCN_FOCUSCHANGE
Definition: commctrl.h:4140

Definition at line 218 of file tab.c.

Referenced by test_curfocus().

◆ tcn_selchanging_result

LRESULT tcn_selchanging_result
static

Definition at line 82 of file tab.c.

Referenced by parent_wnd_proc(), and test_TCN_SELCHANGING().

◆ UINT

Definition at line 43 of file tab.c.