ReactOS  0.4.12-dev-418-g3df31a8
treeview.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "wine/commctrl.h"
#include "wine/test.h"
#include "v6util.h"
#include "msg.h"
Include dependency graph for treeview.c:

Go to the source code of this file.

Classes

struct  _ITEM_DATA
 

Macros

#define NUM_MSG_SEQUENCES   3
 
#define TREEVIEW_SEQ_INDEX   0
 
#define PARENT_SEQ_INDEX   1
 
#define PARENT_CD_SEQ_INDEX   2
 
#define expect(expected, got)   ok(got == expected, "Expected %d, got %d\n", expected, got)
 
#define check_item(a, b, c, d)   _check_item(a, b, c, d, __LINE__)
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX *)
 
static void flush_events (void)
 
static void Clear (void)
 
static void AddItem (char ch)
 
static void IdentifyItem (HTREEITEM hItem)
 
static LRESULT WINAPI TreeviewWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static HWND create_treeview_control (DWORD style)
 
static void fill_tree (HWND hTree)
 
static void test_fillroot (void)
 
static void test_callback (void)
 
static void test_select (void)
 
static void test_getitemtext (void)
 
static void test_focus (void)
 
static void test_get_set_bkcolor (void)
 
static void test_get_set_imagelist (void)
 
static void test_get_set_indent (void)
 
static void test_get_set_insertmark (void)
 
static void test_get_set_item (void)
 
static void test_get_set_itemheight (void)
 
static void test_get_set_scrolltime (void)
 
static void test_get_set_textcolor (void)
 
static void test_get_set_tooltips (void)
 
static void test_get_set_unicodeformat (void)
 
static LRESULT CALLBACK parent_wnd_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_expandinvisible (void)
 
static void test_itemedit (void)
 
static void test_treeview_classinfo (void)
 
static void test_get_linecolor (void)
 
static void test_get_insertmarkcolor (void)
 
static void test_expandnotify (void)
 
static void test_expandedimage (void)
 
static void test_TVS_SINGLEEXPAND (void)
 
static void test_WM_PAINT (void)
 
static void test_delete_items (void)
 
static void test_cchildren (void)
 
static void _check_item (HTREEITEM item, HTREEITEM parent, HTREEITEM nextsibling, HTREEITEM firstchild, int line)
 
static void test_htreeitem_layout (void)
 
static void test_TVS_CHECKBOXES (void)
 
static void test_TVM_GETNEXTITEM (void)
 
static void test_TVM_HITTEST (void)
 
static void test_WM_GETDLGCODE (void)
 
static void test_customdraw (void)
 
static void test_WM_KEYDOWN (void)
 
static void test_TVS_FULLROWSELECT (void)
 
static void get_item_names_string (HWND hwnd, HTREEITEM item, char *str)
 
static void fill_treeview_sort_test (HWND hwnd)
 
static void test_TVM_SORTCHILDREN (void)
 
static void test_right_click (void)
 
static void init_functions (void)
 
 START_TEST (treeview)
 

Variables

static const charTEST_CALLBACK_TEXT = "callback_text"
 
static TVITEMA g_item_expanding
 
static TVITEMA g_item_expanded
 
static BOOL g_get_from_expand
 
static BOOL g_get_rect_in_expand
 
static BOOL g_disp_A_to_W
 
static BOOL g_disp_set_stateimage
 
static BOOL g_beginedit_alter_text
 
static HFONT g_customdraw_font
 
static BOOL g_v6
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static struct msg_sequenceitem_sequence [1]
 
static const struct message FillRootSeq []
 
static const struct message rootnone_select_seq []
 
static const struct message rootchild_select_seq []
 
static const struct message getitemtext_seq []
 
static const struct message focus_seq []
 
static const struct message test_get_set_bkcolor_seq []
 
static const struct message test_get_set_imagelist_seq []
 
static const struct message test_get_set_indent_seq []
 
static const struct message test_get_set_insertmarkcolor_seq []
 
static const struct message test_get_set_item_seq []
 
static const struct message test_get_set_itemheight_seq []
 
static const struct message test_get_set_scrolltime_seq []
 
static const struct message test_get_set_textcolor_seq []
 
static const struct message test_get_set_tooltips_seq []
 
static const struct message test_get_set_unicodeformat_seq []
 
static const struct message test_right_click_seq []
 
static const struct message parent_expand_seq []
 
static const struct message parent_expand_kb_seq []
 
static const struct message parent_collapse_2nd_kb_seq []
 
static const struct message parent_expand_empty_kb_seq []
 
static const struct message parent_singleexpand_seq0 []
 
static const struct message parent_singleexpand_seq1 []
 
static const struct message parent_singleexpand_seq2 []
 
static const struct message parent_singleexpand_seq3 []
 
static const struct message parent_singleexpand_seq4 []
 
static const struct message parent_singleexpand_seq5 []
 
static const struct message parent_singleexpand_seq6 []
 
static const struct message parent_singleexpand_seq7 []
 
static const struct message parent_get_dispinfo_seq []
 
static const struct message empty_seq []
 
static const struct message parent_cd_seq []
 
static const struct message parent_vk_return_seq []
 
static const struct message parent_right_click_seq []
 
static HWND hMainWnd
 
static HTREEITEM hRoot
 
static HTREEITEM hChild
 
static int pos = 0
 
static char sequence [256]
 

Macro Definition Documentation

◆ check_item

#define check_item (   a,
  b,
  c,
  d 
)    _check_item(a, b, c, d, __LINE__)

Definition at line 2146 of file treeview.c.

◆ expect

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

Definition at line 53 of file treeview.c.

◆ NUM_MSG_SEQUENCES

#define NUM_MSG_SEQUENCES   3

Definition at line 48 of file treeview.c.

◆ PARENT_CD_SEQ_INDEX

#define PARENT_CD_SEQ_INDEX   2

Definition at line 51 of file treeview.c.

◆ PARENT_SEQ_INDEX

#define PARENT_SEQ_INDEX   1

Definition at line 50 of file treeview.c.

◆ TREEVIEW_SEQ_INDEX

#define TREEVIEW_SEQ_INDEX   0

Definition at line 49 of file treeview.c.

◆ X

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

Function Documentation

◆ _check_item()

static void _check_item ( HTREEITEM  item,
HTREEITEM  parent,
HTREEITEM  nextsibling,
HTREEITEM  firstchild,
int  line 
)
static

Definition at line 2137 of file treeview.c.

2138 {
2139  struct _ITEM_DATA *data = (struct _ITEM_DATA*)item;
2140 
2141  ok_(__FILE__, line)(data->parent == parent, "parent %p, got %p\n", parent, data->parent);
2142  ok_(__FILE__, line)(data->nextsibling == nextsibling, "sibling %p, got %p\n", nextsibling, data->nextsibling);
2143  ok_(__FILE__, line)(data->firstchild == firstchild, "firstchild %p, got %p\n", firstchild, data->firstchild);
2144 }
Definition: parser.c:48
r parent
Definition: btrfs.c:2659
HTREEITEM nextsibling
Definition: treeview.c:2133
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static ATOM item
Definition: dde.c:856
HTREEITEM firstchild
Definition: treeview.c:2134
#define ok_(x1, x2)
Definition: CString.cpp:56

◆ AddItem()

static void AddItem ( char  ch)
static

Definition at line 392 of file treeview.c.

393 {
394  sequence[pos++] = ch;
395  sequence[pos] = '\0';
396 }
static int pos
Definition: treeview.c:383
static char sequence[256]
Definition: treeview.c:384

Referenced by IdentifyItem(), parent_wnd_proc(), test_fillroot(), and test_select().

◆ BOOL()

static BOOL ( WINAPI pInitCommonControlsEx) const
static

◆ Clear()

static void Clear ( void  )
static

Definition at line 386 of file treeview.c.

387 {
388  pos = 0;
389  sequence[0] = '\0';
390 }
static int pos
Definition: treeview.c:383
static char sequence[256]
Definition: treeview.c:384

Referenced by test_fillroot(), and test_select().

◆ create_treeview_control()

static HWND create_treeview_control ( DWORD  style)
static

Definition at line 437 of file treeview.c.

438 {
440  HWND hTree;
441 
444  0, 0, 120, 100, hMainWnd, (HMENU)100, GetModuleHandleA(0), 0);
445 
446  SetFocus(hTree);
447 
448  /* Record the old WNDPROC so we can call it after recording the messages */
451 
452  return hTree;
453 }
static WNDPROC pOldWndProc
Definition: dateandtime.c:14
#define TVS_LINESATROOT
Definition: commctrl.h:3216
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
#define TVS_HASBUTTONS
Definition: commctrl.h:3214
#define GWLP_USERDATA
Definition: treelist.c:63
#define WC_TREEVIEWA
Definition: commctrl.h:3209
smooth NULL
Definition: ftsmooth.c:416
static HWND hMainWnd
Definition: treeview.c:379
static HWND hTree
Definition: systempage.cpp:52
#define SetWindowLongPtrA
Definition: winuser.h:5214
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define TVS_HASLINES
Definition: commctrl.h:3215
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)
static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: treeview.c:416
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 TVS_EDITLABELS
Definition: commctrl.h:3217

Referenced by test_callback(), test_cchildren(), test_customdraw(), test_delete_items(), test_expandedimage(), test_expandinvisible(), test_expandnotify(), test_fillroot(), test_focus(), test_get_insertmarkcolor(), test_get_linecolor(), test_get_set_bkcolor(), test_get_set_imagelist(), test_get_set_indent(), test_get_set_insertmark(), test_get_set_item(), test_get_set_itemheight(), test_get_set_scrolltime(), test_get_set_textcolor(), test_get_set_tooltips(), test_get_set_unicodeformat(), test_getitemtext(), test_htreeitem_layout(), test_itemedit(), test_right_click(), test_select(), test_TVM_GETNEXTITEM(), test_TVM_HITTEST(), test_TVM_SORTCHILDREN(), test_TVS_CHECKBOXES(), test_TVS_FULLROWSELECT(), test_TVS_SINGLEEXPAND(), test_WM_GETDLGCODE(), test_WM_KEYDOWN(), and test_WM_PAINT().

◆ fill_tree()

static void fill_tree ( HWND  hTree)
static

Definition at line 455 of file treeview.c.

456 {
457  TVINSERTSTRUCTA ins;
458  static CHAR root[] = "Root",
459  child[] = "Child";
460 
461  ins.hParent = TVI_ROOT;
462  ins.hInsertAfter = TVI_ROOT;
463  U(ins).item.mask = TVIF_TEXT;
464  U(ins).item.pszText = root;
466 
467  ins.hParent = hRoot;
468  ins.hInsertAfter = TVI_FIRST;
469  U(ins).item.mask = TVIF_TEXT;
470  U(ins).item.pszText = child;
472 }
static HTREEITEM hChild
Definition: treeview.c:381
char CHAR
Definition: xmlstorage.h:175
struct _root root
#define U(x)
Definition: wordpad.c:44
static HWND child
Definition: cursoricon.c:298
HTREEITEM hParent
Definition: commctrl.h:3351
static HTREEITEM hRoot
Definition: treeview.c:381
#define TVI_FIRST
Definition: commctrl.h:3336
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
static HWND hTree
Definition: systempage.cpp:52
#define TVI_ROOT
Definition: commctrl.h:3335
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91

Referenced by test_cchildren(), test_customdraw(), test_delete_items(), test_expandedimage(), test_expandnotify(), test_fillroot(), test_focus(), test_get_set_bkcolor(), test_get_set_imagelist(), test_get_set_indent(), test_get_set_insertmark(), test_get_set_item(), test_get_set_itemheight(), test_get_set_scrolltime(), test_get_set_textcolor(), test_get_set_tooltips(), test_get_set_unicodeformat(), test_getitemtext(), test_htreeitem_layout(), test_itemedit(), test_right_click(), test_select(), test_TVM_GETNEXTITEM(), test_TVM_HITTEST(), test_TVS_CHECKBOXES(), and test_TVS_SINGLEEXPAND().

◆ fill_treeview_sort_test()

static void fill_treeview_sort_test ( HWND  hwnd)
static

Definition at line 2558 of file treeview.c.

2559 {
2560  static const char *itemnames[] =
2561  {
2562  "root", "Wasp", "Caribou", "Vacuum",
2563  "Ocelot", "Newspaper", "Litter bin"
2564  };
2565 
2566  HTREEITEM root, children[2];
2567  TVINSERTSTRUCTA ins;
2568  unsigned i = 0;
2569 
2571 
2572  /* root, two children, with two children each */
2573  ins.hParent = TVI_ROOT;
2574  ins.hInsertAfter = TVI_ROOT;
2575  U(ins).item.mask = TVIF_TEXT;
2576  U(ins).item.pszText = (char *)itemnames[i++];
2578 
2579  ins.hParent = root;
2580  ins.hInsertAfter = TVI_LAST;
2581  U(ins).item.mask = TVIF_TEXT;
2582  U(ins).item.pszText = (char *)itemnames[i++];
2583  children[0] = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins);
2584 
2585  U(ins).item.pszText = (char *)itemnames[i++];
2586  children[1] = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins);
2587 
2588  ins.hParent = children[0];
2589  U(ins).item.pszText = (char *)itemnames[i++];
2591 
2592  U(ins).item.pszText = (char *)itemnames[i++];
2594 
2595  ins.hParent = children[1];
2596  U(ins).item.pszText = (char *)itemnames[i++];
2598 
2599  U(ins).item.pszText = (char *)itemnames[i++];
2601 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct _root root
#define U(x)
Definition: wordpad.c:44
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
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
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
#define TVI_LAST
Definition: commctrl.h:3337
#define TVI_ROOT
Definition: commctrl.h:3335
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVM_INSERTITEMA
Definition: commctrl.h:3374

Referenced by test_TVM_SORTCHILDREN().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 58 of file treeview.c.

59 {
60  MSG msg;
61  int diff = 200;
62  int min_timeout = 100;
63  DWORD time = GetTickCount() + diff;
64 
65  while (diff > 0)
66  {
67  if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break;
68  while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
69  diff = time - GetTickCount();
70  }
71 }
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)
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
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 QS_ALLINPUT
Definition: winuser.h:874
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_right_click().

◆ get_item_names_string()

static void get_item_names_string ( HWND  hwnd,
HTREEITEM  item,
char str 
)
static

Definition at line 2530 of file treeview.c.

2531 {
2532  TVITEMA tvitem = { 0 };
2533  HTREEITEM child;
2534  char name[16];
2535 
2536  if (!item)
2537  {
2539  str[0] = 0;
2540  }
2541 
2543 
2544  tvitem.mask = TVIF_TEXT;
2545  tvitem.hItem = item;
2546  tvitem.pszText = name;
2547  tvitem.cchTextMax = sizeof(name);
2548  SendMessageA(hwnd, TVM_GETITEMA, 0, (LPARAM)&tvitem);
2549  strcat(str, tvitem.pszText);
2550 
2551  while (child != NULL)
2552  {
2555  }
2556 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVGN_NEXT
Definition: commctrl.h:3420
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
static HWND child
Definition: cursoricon.c:298
UINT mask
Definition: commctrl.h:3270
LONG_PTR LPARAM
Definition: windef.h:208
const WCHAR * str
#define TVGN_ROOT
Definition: commctrl.h:3419
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM hItem
Definition: commctrl.h:3271
static void get_item_names_string(HWND hwnd, HTREEITEM item, char *str)
Definition: treeview.c:2530
#define TVGN_CHILD
Definition: commctrl.h:3423
#define TVM_GETNEXTITEM
Definition: commctrl.h:3416
static ATOM item
Definition: dde.c:856
#define TVIF_TEXT
Definition: commctrl.h:3233
int cchTextMax
Definition: commctrl.h:3275
Definition: name.c:36
#define TVM_GETITEMA
Definition: commctrl.h:3452
LPSTR pszText
Definition: commctrl.h:3274
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by test_TVM_SORTCHILDREN().

◆ IdentifyItem()

static void IdentifyItem ( HTREEITEM  hItem)
static

Definition at line 398 of file treeview.c.

399 {
400  if (hItem == hRoot) {
401  AddItem('R');
402  return;
403  }
404  if (hItem == hChild) {
405  AddItem('C');
406  return;
407  }
408  if (hItem == NULL) {
409  AddItem('n');
410  return;
411  }
412  AddItem('?');
413 }
static void AddItem(char ch)
Definition: treeview.c:392
static HTREEITEM hChild
Definition: treeview.c:381
static HTREEITEM hRoot
Definition: treeview.c:381
smooth NULL
Definition: ftsmooth.c:416

Referenced by parent_wnd_proc().

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 2770 of file treeview.c.

2771 {
2772  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
2773 
2774 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
2776 #undef X
2777 }
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define X(f)

Referenced by START_TEST().

◆ parent_wnd_proc()

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

Definition at line 1227 of file treeview.c.

1228 {
1229  static LONG defwndproc_counter = 0;
1230  struct message msg = { 0 };
1231  LRESULT ret;
1232  RECT rect;
1233  HTREEITEM visibleItem;
1234 
1235  msg.message = message;
1236  msg.flags = sent|wparam|lparam;
1237  if (defwndproc_counter) msg.flags |= defwinproc;
1238  msg.wParam = wParam;
1239  msg.lParam = lParam;
1240  if (message == WM_NOTIFY && lParam)
1241  msg.id = ((NMHDR*)lParam)->code;
1242 
1243  /* log system messages, except for painting */
1244  if (message < WM_USER &&
1245  message != WM_PAINT &&
1246  message != WM_ERASEBKGND &&
1247  message != WM_NCPAINT &&
1248  message != WM_NCHITTEST &&
1249  message != WM_GETTEXT &&
1250  message != WM_GETICON &&
1252  {
1254  }
1255 
1256  switch(message) {
1257  case WM_NOTIFYFORMAT:
1258  {
1259  /* Make NF_QUERY return an invalid format to show that it defaults to ANSI */
1260  if (lParam == NF_QUERY) return 0;
1261  break;
1262  }
1263 
1264  case WM_NOTIFY:
1265  {
1266  NMHDR *pHdr = (NMHDR *)lParam;
1267 
1268  ok(pHdr->code != NM_TOOLTIPSCREATED, "Treeview should not send NM_TOOLTIPSCREATED\n");
1269  if (pHdr->idFrom == 100)
1270  {
1271  NMTREEVIEWA *pTreeView = (LPNMTREEVIEWA) lParam;
1272  switch(pHdr->code)
1273  {
1274  case TVN_SELCHANGINGA:
1275  AddItem('(');
1276  IdentifyItem(pTreeView->itemOld.hItem);
1277  IdentifyItem(pTreeView->itemNew.hItem);
1278  break;
1279  case TVN_SELCHANGEDA:
1280  AddItem(')');
1281  IdentifyItem(pTreeView->itemOld.hItem);
1282  IdentifyItem(pTreeView->itemNew.hItem);
1283  break;
1284  case TVN_GETDISPINFOA: {
1286  if (disp->item.mask & TVIF_TEXT) {
1287  lstrcpynA(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax);
1288  }
1289 
1290  if (g_disp_A_to_W && (disp->item.mask & TVIF_TEXT)) {
1291  static const WCHAR testW[] = {'T','E','S','T','2',0};
1292 
1293  disp->hdr.code = TVN_GETDISPINFOW;
1294  memcpy(disp->item.pszText, testW, sizeof(testW));
1295  }
1296 
1298  {
1299  ok(disp->item.mask == TVIF_IMAGE, "got %x\n", disp->item.mask);
1300  /* both masks set here are necessary to change state bits */
1301  disp->item.mask |= TVIF_STATE;
1304  }
1305 
1306  break;
1307  }
1308  case TVN_BEGINLABELEDITA:
1309  {
1311  {
1312  static const char* textA = "<edittextaltered>";
1313  HWND edit;
1314 
1315  edit = (HWND)SendMessageA(pHdr->hwndFrom, TVM_GETEDITCONTROL, 0, 0);
1316  ok(IsWindow(edit), "failed to get edit handle\n");
1317  SetWindowTextA(edit, textA);
1318  }
1319 
1320  break;
1321  }
1322 
1323  case TVN_ENDLABELEDITA: return TRUE;
1324  case TVN_ITEMEXPANDINGA:
1325  {
1326  UINT newmask = pTreeView->itemNew.mask & ~TVIF_CHILDREN;
1327  ok(newmask ==
1329  "got wrong mask %x\n", pTreeView->itemNew.mask);
1330  ok(pTreeView->itemOld.mask == 0,
1331  "got wrong mask %x\n", pTreeView->itemOld.mask);
1332 
1333  if (g_get_from_expand)
1334  {
1338  ok(ret == TRUE, "got %lu\n", ret);
1339  }
1340  break;
1341  }
1342  case TVN_ITEMEXPANDEDA:
1343  ok(pTreeView->itemNew.mask & TVIF_STATE, "got wrong mask %x\n", pTreeView->itemNew.mask);
1345  "got wrong mask %x\n", pTreeView->itemNew.mask);
1346  ok(pTreeView->itemOld.mask == 0,
1347  "got wrong mask %x\n", pTreeView->itemOld.mask);
1348 
1349  if (g_get_from_expand)
1350  {
1354  ok(ret == TRUE, "got %lu\n", ret);
1355  }
1357  {
1358  visibleItem = (HTREEITEM)SendMessageA(pHdr->hwndFrom, TVM_GETNEXTITEM,
1359  TVGN_FIRSTVISIBLE, 0);
1360  ok(pTreeView->itemNew.hItem == visibleItem, "expanded item == first visible item\n");
1361  *(HTREEITEM*)&rect = visibleItem;
1363  "Failed to get rect for first visible item.\n");
1364  visibleItem = (HTREEITEM)SendMessageA(pHdr->hwndFrom, TVM_GETNEXTITEM,
1365  TVGN_NEXTVISIBLE, (LPARAM)visibleItem);
1366  *(HTREEITEM*)&rect = visibleItem;
1367  ok(visibleItem != NULL, "There must be a visible item after the first visisble item.\n");
1369  "Failed to get rect for second visible item.\n");
1370  }
1371  break;
1372  case TVN_DELETEITEMA:
1373  {
1374  struct message item;
1375 
1376  ok(pTreeView->itemNew.mask == 0, "got wrong mask 0x%x\n", pTreeView->itemNew.mask);
1377 
1378  ok(pTreeView->itemOld.mask == (TVIF_HANDLE | TVIF_PARAM), "got wrong mask 0x%x\n", pTreeView->itemOld.mask);
1379  ok(pTreeView->itemOld.hItem != NULL, "got %p\n", pTreeView->itemOld.hItem);
1380 
1381  memset(&item, 0, sizeof(item));
1382  item.lParam = (LPARAM)pTreeView->itemOld.hItem;
1384 
1385  break;
1386  }
1387  case NM_CUSTOMDRAW:
1388  {
1390  COLORREF c0ffee = RGB(0xc0,0xff,0xee), cafe = RGB(0xca,0xfe,0x00);
1391  COLORREF text = GetTextColor(nmcd->nmcd.hdc), bkgnd = GetBkColor(nmcd->nmcd.hdc);
1392 
1393  msg.flags |= custdraw;
1394  msg.stage = nmcd->nmcd.dwDrawStage;
1396 
1397  switch (msg.stage)
1398  {
1399  case CDDS_PREPAINT:
1401  case CDDS_ITEMPREPAINT:
1402  ok(text == nmcd->clrText || (g_v6 && nmcd->clrText == 0xffffffff),
1403  "got %08x vs %08x\n", text, nmcd->clrText);
1404  ok(bkgnd == nmcd->clrTextBk || (g_v6 && nmcd->clrTextBk == 0xffffffff),
1405  "got %08x vs %08x\n", bkgnd, nmcd->clrTextBk);
1406  nmcd->clrText = cafe;
1407  nmcd->clrTextBk = c0ffee;
1408  SetTextColor(nmcd->nmcd.hdc, c0ffee);
1409  SetBkColor(nmcd->nmcd.hdc, cafe);
1410  if (g_customdraw_font)
1413  case CDDS_ITEMPOSTPAINT:
1414  /* at the point of post paint notification colors are already restored */
1415  ok(nmcd->clrText == cafe, "got 0%x\n", nmcd->clrText);
1416  ok(nmcd->clrTextBk == c0ffee, "got 0%x\n", nmcd->clrTextBk);
1417  ok(text != cafe, "got 0%x\n", text);
1418  ok(bkgnd != c0ffee, "got 0%x\n", bkgnd);
1419  if (g_customdraw_font)
1420  ok(GetCurrentObject(nmcd->nmcd.hdc, OBJ_FONT) != g_customdraw_font, "got %p\n",
1421  GetCurrentObject(nmcd->nmcd.hdc, OBJ_FONT));
1422  break;
1423  default:
1424  ;
1425  }
1426  break;
1427  }
1428  case NM_RCLICK:
1429  {
1432  ok(selected == hChild, "child item should still be selected\n");
1433  break;
1434  }
1435  }
1436  }
1437  break;
1438  }
1439 
1440  }
1441 
1442  defwndproc_counter++;
1444  defwndproc_counter--;
1445 
1446  return ret;
1447 }
#define TVM_GETITEMRECT
Definition: commctrl.h:3395
disp
Definition: i386-dis.c:3181
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:954
Definition: tftpd.h:59
static void AddItem(char ch)
Definition: treeview.c:392
#define TRUE
Definition: types.h:120
TVITEMA itemNew
Definition: commctrl.h:3597
#define TVN_GETDISPINFOA
Definition: commctrl.h:3621
struct tagNMTREEVIEWA * LPNMTREEVIEWA
static TVITEMA g_item_expanded
Definition: treeview.c:39
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:259
#define TVGN_CARET
Definition: commctrl.h:3428
static HTREEITEM hChild
Definition: treeview.c:381
#define PARENT_CD_SEQ_INDEX
Definition: treeview.c:51
#define TVN_DELETEITEMA
Definition: commctrl.h:3674
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TVN_ITEMEXPANDEDA
Definition: commctrl.h:3668
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVIS_SELECTED
Definition: commctrl.h:3247
const WCHAR * text
Definition: package.c:1827
#define WM_GETTEXT
Definition: winuser.h:1600
Definition: msg.h:39
static BOOL g_get_from_expand
Definition: treeview.c:40
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glext.h:5579
static HFONT g_customdraw_font
Definition: treeview.c:45
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:270
#define WM_NCHITTEST
Definition: winuser.h:1668
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3252
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
#define TVGN_NEXTVISIBLE
Definition: commctrl.h:3425
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
UINT mask
Definition: commctrl.h:3270
#define TVN_SELCHANGEDA
Definition: commctrl.h:3614
UINT code
Definition: winuser.h:3112
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define WM_NCPAINT
Definition: winuser.h:1669
#define TVIF_CHILDREN
Definition: commctrl.h:3239
long LONG
Definition: pedump.c:60
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
UINT_PTR idFrom
Definition: winuser.h:3111
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
UINT state
Definition: commctrl.h:3272
Definition: msg.h:45
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:727
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3254
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
static BOOL g_get_rect_in_expand
Definition: treeview.c:41
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:260
HTREEITEM hItem
Definition: commctrl.h:3271
static void IdentifyItem(HTREEITEM hItem)
Definition: treeview.c:398
#define ok(value,...)
Definition: CComObject.cpp:34
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
static BOOL g_disp_set_stateimage
Definition: treeview.c:43
static const char textA[]
Definition: registrar.c:40
#define TVN_ENDLABELEDITA
Definition: commctrl.h:3678
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2298
#define RGB(r, g, b)
Definition: wingdi.h:2918
static TVITEMA g_item_expanding
Definition: treeview.c:39
unsigned int UINT
Definition: ndis.h:50
#define TVM_GETEDITCONTROL
Definition: commctrl.h:3473
static BOOL g_disp_A_to_W
Definition: treeview.c:42
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3716
#define OBJ_FONT
Definition: objidl.idl:1414
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:410
#define WM_PAINT
Definition: winuser.h:1602
#define TVN_SELCHANGINGA
Definition: commctrl.h:3612
int ret
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CDDS_PREPAINT
Definition: commctrl.h:265
static BOOL g_beginedit_alter_text
Definition: treeview.c:44
static BOOL g_v6
Definition: treeview.c:46
Definition: msg.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define PARENT_SEQ_INDEX
Definition: treeview.c:50
static const char * TEST_CALLBACK_TEXT
Definition: treeview.c:37
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hwndFrom
Definition: winuser.h:3110
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define WM_USER
Definition: winuser.h:1856
#define NF_QUERY
Definition: winuser.h:2414
#define TVIF_HANDLE
Definition: commctrl.h:3237
#define TVIS_EXPANDED
Definition: commctrl.h:3251
#define TVM_GETNEXTITEM
Definition: commctrl.h:3416
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:784
#define TVN_GETDISPINFOW
Definition: commctrl.h:3622
static ATOM item
Definition: dde.c:856
#define TVIF_TEXT
Definition: commctrl.h:3233
#define add_message(msg)
Definition: msg.c:2142
#define NM_RCLICK
Definition: commctrl.h:133
#define TVIF_IMAGE
Definition: commctrl.h:3234
COLORREF clrText
Definition: commctrl.h:3717
#define lstrcpynA
Definition: compat.h:408
static struct msg_sequence * item_sequence[1]
Definition: treeview.c:56
#define WM_DEVICECHANGE
Definition: winuser.h:1787
#define CDRF_NOTIFYITEMERASE
Definition: commctrl.h:263
#define CDRF_NEWFONT
Definition: commctrl.h:254
#define TVN_BEGINLABELEDITA
Definition: commctrl.h:3676
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TVIF_STATE
Definition: commctrl.h:3236
TVITEMA itemOld
Definition: commctrl.h:3596
#define TVIF_PARAM
Definition: commctrl.h:3235
#define WM_ERASEBKGND
Definition: winuser.h:1607
LONG_PTR LRESULT
Definition: windef.h:209
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:271
#define NM_TOOLTIPSCREATED
Definition: commctrl.h:144
DWORD COLORREF
Definition: windef.h:285
#define TVM_GETITEMA
Definition: commctrl.h:3452
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:439
#define WM_NOTIFY
Definition: richedit.h:61
COLORREF clrTextBk
Definition: commctrl.h:3718
static const WCHAR testW[]
Definition: jsregexp.c:44
#define LPARAM
Definition: msvc.h:38
#define TVGN_FIRSTVISIBLE
Definition: commctrl.h:3424
#define TVN_ITEMEXPANDINGA
Definition: commctrl.h:3666
#define TVIS_STATEIMAGEMASK
Definition: commctrl.h:3255
UINT WPARAM wparam
Definition: msvc.h:92

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( treeview  )

Definition at line 2779 of file treeview.c.

2780 {
2781  INITCOMMONCONTROLSEX iccex;
2782  ULONG_PTR ctx_cookie;
2783  HANDLE hCtx;
2784  WNDCLASSA wc;
2785 
2786  init_functions();
2787 
2788  iccex.dwSize = sizeof(iccex);
2789  iccex.dwICC = ICC_TREEVIEW_CLASSES;
2790  pInitCommonControlsEx(&iccex);
2791 
2794 
2795  wc.style = CS_HREDRAW | CS_VREDRAW;
2796  wc.cbClsExtra = 0;
2797  wc.cbWndExtra = 0;
2799  wc.hIcon = NULL;
2802  wc.lpszMenuName = NULL;
2803  wc.lpszClassName = "MyTestWnd";
2805  RegisterClassA(&wc);
2806 
2807  hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
2809 
2810  ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
2811  if (!hMainWnd) return;
2812 
2813  test_fillroot();
2814  test_select();
2815  test_getitemtext();
2816  test_focus();
2829  test_callback();
2831  test_itemedit();
2835  test_WM_PAINT();
2837  test_cchildren();
2841  test_TVM_HITTEST();
2843  test_customdraw();
2844  test_WM_KEYDOWN();
2847  test_right_click();
2848 
2849  if (!load_v6_module(&ctx_cookie, &hCtx))
2850  {
2852  return;
2853  }
2854 
2855  /* comctl32 version 6 tests start here */
2856  g_v6 = TRUE;
2857 
2858  test_fillroot();
2859  test_getitemtext();
2870  test_itemedit();
2873  test_cchildren();
2876  test_TVM_HITTEST();
2878  test_customdraw();
2879  test_WM_KEYDOWN();
2882 
2883  unload_v6_module(ctx_cookie, hCtx);
2884 }
static void test_get_set_indent(void)
Definition: treeview.c:836
static void test_treeview_classinfo(void)
Definition: treeview.c:1630
#define TRUE
Definition: types.h:120
static void test_expandedimage(void)
Definition: treeview.c:1847
static void init_functions(void)
Definition: treeview.c:2770
static void test_select(void)
Definition: treeview.c:639
static void test_get_set_bkcolor(void)
Definition: treeview.c:780
static void test_WM_GETDLGCODE(void)
Definition: treeview.c:2447
static void test_focus(void)
Definition: treeview.c:739
static void test_callback(void)
Definition: treeview.c:504
int cbClsExtra
Definition: winuser.h:3118
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3124
static void test_cchildren(void)
Definition: treeview.c:2081
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
HBRUSH hbrBackground
Definition: winuser.h:3123
static void test_expandinvisible(void)
Definition: treeview.c:1449
static void test_get_set_imagelist(void)
Definition: treeview.c:813
BOOL WINAPI DestroyWindow(_In_ HWND)
#define COLOR_WINDOW
Definition: winuser.h:908
#define IDC_IBEAM
Definition: winuser.h:683
uint32_t ULONG_PTR
Definition: typedefs.h:63
int cbWndExtra
Definition: winuser.h:3119
#define ICC_TREEVIEW_CLASSES
Definition: commctrl.h:59
static void test_get_set_textcolor(void)
Definition: treeview.c:1037
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: treeview.c:1227
HCURSOR hCursor
Definition: winuser.h:3122
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
static HWND hMainWnd
Definition: treeview.c:379
const char * LPCSTR
Definition: xmlstorage.h:183
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
static void test_WM_KEYDOWN(void)
Definition: treeview.c:2483
#define CS_VREDRAW
Definition: winuser.h:653
static void test_getitemtext(void)
Definition: treeview.c:701
static void test_TVS_CHECKBOXES(void)
Definition: treeview.c:2183
static void test_WM_PAINT(void)
Definition: treeview.c:1986
static BOOL g_v6
Definition: treeview.c:46
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_delete_items(void)
Definition: treeview.c:2019
LPCSTR lpszClassName
Definition: winuser.h:3125
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
static void test_get_set_unicodeformat(void)
Definition: treeview.c:1193
static void test_get_set_itemheight(void)
Definition: treeview.c:955
UINT style
Definition: winuser.h:3116
static void test_get_set_item(void)
Definition: treeview.c:884
static void test_TVM_GETNEXTITEM(void)
Definition: treeview.c:2368
static void test_get_insertmarkcolor(void)
Definition: treeview.c:1658
static void test_get_set_scrolltime(void)
Definition: treeview.c:1016
static void test_fillroot(void)
Definition: treeview.c:474
HINSTANCE hInstance
Definition: winuser.h:3120
static void test_TVS_FULLROWSELECT(void)
Definition: treeview.c:2506
static void test_expandnotify(void)
Definition: treeview.c:1675
static void test_TVM_SORTCHILDREN(void)
Definition: treeview.c:2603
static void test_itemedit(void)
Definition: treeview.c:1531
static struct msg_sequence * item_sequence[1]
Definition: treeview.c:56
WNDPROC lpfnWndProc
Definition: winuser.h:3117
static void test_get_linecolor(void)
Definition: treeview.c:1641
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 struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
static void test_TVS_SINGLEEXPAND(void)
Definition: treeview.c:1886
static void test_customdraw(void)
Definition: treeview.c:2460
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static void test_htreeitem_layout(void)
Definition: treeview.c:2148
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
static void test_right_click(void)
Definition: treeview.c:2719
static void test_TVM_HITTEST(void)
Definition: treeview.c:2406
static void test_get_set_tooltips(void)
Definition: treeview.c:1070
static void test_get_set_insertmark(void)
Definition: treeview.c:864
HICON hIcon
Definition: winuser.h:3121

◆ test_callback()

static void test_callback ( void  )
static

Definition at line 504 of file treeview.c.

505 {
507  HTREEITEM hItem1, hItem2;
508  TVINSERTSTRUCTA ins;
509  TVITEMA tvi;
510  CHAR test_string[] = "Test_string";
511  static const CHAR test2A[] = "TEST2";
512  CHAR buf[128];
513  HWND hTree;
514  DWORD ret;
515 
517 
519  expect(TRUE, ret);
520  ins.hParent = TVI_ROOT;
521  ins.hInsertAfter = TVI_ROOT;
522  U(ins).item.mask = TVIF_TEXT;
523  U(ins).item.pszText = LPSTR_TEXTCALLBACKA;
525  ok(hRoot != NULL, "failed to set root\n");
526 
527  tvi.hItem = hRoot;
528  tvi.mask = TVIF_TEXT;
529  tvi.pszText = buf;
530  tvi.cchTextMax = sizeof(buf)/sizeof(buf[0]);
531  ret = TreeView_GetItemA(hTree, &tvi);
532  expect(TRUE, ret);
533  ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Callback item text mismatch %s vs %s\n",
535 
536  ins.hParent = hRoot;
537  ins.hInsertAfter = TVI_FIRST;
538  U(ins).item.mask = TVIF_TEXT;
539  U(ins).item.pszText = test_string;
540  hItem1 = TreeView_InsertItemA(hTree, &ins);
541  ok(hItem1 != NULL, "failed to set Item1\n");
542 
543  tvi.hItem = hItem1;
544  ret = TreeView_GetItemA(hTree, &tvi);
545  expect(TRUE, ret);
546  ok(strcmp(tvi.pszText, test_string) == 0, "Item text mismatch %s vs %s\n",
547  tvi.pszText, test_string);
548 
549  /* undocumented: pszText of NULL also means LPSTR_CALLBACK: */
550  tvi.pszText = NULL;
551  ret = TreeView_SetItemA(hTree, &tvi);
552  expect(TRUE, ret);
553  tvi.pszText = buf;
554  ret = TreeView_GetItemA(hTree, &tvi);
555  expect(TRUE, ret);
556  ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
558 
559  U(ins).item.pszText = NULL;
560  hItem2 = TreeView_InsertItemA(hTree, &ins);
561  ok(hItem2 != NULL, "failed to set Item2\n");
562  tvi.hItem = hItem2;
563  memset(buf, 0, sizeof(buf));
564  ret = TreeView_GetItemA(hTree, &tvi);
565  expect(TRUE, ret);
566  ok(strcmp(tvi.pszText, TEST_CALLBACK_TEXT) == 0, "Item text mismatch %s vs %s\n",
568 
569  /* notification handler changed A->W */
571  tvi.hItem = hItem2;
572  memset(buf, 0, sizeof(buf));
573  ret = TreeView_GetItemA(hTree, &tvi);
574  expect(TRUE, ret);
575  ok(strcmp(tvi.pszText, test2A) == 0, "got %s, expected %s\n",
576  tvi.pszText, test2A);
578 
579  /* handler changes state image index */
581 
582  /* clear selection, handler will set selected state */
584  expect(TRUE, ret);
585 
587 
588  tvi.hItem = hRoot;
589  tvi.mask = TVIF_STATE;
590  tvi.state = TVIS_SELECTED;
591  ret = TreeView_GetItemA(hTree, &tvi);
592  expect(TRUE, ret);
593  ok(tvi.state == INDEXTOSTATEIMAGEMASK(1), "got 0x%x\n", tvi.state);
594 
596  "no TVN_GETDISPINFO for a state seq", FALSE);
597 
598  tvi.hItem = hRoot;
599  tvi.mask = TVIF_IMAGE | TVIF_STATE;
600  tvi.state = TVIS_FOCUSED;
601  tvi.stateMask = TVIS_FOCUSED;
602  tvi.iImage = I_IMAGECALLBACK;
603  ret = TreeView_SetItemA(hTree, &tvi);
604  expect(TRUE, ret);
605 
606  /* ask for item image index through callback - state is also set with state image index */
608 
609  tvi.hItem = hRoot;
610  tvi.mask = TVIF_IMAGE;
611  tvi.state = 0;
612  ret = TreeView_GetItemA(hTree, &tvi);
613  expect(TRUE, ret);
614  ok(tvi.state == (INDEXTOSTATEIMAGEMASK(1) | TVIS_FOCUSED), "got 0x%x\n", tvi.state);
615 
617  "callback for state/overlay image index, noop seq", FALSE);
618 
619  /* ask for image again and overwrite state to some value in handler */
621 
623  tvi.hItem = hRoot;
624  tvi.mask = TVIF_IMAGE;
625  tvi.state = INDEXTOSTATEIMAGEMASK(1);
626  tvi.stateMask = 0;
627  ret = TreeView_GetItemA(hTree, &tvi);
628  expect(TRUE, ret);
629  /* handler sets TVIS_SELECTED as well */
630  ok(tvi.state == (TVIS_FOCUSED | TVIS_SELECTED | INDEXTOSTATEIMAGEMASK(2) | INDEXTOOVERLAYMASK(3)), "got 0x%x\n", tvi.state);
632 
634  "callback for state/overlay image index seq", FALSE);
635 
637 }
#define TRUE
Definition: types.h:120
#define TVM_SELECTITEM
Definition: commctrl.h:3445
#define TVGN_CARET
Definition: commctrl.h:3428
UINT stateMask
Definition: commctrl.h:3273
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TVIS_FOCUSED
Definition: treelist.c:125
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVIS_SELECTED
Definition: commctrl.h:3247
char CHAR
Definition: xmlstorage.h:175
#define U(x)
Definition: wordpad.c:44
static const struct message parent_get_dispinfo_seq[]
Definition: treeview.c:345
#define TreeView_GetItemA(hwnd, pitem)
Definition: commctrl.h:88
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TreeView_SetItemA(hwnd, pitem)
Definition: commctrl.h:95
UINT mask
Definition: commctrl.h:3270
HTREEITEM hParent
Definition: commctrl.h:3351
static const struct message empty_seq[]
Definition: treeview.c:350
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
UINT state
Definition: commctrl.h:3272
#define TVI_FIRST
Definition: commctrl.h:3336
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM hItem
Definition: commctrl.h:3271
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
static BOOL g_disp_set_stateimage
Definition: treeview.c:43
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2298
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL g_disp_A_to_W
Definition: treeview.c:42
#define TVS_CHECKBOXES
Definition: commctrl.h:3222
#define TVI_ROOT
Definition: commctrl.h:3335
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:410
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define expect(expected, got)
Definition: treeview.c:53
#define PARENT_SEQ_INDEX
Definition: treeview.c:50
static const char * TEST_CALLBACK_TEXT
Definition: treeview.c:37
#define I_IMAGECALLBACK
Definition: commctrl.h:2355
#define GWL_STYLE
Definition: winuser.h:846
#define TVIF_TEXT
Definition: commctrl.h:3233
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TVIF_IMAGE
Definition: commctrl.h:3234
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
int cchTextMax
Definition: commctrl.h:3275
void test_string()
Definition: test_string.cpp:38
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define TVIF_STATE
Definition: commctrl.h:3236
#define memset(x, y, z)
Definition: compat.h:39
LPSTR pszText
Definition: commctrl.h:3274
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2351
int iImage
Definition: commctrl.h:3276
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_cchildren()

static void test_cchildren ( void  )
static

Definition at line 2081 of file treeview.c.

2082 {
2083  HWND hTree;
2084  INT ret;
2085  TVITEMA item;
2086 
2088  fill_tree(hTree);
2089 
2091  expect(TRUE, ret);
2092 
2093  /* check cChildren - automatic mode */
2094  item.hItem = hRoot;
2095  item.mask = TVIF_CHILDREN;
2096 
2098  expect(TRUE, ret);
2099  expect(0, item.cChildren);
2100 
2102 
2103  /* start over */
2105  fill_tree(hTree);
2106 
2107  /* turn off automatic mode by setting cChildren explicitly */
2108  item.hItem = hRoot;
2109  item.mask = TVIF_CHILDREN;
2110 
2112  expect(TRUE, ret);
2113  expect(1, item.cChildren);
2114 
2116  expect(TRUE, ret);
2117 
2119  expect(TRUE, ret);
2120 
2121  /* check cChildren */
2123  expect(TRUE, ret);
2124 todo_wine
2125  expect(1, item.cChildren);
2126 
2128 }
#define TRUE
Definition: types.h:120
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
#define TVIF_CHILDREN
Definition: commctrl.h:3239
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define todo_wine
Definition: test.h:154
#define expect(expected, got)
Definition: treeview.c:53
static ATOM item
Definition: dde.c:856
#define TVM_GETITEMA
Definition: commctrl.h:3452
#define TVM_SETITEMA
Definition: commctrl.h:3459
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_customdraw()

static void test_customdraw ( void  )
static

Definition at line 2460 of file treeview.c.

2461 {
2462  LOGFONTA lf;
2463  HWND hwnd;
2464 
2466  fill_tree(hwnd);
2468 
2469  /* create additional font, custom draw handler will select it */
2470  SystemParametersInfoA(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
2471  lf.lfHeight *= 2;
2475  UpdateWindow(hwnd);
2476  ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_cd_seq, "custom draw notifications", FALSE);
2479 
2481 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define TVM_EXPAND
Definition: commctrl.h:3386
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
#define PARENT_CD_SEQ_INDEX
Definition: treeview.c:51
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HFONT g_customdraw_font
Definition: treeview.c:45
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI DestroyWindow(_In_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
LONG lfHeight
Definition: dimm.idl:42
static HTREEITEM hRoot
Definition: treeview.c:381
BOOL WINAPI SystemParametersInfoA(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVE_EXPAND
Definition: commctrl.h:3390
static const struct message parent_cd_seq[]
Definition: treeview.c:354
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_delete_items()

static void test_delete_items ( void  )
static

Definition at line 2019 of file treeview.c.

2020 {
2021  const struct message *msg;
2022  HWND hTree;
2023  HTREEITEM hItem1, hItem2;
2024  TVINSERTSTRUCTA ins;
2025  INT ret;
2026 
2027  static CHAR item1[] = "Item 1";
2028  static CHAR item2[] = "Item 2";
2029 
2031  fill_tree(hTree);
2032 
2033  /* check delete order */
2036  ok(ret == TRUE, "got %d\n", ret);
2037 
2038  msg = item_sequence[0]->sequence;
2039  ok(item_sequence[0]->count == 2, "expected 2 items, got %d\n", item_sequence[0]->count);
2040 
2041  if (item_sequence[0]->count == 2)
2042  {
2043  ok(msg[0].lParam == (LPARAM)hChild, "expected %p, got 0x%lx\n", hChild, msg[0].lParam);
2044  ok(msg[1].lParam == (LPARAM)hRoot, "expected %p, got 0x%lx\n", hRoot, msg[1].lParam);
2045  }
2046 
2047  ret = SendMessageA(hTree, TVM_GETCOUNT, 0, 0);
2048  ok(ret == 0, "got %d\n", ret);
2049 
2051 
2052  /* Regression test for a crash when deleting the first visible item while bRedraw == false. */
2054 
2056  ok(ret == 0, "got %d\n", ret);
2057 
2058  ins.hParent = TVI_ROOT;
2059  ins.hInsertAfter = TVI_ROOT;
2060  U(ins).item.mask = TVIF_TEXT;
2061  U(ins).item.pszText = item1;
2062  hItem1 = TreeView_InsertItemA(hTree, &ins);
2063  ok(hItem1 != NULL, "InsertItem failed\n");
2064 
2065  ins.hParent = TVI_ROOT;
2066  ins.hInsertAfter = hItem1;
2067  U(ins).item.mask = TVIF_TEXT;
2068  U(ins).item.pszText = item2;
2069  hItem2 = TreeView_InsertItemA(hTree, &ins);
2070  ok(hItem2 != NULL, "InsertItem failed\n");
2071 
2072  ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hItem1);
2073  ok(ret == TRUE, "got %d\n", ret);
2074 
2076  ok(ret == 0, "got %d\n", ret);
2077 
2079 }
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
char CHAR
Definition: xmlstorage.h:175
#define U(x)
Definition: wordpad.c:44
#define WM_SETREDRAW
Definition: winuser.h:1598
BOOL WINAPI DestroyWindow(_In_ HWND)
int32_t INT
Definition: typedefs.h:56
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
UINT msg
Definition: msvc.h:92
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static const struct metadata_item item2[]
Definition: metadata.c:2800
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVI_ROOT
Definition: commctrl.h:3335
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define TVIF_TEXT
Definition: commctrl.h:3233
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * item_sequence[1]
Definition: treeview.c:56
#define msg(x)
Definition: auth_time.c:54
#define TVM_GETCOUNT
Definition: commctrl.h:3398
static const struct metadata_item item1[]
Definition: metadata.c:2795
LPARAM lParam
Definition: combotst.c:139
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_expandedimage()

static void test_expandedimage ( void  )
static

Definition at line 1847 of file treeview.c.

1848 {
1849  TVITEMEXA item;
1850  HWND hTree;
1851  BOOL ret;
1852 
1854  fill_tree(hTree);
1855 
1856  item.mask = TVIF_EXPANDEDIMAGE;
1857  item.iExpandedImage = 1;
1858  item.hItem = hRoot;
1860  ok(ret, "got %d\n", ret);
1861 
1862  item.mask = TVIF_EXPANDEDIMAGE;
1863  item.iExpandedImage = -1;
1864  item.hItem = hRoot;
1866  ok(ret, "got %d\n", ret);
1867 
1868  if (item.iExpandedImage != 1)
1869  {
1870  win_skip("TVIF_EXPANDEDIMAGE not supported\n");
1872  return;
1873  }
1874 
1875  /* test for default iExpandedImage value */
1876  item.mask = TVIF_EXPANDEDIMAGE;
1877  item.iExpandedImage = -1;
1878  item.hItem = hChild;
1880  ok(ret, "got %d\n", ret);
1881  ok(item.iExpandedImage == (WORD)I_IMAGENONE, "got %d\n", item.iExpandedImage);
1882 
1884 }
#define I_IMAGENONE
Definition: commctrl.h:2356
#define TVIF_EXPANDEDIMAGE
Definition: commctrl.h:3246
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
int ret
static ATOM item
Definition: dde.c:856
#define TVM_GETITEMA
Definition: commctrl.h:3452
#define win_skip
Definition: test.h:141
#define TVM_SETITEMA
Definition: commctrl.h:3459
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_expandinvisible()

static void test_expandinvisible ( void  )
static

Definition at line 1449 of file treeview.c.

1450 {
1451  static CHAR nodeText[][5] = {"0", "1", "2", "3", "4"};
1452  TVINSERTSTRUCTA ins;
1453  HTREEITEM node[5];
1454  RECT dummyRect;
1455  BOOL nodeVisible;
1456  LRESULT ret;
1457  HWND hTree;
1458 
1460 
1461  /* The test builds the following tree and expands node 1, while node 0 is collapsed.
1462  *
1463  * 0
1464  * |- 1
1465  * | |- 2
1466  * | |- 3
1467  * |- 4
1468  *
1469  */
1470 
1472  ok(ret == TRUE, "ret\n");
1473  ins.hParent = TVI_ROOT;
1474  ins.hInsertAfter = TVI_ROOT;
1475  U(ins).item.mask = TVIF_TEXT;
1476  U(ins).item.pszText = nodeText[0];
1477  node[0] = TreeView_InsertItemA(hTree, &ins);
1478  ok(node[0] != NULL, "failed to set node[0]\n");
1479 
1480  ins.hInsertAfter = TVI_LAST;
1481  U(ins).item.mask = TVIF_TEXT;
1482  ins.hParent = node[0];
1483 
1484  U(ins).item.pszText = nodeText[1];
1485  node[1] = TreeView_InsertItemA(hTree, &ins);
1486  ok(node[1] != NULL, "failed to set node[1]\n");
1487  U(ins).item.pszText = nodeText[4];
1488  node[4] = TreeView_InsertItemA(hTree, &ins);
1489  ok(node[4] != NULL, "failed to set node[4]\n");
1490 
1491  ins.hParent = node[1];
1492 
1493  U(ins).item.pszText = nodeText[2];
1494  node[2] = TreeView_InsertItemA(hTree, &ins);
1495  ok(node[2] != NULL, "failed to set node[2]\n");
1496  U(ins).item.pszText = nodeText[3];
1497  node[3] = TreeView_InsertItemA(hTree, &ins);
1498  ok(node[3] != NULL, "failed to set node[3]\n");
1499 
1500  *(HTREEITEM *)&dummyRect = node[1];
1501  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1502  ok(!nodeVisible, "Node 1 should not be visible.\n");
1503  *(HTREEITEM *)&dummyRect = node[2];
1504  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1505  ok(!nodeVisible, "Node 2 should not be visible.\n");
1506  *(HTREEITEM *)&dummyRect = node[3];
1507  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1508  ok(!nodeVisible, "Node 3 should not be visible.\n");
1509  *(HTREEITEM *)&dummyRect = node[4];
1510  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1511  ok(!nodeVisible, "Node 4 should not be visible.\n");
1512 
1513  ok(SendMessageA(hTree, TVM_EXPAND, TVE_EXPAND, (LPARAM)node[1]), "Expand of node 1 failed.\n");
1514 
1515  *(HTREEITEM *)&dummyRect = node[1];
1516  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1517  ok(!nodeVisible, "Node 1 should not be visible.\n");
1518  *(HTREEITEM *)&dummyRect = node[2];
1519  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1520  ok(!nodeVisible, "Node 2 should not be visible.\n");
1521  *(HTREEITEM *)&dummyRect = node[3];
1522  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1523  ok(!nodeVisible, "Node 3 should not be visible.\n");
1524  *(HTREEITEM *)&dummyRect = node[4];
1525  nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);
1526  ok(!nodeVisible, "Node 4 should not be visible.\n");
1527 
1529 }
#define TVM_GETITEMRECT
Definition: commctrl.h:3395
#define TRUE
Definition: types.h:120
#define TVM_EXPAND
Definition: commctrl.h:3386
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
#define U(x)
Definition: wordpad.c:44
BOOL WINAPI DestroyWindow(_In_ HWND)
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
smooth NULL
Definition: ftsmooth.c:416
#define TVI_LAST
Definition: commctrl.h:3337
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
static HWND hTree
Definition: systempage.cpp:52
#define TVE_EXPAND
Definition: commctrl.h:3390
#define TVI_ROOT
Definition: commctrl.h:3335
int ret
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define TVIF_TEXT
Definition: commctrl.h:3233
LONG_PTR LRESULT
Definition: windef.h:209
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
Definition: dlist.c:348
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_expandnotify()

static void test_expandnotify ( void  )
static

Definition at line 1675 of file treeview.c.

1676 {
1677  HTREEITEM hitem;
1678  HWND hTree;
1679  BOOL ret;
1680  TVITEMA item;
1681 
1683  fill_tree(hTree);
1684 
1685  item.hItem = hRoot;
1686  item.mask = TVIF_STATE;
1687 
1688  item.state = TVIS_EXPANDED;
1690  expect(TRUE, ret);
1691  ok((item.state & TVIS_EXPANDED) == 0, "expected collapsed\n");
1692 
1693  /* preselect root node here */
1695  expect(TRUE, ret);
1696 
1699  expect(FALSE, ret);
1700  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "no collapse notifications", FALSE);
1701 
1703  /* expand */
1705  g_item_expanding.state = 0xdeadbeef;
1706  g_item_expanded.state = 0xdeadbeef;
1708  expect(TRUE, ret);
1709  ok(g_item_expanding.state == TVIS_SELECTED, "got state on TVN_ITEMEXPANDING 0x%08x\n",
1711  ok(g_item_expanded.state == (TVIS_SELECTED|TVIS_EXPANDED), "got state on TVN_ITEMEXPANDED 0x%08x\n",
1713  ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_seq, "expand notifications", FALSE);
1715 
1716  /* check that it's expanded */
1717  item.state = TVIS_EXPANDED;
1719  expect(TRUE, ret);
1720  ok((item.state & TVIS_EXPANDED) == TVIS_EXPANDED, "expected expanded\n");
1721 
1722  /* collapse */
1725  expect(TRUE, ret);
1726  item.state = TVIS_EXPANDED;
1728  expect(TRUE, ret);
1729  ok((item.state & TVIS_EXPANDED) == 0, "expected collapsed\n");
1730  /* all further collapse/expand attempts won't produce any notifications,
1731  the only way is to reset with all children removed */
1732  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "collapse after expand notifications", FALSE);
1733 
1734  /* try to toggle child that doesn't have children itself */
1737  expect(FALSE, ret);
1738  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "toggle node without children", FALSE);
1739 
1741 
1742  /* test TVM_GETITEMRECT inside TVN_ITEMEXPANDED notification */
1744  fill_tree(hTree);
1747  expect(TRUE, ret);
1749 
1751 
1752  /* TVE_TOGGLE acts as any other TVM_EXPAND */
1754  fill_tree(hTree);
1755 
1758  expect(TRUE, ret);
1759  ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_seq, "toggle node (expand)", FALSE);
1760 
1761  /* toggle again - no notifications */
1764  expect(TRUE, ret);
1765  ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "toggle node (collapse)", FALSE);
1766 
1768 
1769  /* some keyboard events are also translated to expand */
1771  fill_tree(hTree);
1772 
1773  /* preselect root node here */
1775  expect(TRUE, ret);
1776 
1780  expect(FALSE, ret);
1782  ok(g_item_expanding.state == TVIS_SELECTED, "got state on TVN_ITEMEXPANDING 0x%08x\n",
1784  ok(g_item_expanded.state == (TVIS_SELECTED|TVIS_EXPANDED), "got state on TVN_ITEMEXPANDED 0x%08x\n",
1786 
1789  expect(FALSE, ret);
1791  ok(g_item_expanding.state == (TVIS_SELECTED|TVIS_EXPANDED|TVIS_EXPANDEDONCE), "got state on TVN_ITEMEXPANDING 0x%08x\n",
1793  ok(g_item_expanded.state == (TVIS_SELECTED|TVIS_EXPANDED|TVIS_EXPANDEDONCE), "got state on TVN_ITEMEXPANDED 0x%08x\n",
1795 
1798  expect(FALSE, ret);
1800  ok(g_item_expanding.state == (TVIS_SELECTED|TVIS_EXPANDED|TVIS_EXPANDEDONCE), "got state on TVN_ITEMEXPANDING 0x%08x\n",
1802  ok(g_item_expanded.state == (TVIS_SELECTED|TVIS_EXPANDEDONCE), "got state on TVN_ITEMEXPANDED 0x%08x\n",
1804 
1807  expect(FALSE, ret);
1809  ok(g_item_expanding.state == (TVIS_SELECTED|TVIS_EXPANDEDONCE), "got state on TVN_ITEMEXPANDING 0x%08x\n",
1812 
1815  expect(FALSE, ret);
1817 
1818  /* go to child */
1820  expect(FALSE, ret);
1821 
1822  /* try to expand child that doesn't have children itself */
1825  expect(FALSE, ret);
1826  ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_empty_kb_seq, "expand node with no children", FALSE);
1827 
1828  /* stay on current selection and set non-zero children count */
1830  ok(hitem != NULL, "got %p\n", hitem);
1831 
1832  item.hItem = hitem;
1833  item.mask = TVIF_CHILDREN;
1834  item.cChildren = 0x80000000;
1835 
1837  expect(TRUE, ret);
1838 
1841  expect(FALSE, ret);
1842  ok_sequence(sequences, PARENT_SEQ_INDEX, parent_collapse_2nd_kb_seq, "expand node with children", FALSE);
1843 
1845 }
#define VK_SUBTRACT
Definition: winuser.h:2206
#define TVE_TOGGLE
Definition: commctrl.h:3391
#define TRUE
Definition: types.h:120
static TVITEMA g_item_expanded
Definition: treeview.c:39
#define TVM_EXPAND
Definition: commctrl.h:3386
#define TVM_SELECTITEM
Definition: commctrl.h:3445
#define TVGN_CARET
Definition: commctrl.h:3428
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVIS_SELECTED
Definition: commctrl.h:3247
static BOOL g_get_from_expand
Definition: treeview.c:40
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
#define VK_ADD
Definition: winuser.h:2204
static const struct message parent_expand_kb_seq[]
Definition: treeview.c:236
#define TVIS_EXPANDEDONCE
Definition: commctrl.h:3252
BOOL WINAPI DestroyWindow(_In_ HWND)
static const struct message empty_seq[]
Definition: treeview.c:350
#define TVIF_CHILDREN
Definition: commctrl.h:3239
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
UINT state
Definition: commctrl.h:3272
static const struct message parent_collapse_2nd_kb_seq[]
Definition: treeview.c:244
smooth NULL
Definition: ftsmooth.c:416
#define TVE_COLLAPSE
Definition: commctrl.h:3389
#define WM_KEYDOWN
Definition: winuser.h:1691
static BOOL g_get_rect_in_expand
Definition: treeview.c:41
static const struct message parent_expand_seq[]
Definition: treeview.c:230
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
static TVITEMA g_item_expanding
Definition: treeview.c:39
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static const struct message parent_expand_empty_kb_seq[]
Definition: treeview.c:251
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVE_EXPAND
Definition: commctrl.h:3390
int ret
#define expect(expected, got)
Definition: treeview.c:53
#define PARENT_SEQ_INDEX
Definition: treeview.c:50
#define TVIS_EXPANDED
Definition: commctrl.h:3251
#define VK_RIGHT
Definition: winuser.h:2180
#define TVM_GETNEXTITEM
Definition: commctrl.h:3416
static ATOM item
Definition: dde.c:856
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TVIF_STATE
Definition: commctrl.h:3236
#define TVM_GETITEMA
Definition: commctrl.h:3452
#define TVM_SETITEMA
Definition: commctrl.h:3459
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_fillroot()

static void test_fillroot ( void  )
static

Definition at line 474 of file treeview.c.

475 {
476  TVITEMA tvi;
477  HWND hTree;
478 
480 
482 
483  fill_tree(hTree);
484 
485  Clear();
486  AddItem('A');
487  ok(hRoot != NULL, "failed to set root\n");
488  AddItem('B');
489  ok(hChild != NULL, "failed to set child\n");
490  AddItem('.');
492  ok(!strcmp(sequence, "AB."), "Item creation\n");
493 
494  /* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
495  tvi.hItem = hRoot;
498  ok(tvi.iImage == 0, "tvi.iImage=%d\n", tvi.iImage);
499  ok(tvi.iSelectedImage == 0, "tvi.iSelectedImage=%d\n", tvi.iSelectedImage);
500 
502 }
static void AddItem(char ch)
Definition: treeview.c:392
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
BOOL WINAPI DestroyWindow(_In_ HWND)
int iSelectedImage
Definition: commctrl.h:3277
UINT mask
Definition: commctrl.h:3270
LONG_PTR LPARAM
Definition: windef.h:208
static char sequence[256]
Definition: treeview.c:384
static HTREEITEM hRoot
Definition: treeview.c:381
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM hItem
Definition: commctrl.h:3271
static const struct message FillRootSeq[]
Definition: treeview.c:73
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TVIF_IMAGE
Definition: commctrl.h:3234
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static void Clear(void)
Definition: treeview.c:386
#define TVM_GETITEMA
Definition: commctrl.h:3452
int iImage
Definition: commctrl.h:3276
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_focus()

static void test_focus ( void  )
static

Definition at line 739 of file treeview.c.

740 {
741  TVINSERTSTRUCTA ins;
742  static CHAR child1[] = "Edit",
743  child2[] = "A really long string";
744  HTREEITEM hChild1, hChild2;
745  HWND hTree;
746  HWND hEdit;
747 
749  fill_tree(hTree);
750 
752 
753  /* This test verifies that when a label is being edited, scrolling
754  * the treeview does not cause the label to lose focus. To test
755  * this, first some additional entries are added to generate
756  * scrollbars.
757  */
758  ins.hParent = hRoot;
759  ins.hInsertAfter = hChild;
760  U(ins).item.mask = TVIF_TEXT;
761  U(ins).item.pszText = child1;
762  hChild1 = TreeView_InsertItemA(hTree, &ins);
763  ok(hChild1 != NULL, "failed to set hChild1\n");
764  ins.hInsertAfter = hChild1;
765  U(ins).item.mask = TVIF_TEXT;
766  U(ins).item.pszText = child2;
767  hChild2 = TreeView_InsertItemA(hTree, &ins);
768  ok(hChild2 != NULL, "failed to set hChild2\n");
769 
774  ok(GetFocus() == hEdit, "Edit control should have focus\n");
776 
778 }
#define TRUE
Definition: types.h:120
static const struct message focus_seq[]
Definition: treeview.c:106
#define TVM_SELECTITEM
Definition: commctrl.h:3445
#define TVM_EDITLABELA
Definition: commctrl.h:3466
#define TVGN_CARET
Definition: commctrl.h:3428
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
#define U(x)
Definition: wordpad.c:44
HANDLE HWND
Definition: compat.h:13
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
smooth NULL
Definition: ftsmooth.c:416
static HWND hMainWnd
Definition: treeview.c:379
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:769
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static HWND hEdit
Definition: autocomplete.c:34
#define TVIF_TEXT
Definition: commctrl.h:3233
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define SW_SCROLLCHILDREN
Definition: winuser.h:2532
HWND WINAPI GetFocus(void)
Definition: window.c:1875
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_insertmarkcolor()

static void test_get_insertmarkcolor ( void  )
static

Definition at line 1658 of file treeview.c.

1659 {
1660  COLORREF clr;
1661  HWND hTree;
1662 
1664 
1665  /* newly created control has default color */
1667  if (clr == 0)
1668  win_skip("TVM_GETINSERTMARKCOLOR is not supported on comctl32 < 5.80\n");
1669  else
1670  expect(CLR_DEFAULT, clr);
1671 
1673 }
#define TVM_GETINSERTMARKCOLOR
Definition: commctrl.h:3556
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
static HWND hTree
Definition: systempage.cpp:52
#define expect(expected, got)
Definition: treeview.c:53
#define CLR_DEFAULT
Definition: commctrl.h:305
DWORD COLORREF
Definition: windef.h:285
#define win_skip
Definition: test.h:141
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_linecolor()

static void test_get_linecolor ( void  )
static

Definition at line 1641 of file treeview.c.

1642 {
1643  COLORREF clr;
1644  HWND hTree;
1645 
1647 
1648  /* newly created control has default color */
1649  clr = SendMessageA(hTree, TVM_GETLINECOLOR, 0, 0);
1650  if (clr == 0)
1651  win_skip("TVM_GETLINECOLOR is not supported on comctl32 < 5.80\n");
1652  else
1653  expect(CLR_DEFAULT, clr);
1654 
1656 }
#define TVM_GETLINECOLOR
Definition: treelist.h:345
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
static HWND hTree
Definition: systempage.cpp:52
#define expect(expected, got)
Definition: treeview.c:53
#define CLR_DEFAULT
Definition: commctrl.h:305
DWORD COLORREF
Definition: windef.h:285
#define win_skip
Definition: test.h:141
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_bkcolor()

static void test_get_set_bkcolor ( void  )
static

Definition at line 780 of file treeview.c.

781 {
782  COLORREF crColor;
783  HWND hTree;
784 
786  fill_tree(hTree);
787 
789 
790  /* If the value is -1, the control is using the system color for the background color. */
791  crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
792  ok(crColor == ~0u, "Default background color reported as 0x%.8x\n", crColor);
793 
794  /* Test for black background */
795  SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(0,0,0));
796  crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
797  ok(crColor == RGB(0,0,0), "Black background color reported as 0x%.8x\n", crColor);
798 
799  /* Test for white background */
800  SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(255,255,255));
801  crColor = SendMessageA(hTree, TVM_GETBKCOLOR, 0, 0);
802  ok(crColor == RGB(255,255,255), "White background color reported as 0x%.8x\n", crColor);
803 
804  /* Reset the default background */
806 
808  "test get set bkcolor", FALSE);
809 
811 }
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 * u
Definition: glfuncs.h:240
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const struct message test_get_set_bkcolor_seq[]
Definition: treeview.c:136
#define TVM_SETBKCOLOR
Definition: commctrl.h:3542
BOOL WINAPI DestroyWindow(_In_ HWND)
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define RGB(r, g, b)
Definition: wingdi.h:2918
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
DWORD COLORREF
Definition: windef.h:285
#define TVM_GETBKCOLOR
Definition: commctrl.h:3546
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_imagelist()

static void test_get_set_imagelist ( void  )
static

Definition at line 813 of file treeview.c.

814 {
816  HWND hTree;
817 
819  fill_tree(hTree);
820 
822 
823  /* Test a NULL HIMAGELIST */
826  ok(himl == NULL, "NULL image list, reported as %p, expected 0.\n", himl);
827 
828  /* TODO: Test an actual image list */
829 
831  "test get imagelist", FALSE);
832 
834 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HIMAGELIST himl
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TVM_SETIMAGELIST
Definition: commctrl.h:3413
smooth NULL
Definition: ftsmooth.c:416
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define TVM_GETIMAGELIST
Definition: commctrl.h:3407
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:309
static const struct message test_get_set_imagelist_seq[]
Definition: treeview.c:146
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TVSIL_NORMAL
Definition: commctrl.h:3410
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_indent()

static void test_get_set_indent ( void  )
static

Definition at line 836 of file treeview.c.

837 {
838  int ulIndent;
839  int ulMinIndent;
840  int ulMoreThanTwiceMin;
841  HWND hTree;
842 
844  fill_tree(hTree);
845 
847 
848  /* Finding the minimum indent */
850  ulMinIndent = SendMessageA(hTree, TVM_GETINDENT, 0, 0);
851 
852  /* Checking an indent that is more than twice the default indent */
853  ulMoreThanTwiceMin = 2*ulMinIndent+1;
854  SendMessageA(hTree, TVM_SETINDENT, ulMoreThanTwiceMin, 0);
855  ulIndent = SendMessageA(hTree, TVM_GETINDENT, 0, 0);
856  ok(ulIndent == ulMoreThanTwiceMin, "Indent reported as %d, expected %d\n", ulIndent, ulMoreThanTwiceMin);
857 
859  "test get set indent", FALSE);
860 
862 }
#define TVM_SETINDENT
Definition: commctrl.h:3404
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TVM_GETINDENT
Definition: commctrl.h:3401
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static const struct message test_get_set_indent_seq[]
Definition: treeview.c:152
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_insertmark()

static void test_get_set_insertmark ( void  )
static

Definition at line 864 of file treeview.c.

865 {
866  COLORREF crColor = RGB(0,0,0);
867  HWND hTree;
868 
870  fill_tree(hTree);
871 
873 
875  crColor = SendMessageA(hTree, TVM_GETINSERTMARKCOLOR, 0, 0);
876  ok(crColor == RGB(0,0,0), "Insert mark color reported as 0x%.8x, expected 0x00000000\n", crColor);
877 
879  "test get set insertmark color", FALSE);
880 
882 }
#define TVM_GETINSERTMARKCOLOR
Definition: commctrl.h:3556
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define TVM_SETINSERTMARKCOLOR
Definition: commctrl.h:3554
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define RGB(r, g, b)
Definition: wingdi.h:2918
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
static const struct message test_get_set_insertmarkcolor_seq[]
Definition: treeview.c:161
DWORD COLORREF
Definition: windef.h:285
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_item()

static void test_get_set_item ( void  )
static

Definition at line 884 of file treeview.c.

885 {
886  TVITEMA tviRoot = {0};
887  int nBufferSize = 80;
888  char szBuffer[80] = {0};
889  HWND hTree, hTree2;
890  DWORD ret;
891 
893  fill_tree(hTree);
894 
895  tviRoot.hItem = hRoot;
896  tviRoot.mask = TVIF_STATE;
897  tviRoot.state = TVIS_FOCUSED;
898  tviRoot.stateMask = TVIS_FOCUSED;
899  ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
900  expect(TRUE, ret);
901 
903 
904  /* Test the root item, state is set even when not requested */
905  tviRoot.hItem = hRoot;
906  tviRoot.mask = TVIF_TEXT;
907  tviRoot.state = 0;
908  tviRoot.stateMask = 0;
909  tviRoot.cchTextMax = nBufferSize;
910  tviRoot.pszText = szBuffer;
911  ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
912  expect(TRUE, ret);
913  ok(!strcmp("Root", szBuffer), "GetItem: szBuffer=\"%s\", expected \"Root\"\n", szBuffer);
914  ok(tviRoot.state == TVIS_FOCUSED, "got 0x%0x\n", tviRoot.state);
915 
916  /* Change the root text */
917  lstrcpynA(szBuffer, "Testing123", nBufferSize);
918  ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
919  expect(TRUE, ret);
920  memset(szBuffer, 0, nBufferSize);
921  ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
922  expect(TRUE, ret);
923  ok(!strcmp("Testing123", szBuffer), "GetItem: szBuffer=\"%s\", expected \"Testing123\"\n", szBuffer);
924 
925  /* Reset the root text */
926  memset(szBuffer, 0, nBufferSize);
927  lstrcpynA(szBuffer, "Root", nBufferSize);
928  ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&tviRoot);
929  expect(TRUE, ret);
930 
932  "test get set item", FALSE);
933 
934  /* get item from a different tree */
935  hTree2 = create_treeview_control(0);
936 
937  tviRoot.hItem = hRoot;
938  tviRoot.mask = TVIF_STATE;
939  tviRoot.state = 0;
940  ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
941  expect(TRUE, ret);
942  ok(tviRoot.state == TVIS_FOCUSED, "got state 0x%0x\n", tviRoot.state);
943 
944  /* invalid item pointer, nt4 crashes here but later versions just return 0 */
945  tviRoot.hItem = (HTREEITEM)0xdeadbeef;
946  tviRoot.mask = TVIF_STATE;
947  tviRoot.state = 0;
948  ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot);
949  expect(FALSE, ret);
950 
952  DestroyWindow(hTree2);
953 }
#define TRUE
Definition: types.h:120
UINT stateMask
Definition: commctrl.h:3273
#define TVIS_FOCUSED
Definition: treelist.c:125
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct _TREEITEM * HTREEITEM
Definition: commctrl.h:3231
BOOL WINAPI DestroyWindow(_In_ HWND)
UINT mask
Definition: commctrl.h:3270
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
UINT state
Definition: commctrl.h:3272
HTREEITEM hItem
Definition: commctrl.h:3271
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
unsigned long DWORD
Definition: ntddk_ex.h:95
static void fill_tree(HWND hTree)
Definition: treeview.c:455
int ret
#define expect(expected, got)
Definition: treeview.c:53
#define TVIF_TEXT
Definition: commctrl.h:3233
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define lstrcpynA
Definition: compat.h:408
int cchTextMax
Definition: commctrl.h:3275
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define TVIF_STATE
Definition: commctrl.h:3236
static const struct message test_get_set_item_seq[]
Definition: treeview.c:167
#define TVM_GETITEMA
Definition: commctrl.h:3452
#define memset(x, y, z)
Definition: compat.h:39
LPSTR pszText
Definition: commctrl.h:3274
#define TVM_SETITEMA
Definition: commctrl.h:3459
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_itemheight()

static void test_get_set_itemheight ( void  )
static

Definition at line 955 of file treeview.c.

956 {
957  int ulOldHeight = 0;
958  int ulNewHeight = 0;
959  HWND hTree;
960 
962  fill_tree(hTree);
963 
965 
966  /* Assuming default height to begin with */
967  ulOldHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
968 
969  /* Explicitly setting and getting the default height */
971  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
972  ok(ulNewHeight == ulOldHeight, "Default height not set properly, reported %d, expected %d\n", ulNewHeight, ulOldHeight);
973 
974  /* Explicitly setting and getting the height of twice the normal */
975  SendMessageA(hTree, TVM_SETITEMHEIGHT, 2*ulOldHeight, 0);
976  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
977  ok(ulNewHeight == 2*ulOldHeight, "New height not set properly, reported %d, expected %d\n", ulNewHeight, 2*ulOldHeight);
978 
979  /* Assuming tree doesn't have TVS_NONEVENHEIGHT set, so a set of 9 will round down to 8 */
981  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
982  ok(ulNewHeight == 8, "Uneven height not set properly, reported %d, expected %d\n", ulNewHeight, 8);
983 
985  "test get set item height", FALSE);
986 
987  /* without TVS_NONEVENHEIGHT */
989  /* odd value */
990  ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 3, 0);
991  ok(ulOldHeight == 8, "got %d, expected %d\n", ulOldHeight, 8);
992  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
993  ok(ulNewHeight == 2, "got %d, expected %d\n", ulNewHeight, 2);
994 
995  ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 4, 0);
996  ok(ulOldHeight == 2, "got %d, expected %d\n", ulOldHeight, 2);
997  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
998  ok(ulNewHeight == 4, "got %d, expected %d\n", ulNewHeight, 4);
999 
1000  /* with TVS_NONEVENHEIGHT */
1002  /* odd value */
1003  ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 3, 0);
1004  ok(ulOldHeight == 4, "got %d, expected %d\n", ulOldHeight, 4);
1005  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
1006  ok(ulNewHeight == 3, "got %d, expected %d\n", ulNewHeight, 3);
1007  /* even value */
1008  ulOldHeight = SendMessageA(hTree, TVM_SETITEMHEIGHT, 10, 0);
1009  ok(ulOldHeight == 3, "got %d, expected %d\n", ulOldHeight, 3);
1010  ulNewHeight = SendMessageA(hTree, TVM_GETITEMHEIGHT, 0, 0);
1011  ok(ulNewHeight == 10, "got %d, expected %d\n", ulNewHeight, 10);
1012 
1014 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static const struct message test_get_set_itemheight_seq[]
Definition: treeview.c:175
static HWND hTree
Definition: systempage.cpp:52
#define TVS_NONEVENHEIGHT
Definition: commctrl.h:3228
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define GWL_STYLE
Definition: winuser.h:846
#define TVM_SETITEMHEIGHT
Definition: commctrl.h:3538
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TVM_GETITEMHEIGHT
Definition: commctrl.h:3540
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_scrolltime()

static void test_get_set_scrolltime ( void  )
static

Definition at line 1016 of file treeview.c.

1017 {
1018  int ulExpectedTime = 20;
1019  int ulTime = 0;
1020  HWND hTree;
1021 
1023  fill_tree(hTree);
1024 
1026 
1027  SendMessageA(hTree, TVM_SETSCROLLTIME, ulExpectedTime, 0);
1028  ulTime = SendMessageA(hTree, TVM_GETSCROLLTIME, 0, 0);
1029  ok(ulTime == ulExpectedTime, "Scroll time reported as %d, expected %d\n", ulTime, ulExpectedTime);
1030 
1032  "test get set scroll time", FALSE);
1033 
1035 }
#define TVM_SETSCROLLTIME
Definition: commctrl.h:3550
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
static const struct message test_get_set_scrolltime_seq[]
Definition: treeview.c:186
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TVM_GETSCROLLTIME
Definition: commctrl.h:3552
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_textcolor()

static void test_get_set_textcolor ( void  )
static

Definition at line 1037 of file treeview.c.

1038 {
1039  /* If the value is -1, the control is using the system color for the text color. */
1040  COLORREF crColor;
1041  HWND hTree;
1042 
1044  fill_tree(hTree);
1045 
1047 
1048  crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
1049  ok(crColor == ~0u, "Default text color reported as 0x%.8x\n", crColor);
1050 
1051  /* Test for black text */
1052  SendMessageA(hTree, TVM_SETTEXTCOLOR, 0, RGB(0,0,0));
1053  crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
1054  ok(crColor == RGB(0,0,0), "Black text color reported as 0x%.8x\n", crColor);
1055 
1056  /* Test for white text */
1057  SendMessageA(hTree, TVM_SETTEXTCOLOR, 0, RGB(255,255,255));
1058  crColor = SendMessageA(hTree, TVM_GETTEXTCOLOR, 0, 0);
1059  ok(crColor == RGB(255,255,255), "White text color reported as 0x%.8x\n", crColor);
1060 
1061  /* Reset the default text color */
1063 
1065  "test get set text color", FALSE);
1066 
1068 }
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 * u
Definition: glfuncs.h:240
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CLR_NONE
Definition: commctrl.h:304
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define RGB(r, g, b)
Definition: wingdi.h:2918
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
#define TVM_SETTEXTCOLOR
Definition: commctrl.h:3544
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
static const struct message test_get_set_textcolor_seq[]
Definition: treeview.c:192
#define TVM_GETTEXTCOLOR
Definition: commctrl.h:3548
DWORD COLORREF
Definition: windef.h:285
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_tooltips()

static void test_get_set_tooltips ( void  )
static

Definition at line 1070 of file treeview.c.

1071 {
1072  HWND hTree, tooltips, hwnd;
1073  DWORD style;
1074  int i;
1075 
1076  /* TVS_NOTOOLTIPS */
1078 
1079  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1080  ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
1081 
1082  tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
1083  ok(tooltips == NULL, "Unexpected ret value %p.\n", tooltips);
1084 
1085  /* Toggle style */
1088 
1089  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1090  ok(IsWindow(tooltips), "Unexpected tooltip window %p.\n", tooltips);
1091 
1094 
1095  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1096  ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
1097 
1099 
1100  /* Set some valid window, does not have to be tooltips class. */
1102 
1103  hwnd = CreateWindowA(WC_STATICA, "Test", WS_VISIBLE|WS_CHILD, 5, 5, 100, 100, hMainWnd, NULL, NULL, 0);
1104  ok(hwnd != NULL, "Failed to create child window.\n");
1105 
1106  tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
1107  ok(tooltips == NULL, "Unexpected ret value %p.\n", tooltips);
1108 
1109  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1110  ok(tooltips == hwnd, "Unexpected tooltip window %p.\n", tooltips);
1111 
1112  /* Externally set tooltips window, disable style. */
1115 
1116  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1117  ok(IsWindow(tooltips) && tooltips != hwnd, "Unexpected tooltip window %p.\n", tooltips);
1118  ok(IsWindow(hwnd), "Expected valid window.\n");
1119 
1122  ok(!IsWindow(tooltips), "Unexpected tooltip window %p.\n", tooltips);
1123 
1124  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1125  ok(tooltips == NULL, "Unexpected tooltip window %p.\n", tooltips);
1126  ok(IsWindow(hwnd), "Expected valid window.\n");
1127 
1129  ok(IsWindow(hwnd), "Expected valid window.\n");
1130 
1131  /* Set window, disable tooltips. */
1133 
1134  tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
1135  ok(IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
1136 
1139  ok(!IsWindow(hwnd), "Unexpected tooltip window %p.\n", tooltips);
1140  ok(IsWindow(tooltips), "Expected valid window %p.\n", tooltips);
1141 
1143  ok(IsWindow(tooltips), "Expected valid window %p.\n", tooltips);
1144  DestroyWindow(tooltips);
1146 
1147  for (i = 0; i < 2; i++)
1148  {
1149  DWORD style = i == 0 ? 0 : TVS_NOTOOLTIPS;
1150 
1151  hwnd = CreateWindowA(WC_STATICA, "Test", WS_VISIBLE|WS_CHILD, 5, 5, 100, 100, hMainWnd, NULL, NULL, 0);
1152  ok(hwnd != NULL, "Failed to create child window.\n");
1153 
1155 
1156  tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, (WPARAM)hwnd, 0);
1157  ok(style & TVS_NOTOOLTIPS ? tooltips == NULL : IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
1158  DestroyWindow(tooltips);
1159 
1160  tooltips = (HWND)SendMessageA(hTree, TVM_GETTOOLTIPS, 0, 0);
1161  ok(tooltips == hwnd, "Unexpected tooltip window %p.\n", tooltips);
1162 
1163  /* TreeView is destroyed, check if set window is still around. */
1165  ok(!IsWindow(hwnd), "Unexpected window.\n");
1166  }
1167 
1169  fill_tree(hTree);
1170 
1172 
1173  /* show even WS_POPUP treeview don't send NM_TOOLTIPSCREATED */
1174  hwnd = CreateWindowA(WC_TREEVIEWA, NULL, WS_POPUP|WS_VISIBLE, 0, 0, 100, 100,
1175  hMainWnd, NULL, NULL, NULL);
1177 
1178  /* Testing setting a NULL ToolTip */
1179  tooltips = (HWND)SendMessageA(hTree, TVM_SETTOOLTIPS, 0, 0);
1180  ok(IsWindow(tooltips), "Unexpected ret value %p.\n", tooltips);
1181 
1183  ok(hwnd == NULL, "Unexpected tooltip window %p.\n", hwnd);
1184 
1186  "test get set tooltips", TRUE);
1187 
1189  ok(IsWindow(tooltips), "Expected valid window.\n");
1190  DestroyWindow(tooltips);
1191 }
#define WC_STATICA
Definition: commctrl.h:4639
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE HWND
Definition: compat.h:13
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
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
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
#define WC_TREEVIEWA
Definition: commctrl.h:3209
smooth NULL
Definition: ftsmooth.c:416
#define TVM_SETTOOLTIPS
Definition: commctrl.h:3525
static HWND hMainWnd
Definition: treeview.c:379
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
static const struct message test_get_set_tooltips_seq[]
Definition: treeview.c:202
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
unsigned long DWORD
Definition: ntddk_ex.h:95
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVS_NOTOOLTIPS
Definition: commctrl.h:3221
#define TVM_GETTOOLTIPS
Definition: commctrl.h:3527
#define GWL_STYLE
Definition: winuser.h:846
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define WS_POPUP
Definition: pedump.c:616
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_get_set_unicodeformat()

static void test_get_set_unicodeformat ( void  )
static

Definition at line 1193 of file treeview.c.

1194 {
1195  BOOL bPreviousSetting;
1196  BOOL bNewSetting;
1197  HWND hTree;
1198 
1200  fill_tree(hTree);
1201 
1202  /* Check that an invalid format returned by NF_QUERY defaults to ANSI */
1203  bPreviousSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
1204  ok(bPreviousSetting == FALSE, "Format should be ANSI.\n");
1205 
1207 
1208  /* Set to Unicode */
1209  bPreviousSetting = SendMessageA(hTree, TVM_SETUNICODEFORMAT, 1, 0);
1210  bNewSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
1211  ok(bNewSetting == TRUE, "Unicode setting did not work.\n");
1212 
1213  /* Set to ANSI */
1215  bNewSetting = SendMessageA(hTree, TVM_GETUNICODEFORMAT, 0, 0);
1216  ok(bNewSetting == FALSE, "ANSI setting did not work.\n");
1217 
1218  /* Revert to original setting */
1219  SendMessageA(hTree, TVM_SETUNICODEFORMAT, bPreviousSetting, 0);
1220 
1222  "test get set unicode format", FALSE);
1223 
1225 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
static const struct message test_get_set_unicodeformat_seq[]
Definition: treeview.c:211
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
#define TVM_SETUNICODEFORMAT
Definition: commctrl.h:3533
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
#define TVM_GETUNICODEFORMAT
Definition: commctrl.h:3535
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_getitemtext()

static void test_getitemtext ( void  )
static

Definition at line 701 of file treeview.c.

702 {
703  TVINSERTSTRUCTA ins;
705  TVITEMA tvi;
706  HWND hTree;
707 
708  CHAR szBuffer[80] = "Blah";
709  int nBufferSize = sizeof(szBuffer)/sizeof(CHAR);
710 
712  fill_tree(hTree);
713 
715 
716  /* add an item without TVIF_TEXT mask and pszText == NULL */
717  ins.hParent = hRoot;
718  ins.hInsertAfter = TVI_ROOT;
719  U(ins).item.mask = 0;
720  U(ins).item.pszText = NULL;
721  U(ins).item.cchTextMax = 0;
723  ok(hChild != NULL, "failed to set hChild\n");
724 
725  /* retrieve it with TVIF_TEXT mask */
726  tvi.hItem = hChild;
727  tvi.mask = TVIF_TEXT;
728  tvi.cchTextMax = nBufferSize;
729  tvi.pszText = szBuffer;
730 
731  SendMessageA( hTree, TVM_GETITEMA, 0, (LPARAM)&tvi );
732  ok(!strcmp(szBuffer, ""), "szBuffer=\"%s\", expected \"\"\n", szBuffer);
733  ok(SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild), "DeleteItem failed\n");
735 
737 }
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
char CHAR
Definition: xmlstorage.h:175
#define U(x)
Definition: wordpad.c:44
BOOL WINAPI DestroyWindow(_In_ HWND)
UINT mask
Definition: commctrl.h:3270
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM hItem
Definition: commctrl.h:3271
#define NUM_MSG_SEQUENCES
Definition: treeview.c:48
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_sequence(seq, index, exp, contx, todo)
Definition: msg.h:387
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVI_ROOT
Definition: commctrl.h:3335
#define TVM_DELETEITEM
Definition: commctrl.h:3381
#define TVIF_TEXT
Definition: commctrl.h:3233
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
int cchTextMax
Definition: commctrl.h:3275
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: treeview.c:55
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const struct message getitemtext_seq[]
Definition: treeview.c:99
#define TVM_GETITEMA
Definition: commctrl.h:3452
LPSTR pszText
Definition: commctrl.h:3274
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
#define TREEVIEW_SEQ_INDEX
Definition: treeview.c:49
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_htreeitem_layout()

static void test_htreeitem_layout ( void  )
static

Definition at line 2148 of file treeview.c.

2149 {
2150  TVINSERTSTRUCTA ins;
2152  HWND hTree;
2153 
2155  fill_tree(hTree);
2156 
2157  /* root has some special pointer in parent field */
2158  check_item(hRoot, ((struct _ITEM_DATA*)hRoot)->parent, 0, hChild);
2159  check_item(hChild, hRoot, 0, 0);
2160 
2161  ins.hParent = hChild;
2162  ins.hInsertAfter = TVI_FIRST;
2163  U(ins).item.mask = 0;
2164  item1 = TreeView_InsertItemA(hTree, &ins);
2165 
2166  check_item(item1, hChild, 0, 0);
2167 
2168  ins.hParent = hRoot;
2169  ins.hInsertAfter = TVI_FIRST;
2170  U(ins).item.mask = 0;
2171  item2 = TreeView_InsertItemA(hTree, &ins);
2172 
2173  check_item(item2, hRoot, hChild, 0);
2174 
2176 
2177  /* without children now */
2178  check_item(hRoot, ((struct _ITEM_DATA*)hRoot)->parent, 0, item2);
2179 
2181 }
static HTREEITEM hChild
Definition: treeview.c:381
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define U(x)
Definition: wordpad.c:44
#define check_item(a, b, c, d)
Definition: treeview.c:2146
BOOL WINAPI DestroyWindow(_In_ HWND)
HTREEITEM hParent
Definition: commctrl.h:3351
LONG_PTR LPARAM
Definition: windef.h:208
static HTREEITEM hRoot
Definition: treeview.c:381
#define TVI_FIRST
Definition: commctrl.h:3336
HTREEITEM hInsertAfter
Definition: commctrl.h:3352
r parent
Definition: btrfs.c:2659
static const struct metadata_item item2[]
Definition: metadata.c:2800
static HWND hTree
Definition: systempage.cpp:52
static void fill_tree(HWND hTree)
Definition: treeview.c:455
#define TVM_DELETEITEM
Definition: commctrl.h:3381
static const struct metadata_item item1[]
Definition: metadata.c:2795
#define TreeView_InsertItemA(hwnd, phdi)
Definition: commctrl.h:91
static HWND create_treeview_control(DWORD style)
Definition: treeview.c:437

Referenced by START_TEST().

◆ test_itemedit()

static void test_itemedit ( void  )
static

Definition at line 1531 of file treeview.c.

1532 {
1533  DWORD r;
1534  HWND edit;
1535  TVITEMA item;
1536  CHAR buffA[20];
1537  HWND hTree;
1538 
1540  fill_tree(hTree);
1541 
1542  /* try with null item */
1543  edit = (HWND)SendMessageA(hTree, TVM_EDITLABELA, 0, 0);
1544  ok(!IsWindow(edit), "Expected valid handle\n");
1545 
1546  /* trigger edit */
1548  ok(IsWindow(edit), "Expected valid handle\n");
1549  /* item shouldn't be selected automatically after TVM_EDITLABELA */
1551  expect(0, r);
1552  /* try to cancel with wrong edit handle */
1554  expect(0, r);
1555  ok(IsWindow(edit), "Expected edit control to be valid\n");
1557  expect(0, r);
1558  ok(!IsWindow(edit), "Expected edit control to be destroyed\n");
1559  /* try to cancel without creating edit */
1561  expect(0, r);
1562 
1563  /* try to cancel with wrong (not null) handle */
1565  ok(IsWindow(edit), "Expected valid handle\n");
1567  expect(0, r);
1568  ok(IsWindow(edit), "Expected edit control to be valid\n");
1570  expect(0, r);
1571 
1572  /* remove selection after starting edit */
1574  expect(TRUE, r);
1576  ok(IsWindow(edit), "Expected valid handle\n");
1578  expect(TRUE, r);
1579  /* alter text */
1580  strcpy(buffA, "x");
1581  r = SendMessageA(edit, WM_SETTEXT, 0, (LPARAM)buffA);
1582  expect(TRUE, r);
1584  expect(0, r);
1585  ok(!IsWindow(edit), "Expected edit control to be destroyed\n");
1586  /* check that text is saved */
1587  item.mask = TVIF_TEXT;
1588  item.hItem = hRoot;
1589  item.pszText = buffA;
1590  item.cchTextMax = sizeof(buffA)/sizeof(CHAR);
1592  expect(TRUE, r);
1593  ok(!strcmp("x", buffA), "Expected item text to change\n");
1594 
1595  /* try A/W messages */
1597  ok(IsWindow(edit), "Expected valid handle\n");
1598  ok(IsWindowUnicode(edit), "got ansi window\n");
1600  expect(0, r);
1601  ok(!IsWindow(edit), "expected invalid handle\n");
1602 
1604  ok(IsWindow(edit), "Expected valid handle\n");
1605  ok(IsWindowUnicode(edit), "got ansi window\n");
1607  expect(0, r);
1608 
1609  /* alter text during TVM_BEGINLABELEDIT, check that it's preserved */
1610  strcpy(buffA, "<root>");
1611 
1612  item.mask = TVIF_TEXT;
1613  item.hItem = hRoot;
1614  item.pszText = buffA;
1615  item.cchTextMax = 0;
1617  expect(TRUE, r);
1618