ReactOS  0.4.15-dev-1068-g467feb9
toolbar.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "commctrl.h"
#include "resources.h"
#include "wine/test.h"
#include "msg.h"
Include dependency graph for toolbar.c:

Go to the source code of this file.

Classes

struct  tbsize_result_t
 
struct  tbsize_alt_result_t
 
struct  tbrows_result_t
 
struct  extended_style_t
 

Macros

#define PARENT_SEQ_INDEX   0
 
#define NUM_MSG_SEQUENCES   1
 
#define DEFINE_EXPECT(func)   static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_CALLED(func)
 
#define SET_EXPECT(func)   expect_ ## func = TRUE
 
#define expect(EXPECTED, GOT)   ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
 
#define check_rect(name, val, exp, ...)
 
#define compare(val, exp, format)   ok((val) == (exp), #val " value " format " expected " format "\n", (val), (exp));
 
#define check_button_size(handle, width, height, ...)
 
#define CHECK_IMAGELIST(count, dx, dy)
 
#define CHECK_STRING_TABLE(count, tab)
 
#define check_hot_notify()
 
#define STRING0   "A"
 
#define STRING1   "MMMMMMMMMMMMM"
 
#define STRING2   "Tst"
 
#define tbsize_results_num   28
 
#define check_sizes_todo(todomask)
 
#define check_sizes()   check_sizes_todo(0)
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static HWND (WINAPI *pCreateToolbarEx)(HWND
 
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST)
 
static INT (WINAPI *pImageList_GetImageCount)(HIMAGELIST)
 
static int int *static HIMAGELIST (WINAPI *pImageList_LoadImageA)(HINSTANCE
 
static void MakeButton (TBBUTTON *p, int idCommand, int fsStyle, int nString)
 
static LRESULT parent_wnd_notify (LPARAM lParam)
 
static LRESULT CALLBACK parent_wnd_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void basic_test (void)
 
static void rebuild_toolbar (HWND *hToolbar)
 
static void rebuild_toolbar_with_buttons (HWND *hToolbar)
 
static void add_128x15_bitmap (HWND hToolbar, int nCmds)
 
static void test_add_bitmap (void)
 
static void test_add_string (void)
 
static void expect_hot_notify (int idold, int idnew)
 
static void test_hotitem (void)
 
static int system_font_height (void)
 
static int string_width (const CHAR *s)
 
static tbsize_result_t init_tbsize_result (int nButtonsAlloc, int cleft, int ctop, int cright, int cbottom, int minx, int miny)
 
static void tbsize_addbutton (tbsize_result_t *tbsr, int left, int top, int right, int bottom)
 
static void init_tbsize_results (void)
 
static void free_tbsize_results (void)
 
static void test_sizes (void)
 
static void prepare_recalc_test (HWND *phToolbar)
 
static BOOL did_recalc (HWND hToolbar)
 
static void restore_recalc_state (HWND hToolbar)
 
static void test_recalc (void)
 
static void test_getbuttoninfo (void)
 
static void test_createtoolbarex (void)
 
static void test_dispinfo (void)
 
static void test_setrows (void)
 
static void test_getstring (void)
 
static void test_tooltip (void)
 
static void test_get_set_style (void)
 
 DEFINE_EXPECT (g_hook_create)
 
 DEFINE_EXPECT (g_hook_WM_NCCREATE)
 
 DEFINE_EXPECT (g_hook_WM_CREATE)
 
static LRESULT WINAPI toolbar_subclass_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK cbt_hook_proc (int code, WPARAM wParam, LPARAM lParam)
 
static void test_create (void)
 
static void test_TB_GET_SET_EXTENDEDSTYLE (void)
 
static void test_noresize (void)
 
static void test_save (void)
 
static void test_drawtext_flags (void)
 
static void test_imagelist (void)
 
static void init_functions (void)
 
 START_TEST (toolbar)
 

Variables

static DWORD
 
static UINT
 
static INT
 
static HINSTANCE
 
static UINT_PTR
 
static int int *static LPCSTR
 
static int int *static int
 
static int int *static COLORREF
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static HWND hMainWnd
 
static BOOL g_fBlockHotItemChange
 
static BOOL g_fReceivedHotItemChange
 
static BOOL g_fExpectedHotItemOld
 
static BOOL g_fExpectedHotItemNew
 
static DWORD g_dwExpectedDispInfoMask
 
static BOOL g_ResetDispTextPtr
 
static const struct message ttgetdispinfo_parent_seq []
 
static const struct message save_parent_seq []
 
static const struct message restore_parent_seq []
 
static voidalloced_str
 
static tbsize_result_ttbsize_results
 
static int tbsize_numtests = 0
 
static tbsize_alt_result_t tbsize_alt_results []
 
static DWORD tbsize_alt_numtests = 0
 
static TBBUTTON buttons1 []
 
static TBBUTTON buttons2 []
 
static TBBUTTON buttons3 []
 
static TBBUTTON buttons4 []
 
static tbrows_result_t tbrows_results []
 
static HHOOK g_tbhook
 
static HWND g_toolbar
 
static const extended_style_t extended_style_test []
 

Macro Definition Documentation

◆ check_button_size

#define check_button_size (   handle,
  width,
  height,
  ... 
)
Value:
{\
LRESULT bsize = SendMessageA(handle, TB_GETBUTTONSIZE, 0, 0);\
ok(bsize == MAKELONG(width, height), "Unexpected button size - got size (%d, %d), expected (%d, %d)\n", LOWORD(bsize), HIWORD(bsize), width, height);\
}
GLint GLint GLsizei width
Definition: gl.h:1546
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1156
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define HIWORD(l)
Definition: typedefs.h:247
#define LOWORD(l)
Definition: pedump.c:82

Definition at line 123 of file toolbar.c.

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define FALSE
Definition: types.h:117

Definition at line 106 of file toolbar.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 100 of file toolbar.c.

◆ check_hot_notify

#define check_hot_notify ( )
Value:
ok(g_fReceivedHotItemChange, "TBN_HOTITEMCHANGE not received\n"); \
g_fExpectedHotItemOld = g_fExpectedHotItemNew = 0;
static BOOL g_fExpectedHotItemNew
Definition: toolbar.c:53
#define ok(value,...)
Definition: atltest.h:57
static BOOL g_fReceivedHotItemChange
Definition: toolbar.c:51

Definition at line 838 of file toolbar.c.

◆ CHECK_IMAGELIST

#define CHECK_IMAGELIST (   count,
  dx,
  dy 
)
Value:
{ \
int cx, cy; \
HIMAGELIST himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0); \
ok(himl != NULL, "No image list\n"); \
if (himl != NULL) {\
ok(pImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, pImageList_GetImageCount(himl)); \
pImageList_GetIconSize(himl, &cx, &cy); \
ok(cx == dx && cy == dy, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint dy
Definition: linetemp.h:97
#define TB_GETIMAGELIST
Definition: commctrl.h:1147
HIMAGELIST himl
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
GLint dx
Definition: linetemp.h:97
_Out_opt_ int * cx
Definition: commctrl.h:581
static int int *static HIMAGELIST(WINAPI *pImageList_LoadImageA)(HINSTANCE

Definition at line 486 of file toolbar.c.

◆ check_rect

#define check_rect (   name,
  val,
  exp,
  ... 
)
Value:
"invalid rect %s - expected %s - (" name ")\n", \
GLuint GLfloat * val
Definition: glext.h:7180
const char * wine_dbgstr_rect(const RECT *rect)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define ok(value,...)
Definition: atltest.h:57
DWORD exp
Definition: msg.c:16033
Definition: name.c:38

Definition at line 117 of file toolbar.c.

◆ check_sizes

#define check_sizes ( )    check_sizes_todo(0)

Definition at line 1329 of file toolbar.c.

◆ check_sizes_todo

#define check_sizes_todo (   todomask)
Value:
{ \
RECT rc; \
int buttonCount, i, mask=(todomask); \
tbsize_result_t *res = &tbsize_results[tbsize_numtests]; \
GetClientRect(hToolbar, &rc); \
/*check_rect("client", rc, res->rcClient);*/ \
buttonCount = SendMessageA(hToolbar, TB_BUTTONCOUNT, 0, 0); \
compare(buttonCount, res->nButtons, "%d"); \
for (i=0; i<min(buttonCount, res->nButtons); i++) { \
ok(SendMessageA(hToolbar, TB_GETITEMRECT, i, (LPARAM)&rc) == 1, "TB_GETITEMRECT\n"); \
win_skip("Alternate rect found\n"); \
tbsize_alt_numtests++; \
} else todo_wine_if(mask&1) \
check_rect("button = %d, tbsize_numtests = %d", rc, res->prcButtons[i], i, tbsize_numtests); \
mask >>= 1; \
} \
tbsize_numtests++; \
}
#define TB_BUTTONCOUNT
Definition: commctrl.h:1106
static int tbsize_numtests
Definition: toolbar.c:1290
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TB_GETITEMRECT
Definition: commctrl.h:1129
static DWORD tbsize_alt_numtests
Definition: toolbar.c:1306
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
LONG_PTR LPARAM
Definition: windef.h:208
static tbsize_alt_result_t tbsize_alt_results[]
Definition: toolbar.c:1299
#define todo_wine_if(is_todo)
Definition: test.h:163
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
static tbsize_result_t * tbsize_results
Definition: toolbar.c:1022
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
GLuint res
Definition: glext.h:9613

Definition at line 1308 of file toolbar.c.

◆ CHECK_STRING_TABLE

#define CHECK_STRING_TABLE (   count,
  tab 
)
Value:
{ \
INT _i; \
CHAR _buf[260]; \
for (_i = 0; _i < (count); _i++) {\
ret = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(260, _i), (LPARAM)_buf); \
ok(ret >= 0, "TB_GETSTRINGA - unexpected return %d while checking string %d\n", ret, _i); \
if (ret >= 0) \
ok(strcmp(_buf, (tab)[_i]) == 0, "Invalid string #%d - '%s' vs '%s'\n", _i, (tab)[_i], _buf); \
} \
ok(SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(260, (count)), (LPARAM)_buf) == -1, \
"Too many strings in table\n"); \
}
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TB_GETSTRINGA
Definition: commctrl.h:1272
LONG_PTR LPARAM
Definition: windef.h:208
int ret
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static char * _buf(void)
Definition: clnt_perror.c:55

Definition at line 751 of file toolbar.c.

◆ compare

#define compare (   val,
  exp,
  format 
)    ok((val) == (exp), #val " value " format " expected " format "\n", (val), (exp));

Definition at line 121 of file toolbar.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 97 of file toolbar.c.

◆ expect

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

Definition at line 115 of file toolbar.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   1

Definition at line 38 of file toolbar.c.

◆ PARENT_SEQ_INDEX

#define PARENT_SEQ_INDEX   0

Definition at line 37 of file toolbar.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)    expect_ ## func = TRUE

Definition at line 112 of file toolbar.c.

◆ STRING0

#define STRING0   "A"

Definition at line 1018 of file toolbar.c.

◆ STRING1

#define STRING1   "MMMMMMMMMMMMM"

Definition at line 1019 of file toolbar.c.

◆ STRING2

#define STRING2   "Tst"

Definition at line 1020 of file toolbar.c.

◆ tbsize_results_num

#define tbsize_results_num   28

Definition at line 1024 of file toolbar.c.

◆ X

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

Function Documentation

◆ add_128x15_bitmap()

static void add_128x15_bitmap ( HWND  hToolbar,
int  nCmds 
)
static

Definition at line 478 of file toolbar.c.

479 {
480  TBADDBITMAP bmp128;
481  bmp128.hInst = GetModuleHandleA(NULL);
482  bmp128.nID = IDB_BITMAP_128x15;
483  ok(SendMessageA(hToolbar, TB_ADDBITMAP, nCmds, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
484 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HINSTANCE hInst
Definition: commctrl.h:1055
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TB_ADDBITMAP
Definition: commctrl.h:1052
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define ok(value,...)
Definition: atltest.h:57
#define IDB_BITMAP_128x15
Definition: resources.h:24
UINT_PTR nID
Definition: commctrl.h:1056

Referenced by test_sizes().

◆ basic_test()

static void basic_test ( void  )
static

Definition at line 374 of file toolbar.c.

375 {
376  TBBUTTON buttons[9];
377  HWND hToolbar;
378  int i;
379 
380  for (i=0; i<9; i++)
383  MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
384 
385  hToolbar = pCreateToolbarEx(hMainWnd,
388  100,
389  0, NULL, 0,
391  0, 0, 20, 16, sizeof(TBBUTTON));
392  ok(hToolbar != NULL, "Toolbar creation\n");
393  SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"test\000");
394 
395  /* test for exclusion working inside a separator-separated :-) group */
396  SendMessageA(hToolbar, TB_CHECKBUTTON, 1000, 1); /* press A1 */
397  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
398  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1001, 0), "A2 not pressed\n");
399 
400  SendMessageA(hToolbar, TB_CHECKBUTTON, 1004, 1); /* press A5, release A1 */
401  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1004, 0), "A5 pressed\n");
402  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 not pressed anymore\n");
403 
404  SendMessageA(hToolbar, TB_CHECKBUTTON, 1005, 1); /* press A6, release A5 */
405  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 pressed\n");
406  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1004, 0), "A5 not pressed anymore\n");
407 
408  /* test for inter-group crosstalk, i.e. two radio groups interfering with each other */
409  SendMessageA(hToolbar, TB_CHECKBUTTON, 1007, 1); /* press B2 */
410  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 still pressed, no inter-group crosstalk\n");
411  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 still not pressed\n");
412  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 pressed\n");
413 
414  SendMessageA(hToolbar, TB_CHECKBUTTON, 1000, 1); /* press A1 and ensure B group didn't suffer */
415  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 not pressed anymore\n");
416  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
417  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 still pressed\n");
418 
419  SendMessageA(hToolbar, TB_CHECKBUTTON, 1008, 1); /* press B3, and ensure A group didn't suffer */
420  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1005, 0), "A6 pressed\n");
421  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1000, 0), "A1 pressed\n");
422  ok(!SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1007, 0), "B2 not pressed\n");
423  ok(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 1008, 0), "B3 pressed\n");
424 
425  /* tests with invalid index */
426  compare(SendMessageA(hToolbar, TB_ISBUTTONCHECKED, 0xdeadbeef, 0), -1L, "%ld");
427  compare(SendMessageA(hToolbar, TB_ISBUTTONPRESSED, 0xdeadbeef, 0), -1L, "%ld");
428  compare(SendMessageA(hToolbar, TB_ISBUTTONENABLED, 0xdeadbeef, 0), -1L, "%ld");
429  compare(SendMessageA(hToolbar, TB_ISBUTTONINDETERMINATE, 0xdeadbeef, 0), -1L, "%ld");
430  compare(SendMessageA(hToolbar, TB_ISBUTTONHIGHLIGHTED, 0xdeadbeef, 0), -1L, "%ld");
431  compare(SendMessageA(hToolbar, TB_ISBUTTONHIDDEN, 0xdeadbeef, 0), -1L, "%ld");
432 
433  DestroyWindow(hToolbar);
434 }
#define TB_ADDSTRINGA
Definition: commctrl.h:1127
#define TB_ISBUTTONHIGHLIGHTED
Definition: commctrl.h:1049
#define TB_ISBUTTONPRESSED
Definition: commctrl.h:1046
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_SEP
Definition: commctrl.h:978
#define compare(val, exp, format)
Definition: toolbar.c:121
static HWND hMainWnd
Definition: toolbar.c:49
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TB_ISBUTTONHIDDEN
Definition: commctrl.h:1047
BOOL WINAPI DestroyWindow(_In_ HWND)
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 TBSTYLE_CHECKGROUP
Definition: commctrl.h:981
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_TOP
Definition: commctrl.h:2238
static const WCHAR L[]
Definition: oid.c:1250
#define TB_CHECKBUTTON
Definition: commctrl.h:1039
#define TB_ISBUTTONINDETERMINATE
Definition: commctrl.h:1048
HWND buttons[5]
Definition: sndrec32.cpp:40
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define TBSTYLE_GROUP
Definition: commctrl.h:980
#define TB_ISBUTTONENABLED
Definition: commctrl.h:1044
static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString)
Definition: toolbar.c:128
#define TB_ISBUTTONCHECKED
Definition: commctrl.h:1045
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:989

Referenced by START_TEST().

◆ BOOL()

static BOOL ( WINAPI pImageList_Destroy)
static

◆ cbt_hook_proc()

static LRESULT CALLBACK cbt_hook_proc ( int  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2160 of file toolbar.c.

2161 {
2162  if (code == HCBT_CREATEWND)
2163  {
2164  HWND hwnd = (HWND)wParam;
2165 
2166  if (!g_toolbar)
2167  {
2168  WNDPROC oldproc;
2169 
2170  CHECK_EXPECT2(g_hook_create);
2171  g_toolbar = hwnd;
2172  /* subclass */
2175  }
2176  return 0;
2177  }
2178 
2180 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define HCBT_CREATEWND
Definition: winuser.h:58
static HHOOK g_tbhook
Definition: toolbar.c:2092
static LRESULT WINAPI toolbar_subclass_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2099
WPARAM wParam
Definition: combotst.c:138
#define GWLP_USERDATA
Definition: treelist.c:63
#define CHECK_EXPECT2(func)
Definition: toolbar.c:100
static HWND g_toolbar
Definition: toolbar.c:2093
static HWND(WINAPI *pCreateToolbarEx)(HWND
#define SetWindowLongPtrA
Definition: winuser.h:5320
Definition: inflate.c:139
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPARAM lParam
Definition: combotst.c:139

Referenced by test_create().

◆ DEFINE_EXPECT() [1/3]

DEFINE_EXPECT ( g_hook_create  )

◆ DEFINE_EXPECT() [2/3]

DEFINE_EXPECT ( g_hook_WM_NCCREATE  )

◆ DEFINE_EXPECT() [3/3]

DEFINE_EXPECT ( g_hook_WM_CREATE  )

◆ did_recalc()

static BOOL did_recalc ( HWND  hToolbar)
static

Definition at line 1654 of file toolbar.c.

1655 {
1656  RECT rect;
1657  SendMessageA(hToolbar, TB_GETITEMRECT, 1, (LPARAM)&rect);
1658  ok(rect.top == 2 || rect.top == 0, "Unexpected top margin %d in recalc test\n",
1659  rect.top);
1660  return (rect.top == 0);
1661 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
& rect
Definition: startmenu.cpp:1413
#define TB_GETITEMRECT
Definition: commctrl.h:1129
LONG_PTR LPARAM
Definition: windef.h:208
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_recalc().

◆ expect_hot_notify()

static void expect_hot_notify ( int  idold,
int  idnew 
)
static

Definition at line 831 of file toolbar.c.

832 {
833  g_fExpectedHotItemOld = idold;
834  g_fExpectedHotItemNew = idnew;
836 }
static BOOL g_fExpectedHotItemNew
Definition: toolbar.c:53
#define FALSE
Definition: types.h:117
static BOOL g_fReceivedHotItemChange
Definition: toolbar.c:51
static BOOL g_fExpectedHotItemOld
Definition: toolbar.c:52

Referenced by test_hotitem().

◆ free_tbsize_results()

static void free_tbsize_results ( void  )
static

Definition at line 1281 of file toolbar.c.

1281  {
1282  int i;
1283 
1284  for (i = 0; i < tbsize_results_num; i++)
1285  heap_free(tbsize_results[i].prcButtons);
1287  tbsize_results = NULL;
1288 }
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 tbsize_results_num
Definition: toolbar.c:1024
smooth NULL
Definition: ftsmooth.c:416
static tbsize_result_t * tbsize_results
Definition: toolbar.c:1022
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by test_sizes().

◆ HIMAGELIST()

static int int* static HIMAGELIST ( WINAPI pImageList_LoadImageA)
static

Referenced by test_add_bitmap(), and test_imagelist().

◆ HWND()

static HWND ( WINAPI pCreateToolbarEx)
static

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 2516 of file toolbar.c.

2517 {
2518  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
2519 
2520 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
2521  X(CreateToolbarEx);
2526 #undef X
2527 }
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2063
HIMAGELIST WINAPI ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, COLORREF clrMask, UINT uType, UINT uFlags)
Definition: imagelist.c:2164
HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD style, UINT wID, INT nBitmaps, HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons, INT iNumButtons, INT dxButton, INT dyButton, INT dxBitmap, INT dyBitmap, UINT uStructSize)
Definition: commctrl.c:929
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
#define X(f)

Referenced by START_TEST().

◆ init_tbsize_result()

static tbsize_result_t init_tbsize_result ( int  nButtonsAlloc,
int  cleft,
int  ctop,
int  cright,
int  cbottom,
int  minx,
int  miny 
)
static

Definition at line 1001 of file toolbar.c.

1001  {
1003 
1004  SetRect(&ret.rcClient, cleft, ctop, cright, cbottom);
1005  ret.szMin.cx = minx;
1006  ret.szMin.cy = miny;
1007  ret.nButtons = 0;
1008  ret.prcButtons = heap_alloc_zero(nButtonsAlloc * sizeof(*ret.prcButtons));
1009 
1010  return ret;
1011 }
int ret
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by init_tbsize_results().

◆ init_tbsize_results()

static void init_tbsize_results ( void  )
static

Definition at line 1026 of file toolbar.c.

1026  {
1027  int fontheight = system_font_height();
1028  int buttonwidth;
1029 
1030  tbsize_results = heap_alloc_zero(tbsize_results_num * sizeof(*tbsize_results));
1031 
1032  tbsize_results[0] = init_tbsize_result(5, 0, 0 ,672 ,26, 100 ,22);
1033  tbsize_addbutton(&tbsize_results[0], 0, 2, 23, 24);
1034  tbsize_addbutton(&tbsize_results[0], 23, 2, 46, 24);
1035  tbsize_addbutton(&tbsize_results[0], 46, 2, 54, 24);
1036  tbsize_addbutton(&tbsize_results[0], 54, 2, 77, 24);
1037  tbsize_addbutton(&tbsize_results[0], 77, 2, 100, 24);
1038 
1039  tbsize_results[1] = init_tbsize_result(7, 0, 0, 672, 26, 146, 22);
1040  tbsize_addbutton(&tbsize_results[1], 0, 2, 23, 24);
1041  tbsize_addbutton(&tbsize_results[1], 23, 2, 46, 24);
1042  tbsize_addbutton(&tbsize_results[1], 46, 2, 54, 24);
1043  tbsize_addbutton(&tbsize_results[1], 54, 2, 77, 24);
1044  tbsize_addbutton(&tbsize_results[1], 77, 2, 100, 24);
1045  tbsize_addbutton(&tbsize_results[1], 100, 2, 123, 24);
1046  tbsize_addbutton(&tbsize_results[1], 0, 24, 23, 46);
1047 
1048  tbsize_results[2] = init_tbsize_result(7, 0, 0, 672, 26, 146, 22);
1049  tbsize_addbutton(&tbsize_results[2], 0, 2, 23, 24);
1050  tbsize_addbutton(&tbsize_results[2], 23, 2, 46, 24);
1051  tbsize_addbutton(&tbsize_results[2], 46, 2, 54, 24);
1052  tbsize_addbutton(&tbsize_results[2], 54, 2, 77, 24);
1053  tbsize_addbutton(&tbsize_results[2], 77, 2, 100, 24);
1054  tbsize_addbutton(&tbsize_results[2], 100, 2, 123, 24);
1055  tbsize_addbutton(&tbsize_results[2], 0, 24, 23, 46);
1056 
1057  tbsize_results[3] = init_tbsize_result(7, 0, 0, 672, 26, 146, 22);
1058  tbsize_addbutton(&tbsize_results[3], 0, 2, 23, 24);
1059  tbsize_addbutton(&tbsize_results[3], 23, 2, 46, 24);
1060  tbsize_addbutton(&tbsize_results[3], 46, 2, 54, 24);
1061  tbsize_addbutton(&tbsize_results[3], 54, 2, 77, 24);
1062  tbsize_addbutton(&tbsize_results[3], 77, 2, 100, 24);
1063  tbsize_addbutton(&tbsize_results[3], 100, 2, 123, 24);
1064  tbsize_addbutton(&tbsize_results[3], 123, 2, 146, 24);
1065 
1066  tbsize_results[4] = init_tbsize_result(9, 0, 0, 672, 26, 192, 22);
1067  tbsize_addbutton(&tbsize_results[4], 0, 2, 23, 24);
1068  tbsize_addbutton(&tbsize_results[4], 23, 2, 46, 24);
1069  tbsize_addbutton(&tbsize_results[4], 46, 2, 54, 24);
1070  tbsize_addbutton(&tbsize_results[4], 54, 2, 77, 24);
1071  tbsize_addbutton(&tbsize_results[4], 77, 2, 100, 24);
1072  tbsize_addbutton(&tbsize_results[4], 100, 2, 123, 24);
1073  tbsize_addbutton(&tbsize_results[4], 123, 2, 146, 24);
1074  tbsize_addbutton(&tbsize_results[4], 146, 2, 169, 24);
1075  tbsize_addbutton(&tbsize_results[4], 169, 2, 192, 24);
1076 
1077  tbsize_results[5] = init_tbsize_result(39, 0, 0, 672, 92, 882, 22);
1078  tbsize_addbutton(&tbsize_results[5], 0, 2, 23, 24);
1079  tbsize_addbutton(&tbsize_results[5], 23, 2, 46, 24);
1080  tbsize_addbutton(&tbsize_results[5], 0, 2, 8, 29);
1081  tbsize_addbutton(&tbsize_results[5], 0, 29, 23, 51);
1082  tbsize_addbutton(&tbsize_results[5], 23, 29, 46, 51);
1083  tbsize_addbutton(&tbsize_results[5], 46, 29, 69, 51);
1084  tbsize_addbutton(&tbsize_results[5], 69, 29, 92, 51);
1085  tbsize_addbutton(&tbsize_results[5], 92, 29, 115, 51);
1086  tbsize_addbutton(&tbsize_results[5], 115, 29, 138, 51);
1087  tbsize_addbutton(&tbsize_results[5], 138, 29, 161, 51);
1088  tbsize_addbutton(&tbsize_results[5], 161, 29, 184, 51);
1089  tbsize_addbutton(&tbsize_results[5], 184, 29, 207, 51);
1090  tbsize_addbutton(&tbsize_results[5], 207, 29, 230, 51);
1091  tbsize_addbutton(&tbsize_results[5], 230, 29, 253, 51);
1092  tbsize_addbutton(&tbsize_results[5], 253, 29, 276, 51);
1093  tbsize_addbutton(&tbsize_results[5], 276, 29, 299, 51);
1094  tbsize_addbutton(&tbsize_results[5], 299, 29, 322, 51);
1095  tbsize_addbutton(&tbsize_results[5], 322, 29, 345, 51);
1096  tbsize_addbutton(&tbsize_results[5], 345, 29, 368, 51);
1097  tbsize_addbutton(&tbsize_results[5], 368, 29, 391, 51);
1098  tbsize_addbutton(&tbsize_results[5], 391, 29, 414, 51);
1099  tbsize_addbutton(&tbsize_results[5], 414, 29, 437, 51);
1100  tbsize_addbutton(&tbsize_results[5], 437, 29, 460, 51);
1101  tbsize_addbutton(&tbsize_results[5], 460, 29, 483, 51);
1102  tbsize_addbutton(&tbsize_results[5], 483, 29, 506, 51);
1103  tbsize_addbutton(&tbsize_results[5], 506, 29, 529, 51);
1104  tbsize_addbutton(&tbsize_results[5], 529, 29, 552, 51);
1105  tbsize_addbutton(&tbsize_results[5], 552, 29, 575, 51);
1106  tbsize_addbutton(&tbsize_results[5], 575, 29, 598, 51);
1107  tbsize_addbutton(&tbsize_results[5], 598, 29, 621, 51);
1108  tbsize_addbutton(&tbsize_results[5], 621, 29, 644, 51);
1109  tbsize_addbutton(&tbsize_results[5], 644, 29, 667, 51);
1110  tbsize_addbutton(&tbsize_results[5], 0, 51, 23, 73);
1111  tbsize_addbutton(&tbsize_results[5], 23, 51, 46, 73);
1112  tbsize_addbutton(&tbsize_results[5], 46, 51, 69, 73);
1113  tbsize_addbutton(&tbsize_results[5], 69, 51, 92, 73);
1114  tbsize_addbutton(&tbsize_results[5], 92, 51, 115, 73);
1115  tbsize_addbutton(&tbsize_results[5], 115, 51, 138, 73);
1116  tbsize_addbutton(&tbsize_results[5], 138, 51, 161, 73);
1117 
1118  tbsize_results[6] = init_tbsize_result(7, 0, 0, 48, 226, 23, 140);
1119  tbsize_addbutton(&tbsize_results[6], 0, 2, 23, 24);
1120  tbsize_addbutton(&tbsize_results[6], 23, 2, 46, 24);
1121  tbsize_addbutton(&tbsize_results[6], 46, 2, 94, 24);
1122  tbsize_addbutton(&tbsize_results[6], 94, 2, 117, 24);
1123  tbsize_addbutton(&tbsize_results[6], 117, 2, 140, 24);
1124  tbsize_addbutton(&tbsize_results[6], 140, 2, 163, 24);
1125  tbsize_addbutton(&tbsize_results[6], 0, 24, 23, 46);
1126 
1127  tbsize_results[7] = init_tbsize_result(7, 0, 0, 92, 226, 23, 140);
1128  tbsize_addbutton(&tbsize_results[7], 0, 2, 23, 24);
1129  tbsize_addbutton(&tbsize_results[7], 23, 2, 46, 24);
1130  tbsize_addbutton(&tbsize_results[7], 0, 24, 92, 32);
1131  tbsize_addbutton(&tbsize_results[7], 0, 32, 23, 54);
1132  tbsize_addbutton(&tbsize_results[7], 23, 32, 46, 54);
1133  tbsize_addbutton(&tbsize_results[7], 46, 32, 69, 54);
1134  tbsize_addbutton(&tbsize_results[7], 69, 32, 92, 54);
1135 
1136  tbsize_results[8] = init_tbsize_result(7, 0, 0, 672, 26, 194, 30);
1137  tbsize_addbutton(&tbsize_results[8], 0, 2, 31, 32);
1138  tbsize_addbutton(&tbsize_results[8], 31, 2, 62, 32);
1139  tbsize_addbutton(&tbsize_results[8], 62, 2, 70, 32);
1140  tbsize_addbutton(&tbsize_results[8], 70, 2, 101, 32);
1141  tbsize_addbutton(&tbsize_results[8], 101, 2, 132, 32);
1142  tbsize_addbutton(&tbsize_results[8], 132, 2, 163, 32);
1143  tbsize_addbutton(&tbsize_results[8], 0, 32, 31, 62);
1144 
1145  tbsize_results[9] = init_tbsize_result(7, 0, 0, 672, 64, 194, 30);
1146  tbsize_addbutton(&tbsize_results[9], 0, 2, 31, 32);
1147  tbsize_addbutton(&tbsize_results[9], 31, 2, 62, 32);
1148  tbsize_addbutton(&tbsize_results[9], 62, 2, 70, 32);
1149  tbsize_addbutton(&tbsize_results[9], 70, 2, 101, 32);
1150  tbsize_addbutton(&tbsize_results[9], 101, 2, 132, 32);
1151  tbsize_addbutton(&tbsize_results[9], 132, 2, 163, 32);
1152  tbsize_addbutton(&tbsize_results[9], 0, 32, 31, 62);
1153 
1154  tbsize_results[10] = init_tbsize_result(7, 0, 0, 672, 64, 194, 30);
1155  tbsize_addbutton(&tbsize_results[10], 0, 0, 31, 30);
1156  tbsize_addbutton(&tbsize_results[10], 31, 0, 62, 30);
1157  tbsize_addbutton(&tbsize_results[10], 62, 0, 70, 30);
1158  tbsize_addbutton(&tbsize_results[10], 70, 0, 101, 30);
1159  tbsize_addbutton(&tbsize_results[10], 101, 0, 132, 30);
1160  tbsize_addbutton(&tbsize_results[10], 132, 0, 163, 30);
1161  tbsize_addbutton(&tbsize_results[10], 0, 30, 31, 60);
1162 
1163  tbsize_results[11] = init_tbsize_result(7, 0, 0, 124, 226, 31, 188);
1164  tbsize_addbutton(&tbsize_results[11], 0, 0, 31, 30);
1165  tbsize_addbutton(&tbsize_results[11], 31, 0, 62, 30);
1166  tbsize_addbutton(&tbsize_results[11], 0, 30, 124, 38);
1167  tbsize_addbutton(&tbsize_results[11], 0, 38, 31, 68);
1168  tbsize_addbutton(&tbsize_results[11], 31, 38, 62, 68);
1169  tbsize_addbutton(&tbsize_results[11], 62, 38, 93, 68);
1170  tbsize_addbutton(&tbsize_results[11], 93, 38, 124, 68);
1171 
1172  tbsize_results[12] = init_tbsize_result(7, 0, 0, 672, 26, 146, 22);
1173  tbsize_addbutton(&tbsize_results[12], 0, 2, 23, 24);
1174  tbsize_addbutton(&tbsize_results[12], 23, 2, 46, 24);
1175  tbsize_addbutton(&tbsize_results[12], 46, 2, 54, 24);
1176  tbsize_addbutton(&tbsize_results[12], 54, 2, 77, 24);
1177  tbsize_addbutton(&tbsize_results[12], 77, 2, 100, 24);
1178  tbsize_addbutton(&tbsize_results[12], 100, 2, 123, 24);
1179  tbsize_addbutton(&tbsize_results[12], 123, 2, 146, 24);
1180 
1181  tbsize_results[13] = init_tbsize_result(7, 0, 0, 672, 26, 146, 100);
1182  tbsize_addbutton(&tbsize_results[13], 0, 0, 23, 100);
1183  tbsize_addbutton(&tbsize_results[13], 23, 0, 46, 100);
1184  tbsize_addbutton(&tbsize_results[13], 46, 0, 54, 100);
1185  tbsize_addbutton(&tbsize_results[13], 54, 0, 77, 100);
1186  tbsize_addbutton(&tbsize_results[13], 77, 0, 100, 100);
1187  tbsize_addbutton(&tbsize_results[13], 100, 0, 123, 100);
1188  tbsize_addbutton(&tbsize_results[13], 123, 0, 146, 100);
1189 
1190  tbsize_results[14] = init_tbsize_result(10, 0, 0, 672, 26, 146, 100);
1191  tbsize_addbutton(&tbsize_results[14], 0, 0, 23, 100);
1192  tbsize_addbutton(&tbsize_results[14], 23, 0, 46, 100);
1193  tbsize_addbutton(&tbsize_results[14], 46, 0, 54, 100);
1194  tbsize_addbutton(&tbsize_results[14], 54, 0, 77, 100);
1195  tbsize_addbutton(&tbsize_results[14], 77, 0, 100, 100);
1196  tbsize_addbutton(&tbsize_results[14], 100, 0, 123, 100);
1197  tbsize_addbutton(&tbsize_results[14], 123, 0, 146, 100);
1198  tbsize_addbutton(&tbsize_results[14], 146, 0, 169, 100);
1199  tbsize_addbutton(&tbsize_results[14], 169, 0, 192, 100);
1200  tbsize_addbutton(&tbsize_results[14], 192, 0, 215, 100);
1201 
1202  tbsize_results[15] = init_tbsize_result(11, 0, 0, 672, 26, 238, 39);
1203  tbsize_addbutton(&tbsize_results[15], 0, 0, 23, 23 + fontheight);
1204  tbsize_addbutton(&tbsize_results[15], 23, 0, 46, 23 + fontheight);
1205  tbsize_addbutton(&tbsize_results[15], 46, 0, 54, 23 + fontheight);
1206  tbsize_addbutton(&tbsize_results[15], 54, 0, 77, 23 + fontheight);
1207  tbsize_addbutton(&tbsize_results[15], 77, 0, 100, 23 + fontheight);
1208  tbsize_addbutton(&tbsize_results[15], 100, 0, 123, 23 + fontheight);
1209  tbsize_addbutton(&tbsize_results[15], 123, 0, 146, 23 + fontheight);
1210  tbsize_addbutton(&tbsize_results[15], 146, 0, 169, 23 + fontheight);
1211  tbsize_addbutton(&tbsize_results[15], 169, 0, 192, 23 + fontheight);
1212  tbsize_addbutton(&tbsize_results[15], 192, 0, 215, 23 + fontheight);
1213  tbsize_addbutton(&tbsize_results[15], 215, 0, 238, 23 + fontheight);
1214 
1215  tbsize_results[16] = init_tbsize_result(11, 0, 0, 672, 26, 239, 22);
1216  tbsize_addbutton(&tbsize_results[16], 0, 0, 23, 22);
1217  tbsize_addbutton(&tbsize_results[16], 23, 0, 46, 22);
1218  tbsize_addbutton(&tbsize_results[16], 46, 0, 54, 22);
1219  tbsize_addbutton(&tbsize_results[16], 54, 0, 77, 22);
1220  tbsize_addbutton(&tbsize_results[16], 77, 0, 100, 22);
1221  tbsize_addbutton(&tbsize_results[16], 100, 0, 123, 22);
1222  tbsize_addbutton(&tbsize_results[16], 123, 0, 146, 22);
1223  tbsize_addbutton(&tbsize_results[16], 146, 0, 169, 22);
1224  tbsize_addbutton(&tbsize_results[16], 169, 0, 192, 22);
1225  tbsize_addbutton(&tbsize_results[16], 192, 0, 215, 22);
1226  tbsize_addbutton(&tbsize_results[16], 215, 0, 238, 22);
1227 
1228  buttonwidth = 7 + string_width(STRING1);
1229 
1230  tbsize_results[17] = init_tbsize_result(3, 0, 0, 672, 26, 489, 39);
1231  tbsize_addbutton(&tbsize_results[17], 0, 2, buttonwidth, 25 + fontheight);
1232  tbsize_addbutton(&tbsize_results[17], buttonwidth, 2, 2*buttonwidth + 4, 25 + fontheight);
1233  tbsize_addbutton(&tbsize_results[17], 2*buttonwidth + 4, 2, 3*buttonwidth + 4, 25 + fontheight);
1234 
1235  tbsize_results[18] = init_tbsize_result(6, 0, 0, 672, 104, 978, 24);
1236  tbsize_addbutton(&tbsize_results[18], 0, 2, buttonwidth, 10 + fontheight);
1237  tbsize_addbutton(&tbsize_results[18], buttonwidth, 2, 2*buttonwidth, 10 + fontheight);
1238  tbsize_addbutton(&tbsize_results[18], 2*buttonwidth, 2, 3*buttonwidth, 10 + fontheight);
1239  tbsize_addbutton(&tbsize_results[18], 3*buttonwidth, 2, 4*buttonwidth, 10 + fontheight);
1240  tbsize_addbutton(&tbsize_results[18], 4*buttonwidth, 2, 5*buttonwidth + 4, 10 + fontheight);
1241  tbsize_addbutton(&tbsize_results[18], 5*buttonwidth + 4, 2, 5*buttonwidth + 4 + string_width(STRING2) + 11, 10 + fontheight);
1242 
1243  tbsize_results[19] = init_tbsize_result(6, 0, 0, 672, 28, 978, 38);
1244  tbsize_addbutton(&tbsize_results[19], 0, 0, buttonwidth, 22 + fontheight);
1245  tbsize_addbutton(&tbsize_results[19], buttonwidth, 0, 2*buttonwidth, 22 + fontheight);
1246  tbsize_addbutton(&tbsize_results[19], 2*buttonwidth, 0, 3*buttonwidth, 22 + fontheight);
1247  tbsize_addbutton(&tbsize_results[19], 3*buttonwidth, 0, 4*buttonwidth, 22 + fontheight);
1248  tbsize_addbutton(&tbsize_results[19], 4*buttonwidth, 0, 5*buttonwidth + 4, 22 + fontheight);
1249  tbsize_addbutton(&tbsize_results[19], 5*buttonwidth + 4, 0, 5*buttonwidth + 4 + string_width(STRING2) + 11, 22 + fontheight);
1250 
1251  tbsize_results[20] = init_tbsize_result(3, 0, 0, 672, 100, 239, 102);
1252  tbsize_addbutton(&tbsize_results[20], 0, 2, 100, 102);
1253  tbsize_addbutton(&tbsize_results[20], 100, 2, 139, 102);
1254  tbsize_addbutton(&tbsize_results[20], 139, 2, 239, 102);
1255 
1256  tbsize_results[21] = init_tbsize_result(3, 0, 0, 672, 42, 185, 40);
1257  tbsize_addbutton(&tbsize_results[21], 0, 2, 75, 40);
1258  tbsize_addbutton(&tbsize_results[21], 75, 2, 118, 40);
1259  tbsize_addbutton(&tbsize_results[21], 118, 2, 165 + string_width(STRING2), 40);
1260 
1261  tbsize_results[22] = init_tbsize_result(1, 0, 0, 672, 42, 67, 40);
1262  tbsize_addbutton(&tbsize_results[22], 0, 2, 47 + string_width(STRING2), 40);
1263 
1264  tbsize_results[23] = init_tbsize_result(2, 0, 0, 672, 42, 67, 41);
1265  tbsize_addbutton(&tbsize_results[23], 0, 2, 672, 25 + fontheight);
1266  tbsize_addbutton(&tbsize_results[23], 0, 25 + fontheight, 672, 48 + 2*fontheight);
1267 
1268  tbsize_results[24] = init_tbsize_result(1, 0, 0, 672, 42, 67, 40);
1269  tbsize_addbutton(&tbsize_results[24], 0, 2, 11 + string_width(STRING2), 24);
1270 
1271  tbsize_results[25] = init_tbsize_result(1, 0, 0, 672, 42, 67, 40);
1272  tbsize_addbutton(&tbsize_results[25], 0, 2, 40, 24);
1273 
1274  tbsize_results[26] = init_tbsize_result(1, 0, 0, 672, 42, 67, 40);
1275  tbsize_addbutton(&tbsize_results[26], 0, 2, 40, 24);
1276 
1277  tbsize_results[27] = init_tbsize_result(1, 0, 0, 672, 42, 67, 40);
1278  tbsize_addbutton(&tbsize_results[27], 0, 2, 40, 24);
1279 }
static int string_width(const CHAR *s)
Definition: toolbar.c:982
#define STRING1
Definition: toolbar.c:1019
#define tbsize_results_num
Definition: toolbar.c:1024
static void tbsize_addbutton(tbsize_result_t *tbsr, int left, int top, int right, int bottom)
Definition: toolbar.c:1013
static tbsize_result_t init_tbsize_result(int nButtonsAlloc, int cleft, int ctop, int cright, int cbottom, int minx, int miny)
Definition: toolbar.c:1001
static int system_font_height(void)
Definition: toolbar.c:971
#define STRING2
Definition: toolbar.c:1020
static tbsize_result_t * tbsize_results
Definition: toolbar.c:1022

Referenced by test_sizes().

◆ INT()

static INT ( WINAPI pImageList_GetImageCount)
static

◆ MakeButton()

static void MakeButton ( TBBUTTON p,
int  idCommand,
int  fsStyle,
int  nString 
)
static

Definition at line 128 of file toolbar.c.

128  {
129  p->iBitmap = -2;
130  p->idCommand = idCommand;
131  p->fsState = TBSTATE_ENABLED;
132  p->fsStyle = fsStyle;
133  p->iString = nString;
134 }
#define TBSTATE_ENABLED
Definition: commctrl.h:970
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by basic_test(), test_get_set_style(), and test_setrows().

◆ parent_wnd_notify()

static LRESULT parent_wnd_notify ( LPARAM  lParam)
static

Definition at line 138 of file toolbar.c.

139 {
140  NMHDR *hdr = (NMHDR *)lParam;
141  NMTBHOTITEM *nmhi;
142  NMTBDISPINFOA *nmdisp;
143  switch (hdr->code)
144  {
145  case TBN_HOTITEMCHANGE:
146  nmhi = (NMTBHOTITEM *)lParam;
149  {
150  compare(nmhi->idOld, g_fExpectedHotItemOld, "%d");
151  compare(nmhi->idNew, g_fExpectedHotItemNew, "%d");
152  }
154  return 1;
155  break;
156 
157  case TBN_GETDISPINFOA:
158  ok(FALSE, "TBN_GETDISPINFOA received\n");
159  break;
160 
161  case TBN_GETINFOTIPA:
162  {
164 
165  if (g_ResetDispTextPtr)
166  {
167  tbgit->pszText = NULL;
168  return 0;
169  }
170  break;
171  }
172  case TBN_GETDISPINFOW:
173  nmdisp = (NMTBDISPINFOA *)lParam;
174 
175  compare(nmdisp->dwMask, g_dwExpectedDispInfoMask, "%x");
176  ok(nmdisp->pszText == NULL, "pszText is not NULL\n");
177  break;
178  case TBN_SAVE:
179  {
180  NMTBSAVE *save = (NMTBSAVE *)lParam;
181  if (save->iItem == -1)
182  {
183  save->cbData = save->cbData * 2 + 11 * sizeof(DWORD);
184  save->pData = heap_alloc( save->cbData );
185  save->pData[0] = 0xcafe;
186  save->pCurrent = save->pData + 1;
187  }
188  else
189  {
190  save->pCurrent[0] = 0xcafe0000 + save->iItem;
191  save->pCurrent++;
192  }
193 
194  /* Add on 5 more pseudo buttons. */
195  if (save->iItem == save->cButtons - 1)
196  {
197  save->pCurrent[0] = 0xffffffff;
198  save->pCurrent[1] = 0xcafe0007;
199  save->pCurrent[2] = 0xfffffffe;
200  save->pCurrent[3] = 0xcafe0008;
201  save->pCurrent[4] = 0x80000000;
202  save->pCurrent[5] = 0xcafe0009;
203  save->pCurrent[6] = 0x7fffffff;
204  save->pCurrent[7] = 0xcafe000a;
205  save->pCurrent[8] = 0x100;
206  save->pCurrent[9] = 0xcafe000b;
207  }
208 
209  /* Return value is ignored */
210  return 1;
211  }
212  case TBN_RESTORE:
213  {
214  NMTBRESTORE *restore = (NMTBRESTORE *)lParam;
215 
216  if (restore->iItem == -1)
217  {
218  ok( restore->cButtons == 25, "got %d\n", restore->cButtons );
219  ok( *restore->pCurrent == 0xcafe, "got %08x\n", *restore->pCurrent );
220  /* Skip the last one */
221  restore->cButtons = 11;
222  restore->pCurrent++;
223  /* BytesPerRecord is ignored */
224  restore->cbBytesPerRecord = 10;
225  }
226  else
227  {
228  ok( *restore->pCurrent == 0xcafe0000 + restore->iItem, "got %08x\n", *restore->pCurrent );
229  if (restore->iItem < 7 || restore->iItem == 10)
230  {
231  ok( restore->tbButton.iBitmap == -1, "got %08x\n", restore->tbButton.iBitmap );
232  if (restore->iItem < 7)
233  ok( restore->tbButton.idCommand == restore->iItem * 2 + 1, "%d: got %08x\n", restore->iItem, restore->tbButton.idCommand );
234  else
235  ok( restore->tbButton.idCommand == 0x7fffffff, "%d: got %08x\n", restore->iItem, restore->tbButton.idCommand );
236  ok( restore->tbButton.fsState == 0, "%d: got %02x\n", restore->iItem, restore->tbButton.fsState );
237  ok( restore->tbButton.fsStyle == 0, "%d: got %02x\n", restore->iItem, restore->tbButton.fsStyle );
238  }
239  else
240  {
241  ok( restore->tbButton.iBitmap == 8, "got %08x\n", restore->tbButton.iBitmap );
242  ok( restore->tbButton.idCommand == 0, "%d: got %08x\n", restore->iItem, restore->tbButton.idCommand );
243  if (restore->iItem == 7)
244  ok( restore->tbButton.fsState == 0, "%d: got %02x\n", restore->iItem, restore->tbButton.fsState );
245  else
246  ok( restore->tbButton.fsState == TBSTATE_HIDDEN, "%d: got %02x\n", restore->iItem, restore->tbButton.fsState );
247  ok( restore->tbButton.fsStyle == BTNS_SEP, "%d: got %02x\n", restore->iItem, restore->tbButton.fsStyle );
248  }
249 
250  ok( restore->tbButton.dwData == 0, "got %08lx\n", restore->tbButton.dwData );
251  ok( restore->tbButton.iString == 0, "got %08lx\n", restore->tbButton.iString );
252 
253  restore->tbButton.iBitmap = 0;
254  restore->tbButton.fsState = TBSTATE_ENABLED;
255  restore->tbButton.fsStyle = 0;
256  restore->tbButton.dwData = restore->iItem;
257 
258  if (restore->iItem == 0)
259  {
260  restore->tbButton.iString = (INT_PTR)heap_alloc_zero( 8 );
261  strcpy( (char *)restore->tbButton.iString, "foo" );
262  }
263  else if (restore->iItem == 1)
264  restore->tbButton.iString = 2;
265  else
266  restore->tbButton.iString = -1;
267 
268  restore->pCurrent++;
269  /* Altering cButtons after the 1st call makes no difference. */
270  restore->cButtons--;
271  }
272 
273  /* Returning non-zero from the 1st call aborts the restore,
274  otherwise the return value is ignored. */
275  if (restore->iItem == -1) return 0;
276  return 1;
277  }
278  case TBN_GETBUTTONINFOA:
279  {
281  tb->tbButton.iBitmap = 0;
282  tb->tbButton.fsState = 0;
283  tb->tbButton.fsStyle = 0;
284  tb->tbButton.dwData = 0;
285  ok( tb->cchText == 128, "got %d\n", tb->cchText );
286  switch (tb->iItem)
287  {
288  case 0:
289  tb->tbButton.idCommand = 7;
290  alloced_str = heap_alloc_zero( 8 );
291  strcpy( alloced_str, "foo" );
292  tb->tbButton.iString = (INT_PTR)alloced_str;
293  return 1;
294  case 1:
295  tb->tbButton.idCommand = 9;
296  tb->tbButton.iString = 0;
297  /* tb->pszText is ignored */
298  strcpy( tb->pszText, "foo" );
299  return 1;
300  case 2:
301  tb->tbButton.idCommand = 11;
302  tb->tbButton.iString = 3;
303  return 1;
304  }
305  return 0;
306  }
307  }
308  return 0;
309 }
#define TBN_GETINFOTIPA
Definition: commctrl.h:1337
char hdr[14]
Definition: iptest.cpp:33
static DWORD
Definition: toolbar.c:40
#define TRUE
Definition: types.h:120
static BOOL g_fBlockHotItemChange
Definition: toolbar.c:50
static BOOL g_fExpectedHotItemNew
Definition: toolbar.c:53
#define compare(val, exp, format)
Definition: toolbar.c:121
int32_t INT_PTR
Definition: typedefs.h:64
BYTE fsStyle
Definition: commctrl.h:948
int cButtons
Definition: commctrl.h:1357
#define TBN_HOTITEMCHANGE
Definition: commctrl.h:1332
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define TBN_GETBUTTONINFOA
Definition: commctrl.h:1302
#define FALSE
Definition: types.h:117
DWORD * pCurrent
Definition: commctrl.h:1354
static void * alloced_str
Definition: toolbar.c:136
smooth NULL
Definition: ftsmooth.c:416
INT_PTR iString
Definition: commctrl.h:955
DWORD_PTR dwData
Definition: commctrl.h:954
int iBitmap
Definition: commctrl.h:945
TBBUTTON tbButton
Definition: commctrl.h:1369
#define BTNS_SEP
Definition: commctrl.h:995
int cbBytesPerRecord
Definition: commctrl.h:1368
static BOOL g_ResetDispTextPtr
Definition: toolbar.c:55
static const WCHAR tb[]
Definition: suminfo.c:286
#define TBN_SAVE
Definition: commctrl.h:1341
int idCommand
Definition: commctrl.h:946
LPSTR pszText
Definition: commctrl.h:1402
DWORD dwMask
Definition: commctrl.h:1398
#define TBN_RESTORE
Definition: commctrl.h:1340
#define ok(value,...)
Definition: atltest.h:57
UINT cbData
Definition: commctrl.h:1355
#define TBSTATE_HIDDEN
Definition: commctrl.h:971
#define TBSTATE_ENABLED
Definition: commctrl.h:970
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static DWORD g_dwExpectedDispInfoMask
Definition: toolbar.c:54
#define TBN_GETDISPINFOA
Definition: commctrl.h:1335
static BOOL g_fReceivedHotItemChange
Definition: toolbar.c:51
BYTE fsState
Definition: commctrl.h:947
#define TBN_GETDISPINFOW
Definition: commctrl.h:1336
LPARAM lParam
Definition: combotst.c:139
static BOOL g_fExpectedHotItemOld
Definition: toolbar.c:52
DWORD * pData
Definition: commctrl.h:1353
DWORD * pCurrent
Definition: commctrl.h:1364

Referenced by parent_wnd_proc().

◆ parent_wnd_proc()

static LRESULT CALLBACK parent_wnd_proc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 311 of file toolbar.c.

312 {
313  static LONG defwndproc_counter = 0;
314  struct message msg;
315  LRESULT ret;
316 
317  msg.message = message;
318  msg.flags = sent|wparam|lparam;
319  if (defwndproc_counter) msg.flags |= defwinproc;
320  msg.wParam = wParam;
321  msg.lParam = lParam;
322  if (message == WM_NOTIFY && lParam)
323  {
324  msg.id = ((NMHDR*)lParam)->code;
325  switch (msg.id)
326  {
327  case TBN_SAVE:
328  {
329  NMTBSAVE *save = (NMTBSAVE *)lParam;
330  msg.stage = save->iItem;
331  }
332  break;
333  case TBN_RESTORE:
334  {
335  NMTBRESTORE *restore = (NMTBRESTORE *)lParam;
336  msg.stage = restore->iItem;
337  }
338  break;
339  case TBN_GETBUTTONINFOA:
340  {
342  msg.stage = tb->iItem;
343  }
344  break;
345  }
346  }
347 
348  /* log system messages, except for painting */
349  if (message < WM_USER &&
350  message != WM_PAINT &&
351  message != WM_ERASEBKGND &&
352  message != WM_NCPAINT &&
353  message != WM_NCHITTEST &&
354  message != WM_GETTEXT &&
355  message != WM_GETICON &&
357  {
359  }
360 
361  switch (message)
362  {
363  case WM_NOTIFY:
364  return parent_wnd_notify(lParam);
365  }
366 
367  defwndproc_counter++;
369  defwndproc_counter--;
370 
371  return ret;
372 }
#define PARENT_SEQ_INDEX
Definition: toolbar.c:37
static LRESULT parent_wnd_notify(LPARAM lParam)
Definition: toolbar.c:138
Definition: tftpd.h:59
#define WM_GETTEXT
Definition: winuser.h:1600
Definition: msg.h:39
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
HWND hWnd
Definition: settings.c:17
#define WM_NCHITTEST
Definition: winuser.h:1668
WPARAM wParam
Definition: combotst.c:138
#define WM_NCPAINT
Definition: winuser.h:1669
#define TBN_GETBUTTONINFOA
Definition: commctrl.h:1302
long LONG
Definition: pedump.c:60
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static const WCHAR tb[]
Definition: suminfo.c:286
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: toolbar.c:47
#define WM_PAINT
Definition: winuser.h:1602
int ret
Definition: msg.h:34
#define TBN_SAVE
Definition: commctrl.h:1341
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1877
#define add_message(msg)
Definition: msg.c:2108
#define TBN_RESTORE
Definition: commctrl.h:1340
#define WM_DEVICECHANGE
Definition: winuser.h:1793
#define msg(x)
Definition: auth_time.c:54
#define WM_ERASEBKGND
Definition: winuser.h:1607
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by START_TEST().

◆ prepare_recalc_test()

static void prepare_recalc_test ( HWND phToolbar)
static

Definition at line 1643 of file toolbar.c.

1644 {
1645  RECT rect;
1646  rebuild_toolbar_with_buttons(phToolbar);
1647  SetWindowLongA(*phToolbar, GWL_STYLE,
1648  GetWindowLongA(*phToolbar, GWL_STYLE) | TBSTYLE_FLAT);
1649  SendMessageA(*phToolbar, TB_GETITEMRECT, 1, (LPARAM)&rect);
1650  ok(rect.top == 2, "Test will make no sense because initial top is %d instead of 2\n",
1651  rect.top);
1652 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
& rect
Definition: startmenu.cpp:1413
#define TB_GETITEMRECT
Definition: commctrl.h:1129
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
LONG_PTR LPARAM
Definition: windef.h:208
static void rebuild_toolbar_with_buttons(HWND *hToolbar)
Definition: toolbar.c:448
#define GWL_STYLE
Definition: winuser.h:846
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define TBSTYLE_FLAT
Definition: commctrl.h:988

Referenced by test_recalc().

◆ rebuild_toolbar()

static void rebuild_toolbar ( HWND hToolbar)
static

Definition at line 436 of file toolbar.c.

437 {
438  if (*hToolbar)
439  DestroyWindow(*hToolbar);
440  *hToolbar = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
442  ok(*hToolbar != NULL, "Toolbar creation problem\n");
443  ok(SendMessageA(*hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0) == 0, "TB_BUTTONSTRUCTSIZE failed\n");
444  ok(SendMessageA(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
445  ok(SendMessageA(*hToolbar, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0)==1, "WM_SETFONT\n");
446 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND hMainWnd
Definition: toolbar.c:49
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TB_AUTOSIZE
Definition: commctrl.h:1133
smooth NULL
Definition: ftsmooth.c:416
#define SYSTEM_FONT
Definition: wingdi.h:910
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
#define ok(value,...)
Definition: atltest.h:57
#define WM_SETFONT
Definition: winuser.h:1632
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by rebuild_toolbar_with_buttons(), test_add_bitmap(), test_add_string(), test_dispinfo(), test_drawtext_flags(), test_imagelist(), test_save(), test_sizes(), test_TB_GET_SET_EXTENDEDSTYLE(), and test_tooltip().

◆ rebuild_toolbar_with_buttons()

static void rebuild_toolbar_with_buttons ( HWND hToolbar)
static

Definition at line 448 of file toolbar.c.

449 {
450  TBBUTTON buttons[5];
451  rebuild_toolbar(hToolbar);
452 
453  ZeroMemory(&buttons, sizeof(buttons));
454  buttons[0].idCommand = 1;
455  buttons[0].fsStyle = BTNS_BUTTON;
456  buttons[0].fsState = TBSTATE_ENABLED;
457  buttons[0].iString = -1;
458  buttons[1].idCommand = 3;
459  buttons[1].fsStyle = BTNS_BUTTON;
460  buttons[1].fsState = TBSTATE_ENABLED;
461  buttons[1].iString = -1;
462  buttons[2].idCommand = 5;
463  buttons[2].fsStyle = BTNS_SEP;
464  buttons[2].fsState = TBSTATE_ENABLED;
465  buttons[2].iString = -1;
466  buttons[3].idCommand = 7;
467  buttons[3].fsStyle = BTNS_BUTTON;
468  buttons[3].fsState = TBSTATE_ENABLED;
469  buttons[3].iString = -1;
470  buttons[4].idCommand = 9;
471  buttons[4].fsStyle = BTNS_BUTTON;
472  buttons[4].fsState = 0; /* disabled */
473  buttons[4].iString = -1;
474  ok(SendMessageA(*hToolbar, TB_ADDBUTTONSA, 5, (LPARAM)buttons) == 1, "TB_ADDBUTTONSA failed\n");
475  ok(SendMessageA(*hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
476 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ZeroMemory
Definition: winbase.h:1648
#define BTNS_BUTTON
Definition: commctrl.h:994
#define TB_AUTOSIZE
Definition: commctrl.h:1133
LONG_PTR LPARAM
Definition: windef.h:208
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
#define BTNS_SEP
Definition: commctrl.h:995
HWND buttons[5]
Definition: sndrec32.cpp:40
#define ok(value,...)
Definition: atltest.h:57
#define TB_ADDBUTTONSA
Definition: commctrl.h:1102
#define TBSTATE_ENABLED
Definition: commctrl.h:970

Referenced by prepare_recalc_test(), test_getbuttoninfo(), test_hotitem(), test_save(), and test_sizes().

◆ restore_recalc_state()

static void restore_recalc_state ( HWND  hToolbar)
static

Definition at line 1664 of file toolbar.c.

1665 {
1666  RECT rect;
1667  /* return to style with a 2px top margin */
1668  SetWindowLongA(hToolbar, GWL_STYLE,
1669  SendMessageA(hToolbar, TB_GETSTYLE, 0, 0) & ~TBSTYLE_FLAT);
1670  /* recalc */
1671  SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons3[3]);
1672  /* top margin will be 0px if a recalc occurs */
1673  SetWindowLongA(hToolbar, GWL_STYLE,
1674  SendMessageA(hToolbar, TB_GETSTYLE, 0, 0) | TBSTYLE_FLAT);
1675  /* safety check */
1676  SendMessageA(hToolbar, TB_GETITEMRECT, 1, (LPARAM)&rect);
1677  ok(rect.top == 2, "Test will make no sense because initial top is %d instead of 2\n",
1678  rect.top);
1679 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
& rect
Definition: startmenu.cpp:1413
#define TB_GETITEMRECT
Definition: commctrl.h:1129
static TBBUTTON buttons3[]
Definition: toolbar.c:1341
LONG_PTR LPARAM
Definition: windef.h:208
#define GWL_STYLE
Definition: winuser.h:846
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define TB_ADDBUTTONSA
Definition: commctrl.h:1102
#define TB_GETSTYLE
Definition: commctrl.h:1155
#define TBSTYLE_FLAT
Definition: commctrl.h:988

Referenced by test_recalc().

◆ START_TEST()

START_TEST ( toolbar  )

Definition at line 2529 of file toolbar.c.

2530 {
2531  WNDCLASSA wc;
2532  MSG msg;
2533  RECT rc;
2534 
2536  init_functions();
2537 
2538  wc.style = CS_HREDRAW | CS_VREDRAW;
2539  wc.cbClsExtra = 0;
2540  wc.cbWndExtra = 0;
2542  wc.hIcon = NULL;
2545  wc.lpszMenuName = NULL;
2546  wc.lpszClassName = "Toolbar test parent";
2548  RegisterClassA(&wc);
2549 
2550  hMainWnd = CreateWindowExA(0, "Toolbar test parent", "Blah", WS_OVERLAPPEDWINDOW,
2552  GetClientRect(hMainWnd, &rc);
2554 
2555  basic_test();
2556  test_add_bitmap();
2557  test_add_string();
2558  test_hotitem();
2559  test_sizes();
2560  test_recalc();
2563  test_dispinfo();
2564  test_setrows();
2565  test_getstring();
2566  test_tooltip();
2568  test_create();
2570  test_noresize();
2571  test_save();
2573  test_imagelist();
2574 
2575  PostQuitMessage(0);
2576  while(GetMessageA(&msg,0,0,0)) {
2579  }
2581 }
static void test_hotitem(void)
Definition: toolbar.c:842
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
static void test_sizes(void)
Definition: toolbar.c:1353
int cbClsExtra
Definition: winuser.h:3140
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3146
static HWND hMainWnd
Definition: toolbar.c:49
static void test_get_set_style(void)
Definition: toolbar.c:2044
static void test_getbuttoninfo(void)
Definition: toolbar.c:1794
HBRUSH hbrBackground
Definition: winuser.h:3145
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define COLOR_WINDOW
Definition: winuser.h:908
#define IDC_IBEAM
Definition: winuser.h:683
int cbWndExtra
Definition: winuser.h:3141
static void test_tooltip(void)
Definition: toolbar.c:2004
static void test_recalc(void)
Definition: toolbar.c:1681
static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:311
HCURSOR hCursor
Definition: winuser.h:3144
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
static void test_getstring(void)
Definition: toolbar.c:1966
static void test_noresize(void)
Definition: toolbar.c:2304
#define CS_VREDRAW
Definition: winuser.h:653
static void test_drawtext_flags(void)
Definition: toolbar.c:2455
static void test_create(void)
Definition: toolbar.c:2182
static void test_setrows(void)
Definition: toolbar.c:1927
static void test_add_string(void)
Definition: toolbar.c:764
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: toolbar.c:47
static void test_TB_GET_SET_EXTENDEDSTYLE(void)
Definition: toolbar.c:2261
static void test_add_bitmap(void)
Definition: toolbar.c:497
static void test_dispinfo(void)
Definition: toolbar.c:1875
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3138
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HINSTANCE hInstance
Definition: winuser.h:3142
static void init_functions(void)
Definition: toolbar.c:2516
static void test_save(void)
Definition: toolbar.c:2359
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static void test_createtoolbarex(void)
Definition: toolbar.c:1826
static void test_imagelist(void)
Definition: toolbar.c:2496
static void basic_test(void)
Definition: toolbar.c:374
HBRUSH WINAPI GetSysColorBrush(_In_ int)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define NUM_MSG_SEQUENCES
Definition: toolbar.c:38
HICON hIcon
Definition: winuser.h:3143

◆ string_width()

static int string_width ( const CHAR s)
static

Definition at line 982 of file toolbar.c.

982  {
983  SIZE sz;
984  HDC hdc;
985 
988  DeleteDC(hdc);
989 
990  return sz.cx;
991 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static HDC
Definition: imagelist.c:92
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
HDC hdc
Definition: main.c:9
GLdouble s
Definition: gl.h:2039
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by init_tbsize_results(), and test_sizes().

◆ system_font_height()

static int system_font_height ( void  )
static

Definition at line 971 of file toolbar.c.

971  {
972  HDC hDC;
973  TEXTMETRICA tm;
974 
977  DeleteDC(NULL);
978 
979  return tm.tmHeight;
980 }
static HDC
Definition: imagelist.c:92
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
Definition: time.h:76
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by init_tbsize_results(), and test_sizes().

◆ tbsize_addbutton()

static void tbsize_addbutton ( tbsize_result_t tbsr,
int  left,
int  top,
int  right,
int  bottom 
)
static

Definition at line 1013 of file toolbar.c.

1013  {
1014  SetRect(&tbsr->prcButtons[tbsr->nButtons], left, top, right, bottom);
1015  tbsr->nButtons++;
1016 }
RECT * prcButtons
Definition: toolbar.c:998
GLint GLint bottom
Definition: glext.h:7726
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

Referenced by init_tbsize_results().

◆ test_add_bitmap()

static void test_add_bitmap ( void  )
static

Definition at line 497 of file toolbar.c.

498 {
499  TBADDBITMAP stdsmall, std;
500  HWND hToolbar = NULL;
501  TBADDBITMAP bmp128;
502  TBADDBITMAP bmp80;
503  TBADDBITMAP addbmp;
505  INT ret, id;
506 
507  /* Test default bitmaps range */
508  for (id = IDB_STD_SMALL_COLOR; id < IDB_HIST_LARGE_COLOR; id++)
509  {
511  int cx, cy, count;
512 
513  rebuild_toolbar(&hToolbar);
514 
515  std.hInst = HINST_COMMCTRL;
516  std.nID = id;
517 
518  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&std);
519  ok(ret == 0, "Got %d\n", ret);
520 
521  himl = (HIMAGELIST)SendMessageA(hToolbar, TB_GETIMAGELIST, 0, 0);
522  ok(himl != NULL, "Got %p\n", himl);
523 
524  ret = pImageList_GetIconSize(himl, &cx, &cy);
525  ok(ret, "Got %d\n", ret);
526  ok(cx == cy, "Got %d x %d\n", cx, cy);
527 
528  count = pImageList_GetImageCount(himl);
529 
530  /* Image count */
531  switch (id)
532  {
533  case IDB_STD_SMALL_COLOR:
534  case IDB_STD_LARGE_COLOR:
535  case 2:
536  case 3:
537  ok(count == 15, "got count %d\n", count);
538  break;
541  case 6:
542  case 7:
543  ok(count == 12, "got count %d\n", count);
544  break;
547  ok(count == 5, "got count %d\n", count);
548  break;
549  default:
550  ok(0, "id %d, count %d\n", id, count);
551  }
552 
553  /* Image sizes */
554  switch (id)
555  {
556  case IDB_STD_SMALL_COLOR:
557  case 2:
559  case 6:
561  ok(cx == 16, "got size %d\n", cx);
562  break;
563  case IDB_STD_LARGE_COLOR:
564  case 3:
566  case 7:
568  ok(cx == 24, "got size %d\n", cx);
569  break;
570  default:
571  ok(0, "id %d, size %d\n", id, cx);
572  }
573  }
574 
575  /* empty 128x15 bitmap */
576  bmp128.hInst = GetModuleHandleA(NULL);
577  bmp128.nID = IDB_BITMAP_128x15;
578 
579  /* empty 80x15 bitmap */
580  bmp80.hInst = GetModuleHandleA(NULL);
581  bmp80.nID = IDB_BITMAP_80x15;
582 
583  /* standard bitmap - 240x15 pixels */
584  stdsmall.hInst = HINST_COMMCTRL;
585  stdsmall.nID = IDB_STD_SMALL_COLOR;
586 
587  rebuild_toolbar(&hToolbar);
588  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
589  CHECK_IMAGELIST(8, 16, 16);
590 
591  /* adding more bitmaps */
592  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 8, "TB_ADDBITMAP - unexpected return\n");
593  CHECK_IMAGELIST(13, 16, 16);
594  /* adding the same bitmap will simply return the index of the already loaded block */
595  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 8, (LPARAM)&bmp128);
596  ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
597  CHECK_IMAGELIST(13, 16, 16);
598  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
599  ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
600  CHECK_IMAGELIST(13, 16, 16);
601  /* even if we increase the wParam */
602  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 55, (LPARAM)&bmp80);
603  ok(ret == 8, "TB_ADDBITMAP - unexpected return %d\n", ret);
604  CHECK_IMAGELIST(13, 16, 16);
605 
606  /* when the wParam is smaller than the bitmaps count but non-zero, all the bitmaps will be added*/
607  rebuild_toolbar(&hToolbar);
608  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 3, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
609  CHECK_IMAGELIST(8, 16, 16);
610  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80);
611  ok(ret == 3, "TB_ADDBITMAP - unexpected return %d\n", ret);
612  /* the returned value is misleading - id 8 is the id of the first icon from bmp80 */
613  CHECK_IMAGELIST(13, 16, 16);
614 
615  /* the same for negative wParam */
616  rebuild_toolbar(&hToolbar);
617  ret = SendMessageA(hToolbar, TB_ADDBITMAP, -143, (LPARAM)&bmp128);
618  ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
619  CHECK_IMAGELIST(8, 16, 16);
620  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
621  ok(ret == -143, "TB_ADDBITMAP - unexpected return %d\n", ret);
622  CHECK_IMAGELIST(13, 16, 16);
623 
624  /* for zero only one bitmap will be added */
625  rebuild_toolbar(&hToolbar);
626  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&bmp80);
627  ok(ret == 0, "TB_ADDBITMAP - unexpected return %d\n", ret);
628  CHECK_IMAGELIST(1, 16, 16);
629 
630  /* if wParam is larger than the amount of icons, the list is grown */
631  rebuild_toolbar(&hToolbar);
632  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
633  CHECK_IMAGELIST(100, 16, 16);
634  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp128);
635  ok(ret == 100, "TB_ADDBITMAP - unexpected return %d\n", ret);
636  CHECK_IMAGELIST(200, 16, 16);
637 
638  /* adding built-in items - the wParam is ignored */
639  rebuild_toolbar(&hToolbar);
640  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp80) == 0, "TB_ADDBITMAP - unexpected return\n");
641  CHECK_IMAGELIST(5, 16, 16);
642  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&stdsmall) == 5, "TB_ADDBITMAP - unexpected return\n");
643  CHECK_IMAGELIST(20, 16, 16);
644  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp128) == 20, "TB_ADDBITMAP - unexpected return\n");
645  CHECK_IMAGELIST(28, 16, 16);
646 
647  /* when we increase the bitmap size, less icons will be created */
648  rebuild_toolbar(&hToolbar);
649  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(20, 20)) == TRUE, "TB_SETBITMAPSIZE failed\n");
650  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
651  CHECK_IMAGELIST(6, 20, 20);
652  ret = SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp80);
653  ok(ret == 1, "TB_ADDBITMAP - unexpected return %d\n", ret);
654  CHECK_IMAGELIST(10, 20, 20);
655  /* the icons can be resized - an UpdateWindow is needed as this probably happens during WM_PAINT */
656  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
657  UpdateWindow(hToolbar);
658  CHECK_IMAGELIST(26, 8, 8);
659  /* loading a standard bitmaps automatically resizes the icons */
660  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&stdsmall) == 2, "TB_ADDBITMAP - unexpected return\n");
661  UpdateWindow(hToolbar);
662  CHECK_IMAGELIST(28, 16, 16);
663 
664  /* two more SETBITMAPSIZE tests */
665  rebuild_toolbar(&hToolbar);
666  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
667  CHECK_IMAGELIST(100, 16, 16);
668  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 100, (LPARAM)&bmp80) == 100, "TB_ADDBITMAP - unexpected return\n");
669  CHECK_IMAGELIST(200, 16, 16);
670  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
671  UpdateWindow(hToolbar);
672  CHECK_IMAGELIST(200, 8, 8);
673  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
674  UpdateWindow(hToolbar);
675  CHECK_IMAGELIST(200, 30, 30);
676  rebuild_toolbar(&hToolbar);
677  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 5, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
678  CHECK_IMAGELIST(8, 16, 16);
679  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 3, (LPARAM)&bmp80) == 5, "TB_ADDBITMAP - unexpected return\n");
680  CHECK_IMAGELIST(13, 16, 16);
681  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(30, 30)) == TRUE, "TB_SETBITMAPSIZE failed\n");
682  UpdateWindow(hToolbar);
683  CHECK_IMAGELIST(8, 30, 30);
684  /* when the width or height is zero, set it to 1 */
685  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0, 0)) == TRUE, "TB_SETBITMAPSIZE failed\n");
686  UpdateWindow(hToolbar);
687  CHECK_IMAGELIST(208, 1, 1);
688  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0, 5)) == TRUE, "TB_SETBITMAPSIZE failed\n");
689  UpdateWindow(hToolbar);
690  CHECK_IMAGELIST(208, 1, 5);
691  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(5, 0)) == TRUE, "TB_SETBITMAPSIZE failed\n");
692  UpdateWindow(hToolbar);
693  CHECK_IMAGELIST(41, 5, 1);
694 
695  /* the control can add bitmaps to an existing image list */
696  rebuild_toolbar(&hToolbar);
697  himl = pImageList_LoadImageA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(IDB_BITMAP_80x15),
699  ok(himl != NULL, "failed to create imagelist\n");
700  ok(SendMessageA(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl) == 0, "TB_SETIMAGELIST failed\n");
701  CHECK_IMAGELIST(4, 20, 15);
702  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&bmp128) == 0, "TB_ADDBITMAP - unexpected return\n");
703  CHECK_IMAGELIST(10, 20, 15);
704  /* however TB_SETBITMAPSIZE/add std bitmap won't change the image size (the button size does change) */
705  ok(SendMessageA(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(8, 8)) == TRUE, "TB_SETBITMAPSIZE failed\n");
706  UpdateWindow(hToolbar);
707  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(15, 14), "%x");
708  CHECK_IMAGELIST(10, 20, 15);
709  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&stdsmall) == 1, "TB_SETBITMAPSIZE failed\n");
710  UpdateWindow(hToolbar);
711  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(23, 22), "%x");
712  CHECK_IMAGELIST(22, 20, 15);
713 
714  /* check standard bitmaps */
715  addbmp.hInst = HINST_COMMCTRL;
716  addbmp.nID = IDB_STD_SMALL_COLOR;
717  rebuild_toolbar(&hToolbar);
718  pImageList_Destroy(himl);
719 
720  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
721  CHECK_IMAGELIST(15, 16, 16);
722  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(23, 22), "%x");
723  addbmp.nID = IDB_STD_LARGE_COLOR;
724  rebuild_toolbar(&hToolbar);
725  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
726  CHECK_IMAGELIST(15, 24, 24);
727  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), MAKELONG(31, 30), "%x");
728 
729  addbmp.nID = IDB_VIEW_SMALL_COLOR;
730  rebuild_toolbar(&hToolbar);
731  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
732  CHECK_IMAGELIST(12, 16, 16);
733  addbmp.nID = IDB_VIEW_LARGE_COLOR;
734  rebuild_toolbar(&hToolbar);
735  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
736  CHECK_IMAGELIST(12, 24, 24);
737 
738  addbmp.nID = IDB_HIST_SMALL_COLOR;
739  rebuild_toolbar(&hToolbar);
740  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
741  CHECK_IMAGELIST(5, 16, 16);
742  addbmp.nID = IDB_HIST_LARGE_COLOR;
743  rebuild_toolbar(&hToolbar);
744  ok(SendMessageA(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&addbmp) == 0, "TB_ADDBITMAP - unexpected return\n");
745  CHECK_IMAGELIST(5, 24, 24);
746 
747 
748  DestroyWindow(hToolbar);
749 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI UpdateWindow(_In_ HWND)
#define IDB_BITMAP_80x15
Definition: resources.h:25
#define IDB_STD_SMALL_COLOR
Definition: commctrl.h:1060
#define compare(val, exp, format)
Definition: toolbar.c:121
HINSTANCE hInst
Definition: commctrl.h:1055
#define IDB_HIST_LARGE_COLOR
Definition: commctrl.h:1065
#define TB_GETIMAGELIST
Definition: commctrl.h:1147
Definition: features.h:417
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:58
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define MAKELONG(a, b)
Definition: typedefs.h:249
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CLR_NONE
Definition: commctrl.h:315
const char * LPCSTR
Definition: xmlstorage.h:183
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
#define TB_SETIMAGELIST
Definition: commctrl.h:1146
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1156
#define IDB_VIEW_SMALL_COLOR
Definition: commctrl.h:1062
#define IDB_VIEW_LARGE_COLOR
Definition: commctrl.h:1063
#define TB_ADDBITMAP
Definition: commctrl.h:1052
int ret
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1132
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define IDB_STD_LARGE_COLOR
Definition: commctrl.h:1061
#define ok(value,...)
Definition: atltest.h:57
#define IMAGE_BITMAP
Definition: winuser.h:211
#define HINST_COMMCTRL
Definition: commctrl.h:1059
#define CHECK_IMAGELIST(count, dx, dy)
Definition: toolbar.c:486
_Out_opt_ int * cx
Definition: commctrl.h:581
GLenum GLuint id
Definition: glext.h:5579
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define IDB_HIST_SMALL_COLOR
Definition: commctrl.h:1064
#define IDB_BITMAP_128x15
Definition: resources.h:24
static int int *static HIMAGELIST(WINAPI *pImageList_LoadImageA)(HINSTANCE
UINT_PTR nID
Definition: commctrl.h:1056

Referenced by START_TEST().

◆ test_add_string()

static void test_add_string ( void  )
static

Definition at line 764 of file toolbar.c.

765 {
766  LPCSTR test1 = "a\0b\0";
767  LPCSTR test2 = "|a|b||\0";
768  LPCSTR ret1[] = {"a", "b"};
769  LPCSTR ret2[] = {"a", "b", "|a|b||"};
770  LPCSTR ret3[] = {"a", "b", "|a|b||", "p", "q"};
771  LPCSTR ret4[] = {"a", "b", "|a|b||", "p", "q", "p"};
772  LPCSTR ret5[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q"};
773  LPCSTR ret6[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q", "p", "", "q"};
774  LPCSTR ret7[] = {"a", "b", "|a|b||", "p", "q", "p", "p", "q", "p", "", "q", "br", "c", "d"};
775  HWND hToolbar = NULL;
777  int ret;
778  CHAR buf[260];
779 
780  rebuild_toolbar(&hToolbar);
781  ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)test1);
782  ok(ret == 0, "TB_ADDSTRINGA - unexpected return %d\n", ret);
783  ret = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(260, 1), (LPARAM)buf);
784  if (ret == 0)
785  {
786  win_skip("TB_GETSTRINGA needs 5.80\n");
787  return;
788  }
789  CHECK_STRING_TABLE(2, ret1);
790  ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)test2);
791  ok(ret == 2, "TB_ADDSTRINGA - unexpected return %d\n", ret);
792  CHECK_STRING_TABLE(3, ret2);
793 
794  /* null instance handle */
795  ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, IDS_TBADD1);
796  ok(ret == -1, "TB_ADDSTRINGA - unexpected return %d\n", ret);
797 
798  /* invalid instance handle */
799  ret = SendMessageA(hToolbar, TB_ADDSTRINGA, 0xdeadbeef, IDS_TBADD1);
800  ok(ret == -1, "TB_ADDSTRINGA - unexpected return %d\n", ret);
801 
803  ok(ret == 3, "TB_ADDSTRINGA - unexpected return %d\n", ret);
804  CHECK_STRING_TABLE(3, ret2);
806  ok(ret == 3, "TB_ADDSTRINGA - unexpected return %d\n", ret);
807  CHECK_STRING_TABLE(5, ret3);
809  ok(ret == 5, "TB_ADDSTRINGA - unexpected return %d\n", ret);
810  CHECK_STRING_TABLE(6, ret4);
812  ok(ret == 6, "TB_ADDSTRINGA - unexpected return %d\n", ret);
813  CHECK_STRING_TABLE(8, ret5);
815  ok(ret == 8, "TB_ADDSTRINGA - unexpected return %d\n", ret);
816  CHECK_STRING_TABLE(11, ret6);
818  ok(ret == 11, "TB_ADDSTRINGA - unexpected return %d\n", ret);
819  CHECK_STRING_TABLE(14, ret7);
820 
821  ZeroMemory(&button, sizeof(button));
822  button.iString = (UINT_PTR)"Test";
823  SendMessageA(hToolbar, TB_INSERTBUTTONA, 0, (LPARAM)&button);
824  CHECK_STRING_TABLE(14, ret7);
825  SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&button);
826  CHECK_STRING_TABLE(14, ret7);
827 
828  DestroyWindow(hToolbar);
829 }
#define TB_ADDSTRINGA
Definition: commctrl.h:1127
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
#define TB_GETSTRINGA
Definition: commctrl.h:1272
DWORD button
Definition: button.c:166
#define ZeroMemory
Definition: winbase.h:1648
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI DestroyWindow(_In_ HWND)
#define IDS_TBADD7
Definition: resources.h:32
static UINT_PTR
Definition: toolbar.c:40
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
#define IDS_TBADD3
Definition: resources.h:29
void test1(void)
Definition: hivetest.c:366
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define IDS_TBADD5
Definition: resources.h:31
void test2(void)
Definition: regtest.c:173
#define TB_INSERTBUTTONA
Definition: commctrl.h:1103
#define ok(value,...)
Definition: atltest.h:57
#define TB_ADDBUTTONSA
Definition: commctrl.h:1102
#define IDS_TBADD1
Definition: resources.h:27
#define IDS_TBADD2
Definition: resources.h:28
#define CHECK_STRING_TABLE(count, tab)
Definition: toolbar.c:751
#define win_skip
Definition: test.h:149
#define IDS_TBADD4
Definition: resources.h:30

Referenced by START_TEST().

◆ test_create()

static void test_create ( void  )
static

Definition at line 2182 of file toolbar.c.

2183 {
2184  HWND hwnd, tooltip;
2185  DWORD style;
2186 
2188 
2189  SET_EXPECT(g_hook_create);
2190  SET_EXPECT(g_hook_WM_NCCREATE);
2191  SET_EXPECT(g_hook_WM_CREATE);
2192 
2195 
2196  CHECK_CALLED(g_hook_create);
2197  CHECK_CALLED(g_hook_WM_NCCREATE);
2198  CHECK_CALLED(g_hook_WM_CREATE);
2199 
2201  ok((style & TBSTYLE_TOOLTIPS) == TBSTYLE_TOOLTIPS, "got 0x%08x\n", style);
2202 
2203  tooltip = (HWND)SendMessageA(hwnd, TB_GETTOOLTIPS, 0, 0);
2204  ok(tooltip != NULL, "got %p\n", tooltip);
2205  ok(GetParent(tooltip) == hMainWnd, "got %p, %p\n", hMainWnd, hwnd);
2206 
2209 
2210  /* TBSTYLE_TRANSPARENT */
2213  0, 0, 0, 0, hMainWnd, (HMENU)5, GetModuleHandleA(NULL), NULL);
2214 
2216  ok((style & TBSTYLE_TRANSPARENT) == TBSTYLE_TRANSPARENT, "got 0x%08x\n", style);
2217 
2218  style = SendMessageA(hwnd, TB_GETSTYLE, 0, 0);
2219  ok((style & TBSTYLE_TRANSPARENT) == TBSTYLE_TRANSPARENT, "got 0x%08x\n", style);
2220 
2222 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:992
static HWND hMainWnd
Definition: toolbar.c:49
static HHOOK g_tbhook
Definition: toolbar.c:2092
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SET_EXPECT(func)
Definition: toolbar.c:112
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
static LRESULT CALLBACK cbt_hook_proc(int code, WPARAM wParam, LPARAM lParam)
Definition: toolbar.c:2160
#define CHECK_CALLED(func)
Definition: toolbar.c:106
smooth NULL
Definition: ftsmooth.c:416
HHOOK WINAPI SetWindowsHookA(_In_ int, _In_ HOOKPROC)
#define WH_CBT
Definition: winuser.h:35
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
static HWND(WINAPI *pCreateToolbarEx)(HWND
#define TB_GETTOOLTIPS
Definition: commctrl.h:1134
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
#define ok(value,...)
Definition: atltest.h:57
#define TBSTYLE_GROUP
Definition: commctrl.h:980
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)
BOOL WINAPI UnhookWindowsHook(_In_ int, _In_ HOOKPROC)
#define TB_GETSTYLE
Definition: commctrl.h:1155
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define TBSTYLE_FLAT
Definition: commctrl.h:988

Referenced by START_TEST().

◆ test_createtoolbarex()

static void test_createtoolbarex ( void  )
static

Definition at line 1826 of file toolbar.c.

1827 {
1828  HWND hToolbar;
1829  TBBUTTON btns[3];
1830  ZeroMemory(&btns, sizeof(btns));
1831 
1832  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1833  3, 20, 20, 16, 16, sizeof(TBBUTTON));
1834  CHECK_IMAGELIST(16, 20, 20);
1835  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x1a001b, "%x");
1836  DestroyWindow(hToolbar);
1837 
1838  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1839  3, 4, 4, 16, 16, sizeof(TBBUTTON));
1840  CHECK_IMAGELIST(32, 4, 4);
1841  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xa000b, "%x");
1842  DestroyWindow(hToolbar);
1843 
1844  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1845  3, 0, 8, 12, 12, sizeof(TBBUTTON));
1846  CHECK_IMAGELIST(16, 12, 12);
1847  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x120013, "%x");
1848  DestroyWindow(hToolbar);
1849 
1850  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1851  3, -1, 8, 12, 12, sizeof(TBBUTTON));
1852  CHECK_IMAGELIST(16, 12, 8);
1853  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0013, "%x");
1854  DestroyWindow(hToolbar);
1855 
1856  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1857  3, -1, 8, -1, 12, sizeof(TBBUTTON));
1858  CHECK_IMAGELIST(16, 16, 8);
1859  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0xe0017, "%x");
1860  DestroyWindow(hToolbar);
1861 
1862  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1863  3, 0, 0, 12, -1, sizeof(TBBUTTON));
1864  CHECK_IMAGELIST(16, 12, 16);
1865  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160013, "%x");
1866  DestroyWindow(hToolbar);
1867 
1868  hToolbar = pCreateToolbarEx(hMainWnd, WS_VISIBLE, 1, 16, GetModuleHandleA(NULL), IDB_BITMAP_128x15, btns,
1869  3, 0, 0, 0, 12, sizeof(TBBUTTON));
1870  CHECK_IMAGELIST(16, 16, 16);
1871  compare((int)SendMessageA(hToolbar, TB_GETBUTTONSIZE, 0, 0), 0x160017, "%x");
1872  DestroyWindow(hToolbar);
1873 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ZeroMemory
Definition: winbase.h:1648
#define compare(val, exp, format)
Definition: toolbar.c:121
static HWND hMainWnd
Definition: toolbar.c:49
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1156
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define CHECK_IMAGELIST(count, dx, dy)
Definition: toolbar.c:486
#define WS_VISIBLE
Definition: pedump.c:620
#define IDB_BITMAP_128x15
Definition: resources.h:24

Referenced by START_TEST().

◆ test_dispinfo()

static void test_dispinfo ( void  )
static

Definition at line 1875 of file toolbar.c.

1876 {
1877  HWND hToolbar = NULL;
1878  const TBBUTTON buttons_disp[] = {
1879  {-1, 20, TBSTATE_ENABLED, 0, {0, }, 0, -1},
1880  {0, 21, TBSTATE_ENABLED, 0, {0, }, 0, -1},
1881  };
1882  BOOL ret;
1883 
1884  rebuild_toolbar(&hToolbar);
1886  SendMessageA(hToolbar, TB_ADDBUTTONSA, 2, (LPARAM)buttons_disp);
1888  /* Some TBN_GETDISPINFO tests will be done in MyWnd_Notify function.
1889  * We will receive TBN_GETDISPINFOW even if the control is ANSI */
1890  compare((BOOL)SendMessageA(hToolbar, CCM_GETUNICODEFORMAT, 0, 0), 0, "%d");
1891  ShowWindow(hToolbar, SW_SHOW);
1892  UpdateWindow(hToolbar);
1893 
1894  ret = (BOOL)SendMessageA(hToolbar, CCM_SETUNICODEFORMAT, TRUE, 0);
1895  compare(ret, FALSE, "%d");
1896  compare(SendMessageA(hToolbar, CCM_GETUNICODEFORMAT, 0, 0), 1L, "%ld");
1897  InvalidateRect(hToolbar, NULL, FALSE);
1898  UpdateWindow(hToolbar);
1899 
1900  ret = (BOOL)SendMessageA(hToolbar, CCM_SETUNICODEFORMAT, FALSE, 0);
1901  compare(ret, TRUE, "%d");
1902  compare(SendMessageA(hToolbar, CCM_GETUNICODEFORMAT, 0, 0), 0L, "%ld");
1903  InvalidateRect(hToolbar, NULL, FALSE);
1904  UpdateWindow(hToolbar);
1905 
1906  DestroyWindow(hToolbar);
1908 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI UpdateWindow(_In_ HWND)
#define compare(val, exp, format)
Definition: toolbar.c:121
#define CCM_GETUNICODEFORMAT
Definition: commctrl.h:98
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TBNF_IMAGE
Definition: commctrl.h:1392
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static BOOL(WINAPI *pImageList_Destroy)(HIMAGELIST)
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define TB_LOADIMAGES
Definition: commctrl.h:1148
#define CCM_SETUNICODEFORMAT
Definition: commctrl.h:97
#define TB_ADDBUTTONSA
Definition: commctrl.h:1102
#define HINST_COMMCTRL
Definition: commctrl.h:1059
#define TBSTATE_ENABLED
Definition: commctrl.h:970
static DWORD g_dwExpectedDispInfoMask
Definition: toolbar.c:54
#define IDB_HIST_SMALL_COLOR
Definition: commctrl.h:1064

Referenced by START_TEST().

◆ test_drawtext_flags()

static void test_drawtext_flags ( void  )
static

Definition at line 2455 of file toolbar.c.

2456 {
2457  HWND hwnd = NULL;
2458  UINT flags;
2459 
2461 
2463 todo_wine
2464  ok(flags == 0, "Unexpected draw text flags %#x\n", flags);
2465 
2466  /* zero mask, flags are retained */
2468 todo_wine
2469  ok(flags == 0, "Unexpected draw text flags %#x\n", flags);
2470  ok(!(flags & DT_BOTTOM), "Unexpected DT_BOTTOM style\n");
2471 
2473 todo_wine
2474  ok(flags == 0, "Unexpected draw text flags %#x\n", flags);
2475  ok(!(flags & DT_BOTTOM), "Unexpected DT_BOTTOM style\n");
2476 
2477  /* set/remove */
2479 todo_wine
2480  ok(flags == 0, "Unexpected draw text flags %#x\n", flags);
2481  ok(!(flags & DT_BOTTOM), "Unexpected DT_BOTTOM style\n");
2482 
2484 todo_wine
2485  ok(flags == DT_BOTTOM, "Unexpected draw text flags %#x\n", flags);
2486  ok(flags & DT_BOTTOM, "Expected DT_BOTTOM style, %#x\n", flags);
2487 
2489 todo_wine
2490  ok(flags == 0, "Unexpected draw text flags %#x\n", flags);
2491  ok(!(flags & DT_BOTTOM), "Unexpected DT_BOTTOM style\n");
2492 
2494 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
smooth NULL
Definition: ftsmooth.c:416
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
GLbitfield flags
Definition: glext.h:7161
#define todo_wine
Definition: test.h:162
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define TB_SETDRAWTEXTFLAGS
Definition: commctrl.h:1269
#define DT_BOTTOM
Definition: winuser.h:525

Referenced by START_TEST().

◆ test_get_set_style()

static void test_get_set_style ( void  )
static

Definition at line 2044 of file toolbar.c.

2045 {
2046  TBBUTTON buttons[9];
2047  DWORD style, style2, ret;
2048  HWND hToolbar;
2049  int i;
2050 
2051  for (i=0; i<9; i++)
2054  MakeButton(buttons+6, 1006, TBSTYLE_SEP, 0);
2055 
2056  hToolbar = pCreateToolbarEx(hMainWnd,
2059  100,
2060  0, NULL, 0,
2062  0, 0, 20, 16, sizeof(TBBUTTON));
2063  ok(hToolbar != NULL, "Toolbar creation\n");
2064  SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"test\000");
2065 
2066  style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
2067  style2 = GetWindowLongA(hToolbar, GWL_STYLE);
2068 todo_wine
2069  ok(style == style2, "got 0x%08x, expected 0x%08x\n", style, style2);
2070 
2071  /* try to alter common window bits */
2072  style2 |= WS_BORDER;
2073  ret = SendMessageA(hToolbar, TB_SETSTYLE, 0, style2);
2074  ok(ret == 0, "got %d\n", ret);
2075  style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
2076  style2 = GetWindowLongA(hToolbar, GWL_STYLE);
2077  ok((style != style2) && (style == (style2 | WS_BORDER)),
2078  "got 0x%08x, expected 0x%08x\n", style, style2);
2079  ok(style & WS_BORDER, "got 0x%08x\n", style);
2080 
2081  /* now styles are the same, alter window style */
2082  ret = SendMessageA(hToolbar, TB_SETSTYLE, 0, style2);
2083  ok(ret == 0, "got %d\n", ret);
2084  style2 |= WS_BORDER;
2085  SetWindowLongA(hToolbar, GWL_STYLE, style2);
2086  style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
2087  ok(style == style2, "got 0x%08x, expected 0x%08x\n", style, style2);
2088 
2089  DestroyWindow(hToolbar);
2090 }
#define TB_ADDSTRINGA
Definition: commctrl.h:1127
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_SEP
Definition: commctrl.h:978
#define TB_SETSTYLE
Definition: commctrl.h:1154
static HWND hMainWnd
Definition: toolbar.c:49
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI DestroyWindow(_In_ HWND)
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 TBSTYLE_CHECKGROUP
Definition: commctrl.h:981
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_TOP
Definition: commctrl.h:2238
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define todo_wine
Definition: test.h:162
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
HWND buttons[5]
Definition: sndrec32.cpp:40
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define TBSTYLE_GROUP
Definition: commctrl.h:980
static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString)
Definition: toolbar.c:128
#define TB_GETSTYLE
Definition: commctrl.h:1155
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define TBSTYLE_LIST
Definition: commctrl.h:989

Referenced by START_TEST().

◆ test_getbuttoninfo()

static void test_getbuttoninfo ( void  )
static

Definition at line 1794 of file toolbar.c.

1795 {
1796  HWND hToolbar = NULL;
1797  TBBUTTONINFOW tbiW;
1798  TBBUTTONINFOA tbi;
1799  int i;
1800 
1801  rebuild_toolbar_with_buttons(&hToolbar);
1802  for (i = 0; i < 128; i++)
1803  {
1804  int ret;
1805 
1806  tbi.cbSize = i;
1807  tbi.dwMask = TBIF_COMMAND;
1808  ret = (int)SendMessageA(hToolbar, TB_GETBUTTONINFOA, 1, (LPARAM)&tbi);
1809  if (i == sizeof(TBBUTTONINFOA)) {
1810  compare(ret, 0, "%d");
1811  } else {
1812  compare(ret, -1, "%d");
1813  }
1814  }
1815 
1816  /* TBIF_TEXT with NULL pszText */
1817  memset(&tbiW, 0, sizeof(tbiW));
1818  tbiW.cbSize = sizeof(tbiW);
1820  i = SendMessageA(hToolbar, TB_GETBUTTONINFOW, 1, (LPARAM)&tbiW);
1821  ok(i == 1, "Got index %d\n", i);
1822 
1823  DestroyWindow(hToolbar);
1824 }
#define TBIF_COMMAND
Definition: commctrl.h:1220
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBIF_BYINDEX
Definition: commctrl.h:1222
#define TBIF_STYLE
Definition: commctrl.h:1218
DWORD dwMask
Definition: commctrl.h:1239
#define compare(val, exp, format)
Definition: toolbar.c:121
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD dwMask
Definition: commctrl.h:1226
static int int *static int
Definition: toolbar.c:45
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
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
int ret
static void rebuild_toolbar_with_buttons(HWND *hToolbar)
Definition: toolbar.c:448
#define TB_GETBUTTONINFOA
Definition: commctrl.h:1255
#define TB_GETBUTTONINFOW
Definition: commctrl.h:1253
#define ok(value,...)
Definition: atltest.h:57
#define TBIF_TEXT
Definition: commctrl.h:1216
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_getstring()

static void test_getstring ( void  )
static

Definition at line 1966 of file toolbar.c.

1967 {
1968  HWND hToolbar = NULL;
1969  char str[10];
1970  WCHAR strW[10];
1971  static const char answer[] = "STR";
1972  static const WCHAR answerW[] = { 'S','T','R',0 };
1973  INT r;
1974 
1976  ok(hToolbar != NULL, "Toolbar creation problem\n");
1977 
1978  r = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(0, 0), 0);
1979  if (r == 0)
1980  {
1981  win_skip("TB_GETSTRINGA and TB_GETSTRINGW need 5.80\n");
1982  DestroyWindow(hToolbar);
1983  return;
1984  }
1985  expect(-1, r);
1986  r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0);
1987  expect(-1, r);
1988  r = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)answer);
1989  expect(0, r);
1990  r = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(0, 0), 0);
1991  expect(lstrlenA(answer), r);
1992  r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0);
1993  expect(lstrlenA(answer), r);
1994  r = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(sizeof(str), 0), (LPARAM)str);
1995  expect(lstrlenA(answer), r);
1996  expect(0, lstrcmpA(answer, str));
1997  r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(sizeof(strW), 0), (LPARAM)strW);
1998  expect(lstrlenA(answer), r);
1999  expect(0, lstrcmpW(answerW, strW));
2000 
2001  DestroyWindow(hToolbar);
2002 }
#define TB_ADDSTRINGA
Definition: commctrl.h:1127
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define TB_GETSTRINGA
Definition: commctrl.h:1272
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
static HWND hMainWnd
Definition: toolbar.c:49
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:58
WCHAR strW[12]
Definition: clipboard.c:2029
#define TB_GETSTRINGW
Definition: commctrl.h:1271
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define expect(EXPECTED, GOT)
Definition: toolbar.c:115
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define win_skip
Definition: test.h:149

Referenced by START_TEST().

◆ test_hotitem()

static void test_hotitem ( void  )
static

Definition at line 842 of file toolbar.c.

843 {
844  HWND hToolbar = NULL;
845  TBBUTTONINFOA tbinfo;
846  LRESULT ret;
847 
849 
850  rebuild_toolbar_with_buttons(&hToolbar);
851  /* set TBSTYLE_FLAT. comctl5 allows hot items only for such toolbars.
852  * comctl6 doesn't have this requirement even when theme == NULL */
854  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
855  ok(ret == -1, "Hot item: %ld, expected -1\n", ret);
856  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 1, 0);
857  ok(ret == -1, "TB_SETHOTITEM returned %ld, expected -1\n", ret);
858  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
859  ok(ret == 1, "Hot item: %ld, expected 1\n", ret);
860  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 2, 0);
861  ok(ret == 1, "TB_SETHOTITEM returned %ld, expected 1\n", ret);
862 
863  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 0xbeef, 0);
864  ok(ret == 2, "TB_SETHOTITEM returned %ld, expected 2\n", ret);
865  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
866  ok(ret == 2, "Hot item: %lx, expected 2\n", ret);
867  ret = SendMessageA(hToolbar, TB_SETHOTITEM, -0xbeef, 0);
868  ok(ret == 2, "TB_SETHOTITEM returned %ld, expected 2\n", ret);
869  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
870  ok(ret == -1, "Hot item: %lx, expected -1\n", ret);
871 
872  expect_hot_notify(0, 7);
873  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 3, 0);
874  ok(ret == -1, "TB_SETHOTITEM returned %ld, expected -1\n", ret);
876  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
877  ok(ret == 3, "Hot item: %lx, expected 3\n", ret);
879  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 2, 0);
880  ok(ret == 3, "TB_SETHOTITEM returned %ld, expected 3\n", ret);
881  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
882  ok(ret == 3, "Hot item: %lx, expected 3\n", ret);
884 
886  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 0xbeaf, 0);
887  ok(ret == 3, "TB_SETHOTITEM returned %ld, expected 3\n", ret);
888  ok(g_fReceivedHotItemChange == FALSE, "TBN_HOTITEMCHANGE received for invalid parameter\n");
889 
891  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 3, 0);
892  ok(ret == 3, "TB_SETHOTITEM returned %ld, expected 3\n", ret);
893  ok(g_fReceivedHotItemChange == FALSE, "TBN_HOTITEMCHANGE received after a duplication\n");
894 
895  expect_hot_notify(7, 0);
896  ret = SendMessageA(hToolbar, TB_SETHOTITEM, -0xbeaf, 0);
897  ok(ret == 3, "TB_SETHOTITEM returned %ld, expected 3\n", ret);
899  SendMessageA(hToolbar, TB_SETHOTITEM, 3, 0);
900 
901  /* setting disabled buttons will generate a notify with the button id but no button will be hot */
902  expect_hot_notify(7, 9);
903  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 4, 0);
904  ok(ret == 3, "TB_SETHOTITEM returned %ld, expected 3\n", ret);
906  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
907  ok(ret == -1, "Hot item: %lx, expected -1\n", ret);
908  /* enabling the button won't change that */
909  SendMessageA(hToolbar, TB_ENABLEBUTTON, 9, TRUE);
910  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
911  ok(ret == -1, "TB_GETHOTITEM returned %ld, expected -1\n", ret);
912 
913  /* disabling a hot button works */
914  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 3, 0);
915  ok(ret == -1, "TB_SETHOTITEM returned %ld, expected -1\n", ret);
917  SendMessageA(hToolbar, TB_ENABLEBUTTON, 7, FALSE);
918  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
919  ok(ret == 3, "TB_GETHOTITEM returned %ld, expected 3\n", ret);
920  ok(g_fReceivedHotItemChange == FALSE, "Unexpected TBN_HOTITEMCHANGE\n");
921 
922  SendMessageA(hToolbar, TB_SETHOTITEM, 1, 0);
923  tbinfo.cbSize = sizeof(TBBUTTONINFOA);
924  tbinfo.dwMask = TBIF_STATE;
925  tbinfo.fsState = 0; /* disabled */
927  ok(SendMessageA(hToolbar, TB_SETBUTTONINFOA, 1, (LPARAM)&tbinfo) == TRUE, "TB_SETBUTTONINFOA failed\n");
928  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
929  ok(ret == 1, "TB_GETHOTITEM returned %ld, expected 1\n", ret);
930  ok(g_fReceivedHotItemChange == FALSE, "Unexpected TBN_HOTITEMCHANGE\n");
931 
932  /* deleting a button unsets the hot item */
933  ret = SendMessageA(hToolbar, TB_SETHOTITEM, 0, 0);
934  ok(ret == 1, "TB_SETHOTITEM returned %ld, expected 1\n", ret);
936  ret = SendMessageA(hToolbar, TB_DELETEBUTTON, 1, 0);
937  ok(ret == TRUE, "TB_DELETEBUTTON returned %ld, expected TRUE\n", ret);
938  ret = SendMessageA(hToolbar, TB_GETHOTITEM, 0, 0);
939  ok(ret == -1, "TB_GETHOTITEM returned %ld, expected -1\n", ret);
940  ok(g_fReceivedHotItemChange == FALSE, "Unexpected TBN_HOTITEMCHANGE\n");
941 
942  DestroyWindow(hToolbar);
943 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL g_fBlockHotItemChange
Definition: toolbar.c:50
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD dwMask
Definition: commctrl.h:1226
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define FALSE
Definition: types.h:117
#define TB_ENABLEBUTTON
Definition: commctrl.h:1038
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TB_GETHOTITEM
Definition: commctrl.h:1166
#define TBIF_STATE
Definition: commctrl.h:1217
int ret
static void rebuild_toolbar_with_buttons(HWND *hToolbar)
Definition: toolbar.c:448
#define GWL_STYLE
Definition: winuser.h:846
#define check_hot_notify()
Definition: toolbar.c:838
#define TB_SETBUTTONINFOA
Definition: commctrl.h:1256
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
static BOOL g_fReceivedHotItemChange
Definition: toolbar.c:51
LONG_PTR LRESULT
Definition: windef.h:209
#define TB_SETHOTITEM
Definition: commctrl.h:1167
#define TBSTYLE_FLAT
Definition: commctrl.h:988
static void expect_hot_notify(int idold, int idnew)
Definition: toolbar.c:831
#define TB_DELETEBUTTON
Definition: commctrl.h:1104

Referenced by START_TEST().

◆ test_imagelist()

static void test_imagelist ( void  )
static

Definition at line 2496 of file toolbar.c.

2497 {
2498  HIMAGELIST imagelist;
2499  HWND hwnd = NULL;
2500  int ret;
2501 
2503 
2504  imagelist = (HIMAGELIST)SendMessageA(hwnd, TB_GETIMAGELIST, 0, 0);
2505  ok(imagelist == NULL, "got %p\n", imagelist);
2506 
2507  ret = SendMessageA(hwnd, TB_SETBITMAPSIZE, 0, MAKELONG(16, 16));
2508  ok(ret, "got %d\n", ret);
2509 
2510  imagelist = (HIMAGELIST)SendMessageA(hwnd, TB_GETIMAGELIST, 0, 0);
2511  ok(imagelist == NULL, "got %p\n", imagelist);
2512 
2514 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TB_GETIMAGELIST
Definition: commctrl.h:1147
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MAKELONG(a, b)
Definition: typedefs.h:249
smooth NULL
Definition: ftsmooth.c:416
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
int ret
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1132
#define ok(value,...)
Definition: atltest.h:57
static int int *static HIMAGELIST(WINAPI *pImageList_LoadImageA)(HINSTANCE

Referenced by START_TEST().

◆ test_noresize()

static void test_noresize ( void  )
static

Definition at line 2304 of file toolbar.c.

2305 {
2306  HWND wnd;
2307  int i;
2308  TBBUTTON button = {0, 10, TBSTATE_ENABLED, 0, {0, }, 0, -1};
2309 
2312  SendMessageA(wnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
2313 
2314  for (i=0; i<30; i++)
2315  {
2316  button.idCommand = 10 + i;
2318  }
2319 
2321 
2322  /* autosize clears the wrap on button 0 */
2323  SendMessageA(wnd, TB_AUTOSIZE, 0, 0);
2324  for (i=0; i<30; i++)
2325  {
2327  if (i % 4 == 3)
2328  ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState);
2329  else
2330  ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState);
2331  }
2332 
2333  /* changing the parent doesn't do anything */
2334  MoveWindow(hMainWnd, 0,0, 400, 200, FALSE);
2335  for (i=0; i<30; i++)
2336  {
2338  if (i % 4 == 3)
2339  ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState);
2340  else
2341  ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState);
2342  }
2343 
2344  /* again nothing here */
2345  SendMessageA(wnd, TB_AUTOSIZE, 0, 0);
2346  for (i=0; i<30; i++)
2347  {
2349  if (i % 4 == 3)
2350  ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState);
2351  else
2352  ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState);
2353  }
2354 
2355  DestroyWindow(wnd);
2356 
2357 }
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1130
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TB_SETSTATE
Definition: commctrl.h:1050
#define TB_GETBUTTON
Definition: commctrl.h:1105
DWORD button
Definition: button.c:166
static HWND hMainWnd
Definition: toolbar.c:49
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
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 FALSE
Definition: types.h:117
#define TB_AUTOSIZE
Definition: commctrl.h:1133
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_NORESIZE
Definition: commctrl.h:2241
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:940
#define ok(value,...)
Definition: atltest.h:57
#define TB_ADDBUTTONSA
Definition: commctrl.h:1102
#define TBSTATE_ENABLED
Definition: commctrl.h:970
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 TBSTYLE_WRAPABLE
Definition: commctrl.h:986
#define TBSTATE_WRAP
Definition: commctrl.h:973
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by START_TEST().

◆ test_recalc()

static void test_recalc ( void  )
static

Definition at line 1681 of file toolbar.c.

1682 {
1683  HWND hToolbar = NULL;
1684  TBBUTTONINFOA bi;
1685  CHAR test[] = "Test";
1686  const int EX_STYLES_COUNT = 5;
1687  int i;
1688  BOOL recalc;
1689  DWORD style;
1690 
1691  /* Like TB_ADDBUTTONSA tested in test_sized, inserting a button without text
1692  * results in a relayout, while adding one with text forces a recalc */
1693  prepare_recalc_test(&hToolbar);
1694  SendMessageA(hToolbar, TB_INSERTBUTTONA, 1, (LPARAM)&buttons3[0]);
1695  recalc = did_recalc(hToolbar);
1696  ok(!recalc, "Unexpected recalc - adding button without text\n");
1697 
1698  prepare_recalc_test(&hToolbar);
1699  SendMessageA(hToolbar, TB_INSERTBUTTONA, 1, (LPARAM)&buttons3[3]);
1700  recalc = did_recalc(hToolbar);
1701  ok(recalc, "Expected a recalc - adding button with text\n");
1702 
1703  /* TB_SETBUTTONINFOA, even when adding a text, results only in a relayout */
1704  prepare_recalc_test(&hToolbar);
1705  bi.cbSize = sizeof(bi);
1706  bi.dwMask = TBIF_TEXT;
1707  bi.pszText = test;
1708  SendMessageA(hToolbar, TB_SETBUTTONINFOA, 1, (LPARAM)&bi);
1709  recalc = did_recalc(hToolbar);
1710  ok(!recalc, "Unexpected recalc - setting a button text\n");
1711 
1712  /* most extended styled doesn't force a recalc (testing all the bits gives
1713  * the same results, but prints some ERRs while testing) */
1714  for (i = 0; i < EX_STYLES_COUNT; i++)
1715  {
1716  if (i == 1 || i == 3) /* an undoc style and TBSTYLE_EX_MIXEDBUTTONS */
1717  continue;
1718  prepare_recalc_test(&hToolbar);
1719  expect(0, (int)SendMessageA(hToolbar, TB_GETEXTENDEDSTYLE, 0, 0));
1720  SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, (1 << i));
1721  recalc = did_recalc(hToolbar);
1722  ok(!recalc, "Unexpected recalc - setting bit %d\n", i);
1723  SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, 0);
1724  recalc = did_recalc(hToolbar);
1725  ok(!recalc, "Unexpected recalc - clearing bit %d\n", i);
1726  expect(0, (int)SendMessageA(hToolbar, TB_GETEXTENDEDSTYLE, 0, 0));
1727  }
1728 
1729  /* TBSTYLE_EX_MIXEDBUTTONS does a recalc on change */
1730  prepare_recalc_test(&hToolbar);
1732  recalc = did_recalc(hToolbar);
1733  if (recalc)
1734  {
1735  ok(recalc, "Expected a recalc - setting TBSTYLE_EX_MIXEDBUTTONS\n");
1736  restore_recalc_state(hToolbar);
1738  recalc = did_recalc(hToolbar);
1739  ok(!recalc, "Unexpected recalc - setting TBSTYLE_EX_MIXEDBUTTONS again\n");
1740  restore_recalc_state(hToolbar);
1741  SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, 0);
1742  recalc = did_recalc(hToolbar);
1743  ok(recalc, "Expected a recalc - clearing TBSTYLE_EX_MIXEDBUTTONS\n");
1744  }
1745  else win_skip( "No recalc on TBSTYLE_EX_MIXEDBUTTONS\n" );
1746 
1747  /* undocumented exstyle 0x2 seems to change the top margin, which
1748  * interferes with these tests */
1749 
1750  /* Show that a change in TBSTYLE_WRAPABLE causes a recalc */
1751  prepare_recalc_test(&hToolbar);
1752  style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0);
1753  SendMessageA(hToolbar, TB_SETSTYLE, 0, style);
1754  recalc = did_recalc(hToolbar);
1755  ok(!recalc, "recalc %d\n", recalc);
1756 
1758  recalc = did_recalc(hToolbar);
1759  ok(!recalc, "recalc %d\n", recalc);
1760 
1762  recalc = did_recalc(hToolbar);
1763  ok(recalc, "recalc %d\n", recalc);
1764  restore_recalc_state(hToolbar);
1765 
1767  recalc = did_recalc(hToolbar);
1768  ok(!recalc, "recalc %d\n", recalc);
1769 
1770  SendMessageA(hToolbar, TB_SETSTYLE, 0, style);
1771  recalc = did_recalc(hToolbar);
1772  ok(recalc, "recalc %d\n", recalc);
1773  restore_recalc_state(hToolbar);
1774 
1775  /* Changing CCS_VERT does not recalc */
1776  SendMessageA(hToolbar, TB_SETSTYLE, 0, style | CCS_VERT);
1777  recalc = did_recalc(hToolbar);
1778  ok(!recalc, "recalc %d\n", recalc);
1779  restore_recalc_state(hToolbar);
1780 
1781  SendMessageA(hToolbar, TB_SETSTYLE, 0, style);
1782  recalc = did_recalc(hToolbar);
1783  ok(!recalc, "recalc %d\n", recalc);
1784  restore_recalc_state(hToolbar);
1785 
1786  /* Setting the window's style directly also causes recalc */
1788  recalc = did_recalc(hToolbar);
1789  ok(recalc, "recalc %d\n", recalc);
1790 
1791  DestroyWindow(hToolbar);
1792 }
static void prepare_recalc_test(HWND *phToolbar)
Definition: toolbar.c:1643
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:992
char CHAR
Definition: xmlstorage.h:175
#define TB_SETSTYLE
Definition: commctrl.h:1154
#define test
Definition: rosglue.h:37
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD dwMask
Definition: commctrl.h:1226
#define CCS_VERT
Definition: commctrl.h:2245
static TBBUTTON buttons3[]
Definition: toolbar.c:1341
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
LPSTR pszText
Definition: commctrl.h:1233
#define TB_GETEXTENDEDSTYLE
Definition: commctrl.h:1187
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_BOTTOM
Definition: commctrl.h:2240
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:985
static void restore_recalc_state(HWND hToolbar)
Definition: toolbar.c:1664
#define GWL_STYLE
Definition: winuser.h:846
#define TB_INSERTBUTTONA
Definition: commctrl.h:1103
#define TB_SETBUTTONINFOA
Definition: commctrl.h:1256
#define ok(value,...)
Definition: atltest.h:57
#define TBIF_TEXT
Definition: commctrl.h:1216
static BOOL did_recalc(HWND hToolbar)
Definition: toolbar.c:1654
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define expect(EXPECTED, GOT)
Definition: toolbar.c:115
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:986
#define TBSTYLE_EX_MIXEDBUTTONS
Definition: commctrl.h:1008
#define TB_GETSTYLE
Definition: commctrl.h:1155
Arabic default style
Definition: afstyles.h:93
#define win_skip
Definition: test.h:149
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1186

Referenced by START_TEST().

◆ test_save()

static void test_save ( void  )
static

Definition at line 2359 of file toolbar.c.

2360 {
2361  HWND wnd = NULL;
2363  static const WCHAR subkey[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
2364  'W','i','n','e','T','e','s','t',0};
2365  static const WCHAR value[] = {'t','o','o','l','b','a','r','t','e','s','t',0};
2366  LONG res;
2367  HKEY key;
2368  BYTE data[100];
2369  DWORD size = sizeof(data), type, i, count;
2370  TBBUTTON tb;
2371  static const TBBUTTON more_btns[2] =
2372  {
2373  {0, 11, TBSTATE_HIDDEN, BTNS_BUTTON, {0}, 0, -1},
2374  {0, 13, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, -1}
2375  };
2376  static const DWORD expect[] = {0xcafe, 1, 0xcafe0000, 3, 0xcafe0001, 5, 0xcafe0002, 7, 0xcafe0003,
2377  9, 0xcafe0004, 11, 0xcafe0005, 13, 0xcafe0006, 0xffffffff, 0xcafe0007,
2378  0xfffffffe, 0xcafe0008, 0x80000000, 0xcafe0009, 0x7fffffff, 0xcafe000a,
2379  0x100, 0xcafe000b};
2380  static const TBBUTTON expect_btns[] =
2381  {
2382  {0, 1, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},
2383  {0, 3, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 1, 2},
2384  {0, 5, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 2, 0},
2385  {0, 7, 0, BTNS_BUTTON, {0}, 0, (INT_PTR)"foo"},
2386  {0, 9, 0, BTNS_BUTTON, {0}, 0, 0},
2387  {0, 11, 0, BTNS_BUTTON, {0}, 0, 3},
2388  {0, 13, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 6, 0},
2389  {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 7, 0},
2390  {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 8, 0},
2391  {0, 0, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 9, 0},
2392  {0, 0x7fffffff, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0xa, 0},
2393  };
2394 
2395  params.hkr = HKEY_CURRENT_USER;
2396  params.pszSubKey = subkey;
2397  params.pszValueName = value;
2398 
2400  SendMessageW(wnd, TB_ADDBUTTONSW, ARRAY_SIZE(more_btns), (LPARAM)more_btns);
2401 
2404  ok( res, "saving failed\n" );
2406  DestroyWindow( wnd );
2407 
2408  res = RegOpenKeyW( HKEY_CURRENT_USER, subkey, &key );
2409  ok( !res, "got %08x\n", res );
2411  ok( !res, "got %08x\n", res );
2412  ok( type == REG_BINARY, "got %08x\n", type );
2413  ok( size == sizeof(expect), "got %08x\n", size );
2414  ok( !memcmp( data, expect, size ), "mismatch\n" );
2415 
2416  RegCloseKey( key );
2417 
2418  wnd = NULL;
2419  rebuild_toolbar( &wnd );
2420 
2423  ok( res, "restoring failed\n" );
2425  count = SendMessageW( wnd, TB_BUTTONCOUNT, 0, 0 );
2426  ok( count == ARRAY_SIZE(expect_btns), "got %d\n", count );
2427 
2428  for (i = 0; i < count; i++)
2429  {
2430  res = SendMessageW( wnd, TB_GETBUTTON, i, (LPARAM)&tb );
2431  ok( res, "got %d\n", res );
2432 
2433  ok( tb.iBitmap == expect_btns[i].iBitmap, "%d: got %d\n", i, tb.iBitmap );
2434  ok( tb.idCommand == expect_btns[i].idCommand, "%d: got %d\n", i, tb.idCommand );
2435  ok( tb.fsState == expect_btns[i].fsState, "%d: got %02x\n", i, tb.fsState );
2436  ok( tb.fsStyle == expect_btns[i].fsStyle, "%d: got %02x\n", i, tb.fsStyle );
2437  ok( tb.dwData == expect_btns[i].dwData, "%d: got %lx\n", i, tb.dwData );
2438  if (IS_INTRESOURCE(expect_btns[i].iString))
2439  ok( tb.iString == expect_btns[i].iString, "%d: got %lx\n", i, tb.iString );
2440  else
2441  ok( !strcmp( (char *)tb.iString, (char *)expect_btns[i].iString ),
2442  "%d: got %s\n", i, (char *)tb.iString );
2443 
2444  /* In fact the ptr value set in TBN_GETBUTTONINFOA is simply copied */
2445  if (tb.idCommand == 7)
2446  ok( tb.iString == (INT_PTR)alloced_str, "string not set\n");
2447  }
2448 
2449  DestroyWindow( wnd );
2450  RegOpenKeyW( HKEY_CURRENT_USER, subkey, &key );
2452  RegCloseKey( key );
2453 }
#define PARENT_SEQ_INDEX
Definition: toolbar.c:37
static const struct message restore_parent_seq[]
Definition: toolbar.c:75
#define TB_BUTTONCOUNT
Definition: commctrl.h:1106
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
#define TB_GETBUTTON
Definition: commctrl.h:1105
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TB_SAVERESTOREW
Definition: commctrl.h:1125
int32_t INT_PTR
Definition: typedefs.h:64
BOOL WINAPI DestroyWindow(_In_ HWND)
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 BTNS_BUTTON
Definition: commctrl.h:994
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
GLenum const GLfloat * params
Definition: glext.h:5645
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
static void * alloced_str
Definition: toolbar.c:136
smooth NULL
Definition: ftsmooth.c:416
static const struct message save_parent_seq[]
Definition: toolbar.c:63
LONG_PTR LPARAM
Definition: windef.h:208
static void rebuild_toolbar(HWND *hToolbar)
Definition: toolbar.c:436
GLsizeiptr size
Definition: glext.h:5919
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR tb[]
Definition: suminfo.c:286
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: toolbar.c:47
static void rebuild_toolbar_with_buttons(HWND *hToolbar)
Definition: toolbar.c:448
HKEY key
Definition: reg.c:42
#define TB_ADDBUTTONSW
Definition: commctrl.h:1262
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned char BYTE
Definition: xxhash.c:193
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
#define ARRAY_SIZE(a)
Definition: main.h:24
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define expect(EXPECTED, GOT)
Definition: toolbar.c:115
#define TBSTATE_HIDDEN
Definition: commctrl.h:971
#define TBSTATE_ENABLED
Definition: commctrl.h:970
GLuint res
Definition: glext.h:9613
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define NUM_MSG_SEQUENCES
Definition: toolbar.c:38
Definition: path.c:41

Referenced by START_TEST().

◆ test_setrows()

static void test_setrows ( void  )
static

Definition at line 1927 of file toolbar.c.

1928 {
1929  TBBUTTON buttons[9];
1930  HWND hToolbar;
1931  DWORD i;
1932 
1933  for (i=0; i<9; i++)
1935 
1936  /* Test 1 - 9 buttons */
1937  hToolbar = pCreateToolbarEx(hMainWnd,
1939  | CCS_NOMOVEY | CCS_TOP,
1940  0,
1941  0, NULL, 0,
1943  20, 20, 0, 0, sizeof(TBBUTTON));
1944  ok(hToolbar != NULL, "Toolbar creation\n");
1945  ok(SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0) == 0, "TB_AUTOSIZE failed\n");
1946 
1947  /* test setting rows to each of 1-10 with bLarger true and false */
1948  for (i=0; i<ARRAY_SIZE(tbrows_results); i++) {
1949  RECT rc;
1950  int rows;
1951 
1952  memset(&rc, 0xCC, sizeof(rc));
1953  SendMessageA(hToolbar, TB_SETROWS,
1955  (LPARAM) &rc);
1956 
1957  rows = SendMessageA(hToolbar, TB_GETROWS, MAKELONG(0,0), MAKELONG(0,0));
1958  ok(rows == tbrows_results[i].expectedRows,
1959  "[%d] Unexpected number of rows %d (expected %d)\n", i, rows,
1960  tbrows_results[i].expectedRows);
1961  }
1962 
1963  DestroyWindow(hToolbar);
1964 }
#define TB_GETROWS
Definition: commctrl.h:1138
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND hMainWnd
Definition: toolbar.c:49
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI DestroyWindow(_In_ HWND)
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 TBSTYLE_CHECKGROUP
Definition: commctrl.h:981
#define TB_AUTOSIZE
Definition: commctrl.h:1133
#define MAKELONG(a, b)
Definition: typedefs.h:249
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CCS_TOP
Definition: commctrl.h:2238
#define CCS_NOPARENTALIGN
Definition: commctrl.h:2242
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CCS_NORESIZE
Definition: commctrl.h:2241
HWND buttons[5]
Definition: sndrec32.cpp:40
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
int nRows
Definition: appswitch.c:56
#define CCS_NOMOVEY
Definition: commctrl.h:2239
static void MakeButton(TBBUTTON *p, int idCommand, int fsStyle, int nString)
Definition: toolbar.c:128
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
#define TB_SETROWS
Definition: commctrl.h:1137
#define TBSTYLE_FLAT
Definition: commctrl.h:988
static tbrows_result_t tbrows_results[]
Definition: toolbar.c:1917

Referenced by START_TEST().