ReactOS  0.4.13-dev-443-g10f00f8
tooltips.c File Reference
#include <windows.h>
#include <commctrl.h>
#include "resources.h"
#include "wine/test.h"
#include "v6util.h"
#include "msg.h"
Include dependency graph for tooltips.c:

Go to the source code of this file.

Macros

#define expect(expected, got)   ok(got == expected, "Expected %d, got %d\n", expected, got)
 
#define TEST_CDDS_PREPAINT   0x00000001
 
#define TEST_CDDS_POSTPAINT   0x00000002
 
#define TEST_CDDS_PREERASE   0x00000004
 
#define TEST_CDDS_POSTERASE   0x00000008
 
#define TEST_CDDS_ITEMPREPAINT   0x00000010
 
#define TEST_CDDS_ITEMPOSTPAINT   0x00000020
 
#define TEST_CDDS_ITEMPREERASE   0x00000040
 
#define TEST_CDDS_ITEMPOSTERASE   0x00000080
 
#define TEST_CDDS_SUBITEM   0x00000100
 

Enumerations

enum  seq_index {
  COMBINED_SEQ_INDEX = 0, NUM_MSG_SEQUENCES, LB_SEQ_INDEX, PARENT_SEQ_INDEX,
  NUM_MSG_SEQUENCES, PARENT_SEQ_INDEX, PARENT_FULL_SEQ_INDEX, PARENT_CD_SEQ_INDEX,
  LISTVIEW_SEQ_INDEX, EDITBOX_SEQ_INDEX, COMBINED_SEQ_INDEX, NUM_MSG_SEQUENCES,
  PARENT_SEQ_INDEX = 0, NUM_MSG_SEQUENCES
}
 

Functions

static void test_create_tooltip (BOOL is_v6)
 
static void flush_events (int waitTime)
 
static LRESULT CALLBACK custom_draw_wnd_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_customdraw (void)
 
static LRESULT WINAPI parent_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void register_parent_wnd_class (void)
 
static HWND create_parent_window (void)
 
static void test_gettext (void)
 
static void test_ttm_gettoolinfo (void)
 
static void test_longtextA (void)
 
static void test_longtextW (void)
 
static BOOL almost_eq (int a, int b)
 
static void test_track (void)
 
static LRESULT CALLBACK info_wnd_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_setinfo (BOOL is_v6)
 
static void test_margin (void)
 
static void test_TTM_ADDTOOL (BOOL is_v6)
 
static void test_TTN_SHOW (void)
 
 START_TEST (tooltips)
 

Variables

static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static int CD_Stages
 
static LRESULT CD_Result
 
static HWND g_hwnd
 
static const CHAR testcallbackA [] = "callback"
 
static RECT g_ttip_rect
 
static const struct message ttn_show_parent_seq []
 

Macro Definition Documentation

◆ expect

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

Definition at line 30 of file tooltips.c.

◆ TEST_CDDS_ITEMPOSTERASE

#define TEST_CDDS_ITEMPOSTERASE   0x00000080

Definition at line 107 of file tooltips.c.

◆ TEST_CDDS_ITEMPOSTPAINT

#define TEST_CDDS_ITEMPOSTPAINT   0x00000020

Definition at line 105 of file tooltips.c.

◆ TEST_CDDS_ITEMPREERASE

#define TEST_CDDS_ITEMPREERASE   0x00000040

Definition at line 106 of file tooltips.c.

◆ TEST_CDDS_ITEMPREPAINT

#define TEST_CDDS_ITEMPREPAINT   0x00000010

Definition at line 104 of file tooltips.c.

◆ TEST_CDDS_POSTERASE

#define TEST_CDDS_POSTERASE   0x00000008

Definition at line 103 of file tooltips.c.

◆ TEST_CDDS_POSTPAINT

#define TEST_CDDS_POSTPAINT   0x00000002

Definition at line 101 of file tooltips.c.

◆ TEST_CDDS_PREERASE

#define TEST_CDDS_PREERASE   0x00000004

Definition at line 102 of file tooltips.c.

◆ TEST_CDDS_PREPAINT

#define TEST_CDDS_PREPAINT   0x00000001

Definition at line 100 of file tooltips.c.

◆ TEST_CDDS_SUBITEM

#define TEST_CDDS_SUBITEM   0x00000100

Definition at line 108 of file tooltips.c.

Enumeration Type Documentation

◆ seq_index

Enumerator
COMBINED_SEQ_INDEX 
NUM_MSG_SEQUENCES 
LB_SEQ_INDEX 
PARENT_SEQ_INDEX 
NUM_MSG_SEQUENCES 
PARENT_SEQ_INDEX 
PARENT_FULL_SEQ_INDEX 
PARENT_CD_SEQ_INDEX 
LISTVIEW_SEQ_INDEX 
EDITBOX_SEQ_INDEX 
COMBINED_SEQ_INDEX 
NUM_MSG_SEQUENCES 
PARENT_SEQ_INDEX 
NUM_MSG_SEQUENCES 

Definition at line 32 of file tooltips.c.

Function Documentation

◆ almost_eq()

static BOOL almost_eq ( int  a,
int  b 
)
static

Definition at line 865 of file tooltips.c.

866 {
867  return a-5<b && a+5>b;
868 }
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by test_track().

◆ create_parent_window()

static HWND create_parent_window ( void  )
static

Definition at line 341 of file tooltips.c.

342 {
343  return CreateWindowExA(0, "Tooltips test parent class",
344  "Tooltips test parent window",
347  0, 0, 100, 100,
349 }
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_CAPTION
Definition: pedump.c:624
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_MINIMIZEBOX
Definition: pedump.c:631
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
#define WS_SYSMENU
Definition: pedump.c:629

Referenced by test_gettext(), and test_TTN_SHOW().

◆ custom_draw_wnd_proc()

static LRESULT CALLBACK custom_draw_wnd_proc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 110 of file tooltips.c.

111 {
112  switch(msg) {
113 
114  case WM_DESTROY:
115  PostQuitMessage(0);
116  break;
117 
118  case WM_NOTIFY:
119  if (((NMHDR *)lParam)->code == NM_CUSTOMDRAW) {
121  ok(ttcd->nmcd.hdr.hwndFrom == g_hwnd, "Unexpected hwnd source %p (%p)\n",
122  ttcd->nmcd.hdr.hwndFrom, g_hwnd);
123  ok(ttcd->nmcd.hdr.idFrom == 0x1234ABCD, "Unexpected id %x\n", (int)ttcd->nmcd.hdr.idFrom);
124 
125  switch (ttcd->nmcd.dwDrawStage) {
126  case CDDS_PREPAINT : CD_Stages |= TEST_CDDS_PREPAINT; break;
128  case CDDS_PREERASE : CD_Stages |= TEST_CDDS_PREERASE; break;
134  case CDDS_SUBITEM : CD_Stages |= TEST_CDDS_SUBITEM; break;
135  default: CD_Stages = -1;
136  }
137 
138  if (ttcd->nmcd.dwDrawStage == CDDS_PREPAINT) return CD_Result;
139  }
140  /* drop through */
141 
142  default:
143  return DefWindowProcA(hWnd, msg, wParam, lParam);
144  }
145 
146  return 0L;
147 }
#define CDDS_SUBITEM
Definition: commctrl.h:274
#define CDDS_POSTERASE
Definition: commctrl.h:268
#define TEST_CDDS_ITEMPOSTERASE
Definition: tooltips.c:107
static int CD_Stages
Definition: tooltips.c:96
HWND hWnd
Definition: settings.c:17
static HWND g_hwnd
Definition: tooltips.c:98
#define CDDS_POSTPAINT
Definition: commctrl.h:266
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:270
WPARAM wParam
Definition: combotst.c:138
#define TEST_CDDS_POSTERASE
Definition: tooltips.c:103
#define TEST_CDDS_SUBITEM
Definition: tooltips.c:108
#define TEST_CDDS_PREERASE
Definition: tooltips.c:102
#define CDDS_ITEMPREERASE
Definition: commctrl.h:272
NMCUSTOMDRAW nmcd
Definition: commctrl.h:298
UINT_PTR idFrom
Definition: winuser.h:3111
#define ok(value,...)
#define TEST_CDDS_ITEMPOSTPAINT
Definition: tooltips.c:105
#define TEST_CDDS_ITEMPREERASE
Definition: tooltips.c:106
#define WM_DESTROY
Definition: winuser.h:1591
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:265
static const WCHAR L[]
Definition: oid.c:1250
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwndFrom
Definition: winuser.h:3110
#define TEST_CDDS_POSTPAINT
Definition: tooltips.c:101
#define CDDS_ITEMPOSTERASE
Definition: commctrl.h:273
#define TEST_CDDS_PREPAINT
Definition: tooltips.c:100
#define TEST_CDDS_ITEMPREPAINT
Definition: tooltips.c:104
static LRESULT CD_Result
Definition: tooltips.c:97
#define msg(x)
Definition: auth_time.c:54
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:271
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_NOTIFY
Definition: richedit.h:61
#define CDDS_PREERASE
Definition: commctrl.h:267

Referenced by test_customdraw().

◆ flush_events()

static void flush_events ( int  waitTime)
static

Definition at line 82 of file tooltips.c.

83 {
84  MSG msg;
85  int diff = waitTime;
86  DWORD time = GetTickCount() + waitTime;
87 
88  while (diff > 0)
89  {
90  if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(100,diff), QS_ALLEVENTS) == WAIT_TIMEOUT) break;
91  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
92  diff = time - GetTickCount();
93  }
94 }
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
#define QS_ALLEVENTS
Definition: winuser.h:873
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define min(a, b)
Definition: monoChain.cc:55
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_customdraw(), test_setinfo(), test_track(), and test_TTN_SHOW().

◆ info_wnd_proc()

static LRESULT CALLBACK info_wnd_proc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 921 of file tooltips.c.

922 {
923  switch(msg) {
924 
925  case WM_DESTROY:
926  PostQuitMessage(0);
927  break;
928 
929  default:
930  return DefWindowProcA(hWnd, msg, wParam, lParam);
931  }
932  return 0;
933 }
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
#define WM_DESTROY
Definition: winuser.h:1591
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by test_setinfo().

◆ parent_wnd_proc()

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

Definition at line 277 of file tooltips.c.

278 {
279  static LONG defwndproc_counter = 0;
280  struct message msg;
281  LRESULT ret;
282 
283  if (message == WM_NOTIFY && lParam)
284  {
285  NMTTDISPINFOA *ttnmdi = (NMTTDISPINFOA*)lParam;
286  NMHDR *hdr = (NMHDR *)lParam;
287  RECT rect;
288 
289  if (hdr->code != NM_CUSTOMDRAW)
290  {
291  msg.message = message;
292  msg.flags = sent|wparam|lparam;
293  if (defwndproc_counter) msg.flags |= defwinproc;
294  msg.wParam = wParam;
295  msg.lParam = lParam;
296  msg.id = hdr->code;
298  }
299 
300  switch (hdr->code)
301  {
302  case TTN_GETDISPINFOA:
303  lstrcpyA(ttnmdi->lpszText, testcallbackA);
304  break;
305  case TTN_SHOW:
306  GetWindowRect(hdr->hwndFrom, &rect);
307  ok(!EqualRect(&g_ttip_rect, &rect), "Unexpected window rectangle.\n");
308  break;
309  }
310  }
311 
312  defwndproc_counter++;
313  if (IsWindowUnicode(hwnd))
315  else
317  defwndproc_counter--;
318 
319  return ret;
320 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
Definition: tftpd.h:59
char hdr[14]
Definition: iptest.cpp:33
Definition: msg.h:39
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: tooltips.c:38
long LONG
Definition: pedump.c:60
#define TTN_SHOW
Definition: commctrl.h:1846
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define ok(value,...)
#define TTN_GETDISPINFOA
Definition: commctrl.h:1844
BOOL WINAPI IsWindowUnicode(_In_ HWND)
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
Definition: msg.h:34
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const CHAR testcallbackA[]
Definition: tooltips.c:274
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define add_message(msg)
Definition: msg.c:2142
static RECT g_ttip_rect
Definition: tooltips.c:276
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
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 register_parent_wnd_class().

◆ register_parent_wnd_class()

static void register_parent_wnd_class ( void  )
static

Definition at line 322 of file tooltips.c.

323 {
324  WNDCLASSA cls;
325  BOOL ret;
326 
327  cls.style = 0;
329  cls.cbClsExtra = 0;
330  cls.cbWndExtra = 0;
332  cls.hIcon = 0;
333  cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
335  cls.lpszMenuName = NULL;
336  cls.lpszClassName = "Tooltips test parent class";
337  ret = RegisterClassA(&cls);
338  ok(ret, "Failed to register test parent class.\n");
339 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
int cbClsExtra
Definition: winuser.h:3118
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define WHITE_BRUSH
Definition: wingdi.h:901
HBRUSH hbrBackground
Definition: winuser.h:3123
int cbWndExtra
Definition: winuser.h:3119
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
HCURSOR hCursor
Definition: winuser.h:3122
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
LPCSTR lpszClassName
Definition: winuser.h:3125
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3116
HINSTANCE hInstance
Definition: winuser.h:3120
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:277
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3121

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( tooltips  )

Definition at line 1236 of file tooltips.c.

1237 {
1238  ULONG_PTR ctx_cookie;
1239  HANDLE hCtx;
1240 
1242 
1243  LoadLibraryA("comctl32.dll");
1244 
1246 
1248  test_customdraw();
1249  test_gettext();
1251  test_longtextA();
1252  test_longtextW();
1253  test_track();
1255  test_margin();
1257  test_TTN_SHOW();
1258 
1259  if (!load_v6_module(&ctx_cookie, &hCtx))
1260  return;
1261 
1263  test_customdraw();
1264  test_longtextW();
1265  test_track();
1266  test_setinfo(TRUE);
1267  test_margin();
1269  test_TTN_SHOW();
1270 
1271  unload_v6_module(ctx_cookie, hCtx);
1272 }
#define TRUE
Definition: types.h:120
static void test_track(void)
Definition: tooltips.c:870
static void test_TTN_SHOW(void)
Definition: tooltips.c:1185
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
uint32_t ULONG_PTR
Definition: typedefs.h:63
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: tooltips.c:38
static void register_parent_wnd_class(void)
Definition: tooltips.c:322
static void test_longtextW(void)
Definition: tooltips.c:803
static void test_gettext(void)
Definition: tooltips.c:351
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
static void test_margin(void)
Definition: tooltips.c:1070
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
static void test_create_tooltip(BOOL is_v6)
Definition: tooltips.c:40
static void test_longtextA(void)
Definition: tooltips.c:747
static void test_ttm_gettoolinfo(void)
Definition: tooltips.c:549
static void test_setinfo(BOOL is_v6)
Definition: tooltips.c:935
static void test_customdraw(void)
Definition: tooltips.c:149
static void test_TTM_ADDTOOL(BOOL is_v6)
Definition: tooltips.c:1107

◆ test_create_tooltip()

static void test_create_tooltip ( BOOL  is_v6)
static

Definition at line 40 of file tooltips.c.

41 {
42  HWND parent, hwnd;
43  DWORD style, exp_style;
44 
45  parent = CreateWindowExA(0, "static", NULL, WS_POPUP,
46  0, 0, 0, 0,
47  NULL, NULL, NULL, 0);
48  ok(parent != NULL, "failed to create parent wnd\n");
49 
50  hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0x7fffffff | WS_POPUP,
51  10, 10, 300, 100,
52  parent, NULL, NULL, 0);
53  ok(hwnd != NULL, "failed to create tooltip wnd\n");
54 
56  exp_style = 0x7fffffff | WS_POPUP;
57  exp_style &= ~(WS_CHILD | WS_MAXIMIZE | WS_BORDER | WS_DLGFRAME);
58  ok(style == exp_style || broken(style == (exp_style | WS_BORDER)), /* nt4 */
59  "wrong style %08x/%08x\n", style, exp_style);
60 
62 
64  10, 10, 300, 100,
65  parent, NULL, NULL, 0);
66  ok(hwnd != NULL, "failed to create tooltip wnd\n");
67 
69  exp_style = WS_POPUP | WS_CLIPSIBLINGS;
70  if (!is_v6)
71  exp_style |= WS_BORDER;
72 todo_wine_if(is_v6)
73  ok(style == exp_style || broken(style == (exp_style | WS_BORDER)) /* XP */,
74  "Unexpected window style %#x.\n", style);
75 
77 
79 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define todo_wine_if(is_todo)
Definition: test.h:155
r parent
Definition: btrfs.c:2708
unsigned long DWORD
Definition: ntddk_ex.h:95
#define broken(x)
Definition: _sntprintf.h:21
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
#define WS_POPUP
Definition: pedump.c:616
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)
Arabic default style
Definition: afstyles.h:93
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by START_TEST().

◆ test_customdraw()

static void test_customdraw ( void  )
static

Definition at line 149 of file tooltips.c.

149  {
150  static struct {
151  LRESULT FirstReturnValue;
152  int ExpectedCalls;
153  } expectedResults[] = {
154  /* Valid notification responses */
158 
159  /* Invalid notification responses */
163  };
164 
165  DWORD iterationNumber;
166  WNDCLASSA wc;
167  POINT orig_pos;
168  LRESULT ret;
169 
170  /* Create a class to use the custom draw wndproc */
171  wc.style = CS_HREDRAW | CS_VREDRAW;
172  wc.cbClsExtra = 0;
173  wc.cbWndExtra = 0;
175  wc.hIcon = NULL;
178  wc.lpszMenuName = NULL;
179  wc.lpszClassName = "CustomDrawClass";
181  RegisterClassA(&wc);
182 
183  GetCursorPos(&orig_pos);
184 
185  for (iterationNumber = 0;
186  iterationNumber < ARRAY_SIZE(expectedResults);
187  iterationNumber++) {
188 
189  HWND parent, hwndTip;
190  RECT rect;
191  TTTOOLINFOA toolInfo = { 0 };
192 
193  /* Create a main window */
194  parent = CreateWindowExA(0, "CustomDrawClass", NULL,
197  50, 50,
198  300, 300,
199  NULL, NULL, NULL, 0);
200  ok(parent != NULL, "Creation of main window failed\n");
201 
202  /* Make it show */
204  flush_events(100);
205 
206  /* Create Tooltip */
212  ok(hwndTip != NULL, "Creation of tooltip window failed\n");
213 
214  /* Set up parms for the wndproc to handle */
215  CD_Stages = 0;
216  CD_Result = expectedResults[iterationNumber].FirstReturnValue;
217  g_hwnd = hwndTip;
218 
219  /* Make it topmost, as per the MSDN */
220  SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0,
222 
223  /* Create a tool */
224  toolInfo.cbSize = TTTOOLINFOA_V1_SIZE;
225  toolInfo.hwnd = parent;
226  toolInfo.hinst = GetModuleHandleA(NULL);
227  toolInfo.uFlags = TTF_SUBCLASS;
228  toolInfo.uId = 0x1234ABCD;
229  toolInfo.lpszText = (LPSTR)"This is a test tooltip";
230  toolInfo.lParam = 0xdeadbeef;
231  GetClientRect (parent, &toolInfo.rect);
232  ret = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
233  ok(ret, "Failed to add the tool.\n");
234 
235  /* Make tooltip appear quickly */
237 
238  /* Put cursor inside window, tooltip will appear immediately */
240  SetCursorPos( (rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2 );
241  flush_events(200);
242 
243  if (CD_Stages)
244  {
245  /* Check CustomDraw results */
246  ok(CD_Stages == expectedResults[iterationNumber].ExpectedCalls ||
247  broken(CD_Stages == (expectedResults[iterationNumber].ExpectedCalls & ~TEST_CDDS_POSTPAINT)), /* nt4 */
248  "CustomDraw run %d stages %x, expected %x\n", iterationNumber, CD_Stages,
249  expectedResults[iterationNumber].ExpectedCalls);
250  }
251 
252  ret = SendMessageA(hwndTip, TTM_GETCURRENTTOOLA, 0, 0);
253  ok(ret, "Failed to get current tool %#lx.\n", ret);
254 
255  memset(&toolInfo, 0xcc, sizeof(toolInfo));
256  toolInfo.cbSize = sizeof(toolInfo);
257  toolInfo.lpszText = NULL;
258  toolInfo.lpReserved = (void *)0xdeadbeef;
259  SendMessageA(hwndTip, TTM_GETCURRENTTOOLA, 0, (LPARAM)&toolInfo);
260  ok(toolInfo.hwnd == parent, "Unexpected hwnd %p.\n", toolInfo.hwnd);
261  ok(toolInfo.hinst == GetModuleHandleA(NULL), "Unexpected hinst %p.\n", toolInfo.hinst);
262  ok(toolInfo.uId == 0x1234abcd, "Unexpected uId %lx.\n", toolInfo.uId);
263  ok(toolInfo.lParam == 0, "Unexpected lParam %lx.\n", toolInfo.lParam);
264  ok(toolInfo.lpReserved == (void *)0xdeadbeef, "Unexpected lpReserved %p.\n", toolInfo.lpReserved);
265 
266  /* Clean up */
267  DestroyWindow(hwndTip);
269  }
270 
271  SetCursorPos(orig_pos.x, orig_pos.y);
272 }
long y
Definition: polytest.cpp:48
LPARAM lParam
Definition: commctrl.h:1707
long x
Definition: polytest.cpp:48
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
static int CD_Stages
Definition: tooltips.c:96
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
static HWND g_hwnd
Definition: tooltips.c:98
static LRESULT CALLBACK custom_draw_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:110
int cbClsExtra
Definition: winuser.h:3118
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define HWND_TOPMOST
Definition: winuser.h:1194
void * lpReserved
Definition: commctrl.h:1708
HBRUSH hbrBackground
Definition: winuser.h:3123
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HINSTANCE hinst
Definition: commctrl.h:1705
char * LPSTR
Definition: xmlstorage.h:182
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:255
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
BOOL WINAPI DestroyWindow(_In_ HWND)
#define COLOR_WINDOW
Definition: winuser.h:908
& rect
Definition: startmenu.cpp:1413
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
int cbWndExtra
Definition: winuser.h:3119
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define ok(value,...)
HCURSOR hCursor
Definition: winuser.h:3122
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:260
const char * LPCSTR
Definition: xmlstorage.h:183
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_CAPTION
Definition: pedump.c:624
#define CS_VREDRAW
Definition: winuser.h:653
r parent
Definition: btrfs.c:2708
#define SWP_NOACTIVATE
Definition: winuser.h:1227
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
unsigned long DWORD
Definition: ntddk_ex.h:95
static void flush_events(int waitTime)
Definition: tooltips.c:82
#define CDRF_DODEFAULT
Definition: commctrl.h:253
#define TTM_SETDELAYTIME
Definition: commctrl.h:1757
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_EX_TOPMOST
Definition: pedump.c:647
LPCSTR lpszClassName
Definition: winuser.h:3125
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define TEST_CDDS_POSTPAINT
Definition: tooltips.c:101
UINT_PTR uId
Definition: commctrl.h:1703
#define broken(x)
Definition: _sntprintf.h:21
#define TTTOOLINFOA_V1_SIZE
Definition: commctrl.h:1692
UINT style
Definition: winuser.h:3116
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TTM_GETCURRENTTOOLA
Definition: commctrl.h:1781
#define TEST_CDDS_PREPAINT
Definition: tooltips.c:100
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HINSTANCE hInstance
Definition: winuser.h:3120
#define ARRAY_SIZE(a)
Definition: main.h:24
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
#define CDRF_NOTIFYPOSTERASE
Definition: commctrl.h:262
static LRESULT CD_Result
Definition: tooltips.c:97
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define IDC_ARROW
Definition: winuser.h:682
#define CDRF_NEWFONT
Definition: commctrl.h:254
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 SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define TTDT_INITIAL
Definition: commctrl.h:1749
#define WS_SYSMENU
Definition: pedump.c:629
#define memset(x, y, z)
Definition: compat.h:39
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define TTF_SUBCLASS
Definition: commctrl.h:1739
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3121
LPSTR lpszText
Definition: commctrl.h:1706

Referenced by START_TEST().

◆ test_gettext()

static void test_gettext ( void  )
static

Definition at line 351 of file tooltips.c.

352 {
353  static const CHAR testtip2A[] = "testtip\ttest2";
354  static const CHAR testtipA[] = "testtip";
355  HWND hwnd, notify;
356  TTTOOLINFOA toolinfoA;
357  TTTOOLINFOW toolinfoW;
358  LRESULT r;
359  CHAR bufA[16] = "";
360  WCHAR bufW[10] = { 0 };
361  DWORD length, style;
362 
364  ok(notify != NULL, "Expected notification window to be created\n");
365 
366  /* For bug 14790 - lpszText is NULL */
368  10, 10, 300, 100,
369  NULL, NULL, NULL, 0);
370  ok(hwnd != NULL, "failed to create tooltip wnd\n");
371 
372  /* use sizeof(TTTOOLINFOA) instead of TTTOOLINFOA_V1_SIZE so that adding it fails on Win9x */
373  /* otherwise it crashes on the NULL lpszText */
374  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
375  toolinfoA.hwnd = NULL;
376  toolinfoA.hinst = GetModuleHandleA(NULL);
377  toolinfoA.uFlags = 0;
378  toolinfoA.uId = 0x1234ABCD;
379  toolinfoA.lpszText = NULL;
380  toolinfoA.lParam = 0xdeadbeef;
381  GetClientRect(hwnd, &toolinfoA.rect);
382  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
383  ok(r, "got %ld\n", r);
384 
385  toolinfoA.hwnd = NULL;
386  toolinfoA.uId = 0x1234abcd;
387  toolinfoA.lpszText = bufA;
388  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
389  ok(!r, "got %ld\n", r);
390  ok(!*toolinfoA.lpszText, "lpszText should be empty, got %s\n", toolinfoA.lpszText);
391 
392  toolinfoA.lpszText = bufA;
393  r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
394 todo_wine
395  ok(!r, "got %ld\n", r);
396  ok(toolinfoA.lpszText == NULL, "expected NULL, got %p\n", toolinfoA.lpszText);
397 
398  /* NULL hinst, valid resource id for text */
399  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
400  toolinfoA.hwnd = NULL;
401  toolinfoA.hinst = NULL;
402  toolinfoA.uFlags = 0;
403  toolinfoA.uId = 0x1233abcd;
404  toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1);
405  toolinfoA.lParam = 0xdeadbeef;
406  GetClientRect(hwnd, &toolinfoA.rect);
407  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
408  ok(r, "failed to add a tool\n");
409 
410  toolinfoA.hwnd = NULL;
411  toolinfoA.uId = 0x1233abcd;
412  toolinfoA.lpszText = bufA;
413  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
414  ok(!r, "got %ld\n", r);
415  ok(!strcmp(toolinfoA.lpszText, "abc"), "got wrong text, %s\n", toolinfoA.lpszText);
416 
417  toolinfoA.hinst = (HINSTANCE)0xdeadbee;
418  r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
419 todo_wine
420  ok(!r, "got %ld\n", r);
421  ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst);
422 
423  r = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA);
424  ok(!r, "got %ld\n", r);
425 
426  /* add another tool with text */
427  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
428  toolinfoA.hwnd = NULL;
429  toolinfoA.hinst = GetModuleHandleA(NULL);
430  toolinfoA.uFlags = 0;
431  toolinfoA.uId = 0x1235ABCD;
432  strcpy(bufA, testtipA);
433  toolinfoA.lpszText = bufA;
434  toolinfoA.lParam = 0xdeadbeef;
435  GetClientRect(hwnd, &toolinfoA.rect);
436  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
437  ok(r, "Adding the tool to the tooltip failed\n");
438 
440  ok(length == 0, "Expected 0, got %d\n", length);
441 
442  toolinfoA.hwnd = NULL;
443  toolinfoA.uId = 0x1235abcd;
444  toolinfoA.lpszText = bufA;
445  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
446  ok(!r, "got %ld\n", r);
447  ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText);
448 
449  memset(bufA, 0x1f, sizeof(bufA));
450  toolinfoA.lpszText = bufA;
451  r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
452 todo_wine
453  ok(!r, "got %ld\n", r);
454  ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText);
455 
457  ok(length == 0, "Expected 0, got %d\n", length);
458 
459  /* add another with callback text */
460  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
461  toolinfoA.hwnd = notify;
462  toolinfoA.hinst = GetModuleHandleA(NULL);
463  toolinfoA.uFlags = 0;
464  toolinfoA.uId = 0x1236ABCD;
465  toolinfoA.lpszText = LPSTR_TEXTCALLBACKA;
466  toolinfoA.lParam = 0xdeadbeef;
467  GetClientRect(hwnd, &toolinfoA.rect);
468  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
469  ok(r, "Adding the tool to the tooltip failed\n");
470 
471  toolinfoA.hwnd = notify;
472  toolinfoA.uId = 0x1236abcd;
473  toolinfoA.lpszText = bufA;
474  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
475  ok(!r, "got %ld\n", r);
476  ok(!strcmp(toolinfoA.lpszText, testcallbackA), "lpszText should be an (%s) string\n", testcallbackA);
477 
478  toolinfoA.lpszText = bufA;
479  r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
480 todo_wine
481  ok(!r, "got %ld\n", r);
482  ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText);
483 
486 
488  10, 10, 300, 100,
489  NULL, NULL, NULL, 0);
490  ok(hwnd != NULL, "failed to create tooltip wnd\n");
491 
492  toolinfoW.cbSize = TTTOOLINFOW_V2_SIZE + 1;
493  toolinfoW.hwnd = NULL;
494  toolinfoW.hinst = GetModuleHandleA(NULL);
495  toolinfoW.uFlags = 0;
496  toolinfoW.uId = 0x1234ABCD;
497  toolinfoW.lpszText = NULL;
498  toolinfoW.lParam = 0xdeadbeef;
499  GetClientRect(hwnd, &toolinfoW.rect);
500  r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
501  /* Wine currently checks for V3 structure size, which matches what V6 control does.
502  Older implementation was never updated to support lpReserved field. */
503 todo_wine
504  ok(!r, "Adding the tool to the tooltip succeeded!\n");
505 
506  if (0) /* crashes on NT4 */
507  {
508  toolinfoW.hwnd = NULL;
509  toolinfoW.uId = 0x1234ABCD;
510  toolinfoW.lpszText = bufW;
511  SendMessageW(hwnd, TTM_GETTEXTW, 0, (LPARAM)&toolinfoW);
512  ok(toolinfoW.lpszText[0] == 0, "lpszText should be an empty string\n");
513  }
514 
515  /* text with embedded tabs */
516  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
517  toolinfoA.hwnd = NULL;
518  toolinfoA.hinst = GetModuleHandleA(NULL);
519  toolinfoA.uFlags = 0;
520  toolinfoA.uId = 0x1235abce;
521  strcpy(bufA, testtip2A);
522  toolinfoA.lpszText = bufA;
523  toolinfoA.lParam = 0xdeadbeef;
524  GetClientRect(hwnd, &toolinfoA.rect);
525  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
526  ok(r, "got %ld\n", r);
527 
528  toolinfoA.hwnd = NULL;
529  toolinfoA.uId = 0x1235abce;
530  toolinfoA.lpszText = bufA;
531  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
532  ok(!r, "got %ld\n", r);
533  ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %s\n", testtipA, toolinfoA.lpszText);
534 
535  /* enable TTS_NOPREFIX, original text is retained */
538 
539  toolinfoA.hwnd = NULL;
540  toolinfoA.uId = 0x1235abce;
541  toolinfoA.lpszText = bufA;
542  r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
543  ok(!r, "got %ld\n", r);
544  ok(!strcmp(toolinfoA.lpszText, testtip2A), "expected %s, got %s\n", testtip2A, toolinfoA.lpszText);
545 
547 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: commctrl.h:1707
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
int notify
Definition: msacm.c:1353
#define TTM_GETTEXTA
Definition: commctrl.h:1774
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
HINSTANCE hinst
Definition: commctrl.h:1705
static HWND create_parent_window(void)
Definition: tooltips.c:341
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
LPWSTR lpszText
Definition: commctrl.h:1718
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1766
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
UINT_PTR uId
Definition: commctrl.h:1715
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TTM_DELTOOLA
Definition: commctrl.h:1760
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1679
HANDLE HINSTANCE
Definition: typedefs.h:75
#define todo_wine
Definition: test.h:154
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
UINT_PTR uId
Definition: commctrl.h:1703
HINSTANCE hinst
Definition: commctrl.h:1717
static const CHAR testcallbackA[]
Definition: tooltips.c:274
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TTM_GETTEXTW
Definition: commctrl.h:1775
#define TTM_ADDTOOLW
Definition: commctrl.h:1759
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define IDS_TBADD1
Definition: resources.h:27
struct tagTOOLINFOA TTTOOLINFOA
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
LONG_PTR LRESULT
Definition: windef.h:209
Arabic default style
Definition: afstyles.h:93
#define memset(x, y, z)
Definition: compat.h:39
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define TTTOOLINFOW_V2_SIZE
Definition: commctrl.h:1695
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2353
LPSTR lpszText
Definition: commctrl.h:1706
LPARAM lParam
Definition: commctrl.h:1719

Referenced by START_TEST().

◆ test_longtextA()

static void test_longtextA ( void  )
static

Definition at line 747 of file tooltips.c.

748 {
749  static const char longtextA[] =
750  "According to MSDN, TTM_ENUMTOOLS claims that TOOLINFO's lpszText is maximum "
751  "80 chars including null. In fact, the buffer is not null-terminated.";
752  HWND hwnd;
753  TTTOOLINFOA toolinfoA = { 0 };
754  CHAR bufA[256];
755  LRESULT r;
756 
758  10, 10, 300, 100,
759  NULL, NULL, NULL, 0);
760  toolinfoA.cbSize = sizeof(TTTOOLINFOA);
761  toolinfoA.hwnd = NULL;
762  toolinfoA.hinst = GetModuleHandleA(NULL);
763  toolinfoA.uFlags = 0;
764  toolinfoA.uId = 0x1234ABCD;
765  strcpy(bufA, longtextA);
766  toolinfoA.lpszText = bufA;
767  toolinfoA.lParam = 0xdeadbeef;
768  GetClientRect(hwnd, &toolinfoA.rect);
769  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
770  if (r)
771  {
772  int textlen;
773  memset(bufA, 0, sizeof(bufA));
774  toolinfoA.hwnd = NULL;
775  toolinfoA.uId = 0xABCD1234;
776  toolinfoA.lpszText = bufA;
777  SendMessageA(hwnd, TTM_ENUMTOOLSA, 0, (LPARAM)&toolinfoA);
778  textlen = lstrlenA(toolinfoA.lpszText);
779  ok(textlen == 80, "lpszText has %d chars\n", textlen);
780  ok(toolinfoA.uId == 0x1234ABCD,
781  "uId should be retrieved, got %p\n", (void*)toolinfoA.uId);
782 
783  memset(bufA, 0, sizeof(bufA));
784  toolinfoA.hwnd = NULL;
785  toolinfoA.uId = 0x1234ABCD;
786  toolinfoA.lpszText = bufA;
787  SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
788  textlen = lstrlenA(toolinfoA.lpszText);
789  ok(textlen == 80, "lpszText has %d chars\n", textlen);
790 
791  memset(bufA, 0, sizeof(bufA));
792  toolinfoA.hwnd = NULL;
793  toolinfoA.uId = 0x1234ABCD;
794  toolinfoA.lpszText = bufA;
795  SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
796  textlen = lstrlenA(toolinfoA.lpszText);
797  ok(textlen == 80, "lpszText has %d chars\n", textlen);
798  }
799 
801 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: commctrl.h:1707
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
char CHAR
Definition: xmlstorage.h:175
#define TTM_GETTEXTA
Definition: commctrl.h:1774
HINSTANCE hinst
Definition: commctrl.h:1705
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1766
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
UINT_PTR uId
Definition: commctrl.h:1703
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
struct tagTOOLINFOA TTTOOLINFOA
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
LONG_PTR LRESULT
Definition: windef.h:209
#define TTM_ENUMTOOLSA
Definition: commctrl.h:1779
#define memset(x, y, z)
Definition: compat.h:39
LPSTR lpszText
Definition: commctrl.h:1706

Referenced by START_TEST().

◆ test_longtextW()

static void test_longtextW ( void  )
static

Definition at line 803 of file tooltips.c.

804 {
805  static const char longtextA[] =
806  "According to MSDN, TTM_ENUMTOOLS claims that TOOLINFO's lpszText is maximum "
807  "80 chars including null. Actually, this is not applied for wide version.";
808  HWND hwnd;
809  TTTOOLINFOW toolinfoW = { 0 };
810  WCHAR bufW[256];
811  LRESULT r;
812  int lenW;
813 
815  10, 10, 300, 100,
816  NULL, NULL, NULL, 0);
817  ok(hwnd != NULL, "Failed to create tooltip window.\n");
818 
819  toolinfoW.cbSize = TTTOOLINFOW_V2_SIZE;
820  toolinfoW.hwnd = NULL;
821  toolinfoW.hinst = GetModuleHandleW(NULL);
822  toolinfoW.uFlags = 0;
823  toolinfoW.uId = 0x1234ABCD;
824  MultiByteToWideChar(CP_ACP, 0, longtextA, -1, bufW, ARRAY_SIZE(bufW));
825  lenW = lstrlenW(bufW);
826  toolinfoW.lpszText = bufW;
827  toolinfoW.lParam = 0xdeadbeef;
828  GetClientRect(hwnd, &toolinfoW.rect);
829  r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
830  if (r)
831  {
832  int textlen;
833  memset(bufW, 0, sizeof(bufW));
834  toolinfoW.hwnd = NULL;
835  toolinfoW.uId = 0xABCD1234;
836  toolinfoW.lpszText = bufW;
837  SendMessageW(hwnd, TTM_ENUMTOOLSW, 0, (LPARAM)&toolinfoW);
838  textlen = lstrlenW(toolinfoW.lpszText);
839  ok(textlen == lenW, "lpszText has %d chars\n", textlen);
840  ok(toolinfoW.uId == 0x1234ABCD,
841  "uId should be retrieved, got %p\n", (void*)toolinfoW.uId);
842 
843  memset(bufW, 0, sizeof(bufW));
844  toolinfoW.hwnd = NULL;
845  toolinfoW.uId = 0x1234ABCD;
846  toolinfoW.lpszText = bufW;
847  SendMessageW(hwnd, TTM_GETTOOLINFOW, 0, (LPARAM)&toolinfoW);
848  textlen = lstrlenW(toolinfoW.lpszText);
849  ok(textlen == lenW, "lpszText has %d chars\n", textlen);
850 
851  memset(bufW, 0, sizeof(bufW));
852  toolinfoW.hwnd = NULL;
853  toolinfoW.uId = 0x1234ABCD;
854  toolinfoW.lpszText = bufW;
855  SendMessageW(hwnd, TTM_GETTEXTW, 0, (LPARAM)&toolinfoW);
856  textlen = lstrlenW(toolinfoW.lpszText);
857  ok(textlen == lenW ||
858  broken(textlen == 0 && toolinfoW.lpszText == NULL), /* nt4, kb186177 */
859  "lpszText has %d chars\n", textlen);
860  }
861 
863 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TTM_ENUMTOOLSW
Definition: commctrl.h:1780
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
#define lstrlenW
Definition: compat.h:407
BOOL WINAPI DestroyWindow(_In_ HWND)
LPWSTR lpszText
Definition: commctrl.h:1718
#define TTM_GETTOOLINFOW
Definition: commctrl.h:1767
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT_PTR uId
Definition: commctrl.h:1715
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1679
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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 broken(x)
Definition: _sntprintf.h:21
HINSTANCE hinst
Definition: commctrl.h:1717
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TTM_GETTEXTW
Definition: commctrl.h:1775
#define ARRAY_SIZE(a)
Definition: main.h:24
#define TTM_ADDTOOLW
Definition: commctrl.h:1759
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MultiByteToWideChar
Definition: compat.h:100
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
LONG_PTR LRESULT
Definition: windef.h:209
#define memset(x, y, z)
Definition: compat.h:39
#define TTTOOLINFOW_V2_SIZE
Definition: commctrl.h:1695
LPARAM lParam
Definition: commctrl.h:1719

Referenced by START_TEST().

◆ test_margin()

static void test_margin ( void  )
static

Definition at line 1070 of file tooltips.c.

1071 {
1072  RECT r, r1;
1073  HWND hwnd;
1074  DWORD ret;
1075 
1077  10, 10, 300, 100,
1078  NULL, NULL, NULL, 0);
1079  ok(hwnd != NULL, "failed to create tooltip wnd\n");
1080 
1081  ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
1082  ok(!ret, "got %d\n", ret);
1083 
1084  SetRect(&r, -1, -1, 1, 1);
1086  ok(!ret, "got %d\n", ret);
1087 
1088  SetRectEmpty(&r1);
1090  ok(!ret, "got %d\n", ret);
1091  ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));
1092 
1093  ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0);
1094  ok(!ret, "got %d\n", ret);
1095 
1096  SetRectEmpty(&r1);
1098  ok(!ret, "got %d\n", ret);
1099  ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r));
1100 
1101  ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, 0);
1102  ok(!ret, "got %d\n", ret);
1103 
1105 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TTM_GETMARGIN
Definition: commctrl.h:1794
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static DNS_RECORDW r1
Definition: record.c:37
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define TTM_SETMARGIN
Definition: commctrl.h:1793
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
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)

Referenced by START_TEST().

◆ test_setinfo()

static void test_setinfo ( BOOL  is_v6)
static

Definition at line 935 of file tooltips.c.

936 {
937  WNDCLASSA wc;
938  LRESULT lResult;
939  HWND parent, parent2, hwndTip, hwndTip2;
940  TTTOOLINFOA toolInfo = { 0 };
941  TTTOOLINFOA toolInfo2 = { 0 };
943 
944  /* Create a class to use the custom draw wndproc */
945  wc.style = CS_HREDRAW | CS_VREDRAW;
946  wc.cbClsExtra = 0;
947  wc.cbWndExtra = 0;
949  wc.hIcon = NULL;
952  wc.lpszMenuName = NULL;
953  wc.lpszClassName = "SetInfoClass";
955  RegisterClassA(&wc);
956 
957  /* Create a main window */
958  parent = CreateWindowExA(0, "SetInfoClass", NULL,
961  50, 50,
962  300, 300,
963  NULL, NULL, NULL, 0);
964  ok(parent != NULL, "Creation of main window failed\n");
965 
966  parent2 = CreateWindowExA(0, "SetInfoClass", NULL,
969  50, 50,
970  300, 300,
971  NULL, NULL, NULL, 0);
972  ok(parent2 != NULL, "Creation of main window failed\n");
973 
974  /* Make it show */
975  ShowWindow(parent2, SW_SHOWNORMAL);
976  flush_events(100);
977 
978  /* Create Tooltip */
984  ok(hwndTip != NULL, "Creation of tooltip window failed\n");
985 
991  ok(hwndTip2 != NULL, "Creation of tooltip window failed\n");
992 
993 
994  /* Make it topmost, as per the MSDN */
995  SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0,
997 
998  /* Create a tool */
999  toolInfo.cbSize = TTTOOLINFOA_V1_SIZE;
1000  toolInfo.hwnd = parent;
1001  toolInfo.hinst = GetModuleHandleA(NULL);
1002  toolInfo.uFlags = TTF_SUBCLASS;
1003  toolInfo.uId = 0x1234ABCD;
1004  toolInfo.lpszText = (LPSTR)"This is a test tooltip";
1005  toolInfo.lParam = 0xdeadbeef;
1006  GetClientRect (parent, &toolInfo.rect);
1007  lResult = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
1008  ok(lResult, "Adding the tool to the tooltip failed\n");
1009 
1010  toolInfo.cbSize = TTTOOLINFOA_V1_SIZE;
1011  toolInfo.hwnd = parent2;
1012  toolInfo.hinst = GetModuleHandleA(NULL);
1013  toolInfo.uFlags = 0;
1014  toolInfo.uId = 0x1234ABCE;
1015  toolInfo.lpszText = (LPSTR)"This is a test tooltip";
1016  toolInfo.lParam = 0xdeadbeef;
1017  GetClientRect (parent, &toolInfo.rect);
1018  lResult = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&toolInfo);
1019  ok(lResult, "Adding the tool to the tooltip failed\n");
1020 
1021  /* Try to Remove Subclass */
1022  toolInfo2.cbSize = TTTOOLINFOA_V1_SIZE;
1023  toolInfo2.hwnd = parent;
1024  toolInfo2.uId = 0x1234ABCD;
1025  lResult = SendMessageA(hwndTip, TTM_GETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1026  ok(lResult, "GetToolInfo failed\n");
1027  ok(toolInfo2.uFlags & TTF_SUBCLASS || broken(is_v6 && !(toolInfo2.uFlags & TTF_SUBCLASS)) /* XP */,
1028  "uFlags does not have subclass\n");
1030  ok (wndProc != info_wnd_proc, "Window Proc is wrong\n");
1031 
1032  toolInfo2.uFlags &= ~TTF_SUBCLASS;
1033  SendMessageA(hwndTip, TTM_SETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1034  lResult = SendMessageA(hwndTip, TTM_GETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1035  ok(lResult, "GetToolInfo failed\n");
1036  ok(!(toolInfo2.uFlags & TTF_SUBCLASS), "uFlags has subclass\n");
1038  ok (wndProc != info_wnd_proc, "Window Proc is wrong\n");
1039 
1040  /* Try to Add Subclass */
1041 
1042  /* Make it topmost, as per the MSDN */
1043  SetWindowPos(hwndTip2, HWND_TOPMOST, 0, 0, 0, 0,
1045 
1046  toolInfo2.cbSize = TTTOOLINFOA_V1_SIZE;
1047  toolInfo2.hwnd = parent2;
1048  toolInfo2.uId = 0x1234ABCE;
1049  lResult = SendMessageA(hwndTip, TTM_GETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1050  ok(lResult, "GetToolInfo failed\n");
1051  ok(!(toolInfo2.uFlags & TTF_SUBCLASS), "uFlags has subclass\n");
1053  ok (wndProc == info_wnd_proc, "Window Proc is wrong\n");
1054 
1055  toolInfo2.uFlags |= TTF_SUBCLASS;
1056  SendMessageA(hwndTip, TTM_SETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1057  lResult = SendMessageA(hwndTip, TTM_GETTOOLINFOA, 0, (LPARAM)&toolInfo2);
1058  ok(lResult, "GetToolInfo failed\n");
1059  ok(toolInfo2.uFlags & TTF_SUBCLASS, "uFlags does not have subclass\n");
1061  ok (wndProc == info_wnd_proc, "Window Proc is wrong\n");
1062 
1063  /* Clean up */
1064  DestroyWindow(hwndTip);
1065  DestroyWindow(hwndTip2);
1067  DestroyWindow(parent2);
1068 }
LPARAM lParam
Definition: commctrl.h:1707
static LRESULT WINAPI wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm32.c:179
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int cbClsExtra
Definition: winuser.h:3118
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define HWND_TOPMOST
Definition: winuser.h:1194
HBRUSH hbrBackground
Definition: winuser.h:3123
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HINSTANCE hinst
Definition: commctrl.h:1705
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
#define COLOR_WINDOW
Definition: winuser.h:908
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
int cbWndExtra
Definition: winuser.h:3119
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1766
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define ok(value,...)
HCURSOR hCursor
Definition: winuser.h:3122
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define GetWindowLongPtrA
Definition: winuser.h:4697
#define WS_CAPTION
Definition: pedump.c:624
#define CS_VREDRAW
Definition: winuser.h:653
r parent
Definition: btrfs.c:2708
#define SWP_NOACTIVATE
Definition: winuser.h:1227
static void flush_events(int waitTime)
Definition: tooltips.c:82
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_EX_TOPMOST
Definition: pedump.c:647
LPCSTR lpszClassName
Definition: winuser.h:3125
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT_PTR uId
Definition: commctrl.h:1703
#define GWLP_WNDPROC
Definition: treelist.c:66
#define broken(x)
Definition: _sntprintf.h:21
#define TTTOOLINFOA_V1_SIZE
Definition: commctrl.h:1692
UINT style
Definition: winuser.h:3116
#define SWP_NOSIZE
Definition: winuser.h:1230
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define WS_MINIMIZEBOX
Definition: pedump.c:631
HINSTANCE hInstance
Definition: winuser.h:3120
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define IDC_ARROW
Definition: winuser.h:682
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 SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WS_SYSMENU
Definition: pedump.c:629
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define TTF_SUBCLASS
Definition: commctrl.h:1739
#define TTM_SETTOOLINFOA
Definition: commctrl.h:1769
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3121
LPSTR lpszText
Definition: commctrl.h:1706
static LRESULT CALLBACK info_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:921

Referenced by START_TEST().

◆ test_track()

static void test_track ( void  )
static

Definition at line 870 of file tooltips.c.

871 {
872  WCHAR textW[] = {'t','e','x','t',0};
873  TTTOOLINFOW info = { 0 };
874  HWND parent, tt;
875  LRESULT res;
876  RECT pos;
877 
879  50, 50, 300, 300, NULL, NULL, NULL, 0);
880  ok(parent != NULL, "creation of parent window failed\n");
881 
883  flush_events(100);
884 
888  ok(tt != NULL, "creation of tooltip window failed\n");
889 
890  info.cbSize = TTTOOLINFOW_V1_SIZE;
892  info.hwnd = parent;
893  info.hinst = GetModuleHandleW(NULL);
894  info.lpszText = textW;
895  info.uId = (UINT_PTR)parent;
896  GetClientRect(parent, &info.rect);
897 
898  res = SendMessageW(tt, TTM_ADDTOOLW, 0, (LPARAM)&info);
899  ok(res, "adding the tool to the tooltip failed\n");
900 
903  SendMessageW(tt, TTM_TRACKPOSITION, 0, MAKELPARAM(10, 10));
904 
905  GetWindowRect(tt, &pos);
906  ok(almost_eq(pos.left, 10), "pos.left = %d\n", pos.left);
907  ok(almost_eq(pos.top, 10), "pos.top = %d\n", pos.top);
908 
909  info.uFlags = TTF_IDISHWND | TTF_ABSOLUTE;
911  SendMessageW(tt, TTM_TRACKPOSITION, 0, MAKELPARAM(10, 10));
912 
913  GetWindowRect(tt, &pos);
914  ok(!almost_eq(pos.left, 10), "pos.left = %d\n", pos.left);
915  ok(!almost_eq(pos.top, 10), "pos.top = %d\n", pos.top);
916 
917  DestroyWindow(tt);
919 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
#define TRUE
Definition: types.h:120
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
#define TTM_TRACKPOSITION
Definition: commctrl.h:1785
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TTTOOLINFOW_V1_SIZE
Definition: commctrl.h:1693
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define TTF_IDISHWND
Definition: commctrl.h:1736
#define ok(value,...)
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
static BOOL almost_eq(int a, int b)
Definition: tooltips.c:865
LONG_PTR LPARAM
Definition: windef.h:208
#define TTF_TRACK
Definition: commctrl.h:1740
#define WS_CAPTION
Definition: pedump.c:624
#define TTF_ABSOLUTE
Definition: commctrl.h:1741
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void flush_events(int waitTime)
Definition: tooltips.c:82
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1679
#define TTM_SETDELAYTIME
Definition: commctrl.h:1757
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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_EX_TOPMOST
Definition: pedump.c:647
static const WCHAR textW[]
Definition: itemdlg.c:1559
#define TTM_SETTOOLINFOW
Definition: commctrl.h:1770
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TTM_TRACKACTIVATE
Definition: commctrl.h:1784
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TTM_ADDTOOLW
Definition: commctrl.h:1759
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WC_STATICW
Definition: commctrl.h:4651
GLuint res
Definition: glext.h:9613
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
#define TTDT_INITIAL
Definition: commctrl.h:1749
#define TTS_NOPREFIX
Definition: commctrl.h:1730

Referenced by START_TEST().

◆ test_TTM_ADDTOOL()

static void test_TTM_ADDTOOL ( BOOL  is_v6)
static

Definition at line 1107 of file tooltips.c.

1108 {
1109  static const WCHAR testW[] = {'T','e','s','t',0};
1110  TTTOOLINFOW tiW;
1111  TTTOOLINFOA ti;
1112  int ret, size;
1113  HWND hwnd, parent;
1114  UINT max_size;
1115 
1116  parent = CreateWindowExA(0, "Static", NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, 0);
1117  ok(parent != NULL, "failed to create parent wnd\n");
1118 
1120  0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1121  ok(hwnd != NULL, "Failed to create tooltip window.\n");
1122 
1123  for (size = 0; size <= TTTOOLINFOW_V3_SIZE + 1; size++)
1124  {
1125  ti.cbSize = size;
1126  ti.hwnd = NULL;
1127  ti.hinst = GetModuleHandleA(NULL);
1128  ti.uFlags = 0;
1129  ti.uId = 0x1234abce;
1130  ti.lpszText = (LPSTR)"Test";
1131  ti.lParam = 0xdeadbeef;
1132  GetClientRect(hwnd, &ti.rect);
1133 
1134  ret = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
1135  ok(ret, "Failed to add a tool, size %d.\n", size);
1136 
1138  ok(ret == 1, "Unexpected tool count %d, size %d.\n", ret, size);
1139 
1140  ret = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&ti);
1141  ok(!ret, "Unexpected ret value %d.\n", ret);
1142 
1144  ok(ret == 0, "Unexpected tool count %d, size %d.\n", ret, size);
1145  }
1146 
1147  /* W variant checks cbSize. */
1149  for (size = 0; size <= max_size + 1; size++)
1150  {
1151  tiW.cbSize = size;
1152  tiW.hwnd = NULL;
1153  tiW.hinst = GetModuleHandleA(NULL);
1154  tiW.uFlags = 0;
1155  tiW.uId = 0x1234abce;
1156  tiW.lpszText = (LPWSTR)testW;
1157  tiW.lParam = 0xdeadbeef;
1158  GetClientRect(hwnd, &tiW.rect);
1159 
1160  ret = SendMessageA(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&tiW);
1161  todo_wine_if(!is_v6 && size > max_size)
1162  ok(size <= max_size ? ret : !ret, "%d: Unexpected ret value %d, size %d, max size %d.\n", is_v6, ret, size, max_size);
1163  if (ret)
1164  {
1166  ok(ret == 1, "Unexpected tool count %d.\n", ret);
1167 
1168  ret = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&tiW);
1169  ok(!ret, "Unexpected ret value %d.\n", ret);
1170 
1172  ok(ret == 0, "Unexpected tool count %d.\n", ret);
1173  }
1174  }
1175 
1177 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: commctrl.h:1707
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HINSTANCE hinst
Definition: commctrl.h:1705
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
LPWSTR lpszText
Definition: commctrl.h:1718
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define ok(value,...)
static INT max_size
Definition: history.c:51
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define todo_wine_if(is_todo)
Definition: test.h:155
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2708
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT_PTR uId
Definition: commctrl.h:1715
#define TTM_DELTOOLA
Definition: commctrl.h:1760
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_EX_TOPMOST
Definition: pedump.c:647
UINT_PTR uId
Definition: commctrl.h:1703
HINSTANCE hinst
Definition: commctrl.h:1717
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TTM_ADDTOOLW
Definition: commctrl.h:1759
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
#define TTM_GETTOOLCOUNT
Definition: commctrl.h:1778
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
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)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define TTTOOLINFOW_V3_SIZE
Definition: commctrl.h:1697
#define TTS_NOPREFIX
Definition: commctrl.h:1730
#define TTTOOLINFOW_V2_SIZE
Definition: commctrl.h:1695
static const WCHAR testW[]
Definition: jsregexp.c:44
LPSTR lpszText
Definition: commctrl.h:1706
LPARAM lParam
Definition: commctrl.h:1719

Referenced by START_TEST().

◆ test_ttm_gettoolinfo()

static void test_ttm_gettoolinfo ( void  )
static

Definition at line 549 of file tooltips.c.

550 {
551  TTTOOLINFOA ti;
552  TTTOOLINFOW tiW;
553  HWND hwnd;
554  DWORD r;
555 
556  hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, 10, 10, 300, 100, NULL, NULL, NULL, 0);
557  ok(hwnd != NULL, "Failed to create tooltip control.\n");
558 
560  ti.hwnd = NULL;
562  ti.uFlags = 0;
563  ti.uId = 0x1234ABCD;
564  ti.lpszText = NULL;
565  ti.lParam = 0x1abe11ed;
566  GetClientRect(hwnd, &ti.rect);
567  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
568  ok(r, "Adding the tool to the tooltip failed\n");
569 
571  ti.lParam = 0xaaaaaaaa;
573  ok(r, "Getting tooltip info failed\n");
574  ok(0x1abe11ed == ti.lParam ||
575  broken(0x1abe11ed != ti.lParam), /* comctl32 < 5.81 */
576  "Expected 0x1abe11ed, got %lx\n", ti.lParam);
577 
579  tiW.hwnd = NULL;
580  tiW.uId = 0x1234ABCD;
581  tiW.lParam = 0xaaaaaaaa;
582  tiW.lpszText = NULL;
583  r = SendMessageA(hwnd, TTM_GETTOOLINFOW, 0, (LPARAM)&tiW);
584  ok(r, "Getting tooltip info failed\n");
585  ok(0x1abe11ed == tiW.lParam ||
586  broken(0x1abe11ed != tiW.lParam), /* comctl32 < 5.81 */
587  "Expected 0x1abe11ed, got %lx\n", tiW.lParam);
588 
590  ti.uId = 0x1234ABCD;
591  ti.lParam = 0x55555555;
593 
595  ti.lParam = 0xdeadbeef;
597  ok(r, "Getting tooltip info failed\n");
598  ok(0x55555555 == ti.lParam ||
599  broken(0x55555555 != ti.lParam), /* comctl32 < 5.81 */
600  "Expected 0x55555555, got %lx\n", ti.lParam);
601 
603 
604  /* 1. test size parameter validation rules (ansi messages) */
606  10, 10, 300, 100,
607  NULL, NULL, NULL, 0);
608 
609  ti.cbSize = TTTOOLINFOA_V1_SIZE - 1;
610  ti.hwnd = NULL;
612  ti.uFlags = 0;
613  ti.uId = 0x1234ABCD;
614  ti.lpszText = NULL;
615  ti.lParam = 0xdeadbeef;
616  GetClientRect(hwnd, &ti.rect);
617  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
618  ok(r, "Adding the tool to the tooltip failed\n");
620  expect(1, r);
621 
622  ti.cbSize = TTTOOLINFOA_V1_SIZE - 1;
623  ti.hwnd = NULL;
624  ti.uId = 0x1234ABCD;
627  expect(0, r);
628 
629  ti.cbSize = TTTOOLINFOA_V2_SIZE - 1;
630  ti.hwnd = NULL;
632  ti.uFlags = 0;
633  ti.uId = 0x1234ABCD;
634  ti.lpszText = NULL;
635  ti.lParam = 0xdeadbeef;
636  GetClientRect(hwnd, &ti.rect);
637  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
638  ok(r, "Adding the tool to the tooltip failed\n");
640  expect(1, r);
641 
642  ti.cbSize = TTTOOLINFOA_V2_SIZE - 1;
643  ti.hwnd = NULL;
644  ti.uId = 0x1234ABCD;
647  expect(0, r);
648 
649  ti.cbSize = TTTOOLINFOA_V2_SIZE + 1;
650  ti.hwnd = NULL;
652  ti.uFlags = 0;
653  ti.uId = 0x1234ABCD;
654  ti.lpszText = NULL;
655  ti.lParam = 0xdeadbeef;
656  GetClientRect(hwnd, &ti.rect);
657  r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti);
658  ok(r, "Adding the tool to the tooltip failed\n");
660  expect(1, r);
661 
662  ti.cbSize = TTTOOLINFOA_V2_SIZE + 1;
663  ti.hwnd = NULL;
664  ti.uId = 0x1234ABCD;
667  expect(0, r);
668 
670 
671  /* 2. test size parameter validation rules (w-messages) */
673  10, 10, 300, 100,
674  NULL, NULL, NULL, 0);
675  ok(hwnd != NULL, "Failed to create tooltip window.\n");
676 
677  tiW.cbSize = TTTOOLINFOW_V1_SIZE - 1;
678  tiW.hwnd = NULL;
679  tiW.hinst = GetModuleHandleA(NULL);
680  tiW.uFlags = 0;
681  tiW.uId = 0x1234ABCD;
682  tiW.lpszText = NULL;
683  tiW.lParam = 0xdeadbeef;
684  GetClientRect(hwnd, &tiW.rect);
685  r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&tiW);
686  ok(r, "Adding the tool to the tooltip failed\n");
688  expect(1, r);
689 
690  tiW.cbSize = TTTOOLINFOW_V1_SIZE - 1;
691  tiW.hwnd = NULL;
692  tiW.uId = 0x1234ABCD;
693  SendMessageW(hwnd, TTM_DELTOOLW, 0, (LPARAM)&tiW);
695  expect(0, r);
696 
697  tiW.cbSize = TTTOOLINFOW_V2_SIZE - 1;
698  tiW.hwnd = NULL;
699  tiW.hinst = GetModuleHandleA(NULL);
700  tiW.uFlags = 0;
701  tiW.uId = 0x1234ABCD;
702  tiW.lpszText = NULL;
703  tiW.lParam = 0xdeadbeef;
704  GetClientRect(hwnd, &tiW.rect);
705  r = SendMessageW(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&tiW);
706  ok(r, "Adding the tool to the tooltip failed\n");
708  expect(1, r);
709 
710  tiW.cbSize = TTTOOLINFOW_V2_SIZE - 1;
711  tiW.hwnd = NULL;
712  tiW.uId = 0x1234ABCD;
713  SendMessageW(hwnd, TTM_DELTOOLW, 0, (LPARAM)&tiW);
715  expect(0, r);
716 
717  tiW.cbSize = TTTOOLINFOW_V2_SIZE + 1;
718  tiW.hwnd = NULL;
719  tiW.hinst = GetModuleHandleA(NULL);
720  tiW.uFlags = 0;
721  tiW.uId = 0x1234ABCD;
722  tiW.lpszText = NULL;
723  tiW.lParam = 0xdeadbeef;
724  GetClientRect(hwnd, &tiW.rect);
725  r = SendMessageW(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&tiW);
726  ok(r, "Adding the tool to the tooltip failed\n");
728  expect(1, r);
729  /* looks like TTM_DELTOOLW doesn't work with invalid size */
730  tiW.cbSize = TTTOOLINFOW_V2_SIZE + 1;
731  tiW.hwnd = NULL;
732  tiW.uId = 0x1234ABCD;
733  SendMessageW(hwnd, TTM_DELTOOLW, 0, (LPARAM)&tiW);
735  expect(1, r);
736 
738  tiW.hwnd = NULL;
739  tiW.uId = 0x1234ABCD;
740  SendMessageW(hwnd, TTM_DELTOOLW, 0, (LPARAM)&tiW);
742  expect(0, r);
743 
745 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TTTOOLINFOA_V2_SIZE
Definition: commctrl.h:1694
LPARAM lParam
Definition: commctrl.h:1707
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HINSTANCE hinst
Definition: commctrl.h:1705
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
#define TTTOOLINFOW_V1_SIZE
Definition: commctrl.h:1693
LPWSTR lpszText
Definition: commctrl.h:1718
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1766
#define TTM_GETTOOLINFOW
Definition: commctrl.h:1767
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define expect(expected, got)
Definition: tooltips.c:30
UINT_PTR uId
Definition: commctrl.h:1715
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TTM_DELTOOLA
Definition: commctrl.h:1760
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1679
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
UINT_PTR uId
Definition: commctrl.h:1703
#define broken(x)
Definition: _sntprintf.h:21
#define TTTOOLINFOA_V1_SIZE
Definition: commctrl.h:1692
HINSTANCE hinst
Definition: commctrl.h:1717
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define TTM_ADDTOOLW
Definition: commctrl.h:1759
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
#define TTM_GETTOOLCOUNT
Definition: commctrl.h:1778
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 TTM_DELTOOLW
Definition: commctrl.h:1761
#define TTTOOLINFOW_V2_SIZE
Definition: commctrl.h:1695
#define TTM_SETTOOLINFOA
Definition: commctrl.h:1769
LPSTR lpszText
Definition: commctrl.h:1706
LPARAM lParam
Definition: commctrl.h:1719

Referenced by START_TEST().

◆ test_TTN_SHOW()

static void test_TTN_SHOW ( void  )
static

Definition at line 1185 of file tooltips.c.

1186 {
1187  HWND hwndTip, hwnd;
1188  TTTOOLINFOA ti;
1189  RECT rect;
1190  BOOL ret;
1191 
1193  ok(hwnd != NULL, "Failed to create parent window.\n");
1194 
1195  /* Put cursor outside the window */
1196  GetWindowRect(hwnd, &rect);
1197  SetCursorPos(rect.right + 200, 0);
1198 
1200  flush_events(100);
1201 
1202  /* Create tooltip */
1203  hwndTip = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, NULL, TTS_ALWAYSTIP, 10, 10, 300, 300,
1204  hwnd, NULL, NULL, 0);
1205  ok(hwndTip != NULL, "Failed to create tooltip window.\n");
1206 
1207  SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
1208 
1209  ti.cbSize = sizeof(TTTOOLINFOA);
1210  ti.hwnd = hwnd;
1211  ti.hinst = GetModuleHandleA(NULL);
1212  ti.uFlags = TTF_SUBCLASS;
1213  ti.uId = 0x1234abcd;
1214  ti.lpszText = (LPSTR)"This is a test tooltip";
1215  ti.lParam = 0xdeadbeef;
1216  GetClientRect(hwnd, &ti.rect);
1217  ret = SendMessageA(hwndTip, TTM_ADDTOOLA, 0, (LPARAM)&ti);
1218  ok(ret, "Failed to add a tool.\n");
1219 
1220  /* Make tooltip appear quickly */
1222 
1224 
1225  /* Put cursor inside window, tooltip will appear immediately */
1226  GetWindowRect(hwnd, &rect);
1227  SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
1228  flush_events(200);
1229 
1230  ok_sequence(sequences, PARENT_SEQ_INDEX, ttn_show_parent_seq, "TTN_SHOW parent seq", FALSE);
1231 
1232  DestroyWindow(hwndTip);
1234 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LPARAM lParam
Definition: commctrl.h:1707
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
#define HWND_TOPMOST
Definition: winuser.h:1194
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HINSTANCE hinst
Definition: commctrl.h:1705
static HWND create_parent_window(void)
Definition: tooltips.c:341
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
& rect
Definition: startmenu.cpp:1413
#define TTM_ADDTOOLA
Definition: commctrl.h:1758
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: tooltips.c:38
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TTS_ALWAYSTIP
Definition: commctrl.h:1729
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static const struct message ttn_show_parent_seq[]
Definition: tooltips.c:1179
LONG_PTR LPARAM
Definition: windef.h:208
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
static void flush_events(int waitTime)
Definition: tooltips.c:82
#define TTM_SETDELAYTIME
Definition: commctrl.h:1757
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_EX_TOPMOST
Definition: pedump.c:647
UINT_PTR uId
Definition: commctrl.h:1703
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1680
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
struct tagTOOLINFOA TTTOOLINFOA
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 SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define TTDT_INITIAL
Definition: commctrl.h:1749
#define TTF_SUBCLASS
Definition: commctrl.h:1739
LPSTR lpszText
Definition: commctrl.h:1706

Referenced by START_TEST().

Variable Documentation

◆ CD_Result

LRESULT CD_Result
static

Definition at line 97 of file tooltips.c.

Referenced by custom_draw_wnd_proc(), and test_customdraw().

◆ CD_Stages

int CD_Stages
static

Definition at line 96 of file tooltips.c.

Referenced by custom_draw_wnd_proc(), and test_customdraw().

◆ g_hwnd

HWND g_hwnd
static

Definition at line 98 of file tooltips.c.

Referenced by custom_draw_wnd_proc(), and test_customdraw().

◆ g_ttip_rect

RECT g_ttip_rect
static

Definition at line 276 of file tooltips.c.

Referenced by parent_wnd_proc().

◆ sequences

Definition at line 38 of file tooltips.c.

Referenced by parent_wnd_proc(), START_TEST(), and test_TTN_SHOW().

◆ testcallbackA

const CHAR testcallbackA[] = "callback"
static

Definition at line 274 of file tooltips.c.

Referenced by parent_wnd_proc(), and test_gettext().

◆ ttn_show_parent_seq

const struct message ttn_show_parent_seq[]
static
Initial value:
=
{
{ WM_NOTIFY, sent|id, 0, 0, TTN_SHOW },
{ 0 }
}
#define TTN_SHOW
Definition: commctrl.h:1846
Definition: msg.h:34
GLenum GLuint id
Definition: glext.h:5579
#define WM_NOTIFY
Definition: richedit.h:61

Definition at line 1179 of file tooltips.c.

Referenced by test_TTN_SHOW().