ReactOS 0.4.15-dev-7924-g5949c20
listview.c File Reference
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include "wine/test.h"
#include "v6util.h"
#include "msg.h"
Include dependency graph for listview.c:

Go to the source code of this file.

Macros

#define LISTVIEW_ID   0
 
#define HEADER_ID   1
 
#define expect(expected, got)   ok(got == expected, "Expected %d, got %d\n", expected, got)
 
#define expect2(expected1, expected2, got1, got2)
 
#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 
#define test_lvm_hittest(a, b, c, d, e, f, g, h)   test_lvm_hittest_(a,b,c,d,e,f,g,h,__LINE__)
 
#define test_lvm_subitemhittest(a, b, c, d, e, f, g, h, i)   test_lvm_subitemhittest_(a,b,c,d,e,f,g,h,i,__LINE__)
 
#define TEST_NO_HEADER(a)   test_header_presence_(a, FALSE, __LINE__)
 
#define TEST_HEADER_EXPECTED(a)   test_header_presence_(a, TRUE, __LINE__)
 
#define TEST_NO_HEADER2(a, b)   test_header_presence_(a, b, __LINE__)
 

Enumerations

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

Functions

static HIMAGELIST (WINAPI *pImageList_Create)(int
 
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST)
 
static int (WINAPI *pImageList_Add)(HIMAGELIST
 
static HWND subclass_editbox (HWND hwndListview)
 
static void init_functions (void)
 
static LRESULT WINAPI parent_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static BOOL register_parent_wnd_class (BOOL Unicode)
 
static HWND create_parent_window (BOOL Unicode)
 
static LRESULT WINAPI listview_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static HWND create_listview_control (DWORD style)
 
static HWND create_listview_controlW (DWORD style, HWND parent)
 
static BOOL is_win_xp (void)
 
static LRESULT WINAPI header_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static HWND subclass_header (HWND hwndListview)
 
static LRESULT WINAPI editbox_subclass_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_lvm_hittest_ (HWND hwnd, INT x, INT y, INT item, UINT flags, UINT broken_flags, BOOL todo_item, BOOL todo_flags, int line)
 
static void test_lvm_subitemhittest_ (HWND hwnd, INT x, INT y, INT item, INT subitem, UINT flags, BOOL todo_item, BOOL todo_subitem, BOOL todo_flags, int line)
 
static void test_images (void)
 
static void test_checkboxes (void)
 
static void insert_column (HWND hwnd, int idx)
 
static void insert_item (HWND hwnd, int idx)
 
static void test_items (void)
 
static void test_columns (void)
 
static LRESULT CALLBACK create_test_wndproc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void test_header_presence_ (HWND hwnd, BOOL present, int line)
 
static void test_create (BOOL is_version_6)
 
static void test_redraw (void)
 
static LRESULT WINAPI cd_wndproc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_customdraw (void)
 
static void test_icon_spacing (void)
 
static void test_color (void)
 
static void test_item_count (void)
 
static void test_item_position (void)
 
static void test_getorigin (void)
 
static void test_multiselect (void)
 
static void test_subitem_rect (void)
 
static INT WINAPI test_CallBackCompare (LPARAM first, LPARAM second, LPARAM lParam)
 
static void test_sorting (void)
 
static void test_ownerdata (void)
 
static void test_norecompute (void)
 
static void test_nosortheader (void)
 
static void test_setredraw (void)
 
static void test_hittest (void)
 
static void test_getviewrect (void)
 
static void test_getitemposition (void)
 
static void test_columnscreation (void)
 
static void test_getitemrect (void)
 
static void test_editbox (void)
 
static void test_notifyformat (void)
 
static void test_indentation (void)
 
static INT CALLBACK DummyCompareEx (LPARAM first, LPARAM second, LPARAM param)
 
static BOOL is_below_comctl_5 (void)
 
static void test_get_set_view (void)
 
static void test_canceleditlabel (void)
 
static void test_mapidindex (void)
 
static void test_getitemspacing (void)
 
static INT get_current_font_height (HWND listview)
 
static void test_getcolumnwidth (void)
 
static void test_scrollnotify (void)
 
static void test_LVS_EX_TRANSPARENTBKGND (void)
 
static void test_approximate_viewrect (void)
 
static void test_finditem (void)
 
static void test_LVS_EX_HEADERINALLVIEWS (void)
 
static void test_hover (void)
 
static void test_destroynotify (void)
 
static void test_header_notification (void)
 
static void test_header_notification2 (void)
 
static void test_createdragimage (void)
 
static void test_dispinfo (void)
 
static void test_LVM_SETITEMTEXT (void)
 
static void test_LVM_REDRAWITEMS (void)
 
static void test_imagelists (void)
 
static void test_deleteitem (void)
 
static void test_insertitem (void)
 
static void test_header_proc (void)
 
static void flush_events (void)
 
static void test_oneclickactivate (void)
 
static void test_callback_mask (void)
 
static void test_state_image (void)
 
static void test_LVSCW_AUTOSIZE (void)
 
static void test_LVN_ENDLABELEDIT (void)
 
static LRESULT CALLBACK create_item_height_wndproc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_LVM_GETCOUNTPERPAGE (void)
 
static void test_item_state_change (void)
 
 START_TEST (listview)
 

Variables

static int
 
static UINT
 
static HBITMAP
 
static const WCHAR testparentclassW []
 
static HWND hwndparent
 
static HWND hwndparentW
 
static BOOL blockEdit
 
static BOOL g_block_hover
 
static NMLISTVIEW g_nmlistview
 
static NMLISTVIEW g_nmlistview_changing
 
static INT notifyFormat
 
static BOOL g_is_below_5
 
static LVITEMA g_itema
 
static BOOL g_disp_A_to_W
 
static NMLVDISPINFOA g_editbox_disp_info
 
static BOOL g_focus_test_LVN_DELETEITEM
 
static BOOL g_WM_KILLFOCUS_on_LVN_ENDLABELEDIT
 
static struct msg_sequencesequences [NUM_MSG_SEQUENCES]
 
static const struct message create_ownerdrawfixed_parent_seq []
 
static const struct message redraw_listview_seq []
 
static const struct message listview_icon_spacing_seq []
 
static const struct message listview_color_seq []
 
static const struct message listview_item_count_seq []
 
static const struct message listview_itempos_seq []
 
static const struct message listview_ownerdata_switchto_seq []
 
static const struct message listview_getorderarray_seq []
 
static const struct message listview_setorderarray_seq []
 
static const struct message empty_seq []
 
static const struct message parent_focus_change_ownerdata_seq []
 
static const struct message forward_erasebkgnd_parent_seq []
 
static const struct message ownerdata_select_focus_parent_seq []
 
static const struct message ownerdata_setstate_all_parent_seq []
 
static const struct message ownerdata_defocus_all_parent_seq []
 
static const struct message ownerdata_deselect_all_parent_seq []
 
static const struct message change_all_parent_seq []
 
static const struct message changing_all_parent_seq []
 
static const struct message textcallback_set_again_parent_seq []
 
static const struct message single_getdispinfo_parent_seq []
 
static const struct message getitemposition_seq1 []
 
static const struct message getitemposition_seq2 []
 
static const struct message getsubitemrect_seq []
 
static const struct message editbox_create_pos []
 
static const struct message scroll_parent_seq []
 
static const struct message setredraw_seq []
 
static const struct message lvs_ex_transparentbkgnd_seq []
 
static const struct message edit_end_nochange []
 
static const struct message hover_parent []
 
static const struct message listview_destroy []
 
static const struct message listview_ownerdata_destroy []
 
static const struct message listview_ownerdata_deleteall []
 
static const struct message listview_header_changed_seq []
 
static const struct message parent_header_click_seq []
 
static const struct message parent_header_divider_dclick_seq []
 
static const struct message listview_set_imagelist []
 
static const struct message listview_header_set_imagelist []
 
static const struct message parent_insert_focused_seq []
 
static const struct message parent_report_cd_seq []
 
static const struct message parent_list_cd_seq []
 
static const struct message listview_end_label_edit []
 
static const struct message listview_end_label_edit_kill_focus []
 
static WNDPROC listviewWndProc
 
static HIMAGELIST test_create_imagelist
 

Macro Definition Documentation

◆ expect

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

Definition at line 49 of file listview.c.

◆ expect2

#define expect2 (   expected1,
  expected2,
  got1,
  got2 
)
Value:
ok(expected1 == got1 && expected2 == got2, \
"expected (%d,%d), got (%d,%d)\n", expected1, expected2, got1, got2)
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR expected2[]
Definition: dir.c:143
static const WCHAR expected1[]
Definition: dir.c:142

Definition at line 50 of file listview.c.

◆ HEADER_ID

#define HEADER_ID   1

Definition at line 47 of file listview.c.

◆ LISTVIEW_ID

#define LISTVIEW_ID   0

Definition at line 46 of file listview.c.

◆ TEST_HEADER_EXPECTED

#define TEST_HEADER_EXPECTED (   a)    test_header_presence_(a, TRUE, __LINE__)

Definition at line 1571 of file listview.c.

◆ test_lvm_hittest

#define test_lvm_hittest (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    test_lvm_hittest_(a,b,c,d,e,f,g,h,__LINE__)

Definition at line 859 of file listview.c.

◆ test_lvm_subitemhittest

#define test_lvm_subitemhittest (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    test_lvm_subitemhittest_(a,b,c,d,e,f,g,h,i,__LINE__)

Definition at line 886 of file listview.c.

◆ TEST_NO_HEADER

#define TEST_NO_HEADER (   a)    test_header_presence_(a, FALSE, __LINE__)

Definition at line 1570 of file listview.c.

◆ TEST_NO_HEADER2

#define TEST_NO_HEADER2 (   a,
  b 
)    test_header_presence_(a, b, __LINE__)

Definition at line 1572 of file listview.c.

◆ X

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

Enumeration Type Documentation

◆ seq_index

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

Definition at line 36 of file listview.c.

36 {
44};
@ COMBINED_SEQ_INDEX
Definition: listview.c:42
@ EDITBOX_SEQ_INDEX
Definition: listview.c:41
@ PARENT_FULL_SEQ_INDEX
Definition: listview.c:38
@ PARENT_CD_SEQ_INDEX
Definition: listview.c:39
@ NUM_MSG_SEQUENCES
Definition: listview.c:43
@ LISTVIEW_SEQ_INDEX
Definition: listview.c:40
@ PARENT_SEQ_INDEX
Definition: listview.c:37

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pImageList_Destroy)
static

◆ cd_wndproc()

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

Definition at line 1867 of file listview.c.

1868{
1869 COLORREF clr, c0ffee = RGB(0xc0, 0xff, 0xee);
1870
1871 if(message == WM_NOTIFY) {
1872 NMHDR *nmhdr = (NMHDR*)lParam;
1873 if(nmhdr->code == NM_CUSTOMDRAW) {
1874 NMLVCUSTOMDRAW *nmlvcd = (NMLVCUSTOMDRAW*)nmhdr;
1875 struct message msg;
1876
1877 msg.message = message;
1878 msg.flags = sent|wparam|lparam|custdraw;
1879 msg.wParam = wParam;
1880 msg.lParam = lParam;
1881 msg.id = nmhdr->code;
1882 msg.stage = nmlvcd->nmcd.dwDrawStage;
1884
1885 switch(nmlvcd->nmcd.dwDrawStage) {
1886 case CDDS_PREPAINT:
1887 SetBkColor(nmlvcd->nmcd.hdc, c0ffee);
1889 case CDDS_ITEMPREPAINT:
1890 nmlvcd->clrTextBk = CLR_DEFAULT;
1891 nmlvcd->clrText = RGB(0, 255, 0);
1894 clr = GetBkColor(nmlvcd->nmcd.hdc);
1895 ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
1896 ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
1898 {
1899 todo_wine_if(nmlvcd->iSubItem)
1900 ok(clr == c0ffee, "clr=%.8x\n", clr);
1901 }
1904 clr = GetBkColor(nmlvcd->nmcd.hdc);
1905 if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS))
1906 todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr);
1907 ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk);
1908 ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
1910 }
1912 }
1913 }
1914
1916}
@ sent
Definition: SystemMenu.c:27
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define add_message(msg)
Definition: SystemMenu.c:98
#define msg(x)
Definition: auth_time.c:54
return
Definition: dirsup.c:529
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
@ custdraw
Definition: msg.h:45
#define RGB(r, g, b)
Definition: precomp.h:71
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
if(dx< 0)
Definition: linetemp.h:194
HDC hdc
Definition: main.c:9
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: listview.c:95
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define todo_wine
Definition: custom.c:79
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDDS_SUBITEM
Definition: commctrl.h:289
#define CDRF_NOTIFYSUBITEMDRAW
Definition: commctrl.h:276
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define CLR_DEFAULT
Definition: commctrl.h:320
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define WM_NOTIFY
Definition: richedit.h:61
Definition: tftpd.h:60
UINT message
Definition: SystemMenu.c:42
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
COLORREF clrTextBk
Definition: commctrl.h:3064
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3062
COLORREF clrText
Definition: commctrl.h:3063
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:852

Referenced by test_customdraw().

◆ create_item_height_wndproc()

static LRESULT CALLBACK create_item_height_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6408 of file listview.c.

6409{
6410 if (msg == WM_CREATE)
6411 return 0;
6412
6414}
static WNDPROC listviewWndProc
Definition: listview.c:1552
#define WM_CREATE
Definition: winuser.h:1608
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_LVM_GETCOUNTPERPAGE().

◆ create_listview_control()

static HWND create_listview_control ( DWORD  style)
static

Definition at line 690 of file listview.c.

691{
692 WNDPROC oldproc;
693 HWND hwnd;
694 RECT rect;
695
699 0, 0, rect.right, rect.bottom,
701 ok(hwnd != NULL, "gle=%d\n", GetLastError());
702
703 if (!hwnd) return NULL;
704
708
709 return hwnd;
710}
Arabic default style
Definition: afstyles.h:94
#define NULL
Definition: types.h:112
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static HWND hwndparent
Definition: listview.c:56
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:668
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
#define WC_LISTVIEWA
Definition: commctrl.h:2256
& rect
Definition: startmenu.cpp:1413
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SetWindowLongPtrA
Definition: winuser.h:5345
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906

Referenced by is_below_comctl_5(), is_win_xp(), test_approximate_viewrect(), test_callback_mask(), test_canceleditlabel(), test_color(), test_columns(), test_columnscreation(), test_create(), test_createdragimage(), test_customdraw(), test_deleteitem(), test_destroynotify(), test_dispinfo(), test_editbox(), test_finditem(), test_get_set_view(), test_getcolumnwidth(), test_getitemposition(), test_getitemrect(), test_getitemspacing(), test_getorigin(), test_getviewrect(), test_header_notification(), test_header_notification2(), test_header_proc(), test_hittest(), test_hover(), test_icon_spacing(), test_imagelists(), test_indentation(), test_insertitem(), test_item_count(), test_item_position(), test_item_state_change(), test_LVM_GETCOUNTPERPAGE(), test_LVM_REDRAWITEMS(), test_LVM_SETITEMTEXT(), test_LVN_ENDLABELEDIT(), test_LVS_EX_HEADERINALLVIEWS(), test_LVS_EX_TRANSPARENTBKGND(), test_LVSCW_AUTOSIZE(), test_mapidindex(), test_multiselect(), test_norecompute(), test_nosortheader(), test_notifyformat(), test_ownerdata(), test_redraw(), test_scrollnotify(), test_setredraw(), test_sorting(), test_state_image(), and test_subitem_rect().

◆ create_listview_controlW()

static HWND create_listview_controlW ( DWORD  style,
HWND  parent 
)
static

Definition at line 713 of file listview.c.

714{
715 WNDPROC oldproc;
716 HWND hwnd;
717 RECT rect;
718 static const WCHAR nameW[] = {'f','o','o',0};
719
723 0, 0, rect.right, rect.bottom,
725 ok(hwnd != NULL, "gle=%d\n", GetLastError());
726
727 if (!hwnd) return NULL;
728
732
733 return hwnd;
734}
static const WCHAR nameW[]
Definition: main.c:46
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
r parent
Definition: btrfs.c:3010
#define WC_LISTVIEWW
Definition: commctrl.h:2257
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define SetWindowLongPtrW
Definition: winuser.h:5346
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_notifyformat().

◆ create_parent_window()

static HWND create_parent_window ( BOOL  Unicode)
static

Definition at line 640 of file listview.c.

641{
642 static const WCHAR nameW[] = {'t','e','s','t','p','a','r','e','n','t','n','a','m','e','W',0};
643 HWND hwnd;
644
645 if (!register_parent_wnd_class(Unicode))
646 return NULL;
647
649 notifyFormat = -1;
650
651 if (Unicode)
655 0, 0, 100, 100,
657 else
658 hwnd = CreateWindowExA(0, "Listview test parent class",
659 "Listview test parent window",
662 0, 0, 100, 100,
665 return hwnd;
666}
#define FALSE
Definition: types.h:117
static BOOL register_parent_wnd_class(void)
Definition: header.c:458
static const WCHAR testparentclassW[]
Definition: listview.c:53
static BOOL blockEdit
Definition: listview.c:58
static INT notifyFormat
Definition: listview.c:67
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define HWND_TOPMOST
Definition: winuser.h:1208
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656

◆ create_test_wndproc()

static LRESULT CALLBACK create_test_wndproc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1555 of file listview.c.

1556{
1557 LRESULT ret;
1558
1559 if (uMsg == WM_CREATE)
1560 {
1562 lpcs->style |= LVS_REPORT;
1563 }
1566 return ret;
1567}
static HIMAGELIST test_create_imagelist
Definition: listview.c:1553
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVM_SETIMAGELIST
Definition: commctrl.h:2303
int ret
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_create().

◆ DummyCompareEx()

static INT CALLBACK DummyCompareEx ( LPARAM  first,
LPARAM  second,
LPARAM  param 
)
static

Definition at line 4580 of file listview.c.

4581{
4582 return 0;
4583}

Referenced by is_below_comctl_5().

◆ editbox_subclass_proc()

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

Definition at line 785 of file listview.c.

786{
788 static LONG defwndproc_counter = 0;
789 struct message msg = { 0 };
790 LRESULT ret;
791
792 msg.message = message;
793 msg.flags = sent|wparam|lparam;
794 if (defwndproc_counter) msg.flags |= defwinproc;
795 msg.wParam = wParam;
796 msg.lParam = lParam;
797
798 /* all we need is sizing */
802 message == WM_MOVE ||
803 message == WM_SIZE)
804 {
806 }
807
808 defwndproc_counter++;
810 defwndproc_counter--;
811 return ret;
812}
@ defwinproc
Definition: SystemMenu.c:32
long LONG
Definition: pedump.c:60
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_SIZE
Definition: winuser.h:1611
#define GetWindowLongPtrA
Definition: winuser.h:4828
#define WM_MOVE
Definition: winuser.h:1610
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662

Referenced by subclass_editbox().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 5993 of file listview.c.

5994{
5995 MSG msg;
5996 int diff = 200;
5997 int min_timeout = 100;
5998 DWORD time = GetTickCount() + diff;
5999
6000 while (diff > 0)
6001 {
6002 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
6003 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
6004 diff = time - GetTickCount();
6005 }
6006}
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
unsigned long DWORD
Definition: ntddk_ex.h:95
__u16 time
Definition: mkdosfs.c:8
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:903
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

Referenced by test_oneclickactivate().

◆ get_current_font_height()

static INT get_current_font_height ( HWND  listview)
static

Definition at line 4882 of file listview.c.

4883{
4885 HFONT hfont;
4886 HWND hwnd;
4887 HDC hdc;
4888
4889 hwnd = (HWND)SendMessageA(listview, LVM_GETHEADER, 0, 0);
4890 if (!hwnd)
4891 hwnd = listview;
4892
4894 if (!hfont) {
4895 hdc = GetDC(hwnd);
4897 ReleaseDC(hwnd, hdc);
4898 }
4899 else {
4900 HFONT oldfont;
4901
4902 hdc = GetDC(0);
4903 oldfont = SelectObject(hdc, hfont);
4905 SelectObject(hdc, oldfont);
4906 ReleaseDC(0, hdc);
4907 }
4908
4909 return tm.tmHeight;
4910}
static HFONT hfont
HANDLE HWND
Definition: compat.h:19
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define LVM_GETHEADER
Definition: commctrl.h:2650
Definition: time.h:68
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_GETFONT
Definition: winuser.h:1651
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by test_getcolumnwidth().

◆ header_subclass_proc()

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

Definition at line 751 of file listview.c.

752{
754 static LONG defwndproc_counter = 0;
755 struct message msg = { 0 };
756 LRESULT ret;
757
758 msg.message = message;
759 msg.flags = sent|wparam|lparam;
760 if (defwndproc_counter) msg.flags |= defwinproc;
761 msg.wParam = wParam;
762 msg.lParam = lParam;
763 msg.id = HEADER_ID;
765
766 defwndproc_counter++;
768 defwndproc_counter--;
769 return ret;
770}
#define HEADER_ID
Definition: listview.c:47

Referenced by subclass_header().

◆ HIMAGELIST()

static HIMAGELIST ( WINAPI pImageList_Create)
static

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 83 of file listview.c.

84{
85 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
86
87#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
92#undef X
93}
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1207
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define X(f)

Referenced by START_TEST().

◆ insert_column()

static void insert_column ( HWND  hwnd,
int  idx 
)
static

Definition at line 1158 of file listview.c.

1159{
1161 INT rc;
1162
1163 memset(&column, 0xcc, sizeof(column));
1164 column.mask = LVCF_SUBITEM;
1165 column.iSubItem = idx;
1166
1168 expect(idx, rc);
1169}
unsigned int idx
Definition: utils.c:41
#define expect(expected, got)
Definition: listview.c:49
#define LVM_INSERTCOLUMNA
Definition: commctrl.h:2631
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define memset(x, y, z)
Definition: compat.h:39
int32_t INT
Definition: typedefs.h:58

Referenced by test_customdraw(), test_editbox(), test_getitemposition(), test_getitemrect(), test_getviewrect(), test_hittest(), test_items(), test_LVN_ENDLABELEDIT(), test_LVSCW_AUTOSIZE(), test_scrollnotify(), and test_state_image().

◆ insert_item()

static void insert_item ( HWND  hwnd,
int  idx 
)
static

Definition at line 1171 of file listview.c.

1172{
1173 static CHAR text[] = "foo";
1174
1175 LVITEMA item;
1176 INT rc;
1177
1178 memset(&item, 0xcc, sizeof (item));
1179 item.mask = LVIF_TEXT;
1180 item.iItem = idx;
1181 item.iSubItem = 0;
1182 item.pszText = text;
1183
1185 expect(idx, rc);
1186}
const WCHAR * text
Definition: package.c:1799
static ATOM item
Definition: dde.c:856
#define LVM_INSERTITEMA
Definition: commctrl.h:2403
#define LVIF_TEXT
Definition: commctrl.h:2309
char CHAR
Definition: xmlstorage.h:175

Referenced by is_below_comctl_5(), test_canceleditlabel(), test_columns(), test_columnscreation(), test_createdragimage(), test_customdraw(), test_deleteitem(), test_dispinfo(), test_finditem(), test_getitemposition(), test_hittest(), test_item_state_change(), test_LVM_REDRAWITEMS(), test_LVM_SETITEMTEXT(), test_LVSCW_AUTOSIZE(), test_mapidindex(), test_multiselect(), test_scrollnotify(), and test_subitem_rect().

◆ int()

static int ( WINAPI pImageList_Add)
static

◆ is_below_comctl_5()

static BOOL is_below_comctl_5 ( void  )
static

Definition at line 4585 of file listview.c.

4586{
4587 HWND hwnd;
4588 BOOL ret;
4589
4591 ok(hwnd != NULL, "failed to create a listview window\n");
4592 insert_item(hwnd, 0);
4593
4595
4597
4598 return !ret;
4599}
unsigned int BOOL
Definition: ntddk_ex.h:94
static INT CALLBACK DummyCompareEx(LPARAM first, LPARAM second, LPARAM param)
Definition: listview.c:4580
static void insert_item(HWND hwnd, int idx)
Definition: listview.c:1171
static HWND create_listview_control(DWORD style)
Definition: listview.c:690
#define LVM_SORTITEMSEX
Definition: commctrl.h:2800
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ is_win_xp()

static BOOL is_win_xp ( void  )
static

Definition at line 736 of file listview.c.

737{
739 BOOL ret;
740
742 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS, LVS_EX_HEADERINALLVIEWS);
744 ret = !IsWindow(header);
745
747
748 return ret;
749}
#define LVS_ICON
Definition: commctrl.h:2261
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by test_create().

◆ listview_subclass_proc()

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

Definition at line 668 of file listview.c.

669{
671 static LONG defwndproc_counter = 0;
672 LRESULT ret;
673 struct message msg;
674
675 msg.message = message;
676 msg.flags = sent|wparam|lparam;
677 if (defwndproc_counter) msg.flags |= defwinproc;
678 msg.wParam = wParam;
679 msg.lParam = lParam;
680 msg.id = LISTVIEW_ID;
683
684 defwndproc_counter++;
686 defwndproc_counter--;
687 return ret;
688}
#define LISTVIEW_ID
Definition: listview.c:46

Referenced by create_listview_control(), and create_listview_controlW().

◆ parent_wnd_proc()

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

Definition at line 469 of file listview.c.

470{
471 static LONG defwndproc_counter = 0;
472 LRESULT ret;
473 struct message msg;
474
475 msg.message = message;
476 msg.flags = sent|wparam|lparam;
477 if (defwndproc_counter) msg.flags |= defwinproc;
478 msg.wParam = wParam;
479 msg.lParam = lParam;
480 if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code;
481 if (message == WM_COMMAND) msg.id = HIWORD(wParam);
482
483 /* log system messages, except for painting */
484 if (message < WM_USER &&
485 message != WM_PAINT &&
487 message != WM_NCPAINT &&
489 message != WM_GETTEXT &&
490 message != WM_GETICON &&
492 {
495 }
497
498 switch (message)
499 {
500 case WM_NOTIFY:
501 {
502 switch (((NMHDR*)lParam)->code)
503 {
505 {
506 HWND edit = NULL;
507
508 /* subclass edit box */
509 if (!blockEdit)
510 edit = subclass_editbox(((NMHDR*)lParam)->hwndFrom);
511
512 if (edit)
513 {
514 INT len = SendMessageA(edit, EM_GETLIMITTEXT, 0, 0);
515 ok(len == 259 || broken(len == 260) /* includes NULL in NT4 */,
516 "text limit %d, expected 259\n", len);
517 }
518
519 return blockEdit;
520 }
522 {
523 HWND edit;
524
525 /* always accept new item text */
528
529 /* edit control still available from this notification */
530 edit = (HWND)SendMessageA(((NMHDR*)lParam)->hwndFrom, LVM_GETEDITCONTROL, 0, 0);
531 ok(IsWindow(edit), "expected valid edit control handle\n");
532 ok((GetWindowLongA(edit, GWL_STYLE) & ES_MULTILINE) == 0, "edit is multiline\n");
533
535 SendMessageA(edit, WM_KILLFOCUS, 0, 0);
536
537 return TRUE;
538 }
539 case LVN_ITEMCHANGING:
540 {
541 NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam;
542 g_nmlistview_changing = *nmlv;
543 }
544 break;
545 case LVN_ITEMCHANGED:
546 {
547 NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam;
548 g_nmlistview = *nmlv;
549 }
550 break;
551 case LVN_GETDISPINFOA:
552 {
553 NMLVDISPINFOA *dispinfo = (NMLVDISPINFOA*)lParam;
554 g_itema = dispinfo->item;
555
556 if (g_disp_A_to_W && (dispinfo->item.mask & LVIF_TEXT))
557 {
558 static const WCHAR testW[] = {'T','E','S','T',0};
559 dispinfo->hdr.code = LVN_GETDISPINFOW;
560 memcpy(dispinfo->item.pszText, testW, sizeof(testW));
561 }
562
563 /* test control buffer size for text, 10 used to mask cases when control
564 is using caller buffer to process LVM_GETITEM for example */
565 if (dispinfo->item.mask & LVIF_TEXT && dispinfo->item.cchTextMax > 10)
566 ok(dispinfo->item.cchTextMax == 260 ||
567 broken(dispinfo->item.cchTextMax == 264) /* NT4 reports aligned size */,
568 "buffer size %d\n", dispinfo->item.cchTextMax);
569 }
570 break;
571 case LVN_DELETEITEM:
573 {
574 NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam;
575 UINT state;
576
578 ok(state == 0, "got state %x\n", state);
579 }
580 break;
581 case NM_HOVER:
582 if (g_block_hover) return 1;
583 break;
584 }
585 break;
586 }
587 case WM_NOTIFYFORMAT:
588 {
589 /* force to return format */
590 if (lParam == NF_QUERY && notifyFormat != -1) return notifyFormat;
591 break;
592 }
593 }
594
595 defwndproc_counter++;
598 else
600 defwndproc_counter--;
601
602 return ret;
603}
#define broken(x)
Definition: _sntprintf.h:21
static int state
Definition: maze.c:121
#define TRUE
Definition: types.h:120
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR testW[]
Definition: jsregexp.c:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static NMLVDISPINFOA g_editbox_disp_info
Definition: listview.c:75
static BOOL g_focus_test_LVN_DELETEITEM
Definition: listview.c:77
static NMLISTVIEW g_nmlistview_changing
Definition: listview.c:64
static LVITEMA g_itema
Definition: listview.c:71
static NMLISTVIEW g_nmlistview
Definition: listview.c:62
static BOOL g_disp_A_to_W
Definition: listview.c:73
static BOOL g_block_hover
Definition: listview.c:60
static BOOL g_WM_KILLFOCUS_on_LVN_ENDLABELEDIT
Definition: listview.c:79
static HWND subclass_editbox(HWND hwndListview)
Definition: listview.c:814
unsigned int UINT
Definition: ndis.h:50
#define ES_MULTILINE
Definition: pedump.c:667
#define LVN_GETDISPINFOA
Definition: commctrl.h:3153
#define LVM_GETITEMSTATE
Definition: commctrl.h:2675
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2542
#define NM_HOVER
Definition: commctrl.h:138
#define LVN_ITEMCHANGING
Definition: commctrl.h:3130
#define LVN_BEGINLABELEDITA
Definition: commctrl.h:3135
#define LVN_ENDLABELEDITA
Definition: commctrl.h:3137
#define LVN_GETDISPINFOW
Definition: commctrl.h:3154
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define LVN_DELETEITEM
Definition: commctrl.h:3133
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define EM_GETLIMITTEXT
Definition: richedit.h:74
Definition: inflate.c:139
LVITEMA item
Definition: commctrl.h:3174
int cchTextMax
Definition: commctrl.h:2349
LPSTR pszText
Definition: commctrl.h:2348
UINT mask
Definition: commctrl.h:2343
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_NCHITTEST
Definition: winuser.h:1686
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_DEVICECHANGE
Definition: winuser.h:1811
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_USER
Definition: winuser.h:1895
#define WM_KILLFOCUS
Definition: winuser.h:1614
#define NF_QUERY
Definition: winuser.h:2460
#define WM_NCPAINT
Definition: winuser.h:1687

Referenced by register_parent_wnd_class().

◆ register_parent_wnd_class()

static BOOL register_parent_wnd_class ( BOOL  Unicode)
static

Definition at line 605 of file listview.c.

606{
607 WNDCLASSA clsA;
608 WNDCLASSW clsW;
609
610 if (Unicode)
611 {
612 clsW.style = 0;
614 clsW.cbClsExtra = 0;
615 clsW.cbWndExtra = 0;
617 clsW.hIcon = 0;
620 clsW.lpszMenuName = NULL;
622 }
623 else
624 {
625 clsA.style = 0;
627 clsA.cbClsExtra = 0;
628 clsA.cbWndExtra = 0;
630 clsA.hIcon = 0;
633 clsA.lpszMenuName = NULL;
634 clsA.lpszClassName = "Listview test parent class";
635 }
636
637 return Unicode ? RegisterClassW(&clsW) : RegisterClassA(&clsA);
638}
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:469
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
LPCWSTR lpszClassName
Definition: winuser.h:3185
LPCWSTR lpszMenuName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2090
const char * LPCSTR
Definition: xmlstorage.h:183

◆ START_TEST()

START_TEST ( listview  )

Definition at line 6558 of file listview.c.

6559{
6560 ULONG_PTR ctx_cookie;
6561 HANDLE hCtx;
6562
6564
6566
6569
6571
6574 test_images();
6576 test_items();
6578 test_redraw();
6581 test_color();
6584 test_columns();
6589 test_sorting();
6594 test_hittest();
6598 test_editbox();
6604 test_finditem();
6605 test_hover();
6608 test_dispinfo();
6622
6623 if (!load_v6_module(&ctx_cookie, &hCtx))
6624 {
6626 return;
6627 }
6628
6630
6631 /* comctl32 version 6 tests start here */
6642 test_images();
6644 test_items();
6646 test_color();
6647 test_columns();
6648 test_sorting();
6654 test_finditem();
6655 test_hover();
6658 test_dispinfo();
6667
6668 unload_v6_module(ctx_cookie, hCtx);
6669
6671}
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:391
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:97
static void test_finditem(void)
Definition: listview.c:5227
static void test_LVM_GETCOUNTPERPAGE(void)
Definition: listview.c:6416
static void test_hittest(void)
Definition: listview.c:3687
static void test_imagelists(void)
Definition: listview.c:5777
static void test_sorting(void)
Definition: listview.c:2897
static void test_subitem_rect(void)
Definition: listview.c:2701
static void test_hover(void)
Definition: listview.c:5372
static void test_multiselect(void)
Definition: listview.c:2305
static void test_LVN_ENDLABELEDIT(void)
Definition: listview.c:6357
static void test_items(void)
Definition: listview.c:1188
static void test_customdraw(void)
Definition: listview.c:1918
static void test_indentation(void)
Definition: listview.c:4551
static void test_LVM_SETITEMTEXT(void)
Definition: listview.c:5704
static void test_checkboxes(void)
Definition: listview.c:961
static void test_LVS_EX_HEADERINALLVIEWS(void)
Definition: listview.c:5312
static void test_norecompute(void)
Definition: listview.c:3493
static void test_editbox(void)
Definition: listview.c:4214
static void test_ownerdata(void)
Definition: listview.c:3075
static void test_notifyformat(void)
Definition: listview.c:4433
static void test_header_notification2(void)
Definition: listview.c:5496
static void test_approximate_viewrect(void)
Definition: listview.c:5032
static void test_LVM_REDRAWITEMS(void)
Definition: listview.c:5740
static BOOL is_below_comctl_5(void)
Definition: listview.c:4585
static void test_scrollnotify(void)
Definition: listview.c:4949
static void test_dispinfo(void)
Definition: listview.c:5673
static void test_destroynotify(void)
Definition: listview.c:5407
static void test_color(void)
Definition: listview.c:2013
static void test_nosortheader(void)
Definition: listview.c:3566
static void test_state_image(void)
Definition: listview.c:6201
static void test_setredraw(void)
Definition: listview.c:3607
static void test_item_position(void)
Definition: listview.c:2190
static void test_getitemposition(void)
Definition: listview.c:3917
static void test_item_count(void)
Definition: listview.c:2085
static void test_LVS_EX_TRANSPARENTBKGND(void)
Definition: listview.c:4988
static void test_mapidindex(void)
Definition: listview.c:4705
static void test_oneclickactivate(void)
Definition: listview.c:6008
static void test_columns(void)
Definition: listview.c:1445
static void test_insertitem(void)
Definition: listview.c:5917
static void test_getorigin(void)
Definition: listview.c:2258
static void test_redraw(void)
Definition: listview.c:1793
static void test_get_set_view(void)
Definition: listview.c:4601
static void test_deleteitem(void)
Definition: listview.c:5862
static void test_LVSCW_AUTOSIZE(void)
Definition: listview.c:6313
static void test_getitemrect(void)
Definition: listview.c:3978
static void test_header_proc(void)
Definition: listview.c:5969
static void test_getcolumnwidth(void)
Definition: listview.c:4912
static void test_images(void)
Definition: listview.c:888
static void test_icon_spacing(void)
Definition: listview.c:1971
static void test_callback_mask(void)
Definition: listview.c:6066
static void test_canceleditlabel(void)
Definition: listview.c:4653
static void init_functions(void)
Definition: listview.c:83
static void test_columnscreation(void)
Definition: listview.c:3959
static void test_getviewrect(void)
Definition: listview.c:3866
static void test_getitemspacing(void)
Definition: listview.c:4759
static BOOL g_is_below_5
Definition: listview.c:69
static void test_createdragimage(void)
Definition: listview.c:5651
static void test_header_notification(void)
Definition: listview.c:5437
static void test_item_state_change(void)
Definition: listview.c:6478
static HWND create_parent_window(void)
Definition: monthcal.c:599
static void test_create(void)
Definition: monthcal.c:1595
uint32_t ULONG_PTR
Definition: typedefs.h:65
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63

◆ subclass_editbox()

static HWND subclass_editbox ( HWND  hwndListview)
static

Definition at line 814 of file listview.c.

815{
816 WNDPROC oldproc;
817 HWND hwnd;
818
819 hwnd = (HWND)SendMessageA(hwndListview, LVM_GETEDITCONTROL, 0, 0);
823
824 return hwnd;
825}
static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:785

Referenced by parent_wnd_proc().

◆ subclass_header()

static HWND subclass_header ( HWND  hwndListview)
static

Definition at line 772 of file listview.c.

773{
774 WNDPROC oldproc;
775 HWND hwnd;
776
777 hwnd = (HWND)SendMessageA(hwndListview, LVM_GETHEADER, 0, 0);
781
782 return hwnd;
783}
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:751

Referenced by test_columns(), test_getitemposition(), test_header_notification(), test_imagelists(), test_redraw(), test_setredraw(), and test_subitem_rect().

◆ test_approximate_viewrect()

static void test_approximate_viewrect ( void  )
static

Definition at line 5032 of file listview.c.

5033{
5034 static CHAR test[] = "abracadabra, a very long item label";
5035 DWORD item_width, item_height, header_height;
5036 static CHAR column_header[] = "Header";
5037 unsigned const column_width = 100;
5038 DWORD ret, item_count;
5040 LVITEMA itema;
5041 LVCOLUMNA col;
5042 HBITMAP hbmp;
5043 HWND hwnd;
5044
5045 /* LVS_ICON */
5047 himl = pImageList_Create(40, 40, 0, 4, 4);
5048 ok(himl != NULL, "failed to create imagelist\n");
5049 hbmp = CreateBitmap(40, 40, 1, 1, NULL);
5050 ok(hbmp != NULL, "failed to create bitmap\n");
5051 ret = pImageList_Add(himl, hbmp, 0);
5052 expect(0, ret);
5054 expect(0, ret);
5055
5056 itema.mask = LVIF_IMAGE;
5057 itema.iImage = 0;
5058 itema.iItem = 0;
5059 itema.iSubItem = 0;
5060 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
5061 expect(0, ret);
5062
5064 ok(ret != 0, "Unexpected return value %#x.\n", ret);
5065
5067 expect(MAKELONG(77,827), ret);
5068
5070 ok(ret != 0, "got 0\n");
5071
5073 expect(MAKELONG(102,302), ret);
5074
5076 expect(MAKELONG(52,52), ret);
5077
5078 itema.pszText = test;
5080 expect(TRUE, ret);
5082 expect(MAKELONG(52,52), ret);
5083
5085 expect(MAKELONG(52,2), ret);
5087 expect(MAKELONG(52,52), ret);
5089 expect(MAKELONG(102,52), ret);
5091 expect(MAKELONG(102,102), ret);
5093 expect(MAKELONG(102,102), ret);
5095 expect(MAKELONG(102,152), ret);
5097 expect(MAKELONG(102,152), ret);
5099 expect(MAKELONG(152,152), ret);
5100
5102
5103 /* LVS_REPORT */
5105
5106 /* Empty control without columns */
5109 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5110 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5111
5113 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5115 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5116
5117 header_height = HIWORD(ret);
5118
5120 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5122 ok(HIWORD(ret) > header_height, "Unexpected height %d.\n", HIWORD(ret));
5123
5124 item_height = HIWORD(ret) - header_height;
5125
5127 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5128 ok(HIWORD(ret) == (header_height - 2 * item_height), "Unexpected height %d.\n", HIWORD(ret)) ;
5129
5131 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5132 ok(HIWORD(ret) == header_height, "Unexpected height.\n");
5134 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5135 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5136
5137 /* Insert column */
5138 col.mask = LVCF_TEXT | LVCF_WIDTH;
5139 col.pszText = column_header;
5140 col.cx = column_width;
5142 ok(ret == 0, "Unexpected return value %d.\n", ret);
5143
5144 /* Empty control with column */
5146todo_wine {
5147 ok(LOWORD(ret) >= column_width, "Unexpected width %d.\n", LOWORD(ret));
5148 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5149}
5150 header_height = HIWORD(ret);
5151 item_width = LOWORD(ret);
5152
5154 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5156 ok(HIWORD(ret) > header_height, "Unexpected height %d.\n", HIWORD(ret));
5157
5158 item_height = HIWORD(ret) - header_height;
5159
5161 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5162 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5163
5165 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5166 ok(HIWORD(ret) == header_height, "Unexpected height %d.\n", HIWORD(ret));
5167
5169 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5170 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5171
5172 for (item_count = 1; item_count <= 2; ++item_count)
5173 {
5174 itema.mask = LVIF_TEXT;
5175 itema.iItem = 0;
5176 itema.iSubItem = 0;
5177 itema.pszText = test;
5178 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
5179 ok(ret == 0, "Unexpected return value %d.\n", ret);
5180
5182 ok(LOWORD(ret) >= column_width, "Unexpected width %d.\n", LOWORD(ret));
5183 todo_wine
5184 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5185
5186 header_height = HIWORD(ret);
5187 item_width = LOWORD(ret);
5188
5190 ok(LOWORD(ret) == item_width, "Unexpected width %d, item %d\n", LOWORD(ret), item_count - 1);
5191 ok(HIWORD(ret) > header_height, "Unexpected height %d. item %d.\n", HIWORD(ret), item_count - 1);
5192
5193 item_height = HIWORD(ret) - header_height;
5194
5196 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5197 todo_wine
5198 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5199
5201 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5202 ok(HIWORD(ret) == header_height + item_count * item_height, "Unexpected height %d.\n", HIWORD(ret));
5203
5205 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5206 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5207
5208 ret = SendMessageA(hwnd, LVM_APPROXIMATEVIEWRECT, 2, MAKELONG(item_width * 2, header_height + 3 * item_height));
5209 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5210 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5211
5212 ret = SendMessageA(hwnd, LVM_APPROXIMATEVIEWRECT, -2, MAKELONG(item_width * 2, 0));
5213 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5214 todo_wine
5215 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5216
5218 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5219 todo_wine
5220 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5221 }
5222
5224
5225}
HBITMAP hbmp
HIMAGELIST himl
static HBITMAP
Definition: button.c:44
#define LOWORD(l)
Definition: pedump.c:82
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVM_APPROXIMATEVIEWRECT
Definition: commctrl.h:2778
#define LVM_SETITEMTEXTA
Definition: commctrl.h:2686
#define LVM_SETICONSPACING
Definition: commctrl.h:2721
#define LVIF_IMAGE
Definition: commctrl.h:2310
#define LVCF_TEXT
Definition: commctrl.h:2588
#define test
Definition: rosglue.h:37
LPSTR pszText
Definition: commctrl.h:2556
int iSubItem
Definition: commctrl.h:2345
int iImage
Definition: commctrl.h:2350
#define MAKELONG(a, b)
Definition: typedefs.h:249
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define MAKELPARAM(l, h)
Definition: winuser.h:4008

Referenced by START_TEST().

◆ test_callback_mask()

static void test_callback_mask ( void  )
static

Definition at line 6066 of file listview.c.

6067{
6068 LVITEMA item;
6069 DWORD mask;
6070 HWND hwnd;
6071 BOOL ret;
6072
6074
6076 ok(ret, "got %d\n", ret);
6077
6079 ok(ret, "got %d\n", ret);
6080
6082 ok(mask == ~0u, "got 0x%08x\n", mask);
6083
6085
6086 /* LVS_OWNERDATA, mask LVIS_FOCUSED */
6088
6090 ok(mask == 0, "Unexpected callback mask %#x.\n", mask);
6091
6093 ok(ret, "Failed to set callback mask, %d\n", ret);
6094
6096 ok(mask == LVIS_FOCUSED, "Unexpected callback mask %#x.\n", mask);
6097
6099 ok(ret, "Failed to set item count.\n");
6100
6102 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6103
6104 item.stateMask = LVIS_FOCUSED;
6105 item.state = LVIS_FOCUSED;
6107 ok(ret, "Failed to set item state.\n");
6108
6110
6113 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6114
6117 ok(ret == 0, "Unexpected selection mark, %d\n", ret);
6118
6120 ok(ret, "Failed to set item count.\n");
6121
6123 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6124
6126 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6127
6129 ok(ret, "Failed to set item count.\n");
6130
6132 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6133
6134 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 1", FALSE);
6135
6136 /* LVS_OWNDERDATA, empty mask */
6138 ok(ret, "Failed to set callback mask, %d\n", ret);
6139
6141 ok(ret, "Failed to set item count.\n");
6142
6144 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6145
6146 item.stateMask = LVIS_FOCUSED;
6147 item.state = LVIS_FOCUSED;
6149 ok(ret, "Failed to set item state.\n");
6150
6152 ok(ret == 0, "Unexpected selection mark, %d\n", ret);
6153
6155
6157 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6158
6160 ok(ret, "Failed to set item count.\n");
6161
6163 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6164
6167 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6168
6170 ok(ret, "Failed to set item count.\n");
6171
6173 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6174
6175 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", FALSE);
6176
6177 /* 2 items, focus on index 0, reduce to 1 item. */
6179
6181 ok(ret, "Failed to set item count.\n");
6182
6184 ok(ret, "Failed to set item state.\n");
6185
6187 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6188
6190 ok(ret, "Failed to set item count.\n");
6191
6193 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6194
6196 "parent seq, owner data/focus 3", TRUE);
6197
6199}
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
GLenum GLint GLuint mask
Definition: glext.h:6028
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
static const struct message parent_focus_change_ownerdata_seq[]
Definition: listview.c:215
static const struct message empty_seq[]
Definition: listview.c:211
#define LVM_GETCALLBACKMASK
Definition: commctrl.h:2416
#define LVS_OWNERDATA
Definition: commctrl.h:2274
#define LVM_SETITEMSTATE
Definition: commctrl.h:2672
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2419
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433
#define LVM_SETITEMCOUNT
Definition: commctrl.h:2696
#define LVM_GETSELECTIONMARK
Definition: commctrl.h:2788

Referenced by START_TEST().

◆ test_CallBackCompare()

static INT WINAPI test_CallBackCompare ( LPARAM  first,
LPARAM  second,
LPARAM  lParam 
)
static

Definition at line 2891 of file listview.c.

2892{
2893 if (first == second) return 0;
2894 return (first > second ? 1 : -1);
2895}
const GLint * first
Definition: glext.h:5794

Referenced by test_sorting().

◆ test_canceleditlabel()

static void test_canceleditlabel ( void  )
static

Definition at line 4653 of file listview.c.

4654{
4655 HWND hwnd, hwndedit;
4656 DWORD ret;
4657 CHAR buff[10];
4658 LVITEMA itema;
4659 static CHAR test[] = "test";
4660 static const CHAR test1[] = "test1";
4661
4663 ok(hwnd != NULL, "failed to create a listview window\n");
4664
4665 insert_item(hwnd, 0);
4666
4667 /* try without edit created */
4670 expect(TRUE, ret);
4672 "cancel edit label without edit", FALSE);
4673
4674 /* cancel without data change */
4675 SetFocus(hwnd);
4676 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4677 ok(IsWindow(hwndedit), "Expected edit control to be created\n");
4679 expect(TRUE, ret);
4680 ok(!IsWindow(hwndedit), "Expected edit control to be destroyed\n");
4681
4682 /* cancel after data change */
4683 memset(&itema, 0, sizeof(itema));
4684 itema.pszText = test;
4686 expect(TRUE, ret);
4687 SetFocus(hwnd);
4688 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4689 ok(IsWindow(hwndedit), "Expected edit control to be created\n");
4690 ret = SetWindowTextA(hwndedit, test1);
4691 expect(1, ret);
4693 expect(TRUE, ret);
4694 ok(!IsWindow(hwndedit), "Expected edit control to be destroyed\n");
4695 memset(&itema, 0, sizeof(itema));
4696 itema.pszText = buff;
4697 itema.cchTextMax = ARRAY_SIZE(buff);
4699 expect(5, ret);
4700 ok(strcmp(buff, test1) == 0, "Expected label text not to change\n");
4701
4703}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ARRAY_SIZE(A)
Definition: main.h:33
void test1()
Definition: ehthrow.cxx:277
static unsigned char buff[32768]
Definition: fatten.c:17
#define LVM_EDITLABELA
Definition: commctrl.h:2535
#define LVM_CANCELEDITLABEL
Definition: commctrl.h:3012
#define LVM_GETITEMTEXTA
Definition: commctrl.h:2679
#define LVS_EDITLABELS
Definition: commctrl.h:2273
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_checkboxes()

static void test_checkboxes ( void  )
static

Definition at line 961 of file listview.c.

962{
963 HWND hwnd;
965 DWORD r;
966 static CHAR text[] = "Text",
967 text2[] = "Text2",
968 text3[] = "Text3";
969
971 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
972 ok(hwnd != NULL, "failed to create listview window\n");
973
974 /* first without LVS_EX_CHECKBOXES set and an item and check that state is preserved */
975 item.mask = LVIF_TEXT | LVIF_STATE;
976 item.stateMask = 0xffff;
977 item.state = 0xfccc;
978 item.iItem = 0;
979 item.iSubItem = 0;
980 item.pszText = text;
982 expect(0, r);
983
984 item.iItem = 0;
985 item.mask = LVIF_STATE;
986 item.stateMask = 0xffff;
988 expect(1, r);
989 ok(item.state == 0xfccc, "state %x\n", item.state);
990
991 /* Don't set LVIF_STATE */
992 item.mask = LVIF_TEXT;
993 item.stateMask = 0xffff;
994 item.state = 0xfccc;
995 item.iItem = 1;
996 item.iSubItem = 0;
997 item.pszText = text;
999 expect(1, r);
1000
1001 item.iItem = 1;
1002 item.mask = LVIF_STATE;
1003 item.stateMask = 0xffff;
1005 expect(1, r);
1006 ok(item.state == 0, "state %x\n", item.state);
1007
1009 expect(0, r);
1010
1011 /* Having turned on checkboxes, check that all existing items are set to 0x1000 (unchecked) */
1012 item.iItem = 0;
1013 item.mask = LVIF_STATE;
1014 item.stateMask = 0xffff;
1016 expect(1, r);
1017 if (item.state != 0x1ccc)
1018 {
1019 win_skip("LVS_EX_CHECKBOXES style is unavailable. Skipping.\n");
1021 return;
1022 }
1023
1024 /* Now add an item without specifying a state and check that its state goes to 0x1000 */
1025 item.iItem = 2;
1026 item.mask = LVIF_TEXT;
1027 item.state = 0;
1028 item.pszText = text2;
1030 expect(2, r);
1031
1032 item.iItem = 2;
1033 item.mask = LVIF_STATE;
1034 item.stateMask = 0xffff;
1036 expect(1, r);
1037 ok(item.state == 0x1000, "state %x\n", item.state);
1038
1039 /* Add a further item this time specifying a state and still its state goes to 0x1000 */
1040 item.iItem = 3;
1041 item.mask = LVIF_TEXT | LVIF_STATE;
1042 item.stateMask = 0xffff;
1043 item.state = 0x2aaa;
1044 item.pszText = text3;
1046 expect(3, r);
1047
1048 item.iItem = 3;
1049 item.mask = LVIF_STATE;
1050 item.stateMask = 0xffff;
1052 expect(1, r);
1053 ok(item.state == 0x1aaa, "state %x\n", item.state);
1054
1055 /* Set an item's state to checked */
1056 item.iItem = 3;
1057 item.mask = LVIF_STATE;
1058 item.stateMask = 0xf000;
1059 item.state = 0x2000;
1061 expect(1, r);
1062
1063 item.iItem = 3;
1064 item.mask = LVIF_STATE;
1065 item.stateMask = 0xffff;
1067 expect(1, r);
1068 ok(item.state == 0x2aaa, "state %x\n", item.state);
1069
1070 /* Check that only the bits we asked for are returned,
1071 * and that all the others are set to zero
1072 */
1073 item.iItem = 3;
1074 item.mask = LVIF_STATE;
1075 item.stateMask = 0xf000;
1076 item.state = 0xffff;
1078 expect(1, r);
1079 ok(item.state == 0x2000, "state %x\n", item.state);
1080
1081 /* Set the style again and check that doesn't change an item's state */
1083 ok(r == LVS_EX_CHECKBOXES, "ret %x\n", r);
1084
1085 item.iItem = 3;
1086 item.mask = LVIF_STATE;
1087 item.stateMask = 0xffff;
1089 expect(1, r);
1090 ok(item.state == 0x2aaa, "state %x\n", item.state);
1091
1092 /* Unsetting the checkbox extended style doesn't change an item's state */
1094 ok(r == LVS_EX_CHECKBOXES, "ret %x\n", r);
1095
1096 item.iItem = 3;
1097 item.mask = LVIF_STATE;
1098 item.stateMask = 0xffff;
1100 expect(1, r);
1101 ok(item.state == 0x2aaa, "state %x\n", item.state);
1102
1103 /* Now setting the style again will change an item's state */
1105 expect(0, r);
1106
1107 item.iItem = 3;
1108 item.mask = LVIF_STATE;
1109 item.stateMask = 0xffff;
1111 expect(1, r);
1112 ok(item.state == 0x1aaa, "state %x\n", item.state);
1113
1114 /* Toggle checkbox tests (bug 9934) */
1115 memset (&item, 0xcc, sizeof(item));
1116 item.mask = LVIF_STATE;
1117 item.iItem = 3;
1118 item.iSubItem = 0;
1119 item.state = LVIS_FOCUSED;
1120 item.stateMask = LVIS_FOCUSED;
1122 expect(1, r);
1123
1124 item.iItem = 3;
1125 item.mask = LVIF_STATE;
1126 item.stateMask = 0xffff;
1128 expect(1, r);
1129 ok(item.state == 0x1aab, "state %x\n", item.state);
1130
1132 expect(0, r);
1134 expect(0, r);
1135
1136 item.iItem = 3;
1137 item.mask = LVIF_STATE;
1138 item.stateMask = 0xffff;
1140 expect(1, r);
1141 ok(item.state == 0x2aab, "state %x\n", item.state);
1142
1144 expect(0, r);
1146 expect(0, r);
1147
1148 item.iItem = 3;
1149 item.mask = LVIF_STATE;
1150 item.stateMask = 0xffff;
1152 expect(1, r);
1153 ok(item.state == 0x1aab, "state %x\n", item.state);
1154
1156}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define LVM_GETITEMA
Definition: commctrl.h:2389
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define LVM_SETITEMA
Definition: commctrl.h:2396
#define win_skip
Definition: test.h:160
#define WM_KEYUP
Definition: winuser.h:1716
#define VK_SPACE
Definition: winuser.h:2219
#define WM_KEYDOWN
Definition: winuser.h:1715

Referenced by START_TEST().

◆ test_color()

static void test_color ( void  )
static

Definition at line 2013 of file listview.c.

2014{
2015 RECT rect;
2016 HWND hwnd;
2017 DWORD r;
2018 int i;
2019
2021 COLORREF colors[4] = {RGB(0,0,0), RGB(100,50,200), CLR_NONE, RGB(255,255,255)};
2022
2024 ok(hwnd != NULL, "failed to create a listview window\n");
2025
2027
2028 for (i = 0; i < 4; i++)
2029 {
2030 color = colors[i];
2031
2033 expect(TRUE, r);
2035 expect(color, r);
2036
2038 expect (TRUE, r);
2040 expect(color, r);
2041
2043 expect(TRUE, r);
2045 expect(color, r);
2046 }
2047
2050
2051 /* invalidation test done separately to avoid a message chain mess */
2052 r = ValidateRect(hwnd, NULL);
2053 expect(TRUE, r);
2054 r = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, colors[0]);
2055 expect(TRUE, r);
2056
2057 rect.right = rect.bottom = 1;
2060 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2061
2062 r = ValidateRect(hwnd, NULL);
2063 expect(TRUE, r);
2064 r = SendMessageA(hwnd, LVM_SETTEXTCOLOR, 0, colors[0]);
2065 expect(TRUE, r);
2066
2067 rect.right = rect.bottom = 1;
2070 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2071
2072 r = ValidateRect(hwnd, NULL);
2073 expect(TRUE, r);
2074 r = SendMessageA(hwnd, LVM_SETTEXTBKCOLOR, 0, colors[0]);
2075 expect(TRUE, r);
2076
2077 rect.right = rect.bottom = 1;
2080 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2081
2083}
GLuint color
Definition: glext.h:6243
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
static const struct message listview_color_seq[]
Definition: listview.c:123
#define LVM_SETTEXTCOLOR
Definition: commctrl.h:2658
#define LVM_SETBKCOLOR
Definition: commctrl.h:2293
#define CLR_NONE
Definition: commctrl.h:319
#define LVM_GETBKCOLOR
Definition: commctrl.h:2291
#define LVM_GETTEXTCOLOR
Definition: commctrl.h:2656
#define LVM_SETTEXTBKCOLOR
Definition: commctrl.h:2662
#define LVM_GETTEXTBKCOLOR
Definition: commctrl.h:2660
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)

Referenced by START_TEST().

◆ test_columns()

static void test_columns ( void  )
static

Definition at line 1445 of file listview.c.

1446{
1447 HWND hwnd, header;
1449 LVITEMA item;
1450 INT order[2];
1451 CHAR buff[5];
1452 DWORD rc;
1453
1455 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1456 ok(hwnd != NULL, "failed to create listview window\n");
1457
1459 ok(header == NULL, "got %p\n", header);
1460
1462 ok(rc == 0, "got %d\n", rc);
1463
1465 ok(header == NULL, "got %p\n", header);
1466
1468
1470 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1471 ok(hwnd != NULL, "failed to create listview window\n");
1472
1473 rc = SendMessageA(hwnd, LVM_DELETECOLUMN, -1, 0);
1474 ok(!rc, "got %d\n", rc);
1475
1476 rc = SendMessageA(hwnd, LVM_DELETECOLUMN, 0, 0);
1477 ok(!rc, "got %d\n", rc);
1478
1479 /* Add a column with no mask */
1480 memset(&column, 0xcc, sizeof(column));
1481 column.mask = 0;
1483 ok(rc == 0, "Inserting column with no mask failed with %d\n", rc);
1484
1485 /* Check its width */
1487 ok(rc == 10, "Inserting column with no mask failed to set width to 10 with %d\n", rc);
1488
1490
1491 /* LVM_GETCOLUMNORDERARRAY */
1494
1495 memset(&column, 0, sizeof(column));
1496 column.mask = LVCF_WIDTH;
1497 column.cx = 100;
1499 expect(0, rc);
1500
1501 column.cx = 200;
1503 expect(1, rc);
1504
1506
1508 expect(1, rc);
1509 ok(order[0] == 0, "Expected order 0, got %d\n", order[0]);
1510 ok(order[1] == 1, "Expected order 1, got %d\n", order[1]);
1511
1513 expect(0, rc);
1514
1516
1517 /* LVM_SETCOLUMNORDERARRAY */
1519
1520 order[0] = 0;
1521 order[1] = 1;
1523 expect(1, rc);
1524
1526 expect(0, rc);
1527
1529
1530 /* after column added subitem is considered as present */
1531 insert_item(hwnd, 0);
1532
1534
1535 item.pszText = buff;
1536 item.cchTextMax = sizeof(buff);
1537 item.iItem = 0;
1538 item.iSubItem = 1;
1539 item.mask = LVIF_TEXT;
1540 memset(&g_itema, 0, sizeof(g_itema));
1542 expect(1, rc);
1543 ok(g_itema.iSubItem == 1, "got %d\n", g_itema.iSubItem);
1544
1546 "get subitem text after column added", FALSE);
1547
1549}
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
static HWND subclass_header(HWND hwndListview)
Definition: listview.c:772
static const struct message listview_setorderarray_seq[]
Definition: listview.c:203
static const struct message single_getdispinfo_parent_seq[]
Definition: listview.c:285
static const struct message listview_getorderarray_seq[]
Definition: listview.c:195
#define LVM_GETCOLUMNORDERARRAY
Definition: commctrl.h:2768
#define LVM_DELETECOLUMN
Definition: commctrl.h:2638
#define LVM_SETCOLUMNORDERARRAY
Definition: commctrl.h:2766
#define LVM_GETCOLUMNWIDTH
Definition: commctrl.h:2641
#define LVS_LIST
Definition: commctrl.h:2264

Referenced by START_TEST().

◆ test_columnscreation()

static void test_columnscreation ( void  )
static

Definition at line 3959 of file listview.c.

3960{
3961 HWND hwnd, header;
3962 DWORD r;
3963
3965 ok(hwnd != NULL, "failed to create a listview window\n");
3966
3967 insert_item(hwnd, 0);
3968
3969 /* headers columns aren't created automatically */
3971 ok(IsWindow(header), "Expected header handle\n");
3973 expect(0, r);
3974
3976}
#define HDM_GETITEMCOUNT
Definition: commctrl.h:733

Referenced by START_TEST().

◆ test_create()

static void test_create ( BOOL  is_version_6)
static

Definition at line 1590 of file listview.c.

1591{
1592 static const WCHAR testtextW[] = {'t','e','s','t',' ','t','e','x','t',0};
1593 char buff[16];
1594 HWND hList;
1595 HWND hHeader;
1596 LONG_PTR ret;
1597 LONG r;
1598 LVCOLUMNA col;
1599 RECT rect;
1600 WNDCLASSEXA cls;
1601 DWORD style;
1602 ATOM class;
1603
1604 if (is_win_xp() && is_version_6)
1605 {
1606 win_skip("Skipping some tests on XP.\n");
1607 return;
1608 }
1609
1610 cls.cbSize = sizeof(WNDCLASSEXA);
1612 ok(r, "Failed to get class info.\n");
1615 cls.lpszClassName = "MyListView32";
1616 class = RegisterClassExA(&cls);
1617 ok(class, "Failed to register class.\n");
1618
1619 test_create_imagelist = pImageList_Create(16, 16, 0, 5, 10);
1620 hList = CreateWindowA("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1621 ok((HIMAGELIST)SendMessageA(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
1622 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1623 ok(IsWindow(hHeader) && IsWindowVisible(hHeader), "Listview not in report mode\n");
1624 ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
1626
1627 /* header isn't created on LVS_ICON and LVS_LIST styles */
1628 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1630
1631 /* insert column */
1632 memset(&col, 0, sizeof(LVCOLUMNA));
1633 col.mask = LVCF_WIDTH;
1634 col.cx = 100;
1636 expect(0, r);
1638 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1639 style = GetWindowLongA(hHeader, GWL_STYLE);
1640 ok(!(style & HDS_HIDDEN), "Not expected HDS_HIDDEN\n");
1642
1643 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
1646 /* insert column */
1647 memset(&col, 0, sizeof(LVCOLUMNA));
1648 col.mask = LVCF_WIDTH;
1649 col.cx = 100;
1651 expect(0, r);
1654
1655 /* try to switch LVS_ICON -> LVS_REPORT and back LVS_ICON -> LVS_REPORT */
1656 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
1659 ok(ret & WS_VISIBLE, "Style wrong, should have WS_VISIBLE\n");
1662 ok((ret & WS_VISIBLE) && (ret & LVS_REPORT), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
1665
1666 /* try to switch LVS_LIST -> LVS_REPORT and back LVS_LIST -> LVS_REPORT */
1667 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
1671 ok(((ret & WS_VISIBLE) && (ret & LVS_LIST)), "Style wrong, should have WS_VISIBLE|LVS_LIST\n");
1674 ok(((ret & WS_VISIBLE) && (ret & LVS_REPORT)), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
1677
1678 /* LVS_REPORT without WS_VISIBLE */
1679 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1681 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1682todo_wine_if(is_version_6)
1683 TEST_NO_HEADER2(hList, is_version_6);
1684
1685 /* insert column */
1686 memset(&col, 0, sizeof(LVCOLUMNA));
1687 col.mask = LVCF_WIDTH;
1688 col.cx = 100;
1690 expect(0, r);
1693
1694 /* LVS_REPORT without WS_VISIBLE, try to show it */
1695 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1697todo_wine_if(is_version_6)
1698 TEST_NO_HEADER2(hList, is_version_6);
1699
1703
1704 /* LVS_REPORT with LVS_NOCOLUMNHEADER */
1706 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1708 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1709 /* HDS_DRAGDROP set by default */
1710 ok(GetWindowLongPtrA(hHeader, GWL_STYLE) & HDS_DRAGDROP, "Expected header to have HDS_DRAGDROP\n");
1712
1713 /* setting LVS_EX_HEADERDRAGDROP creates header */
1714 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1716todo_wine_if(is_version_6)
1717 TEST_NO_HEADER2(hList, is_version_6);
1718
1722
1723 /* setting LVS_EX_GRIDLINES creates header */
1724 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1726todo_wine_if(is_version_6)
1727 TEST_NO_HEADER2(hList, is_version_6);
1728
1732
1733 /* setting LVS_EX_FULLROWSELECT creates header */
1734 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1736todo_wine_if(is_version_6)
1737 TEST_NO_HEADER2(hList, is_version_6);
1741
1742 /* not report style accepts LVS_EX_HEADERDRAGDROP too */
1746 ok(r & LVS_EX_HEADERDRAGDROP, "Expected LVS_EX_HEADERDRAGDROP to be set\n");
1748
1749 /* requesting header info with LVM_GETSUBITEMRECT doesn't create it */
1750 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1752todo_wine_if(is_version_6)
1753 TEST_NO_HEADER2(hList, is_version_6);
1754
1755 SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
1757 ok(r == 1, "Unexpected ret value %d.\n", r);
1758 /* right value contains garbage, probably because header columns are not set up */
1759 ok(rect.bottom >= 0, "Unexpected rectangle.\n");
1760
1761todo_wine_if(is_version_6)
1762 TEST_NO_HEADER2(hList, is_version_6);
1764
1765 /* WM_MEASUREITEM should be sent when created with LVS_OWNERDRAWFIXED */
1769 "created with LVS_OWNERDRAWFIXED|LVS_REPORT - parent seq", FALSE);
1771
1772 /* Test that window text is preserved. */
1774 0, 0, 100, 100, hwndparent, NULL, GetModuleHandleA(NULL), NULL);
1775 ok(hList != NULL, "Failed to create ListView window.\n");
1776 *buff = 0;
1777 GetWindowTextA(hList, buff, sizeof(buff));
1778 ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff);
1780
1782 0, 0, 100, 100, hwndparent, NULL, GetModuleHandleA(NULL), NULL);
1783 ok(hList != NULL, "Failed to create ListView window.\n");
1784 *buff = 0;
1785 GetWindowTextA(hList, buff, sizeof(buff));
1786 ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff);
1788
1789 r = UnregisterClassA("MyListView32", NULL);
1790 ok(r, "Failed to unregister test class.\n");
1791}
WORD ATOM
Definition: dimm.idl:113
HWND hList
Definition: livecd.c:10
static LRESULT CALLBACK create_test_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:1555
#define TEST_HEADER_EXPECTED(a)
Definition: listview.c:1571
static const struct message create_ownerdrawfixed_parent_seq[]
Definition: listview.c:97
#define TEST_NO_HEADER2(a, b)
Definition: listview.c:1572
#define TEST_NO_HEADER(a)
Definition: listview.c:1570
static BOOL is_win_xp(void)
Definition: listview.c:736
static const WCHAR testtextW[]
Definition: dialog.c:1384
#define HDS_HIDDEN
Definition: commctrl.h:631
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
#define LVS_EX_GRIDLINES
Definition: commctrl.h:2729
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2283
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2733
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVM_GETSUBITEMRECT
Definition: commctrl.h:2762
#define HDS_DRAGDROP
Definition: commctrl.h:632
#define LVM_GETIMAGELIST
Definition: commctrl.h:2295
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2727
#define LVIR_BOUNDS
Definition: commctrl.h:2472
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
struct _WNDCLASSEXA WNDCLASSEXA
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

◆ test_createdragimage()

static void test_createdragimage ( void  )
static

Definition at line 5651 of file listview.c.

5652{
5654 POINT pt;
5655 HWND list;
5656
5658 ok(list != NULL, "failed to create listview window\n");
5659
5660 insert_item(list, 0);
5661
5662 /* NULL point */
5664 ok(himl == NULL, "got %p\n", himl);
5665
5667 ok(himl != NULL, "got %p\n", himl);
5668 pImageList_Destroy(himl);
5669
5671}
Definition: list.h:37
#define pt(x, y)
Definition: drawing.c:79
#define LVM_CREATEDRAGIMAGE
Definition: commctrl.h:2652
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
#define list
Definition: rosglue.h:35

Referenced by START_TEST().

◆ test_customdraw()

static void test_customdraw ( void  )
static

Definition at line 1918 of file listview.c.

1919{
1920 HWND hwnd;
1921 WNDPROC oldwndproc;
1922 LVITEMA item;
1923
1925
1926 insert_column(hwnd, 0);
1927 insert_column(hwnd, 1);
1928 insert_item(hwnd, 0);
1929
1932
1935
1936 /* message tests */
1940 ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT", FALSE);
1941
1942 /* check colors when item is selected */
1944 item.mask = LVIF_STATE;
1945 item.stateMask = LVIS_SELECTED;
1946 item.state = LVIS_SELECTED;
1948
1952 ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT, selection", FALSE);
1953
1955
1957
1958 insert_column(hwnd, 0);
1959 insert_column(hwnd, 1);
1960 insert_item(hwnd, 0);
1961
1965 ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_list_cd_seq, "parent customdraw, LVS_LIST", FALSE);
1966
1969}
static const struct message parent_report_cd_seq[]
Definition: listview.c:430
static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:1867
static void insert_column(HWND hwnd, int idx)
Definition: listview.c:1158
static const struct message parent_list_cd_seq[]
Definition: listview.c:442
#define LVIS_SELECTED
Definition: commctrl.h:2319
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by START_TEST().

◆ test_deleteitem()

static void test_deleteitem ( void  )
static

Definition at line 5862 of file listview.c.

5863{
5864 LVITEMA item;
5865 UINT state;
5866 HWND hwnd;
5867 BOOL ret;
5868
5870
5871 insert_item(hwnd, 0);
5872 insert_item(hwnd, 0);
5873 insert_item(hwnd, 0);
5874 insert_item(hwnd, 0);
5875 insert_item(hwnd, 0);
5876
5878
5879 /* delete focused item (not the last index) */
5880 item.stateMask = LVIS_FOCUSED;
5881 item.state = LVIS_FOCUSED;
5883 ok(ret == TRUE, "got %d\n", ret);
5885 ok(ret == TRUE, "got %d\n", ret);
5886 /* next item gets focus */
5888 ok(state == LVIS_FOCUSED, "got %x\n", state);
5889
5890 /* focus last item and delete it */
5891 item.stateMask = LVIS_FOCUSED;
5892 item.state = LVIS_FOCUSED;
5894 ok(ret == TRUE, "got %d\n", ret);
5896 ok(ret == TRUE, "got %d\n", ret);
5897 /* new last item gets focus */
5899 ok(state == LVIS_FOCUSED, "got %x\n", state);
5900
5901 /* focus first item and delete it */
5902 item.stateMask = LVIS_FOCUSED;
5903 item.state = LVIS_FOCUSED;
5905 ok(ret == TRUE, "got %d\n", ret);
5907 ok(ret == TRUE, "got %d\n", ret);
5908 /* new first item gets focus */
5910 ok(state == LVIS_FOCUSED, "got %x\n", state);
5911
5913
5915}
#define LVM_DELETEITEM
Definition: commctrl.h:2410

Referenced by START_TEST().

◆ test_destroynotify()

static void test_destroynotify ( void  )
static

Definition at line 5407 of file listview.c.

5408{
5409 HWND hwnd;
5410 BOOL ret;
5411
5413 ok(hwnd != NULL, "failed to create listview window\n");
5414
5418
5419 /* same for ownerdata list */
5421 ok(hwnd != NULL, "failed to create listview window\n");
5422
5425 ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_ownerdata_destroy, "check destroy order, ownerdata", FALSE);
5426
5428 ok(hwnd != NULL, "failed to create listview window\n");
5429
5432 ok(ret == TRUE, "got %d\n", ret);
5435}
static const struct message listview_destroy[]
Definition: listview.c:359
static const struct message listview_ownerdata_destroy[]
Definition: listview.c:371
static const struct message listview_ownerdata_deleteall[]
Definition: listview.c:382
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2413

Referenced by START_TEST().

◆ test_dispinfo()

static void test_dispinfo ( void  )
static

Definition at line 5673 of file listview.c.

5674{
5675 static const char testA[] = "TEST";
5676 WCHAR buff[10];
5677 LVITEMA item;
5678 HWND hwnd;
5679 DWORD ret;
5680
5682 ok(hwnd != NULL, "failed to create listview window\n");
5683
5684 insert_item(hwnd, 0);
5685
5686 memset(&item, 0, sizeof(item));
5687 item.pszText = LPSTR_TEXTCALLBACKA;
5689 expect(1, ret);
5690
5692 item.pszText = (char*)buff;
5693 item.cchTextMax = ARRAY_SIZE(buff);
5695 ok(ret == sizeof(testA)-1, "got %d, expected 4\n", ret);
5697
5698 ok(memcmp(item.pszText, testA, sizeof(testA)) == 0,
5699 "got %s, expected %s\n", item.pszText, testA);
5700
5702}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const CHAR testA[]
Definition: run.c:171
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2381

Referenced by START_TEST().

◆ test_editbox()

static void test_editbox ( void  )
static

Definition at line 4214 of file listview.c.

4215{
4216 static CHAR testitemA[] = "testitem";
4217 static CHAR testitem1A[] = "testitem_quitelongname";
4218 static CHAR testitem2A[] = "testITEM_quitelongname";
4219 static CHAR buffer[25];
4220 HWND hwnd, hwndedit, hwndedit2, header;
4221 LVITEMA item;
4222 INT r;
4223
4225 ok(hwnd != NULL, "failed to create a listview window\n");
4226
4227 insert_column(hwnd, 0);
4228
4229 memset(&item, 0, sizeof(item));
4230 item.mask = LVIF_TEXT;
4231 item.pszText = testitemA;
4232 item.iItem = 0;
4233 item.iSubItem = 0;
4235 expect(0, r);
4236
4237 /* test notifications without edit created */
4240 expect(0, r);
4242 "edit box WM_COMMAND (EN_SETFOCUS), no edit created", FALSE);
4243 /* same thing but with valid window */
4244 hwndedit = CreateWindowA(WC_EDITA, "Test edit", WS_VISIBLE | WS_CHILD, 0, 0, 20,
4248 expect(0, r);
4250 "edit box WM_COMMAND (EN_SETFOCUS), no edit created #2", FALSE);
4251 DestroyWindow(hwndedit);
4252
4253 /* setting focus is necessary */
4254 SetFocus(hwnd);
4255 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4256 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4257
4258 /* test children Z-order after Edit box created */
4260 ok(IsWindow(header), "Expected header to be created\n");
4261 ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n");
4262 ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT));
4263
4264 /* modify initial string */
4265 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A);
4266 expect(TRUE, r);
4267
4268 /* edit window is resized and repositioned,
4269 check again for Z-order - it should be preserved */
4270 ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n");
4271 ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT));
4272
4273 /* return focus to listview */
4274 SetFocus(hwnd);
4275
4276 memset(&item, 0, sizeof(item));
4277 item.mask = LVIF_TEXT;
4278 item.pszText = buffer;
4279 item.cchTextMax = sizeof(buffer);
4280 item.iItem = 0;
4281 item.iSubItem = 0;
4283 expect(TRUE, r);
4284
4285 ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
4286
4287 /* send LVM_EDITLABEL on already created edit */
4288 SetFocus(hwnd);
4289 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4290 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4291 /* focus will be set to edit */
4292 ok(GetFocus() == hwndedit, "Expected Edit window to be focused\n");
4293 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4294 ok(IsWindow(hwndedit2), "Expected Edit window to be created\n");
4295
4296 /* creating label disabled when control isn't focused */
4297 SetFocus(0);
4298 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4299 todo_wine ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4300
4301 /* check EN_KILLFOCUS handling */
4302 memset(&item, 0, sizeof(item));
4303 item.pszText = testitemA;
4304 item.iItem = 0;
4305 item.iSubItem = 0;
4307 expect(TRUE, r);
4308
4309 SetFocus(hwnd);
4310 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4311 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4312 /* modify edit and notify control that it lost focus */
4313 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A);
4314 expect(TRUE, r);
4317 expect(0, r);
4318 ok(g_editbox_disp_info.item.pszText != NULL, "expected notification with not null text\n");
4319
4320 memset(&item, 0, sizeof(item));
4321 item.pszText = buffer;
4322 item.cchTextMax = sizeof(buffer);
4323 item.iItem = 0;
4324 item.iSubItem = 0;
4326 expect(lstrlenA(item.pszText), r);
4327 ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
4328 ok(!IsWindow(hwndedit), "Expected Edit window to be freed\n");
4329
4330 /* change item name to differ in casing only */
4331 SetFocus(hwnd);
4332 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4333 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4334 /* modify edit and notify control that it lost focus */
4335 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem2A);
4336 expect(TRUE, r);
4339 expect(0, r);
4341
4342 memset(&item, 0, sizeof(item));
4343 item.pszText = buffer;
4344 item.cchTextMax = sizeof(buffer);
4345 item.iItem = 0;
4346 item.iSubItem = 0;
4348 expect(lstrlenA(item.pszText), r);
4349 ok(strcmp(buffer, testitem2A) == 0, "got %s, expected %s\n", buffer, testitem2A);
4350 ok(!IsWindow(hwndedit), "Expected Edit window to be freed\n");
4351
4352 /* end edit without saving */
4353 SetFocus(hwnd);
4354 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4356 r = SendMessageA(hwndedit, WM_KEYDOWN, VK_ESCAPE, 0);
4357 expect(0, r);
4359 "edit box - end edit, no change, escape", TRUE);
4360 /* end edit with saving */
4361 SetFocus(hwnd);
4362 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4364 r = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
4365 expect(0, r);
4367 "edit box - end edit, no change, return", TRUE);
4368
4369 memset(&item, 0, sizeof(item));
4370 item.pszText = buffer;
4371 item.cchTextMax = sizeof(buffer);
4372 item.iItem = 0;
4373 item.iSubItem = 0;
4375 expect(lstrlenA(item.pszText), r);
4376 ok(strcmp(buffer, testitem2A) == 0, "Expected item text to change\n");
4377
4378 /* LVM_EDITLABEL with -1 destroys current edit */
4379 hwndedit = (HWND)SendMessageA(hwnd, LVM_GETEDITCONTROL, 0, 0);
4380 ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4381 /* no edit present */
4382 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -1, 0);
4383 ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4384 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4385 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4386 /* edit present */
4387 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4388 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -1, 0);
4389 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4390 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4391 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4392 /* check another negative value */
4393 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4394 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4395 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4396 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -2, 0);
4397 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4398 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4399 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4400 /* and value greater than max item index */
4401 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4402 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4403 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4405 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, r, 0);
4406 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4407 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4408 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4409
4410 /* messaging tests */
4411 SetFocus(hwnd);
4413 blockEdit = FALSE;
4414 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4415 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4416 /* testing only sizing messages */
4418 "edit box create - sizing", FALSE);
4419
4420 /* WM_COMMAND with EN_KILLFOCUS isn't forwarded to parent */
4421 SetFocus(hwnd);
4422 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4423 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4426 expect(0, r);
4428 "edit box WM_COMMAND (EN_KILLFOCUS)", TRUE);
4429
4431}
GLuint buffer
Definition: glext.h:5915
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static const struct message editbox_create_pos[]
Definition: listview.c:313
static const struct message edit_end_nochange[]
Definition: listview.c:346
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2306
#define WC_EDITA
Definition: commctrl.h:4686
HWND WINAPI GetFocus(void)
Definition: window.c:1893
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define EN_KILLFOCUS
Definition: winuser.h:2025
#define EN_SETFOCUS
Definition: winuser.h:2027
HWND WINAPI GetTopWindow(_In_opt_ HWND)
#define GWLP_HINSTANCE
Definition: winuser.h:856
#define GW_HWNDNEXT
Definition: winuser.h:761
#define WM_SETTEXT
Definition: winuser.h:1617
#define VK_RETURN
Definition: winuser.h:2201
#define GetNextWindow(h, c)
Definition: winuser.h:4727
#define VK_ESCAPE
Definition: winuser.h:2214

Referenced by START_TEST().

◆ test_finditem()

static void test_finditem ( void  )
static

Definition at line 5227 of file listview.c.

5228{
5229 LVFINDINFOA fi;
5230 static char f[5];
5231 HWND hwnd;
5232 INT r;
5233
5235 insert_item(hwnd, 0);
5236
5237 memset(&fi, 0, sizeof(fi));
5238
5239 /* full string search, inserted text was "foo" */
5240 strcpy(f, "foo");
5241 fi.flags = LVFI_STRING;
5242 fi.psz = f;
5243 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5244 expect(0, r);
5245
5247 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5248 expect(0, r);
5249
5250 fi.flags = LVFI_PARTIAL;
5251 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5252 expect(0, r);
5253
5254 /* partial string search, inserted text was "foo" */
5255 strcpy(f, "fo");
5257 fi.psz = f;
5258 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5259 expect(0, r);
5260
5261 fi.flags = LVFI_STRING;
5262 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5263 expect(-1, r);
5264
5265 fi.flags = LVFI_PARTIAL;
5266 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5267 expect(0, r);
5268
5269 /* partial string search, part after start char */
5270 strcpy(f, "oo");
5272 fi.psz = f;
5273 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5274 expect(-1, r);
5275
5276 /* try with LVFI_SUBSTRING */
5277 strcpy(f, "fo");
5278 fi.flags = LVFI_SUBSTRING;
5279 fi.psz = f;
5280 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5281 expect(0, r);
5282 strcpy(f, "f");
5283 fi.flags = LVFI_SUBSTRING;
5284 fi.psz = f;
5285 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5286 expect(0, r);
5287 strcpy(f, "o");
5288 fi.flags = LVFI_SUBSTRING;
5289 fi.psz = f;
5290 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5291 expect(-1, r);
5292
5293 strcpy(f, "o");
5295 fi.psz = f;
5296 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5297 expect(-1, r);
5298
5299 strcpy(f, "f");
5301 fi.psz = f;
5302 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5303 expect(0, r);
5304
5306 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5307 expect(0, r);
5308
5310}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83
#define LVFI_STRING
Definition: commctrl.h:2437
#define LVFI_SUBSTRING
Definition: commctrl.h:2438
#define LVFI_PARTIAL
Definition: commctrl.h:2439
#define LVM_FINDITEMA
Definition: commctrl.h:2465

Referenced by START_TEST().

◆ test_get_set_view()

static void test_get_set_view ( void  )
static

Definition at line 4601 of file listview.c.

4602{
4603 HWND hwnd;
4604 DWORD ret;
4606
4607 /* test style->view mapping */
4609 ok(hwnd != NULL, "failed to create a listview window\n");
4610
4611 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4613
4615 /* LVS_ICON == 0 */
4617 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4619
4622 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4624
4627 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4629
4630 /* switching view doesn't touch window style */
4632 expect(1, ret);
4634 ok(style & LVS_LIST, "Expected style to be preserved\n");
4636 expect(1, ret);
4638 ok(style & LVS_LIST, "Expected style to be preserved\n");
4640 expect(1, ret);
4642 ok(style & LVS_LIST, "Expected style to be preserved\n");
4643
4644 /* now change window style to see if view is remapped */
4647 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4649
4651}
#define LV_VIEW_DETAILS
Definition: commctrl.h:2841
#define LVS_SMALLICON
Definition: commctrl.h:2263
#define LV_VIEW_LIST
Definition: commctrl.h:2843
#define LVM_GETVIEW
Definition: commctrl.h:2848
#define LVM_SETVIEW
Definition: commctrl.h:2846
#define LV_VIEW_SMALLICON
Definition: commctrl.h:2842
#define LV_VIEW_ICON
Definition: commctrl.h:2840
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by START_TEST().

◆ test_getcolumnwidth()

static void test_getcolumnwidth ( void  )
static

Definition at line 4912 of file listview.c.

4913{
4914 HWND hwnd;
4915 INT ret;
4917 LVCOLUMNA col;
4918 LVITEMA itema;
4919 INT height;
4920
4921 /* default column width */
4924 expect(0, ret);
4928 todo_wine expect(8, ret);
4929 style = GetWindowLongA(hwnd, GWL_STYLE) & ~LVS_LIST;
4931 col.mask = 0;
4933 expect(0, ret);
4935 expect(10, ret);
4937
4938 /* default column width with item added */
4940 memset(&itema, 0, sizeof(itema));
4941 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
4942 ok(!ret, "got %d\n", ret);
4945 ok((ret / height) >= 6, "got width %d, height %d\n", ret, height);
4947}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static INT get_current_font_height(HWND listview)
Definition: listview.c:4882
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)

Referenced by START_TEST().

◆ test_getitemposition()

static void test_getitemposition ( void  )
static

Definition at line 3917 of file listview.c.

3918{
3919 HWND hwnd, header;
3920 DWORD r;
3921 POINT pt;
3922 RECT rect;
3923
3925 ok(hwnd != NULL, "failed to create a listview window\n");
3927
3928 /* LVS_REPORT, single item, no columns added */
3929 insert_item(hwnd, 0);
3930
3932
3933 pt.x = pt.y = -1;
3935 expect(TRUE, r);
3937
3938 /* LVS_REPORT, single item, single column */
3939 insert_column(hwnd, 0);
3940
3942
3943 pt.x = pt.y = -1;
3945 expect(TRUE, r);
3947
3950 ok(r, "got %d\n", r);
3951 /* some padding? */
3952 expect(2, pt.x);
3953 /* offset by header height */
3954 expect(rect.bottom - rect.top, pt.y);
3955
3957}
static const struct message getitemposition_seq1[]
Definition: listview.c:290
static const struct message getitemposition_seq2[]
Definition: listview.c:295
#define LVM_GETITEMPOSITION
Definition: commctrl.h:2483
#define HDM_GETITEMRECT
Definition: commctrl.h:791
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Referenced by START_TEST().

◆ test_getitemrect()

static void test_getitemrect ( void  )
static

Definition at line 3978 of file listview.c.

3979{
3980 HWND hwnd;
3981 HIMAGELIST himl, himl_ret;
3982 HBITMAP hbm;
3983 RECT rect;
3984 DWORD r;
3985 LVITEMA item;
3986 LVCOLUMNA col;
3987 INT order[2];
3988 POINT pt;
3989
3990 /* rectangle isn't empty for empty text items */
3992 memset(&item, 0, sizeof(item));
3993 item.mask = 0;
3994 item.iItem = 0;
3996 expect(0, r);
3997 rect.left = LVIR_LABEL;
3999 expect(TRUE, r);
4000 expect(0, rect.left);
4001 expect(0, rect.top);
4002 /* estimate it as width / height ratio */
4004 ok((rect.right / rect.bottom) >= 5, "got right %d, bottom %d\n", rect.right, rect.bottom);
4006
4008 ok(hwnd != NULL, "failed to create a listview window\n");
4009
4010 /* empty item */
4011 memset(&item, 0, sizeof(item));
4012 item.iItem = 0;
4013 item.iSubItem = 0;
4015 expect(0, r);
4016
4017 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4019 expect(TRUE, r);
4020
4021 /* zero width rectangle with no padding */
4022 expect(0, rect.left);
4023 expect(0, rect.right);
4024
4025 insert_column(hwnd, 0);
4026 insert_column(hwnd, 1);
4027
4028 col.mask = LVCF_WIDTH;
4029 col.cx = 50;
4030 r = SendMessageA(hwnd, LVM_SETCOLUMNA, 0, (LPARAM)&col);
4031 expect(TRUE, r);
4032
4033 col.mask = LVCF_WIDTH;
4034 col.cx = 100;
4035 r = SendMessageA(hwnd, LVM_SETCOLUMNA, 1, (LPARAM)&col);
4036 expect(TRUE, r);
4037
4038 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4040 expect(TRUE, r);
4041
4042 /* still no left padding */
4043 expect(0, rect.left);
4044 expect(150, rect.right);
4045
4046 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4048 expect(TRUE, r);
4049 /* padding */
4050 expect(2, rect.left);
4051
4052 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4054 expect(TRUE, r);
4055 /* padding, column width */
4056 expect(2, rect.left);
4057 expect(50, rect.right);
4058
4059 /* no icons attached */
4060 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4062 expect(TRUE, r);
4063 /* padding */
4064 expect(2, rect.left);
4065 expect(2, rect.right);
4066
4067 /* change order */
4068 order[0] = 1; order[1] = 0;
4070 expect(TRUE, r);
4071 pt.x = -1;
4073 expect(TRUE, r);
4074 /* 1 indexed column width + padding */
4075 expect(102, pt.x);
4076 /* rect is at zero too */
4077 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4079 expect(TRUE, r);
4080 expect(0, rect.left);
4081 /* just width sum */
4082 expect(150, rect.right);
4083
4084 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4086 expect(TRUE, r);
4087 /* column width + padding */
4088 expect(102, rect.left);
4089
4090 /* back to initial order */
4091 order[0] = 0; order[1] = 1;
4093 expect(TRUE, r);
4094
4095 /* state icons */
4096 himl = pImageList_Create(16, 16, 0, 2, 2);
4097 ok(himl != NULL, "failed to create imagelist\n");
4098 hbm = CreateBitmap(16, 16, 1, 1, NULL);
4099 ok(hbm != NULL, "failed to create bitmap\n");
4100 r = pImageList_Add(himl, hbm, 0);
4101 expect(0, r);
4102 hbm = CreateBitmap(16, 16, 1, 1, NULL);
4103 ok(hbm != NULL, "failed to create bitmap\n");
4104 r = pImageList_Add(himl, hbm, 0);
4105 expect(1, r);
4106
4108 expect(0, r);
4109
4110 item.mask = LVIF_STATE;
4111 item.state = INDEXTOSTATEIMAGEMASK(1);
4112 item.stateMask = LVIS_STATEIMAGEMASK;
4113 item.iItem = 0;
4114 item.iSubItem = 0;
4116 expect(TRUE, r);
4117
4118 /* icon bounds */
4119 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4121 expect(TRUE, r);
4122 /* padding + stateicon width */
4123 expect(18, rect.left);
4124 expect(18, rect.right);
4125 /* label bounds */
4126 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4128 expect(TRUE, r);
4129 /* padding + stateicon width -> column width */
4130 expect(18, rect.left);
4131 expect(50, rect.right);
4132
4134 ok(himl_ret == himl, "got %p, expected %p\n", himl_ret, himl);
4135
4137 expect(0, r);
4138
4139 item.mask = LVIF_STATE | LVIF_IMAGE;
4140 item.iImage = 1;
4141 item.state = 0;
4142 item.stateMask = ~0;
4143 item.iItem = 0;
4144 item.iSubItem = 0;
4146 expect(TRUE, r);
4147
4148 /* icon bounds */
4149 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4151 expect(TRUE, r);
4152 /* padding, icon width */
4153 expect(2, rect.left);
4154 expect(18, rect.right);
4155 /* label bounds */
4156 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4158 expect(TRUE, r);
4159 /* padding + icon width -> column width */
4160 expect(18, rect.left);
4161 expect(50, rect.right);
4162
4163 /* select bounds */
4164 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4166 expect(TRUE, r);
4167 /* padding, column width */
4168 expect(2, rect.left);
4169 expect(50, rect.right);
4170
4171 /* try with indentation */
4172 item.mask = LVIF_INDENT;
4173 item.iIndent = 1;
4174 item.iItem = 0;
4175 item.iSubItem = 0;
4177 expect(TRUE, r);
4178
4179 /* bounds */
4180 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4182 expect(TRUE, r);
4183 /* padding + 1 icon width, column width */
4184 expect(0, rect.left);
4185 expect(150, rect.right);
4186
4187 /* select bounds */
4188 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4190 expect(TRUE, r);
4191 /* padding + 1 icon width, column width */
4192 expect(2 + 16, rect.left);
4193 expect(50, rect.right);
4194
4195 /* label bounds */
4196 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4198 expect(TRUE, r);
4199 /* padding + 2 icon widths, column width */
4200 expect(2 + 16*2, rect.left);
4201 expect(50, rect.right);
4202
4203 /* icon bounds */
4204 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4206 expect(TRUE, r);
4207 /* padding + 1 icon width indentation, icon width */
4208 expect(2 + 16, rect.left);
4209 expect(34, rect.right);
4210
4212}
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define LVIR_ICON
Definition: commctrl.h:2473
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define LVM_SETCOLUMNA
Definition: commctrl.h:2624
#define LVIF_INDENT
Definition: commctrl.h:2313
#define LVIR_LABEL
Definition: commctrl.h:2474
#define LVM_GETITEMRECT
Definition: commctrl.h:2477
#define LVIR_SELECTBOUNDS
Definition: commctrl.h:2475
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2328
#define LVSIL_STATE
Definition: commctrl.h:2300
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326

Referenced by START_TEST().

◆ test_getitemspacing()

static void test_getitemspacing ( void  )
static

Definition at line 4759 of file listview.c.

4760{
4761 HWND hwnd;
4762 DWORD ret;
4763 INT cx, cy;
4764 HIMAGELIST himl40, himl80;
4765
4768
4769 /* LVS_ICON */
4772 expect(cx, LOWORD(ret));
4773 expect(cy, HIWORD(ret));
4774
4775 /* now try with icons */
4776 himl40 = pImageList_Create(40, 40, 0, 4, 4);
4777 ok(himl40 != NULL, "failed to create imagelist\n");
4778 himl80 = pImageList_Create(80, 80, 0, 4, 4);
4779 ok(himl80 != NULL, "failed to create imagelist\n");
4781 expect(0, ret);
4782
4784 /* spacing + icon size returned */
4785 expect(cx + 40, LOWORD(ret));
4786 expect(cy + 40, HIWORD(ret));
4787 /* try changing icon size */
4789
4791 /* spacing + icon size returned */
4792 expect(cx + 80, LOWORD(ret));
4793 expect(cy + 80, HIWORD(ret));
4794
4795 /* set own icon spacing */
4797 expect(cx + 80, LOWORD(ret));
4798 expect(cy + 80, HIWORD(ret));
4799
4801 /* set size returned */
4802 expect(100, LOWORD(ret));
4803 expect(100, HIWORD(ret));
4804
4805 /* now change image list - icon spacing should be unaffected */
4807
4809 /* set size returned */
4810 expect(100, LOWORD(ret));
4811 expect(100, HIWORD(ret));
4812
4813 /* spacing = 0 - keep previous value */
4815 expect(100, LOWORD(ret));
4816 expect(100, HIWORD(ret));
4817
4819 expect(100, LOWORD(ret));
4820
4821 expect(0xFFFF, HIWORD(ret));
4822
4823 if (sizeof(void*) == 8)
4824 {
4825 /* NOTE: -1 is not treated the same as (DWORD)-1 by 64bit listview */
4827 expect(100, LOWORD(ret));
4828 expect(0xFFFF, HIWORD(ret));
4829
4831 expect(0xFFFF, LOWORD(ret));
4832 expect(0xFFFF, HIWORD(ret));
4833 }
4834 else
4835 {
4837 expect(100, LOWORD(ret));
4838 expect(0xFFFF, HIWORD(ret));
4839 }
4841 /* spacing + icon size returned */
4842 expect(cx + 40, LOWORD(ret));
4843 expect(cy + 40, HIWORD(ret));
4844
4846 pImageList_Destroy(himl80);
4848 /* LVS_SMALLICON */
4851 expect(cx, LOWORD(ret));
4852 expect(cy, HIWORD(ret));
4853
4854 /* spacing does not depend on selected view type */
4856 expect(0, ret);
4857
4859 /* spacing + icon size returned */
4860 expect(cx + 40, LOWORD(ret));
4861 expect(cy + 40, HIWORD(ret));
4862
4864 pImageList_Destroy(himl40);
4866 /* LVS_REPORT */
4869 expect(cx, LOWORD(ret));
4870 expect(cy, HIWORD(ret));
4871
4873 /* LVS_LIST */
4876 expect(cx, LOWORD(ret));
4877 expect(cy, HIWORD(ret));
4878
4880}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define LVM_GETITEMSPACING
Definition: commctrl.h:2711
_Out_opt_ int * cx
Definition: commctrl.h:585
#define LVSIL_NORMAL
Definition: commctrl.h:2298
#define SM_CYICONSPACING
Definition: winuser.h:1002
#define SM_CYICON
Definition: winuser.h:973
#define SM_CXICON
Definition: winuser.h:972
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXICONSPACING
Definition: winuser.h:1001

Referenced by START_TEST().

◆ test_getorigin()

static void test_getorigin ( void  )
static

Definition at line 2258 of file listview.c.

2259{
2260 /* LVM_GETORIGIN */
2261
2262 HWND hwnd;
2263 DWORD r;
2264 POINT position;
2265
2266 position.x = position.y = 0;
2267
2269 ok(hwnd != NULL, "failed to create a listview window\n");
2271
2272 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2273 expect(TRUE, r);
2276
2278 ok(hwnd != NULL, "failed to create a listview window\n");
2280
2281 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2282 expect(TRUE, r);
2285
2287 ok(hwnd != NULL, "failed to create a listview window\n");
2289
2290 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2291 expect(FALSE, r);
2294
2296 ok(hwnd != NULL, "failed to create a listview window\n");
2298
2299 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2300 expect(FALSE, r);
2303}
#define LVM_GETORIGIN
Definition: commctrl.h:2668
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by START_TEST().

◆ test_getviewrect()

static void test_getviewrect ( void  )
static

Definition at line 3866 of file listview.c.

3867{
3868 HWND hwnd;
3869 DWORD r;
3870 RECT rect;
3871 LVITEMA item;
3872
3874 ok(hwnd != NULL, "failed to create a listview window\n");
3875
3876 /* empty */
3878 expect(TRUE, r);
3879
3880 insert_column(hwnd, 0);
3881 insert_column(hwnd, 1);
3882
3883 memset(&item, 0, sizeof(item));
3884 item.iItem = 0;
3885 item.iSubItem = 0;
3887 ok(!r, "got %d\n", r);
3888
3890 expect(TRUE, r);
3892 expect(TRUE, r);
3893
3894 SetRect(&rect, -1, -1, -1, -1);
3896 expect(TRUE, r);
3897 /* left is set to (2e31-1) - XP SP2 */
3898 expect(0, rect.right);
3899 expect(0, rect.top);
3900 expect(0, rect.bottom);
3901
3902 /* switch to LVS_ICON */
3904
3905 SetRect(&rect, -1, -1, -1, -1);
3907 expect(TRUE, r);
3908 expect(0, rect.left);
3909 expect(0, rect.top);
3910 /* precise value differs for 2k, XP and Vista */
3911 ok(rect.bottom > 0, "Expected positive bottom value, got %d\n", rect.bottom);
3912 ok(rect.right > 0, "Expected positive right value, got %d\n", rect.right);
3913
3915}
#define LVM_SETCOLUMNWIDTH
Definition: commctrl.h:2646
#define LVM_GETVIEWRECT
Definition: commctrl.h:2654

Referenced by START_TEST().

◆ test_header_notification()

static void test_header_notification ( void  )
static

Definition at line 5437 of file listview.c.

5438{
5439 static char textA[] = "newtext";
5440 HWND list, header;
5441 HDITEMA item;
5442 NMHEADERA nmh;
5443 LVCOLUMNA col;
5444 DWORD ret;
5445 BOOL r;
5446
5448 ok(list != NULL, "failed to create listview window\n");
5449
5450 memset(&col, 0, sizeof(col));
5451 col.mask = LVCF_WIDTH;
5452 col.cx = 100;
5454 expect(0, ret);
5455
5456 /* check list parent notification after header item changed,
5457 this test should be placed before header subclassing to avoid
5458 Listview -> Header messages to be logged */
5460
5461 col.mask = LVCF_TEXT;
5462 col.pszText = textA;
5463 r = SendMessageA(list, LVM_SETCOLUMNA, 0, (LPARAM)&col);
5464 expect(TRUE, r);
5465
5467 "header notify, listview", FALSE);
5469 "header notify, parent", FALSE);
5470
5472
5474 expect(1, ret);
5475
5476 memset(&item, 0, sizeof(item));
5477 item.mask = HDI_WIDTH;
5479 expect(1, ret);
5480 expect(100, item.cxy);
5481
5482 nmh.hdr.hwndFrom = header;
5485 nmh.iItem = 0;
5486 nmh.iButton = 0;
5487 item.mask = HDI_WIDTH;
5488 item.cxy = 50;
5489 nmh.pitem = &item;
5490 ret = SendMessageA(list, WM_NOTIFY, 0, (LPARAM)&nmh);
5491 expect(0, ret);
5492
5494}
static const char textA[]
Definition: registrar.c:40
static const struct message listview_header_changed_seq[]
Definition: listview.c:388
#define HDM_GETITEMA
Definition: commctrl.h:746
#define HDI_WIDTH
Definition: commctrl.h:702
#define HDN_ITEMCHANGEDA
Definition: commctrl.h:839
UINT_PTR idFrom
Definition: winuser.h:3158
NMHDR hdr
Definition: commctrl.h:881
HDITEMA * pitem
Definition: commctrl.h:884
#define GWLP_ID
Definition: winuser.h:860

Referenced by START_TEST().

◆ test_header_notification2()

static void test_header_notification2 ( void  )
static

Definition at line 5496 of file listview.c.

5497{
5498 static char textA[] = "newtext";
5499 HWND list, header;
5500 HDITEMW itemW;
5501 NMHEADERW nmhdr;
5502 LVCOLUMNA col;
5503 DWORD ret;
5504 WCHAR buffer[100];
5505 struct message parent_header_notify_seq[] = {
5506 { WM_NOTIFY, sent|id, 0, 0, 0 },
5507 { 0 }
5508 };
5509
5511 ok(list != NULL, "failed to create listview window\n");
5512
5513 memset(&col, 0, sizeof(col));
5514 col.mask = LVCF_WIDTH | LVCF_TEXT;
5515 col.cx = 100;
5516 col.pszText = textA;
5518 expect(0, ret);
5519
5521 ok(header != 0, "No header\n");
5522 memset(&itemW, 0, sizeof(itemW));
5523 itemW.mask = HDI_WIDTH | HDI_ORDER | HDI_TEXT;
5524 itemW.pszText = buffer;
5525 itemW.cchTextMax = ARRAY_SIZE(buffer);
5527 expect(1, ret);
5528
5529 nmhdr.hdr.hwndFrom = header;
5531 nmhdr.iItem = 0;
5532 nmhdr.iButton = 0;
5533 nmhdr.pitem = &itemW;
5534
5536 nmhdr.hdr.code = HDN_ITEMCHANGINGW;
5537 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5538 ok(ret == 0, "got %d\n", ret);
5539 parent_header_notify_seq[0].id = HDN_ITEMCHANGINGA;
5540 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5541 "header notify, parent", TRUE);
5542 todo_wine
5543 ok(nmhdr.hdr.code == HDN_ITEMCHANGINGA, "Expected ANSI notification code\n");
5545 nmhdr.hdr.code = HDN_ITEMCHANGEDW;
5546 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5547 ok(ret == 0, "got %d\n", ret);
5548 parent_header_notify_seq[0].id = HDN_ITEMCHANGEDA;
5549 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5550 "header notify, parent", TRUE);
5551 todo_wine
5552 ok(nmhdr.hdr.code == HDN_ITEMCHANGEDA, "Expected ANSI notification code\n");
5553 /* HDN_ITEMCLICK sets focus to list, which generates messages we don't want to check */
5554 SetFocus(list);
5556 nmhdr.hdr.code = HDN_ITEMCLICKW;
5557 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5558 ok(ret == 0, "got %d\n", ret);
5560 "header notify, parent", FALSE);
5561 ok(nmhdr.hdr.code == HDN_ITEMCLICKA, "Expected ANSI notification code\n");
5563 nmhdr.hdr.code = HDN_ITEMDBLCLICKW;
5564 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5565 ok(ret == 0, "got %d\n", ret);
5567 "header notify, parent", FALSE);
5568 ok(nmhdr.hdr.code == HDN_ITEMDBLCLICKW, "Expected Unicode notification code\n");
5571 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5572 ok(ret == 0, "got %d\n", ret);
5574 "header notify, parent", TRUE);
5575 ok(nmhdr.hdr.code == HDN_DIVIDERDBLCLICKA, "Expected ANSI notification code\n");
5577 nmhdr.hdr.code = HDN_BEGINTRACKW;
5578 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5579 ok(ret == 0, "got %d\n", ret);
5581 "header notify, parent", FALSE);
5582 ok(nmhdr.hdr.code == HDN_BEGINTRACKW, "Expected Unicode notification code\n");
5584 nmhdr.hdr.code = HDN_ENDTRACKW;
5585 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5586 ok(ret == 0, "got %d\n", ret);
5587 parent_header_notify_seq[0].id = HDN_ENDTRACKA;
5588 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5589 "header notify, parent", FALSE);
5590 ok(nmhdr.hdr.code == HDN_ENDTRACKA, "Expected ANSI notification code\n");
5592 nmhdr.hdr.code = HDN_TRACKW;
5593 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5594 ok(ret == 0, "got %d\n", ret);
5595 parent_header_notify_seq[0].id = HDN_TRACKA;
5596 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5597 "header notify, parent", FALSE);
5598 ok(nmhdr.hdr.code == HDN_TRACKA, "Expected ANSI notification code\n");
5600 nmhdr.hdr.code = HDN_BEGINDRAG;
5601 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5602 ok(ret == 1, "got %d\n", ret);
5604 "header notify, parent", FALSE);
5606 nmhdr.hdr.code = HDN_ENDDRAG;
5607 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5608 ok(ret == 0, "got %d\n", ret);
5609 parent_header_notify_seq[0].id = HDN_ENDDRAG;
5610 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5611 "header notify, parent", FALSE);
5613 nmhdr.hdr.code = HDN_FILTERCHANGE;
5614 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5615 ok(ret == 0, "got %d\n", ret);
5616 parent_header_notify_seq[0].id = HDN_FILTERCHANGE;
5617 parent_header_notify_seq[0].flags |= optional; /* NT4 does not send this message */
5618 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5619 "header notify, parent", FALSE);
5620 parent_header_notify_seq[0].flags &= ~optional;
5623 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5624 ok(ret == 0, "got %d\n", ret);
5626 "header notify, parent", FALSE);
5628 nmhdr.hdr.code = HDN_ENDFILTEREDIT;
5629 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5630 ok(ret == 0, "got %d\n", ret);
5632 "header notify, parent", FALSE);
5635 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5636 ok(ret == 0, "got %d\n", ret);
5638 "header notify, parent", FALSE);
5640 nmhdr.hdr.code = HDN_ITEMKEYDOWN;
5641 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5642 ok(ret == 0, "got %d\n", ret);
5644 "header notify, parent", FALSE);
5645
5647
5649}
@ optional
Definition: SystemMenu.c:34
static const WCHAR itemW[]
Definition: enumerator.c:37
GLuint id
Definition: glext.h:5910
static const struct message parent_header_divider_dclick_seq[]
Definition: listview.c:401
static const struct message parent_header_click_seq[]
Definition: listview.c:395
#define HDI_TEXT
Definition: commctrl.h:704
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define HDN_ITEMKEYDOWN
Definition: commctrl.h:862
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define HDN_ITEMSTATEICONCLICK
Definition: commctrl.h:861
#define HDN_ITEMCHANGINGA
Definition: commctrl.h:837
#define HDN_ITEMCLICKA
Definition: commctrl.h:841
#define HDN_ENDTRACKA
Definition: commctrl.h:849
#define HDN_ITEMDBLCLICKW
Definition: commctrl.h:844
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define HDN_FILTERCHANGE
Definition: commctrl.h:857
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define HDN_ENDFILTEREDIT
Definition: commctrl.h:860
#define HDM_GETITEMW
Definition: commctrl.h:747
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define HDN_BEGINTRACKW
Definition: commctrl.h:848
#define HDN_TRACKA
Definition: commctrl.h:851
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
#define HDN_DIVIDERDBLCLICKA
Definition: commctrl.h:845
#define HDN_BEGINFILTEREDIT
Definition: commctrl.h:859
#define HDI_ORDER
Definition: commctrl.h:710
UINT id
Definition: msg.h:54
msg_flags_t flags
Definition: SystemMenu.c:43
HDITEMW * pitem
Definition: commctrl.h:891
NMHDR hdr
Definition: commctrl.h:888
#define GetWindowLongPtrW
Definition: winuser.h:4829
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by START_TEST().

◆ test_header_presence_()

static void test_header_presence_ ( HWND  hwnd,
BOOL  present,
int  line 
)
static

Definition at line 1573 of file listview.c.

1574{
1576
1577 if (present)
1578 {
1579 ok_(__FILE__, line)(IsWindow(header), "Header should have been created.\n");
1580 if (header) /* FIXME: remove when todo's are fixed */
1581 ok_(__FILE__, line)(header == GetDlgItem(hwnd, 0), "Dialog item expected.\n");
1582 }
1583 else
1584 {
1585 ok_(__FILE__, line)(!IsWindow(header), "Header shouldn't be created.\n");
1586 ok_(__FILE__, line)(NULL == GetDlgItem(hwnd, 0), "NULL dialog item expected.\n");
1587 }
1588}
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: parser.c:49

◆ test_header_proc()

static void test_header_proc ( void  )
static

Definition at line 5969 of file listview.c.

5970{
5971 HWND hwnd, header, hdr;
5972 WNDPROC proc1, proc2;
5973
5975
5977 ok(header != NULL, "got %p\n", header);
5978
5981 0, 0, 0, 0,
5982 NULL, NULL, NULL, NULL);
5983 ok(hdr != NULL, "got %p\n", hdr);
5984
5987 ok(proc1 == proc2, "got %p, expected %p\n", proc1, proc2);
5988
5991}
char hdr[14]
Definition: iptest.cpp:33
#define HDS_BUTTONS
Definition: commctrl.h:629
#define WC_HEADERA
Definition: commctrl.h:623
#define HDS_HORZ
Definition: commctrl.h:628

Referenced by START_TEST().

◆ test_hittest()

static void test_hittest ( void  )
static

Definition at line 3687 of file listview.c.

3688{
3689 HWND hwnd;
3690 DWORD r;
3691 RECT bounds;
3692 LVITEMA item;
3693 static CHAR text[] = "1234567890ABCDEFGHIJKLMNOPQRST";
3694 POINT pos;
3695 INT x, y, i;
3696 WORD vert;
3697 HIMAGELIST himl, himl2;
3698 HBITMAP hbmp;
3699
3701 ok(hwnd != NULL, "failed to create a listview window\n");
3702
3703 /* LVS_REPORT with a single subitem (2 columns) */
3704 insert_column(hwnd, 0);
3705 insert_column(hwnd, 1);
3706 insert_item(hwnd, 0);
3707
3708 item.iSubItem = 0;
3709 /* the only purpose of that line is to be as long as a half item rect */
3710 item.pszText = text;
3712 expect(TRUE, r);
3713
3715 expect(TRUE, r);
3717 expect(TRUE, r);
3718
3719 SetRect(&bounds, LVIR_BOUNDS, 0, 0, 0);
3720 r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&bounds);
3721 expect(1, r);
3722 ok(bounds.bottom - bounds.top > 0, "Expected non zero item height\n");
3723 ok(bounds.right - bounds.left > 0, "Expected non zero item width\n");
3725 vert = HIWORD(r);
3726 ok(bounds.bottom - bounds.top == vert,
3727 "Vertical spacing inconsistent (%d != %d)\n", bounds.bottom - bounds.top, vert);
3729 expect(TRUE, r);
3730
3731 /* LVS_EX_FULLROWSELECT not set, no icons attached */
3732
3733 /* outside columns by x position - valid is [0, 199] */
3734 x = -1;
3735 y = pos.y + (bounds.bottom - bounds.top) / 2;
3738
3739 x = pos.x + 50; /* column half width */
3740 y = pos.y + (bounds.bottom - bounds.top) / 2;
3743 x = pos.x + 150; /* outside column */
3744 y = pos.y + (bounds.bottom - bounds.top) / 2;
3747 y = (bounds.bottom - bounds.top) / 2;
3750 /* outside possible client rectangle (to right) */
3751 x = pos.x + 500;
3752 y = pos.y + (bounds.bottom - bounds.top) / 2;
3755 y = (bounds.bottom - bounds.top) / 2;
3758 /* subitem returned with -1 item too */
3759 x = pos.x + 150;
3760 y = bounds.top - vert;
3762 test_lvm_subitemhittest(hwnd, x, y - vert + 1, -1, 1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
3763 /* return values appear to underflow with negative indices */
3764 i = -2;
3765 y = y - vert;
3766 while (i > -10) {
3769 y = y - vert;
3770 i--;
3771 }
3772 /* parent client area is 100x100 by default */
3773 MoveWindow(hwnd, 0, 0, 300, 100, FALSE);
3774 x = pos.x + 150; /* outside column */
3775 y = pos.y + (bounds.bottom - bounds.top) / 2;
3778 y = (bounds.bottom - bounds.top) / 2;
3781 /* the same with LVS_EX_FULLROWSELECT */
3783 x = pos.x + 150; /* outside column */
3784 y = pos.y + (bounds.bottom - bounds.top) / 2;
3787 y = (bounds.bottom - bounds.top) / 2;
3789 MoveWindow(hwnd, 0, 0, 100, 100, FALSE);
3790 x = pos.x + 150; /* outside column */
3791 y = pos.y + (bounds.bottom - bounds.top) / 2;
3794 y = (bounds.bottom - bounds.top) / 2;
3797 /* outside possible client rectangle (to right) */
3798 x = pos.x + 500;
3799 y = pos.y + (bounds.bottom - bounds.top) / 2;
3802 y = (bounds.bottom - bounds.top) / 2;
3805 /* try with icons, state icons index is 1 based so at least 2 bitmaps needed */
3806 himl = pImageList_Create(16, 16, 0, 4, 4);
3807 ok(himl != NULL, "failed to create imagelist\n");
3808 hbmp = CreateBitmap(16, 16, 1, 1, NULL);
3809 ok(hbmp != NULL, "failed to create bitmap\n");
3810 r = pImageList_Add(himl, hbmp, 0);
3811 ok(r == 0, "should be zero\n");
3812 hbmp = CreateBitmap(16, 16, 1, 1, NULL);
3813 ok(hbmp != NULL, "failed to create bitmap\n");
3814 r = pImageList_Add(himl, hbmp, 0);
3815 ok(r == 1, "should be one\n");
3816
3818 expect(0, r);
3819
3820 item.mask = LVIF_IMAGE;
3821 item.iImage = 0;
3822 item.iItem = 0;
3823 item.iSubItem = 0;
3825 expect(TRUE, r);
3826 /* on state icon */
3827 x = pos.x + 8;
3828 y = pos.y + (bounds.bottom - bounds.top) / 2;
3831 y = (bounds.bottom - bounds.top) / 2;
3833
3834 /* state icons indices are 1 based, check with valid index */
3835 item.mask = LVIF_STATE;
3836 item.state = INDEXTOSTATEIMAGEMASK(1);
3837 item.stateMask = LVIS_STATEIMAGEMASK;
3838 item.iItem = 0;
3839 item.iSubItem = 0;
3841 expect(TRUE, r);
3842 /* on state icon */
3843 x = pos.x + 8;
3844 y = pos.y + (bounds.bottom - bounds.top) / 2;
3847 y = (bounds.bottom - bounds.top) / 2;
3849
3851 ok(himl2 == himl, "should return handle\n");
3852
3854 expect(0, r);
3855 /* on item icon */
3856 x = pos.x + 8;
3857 y = pos.y + (bounds.bottom - bounds.top) / 2;
3860 y = (bounds.bottom - bounds.top) / 2;
3862
3864}
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define test_lvm_subitemhittest(a, b, c, d, e, f, g, h, i)
Definition: listview.c:886
#define test_lvm_hittest(a, b, c, d, e, f, g, h)
Definition: listview.c:859
#define LVHT_ONITEM
Definition: commctrl.h:2497
#define LVHT_TOLEFT
Definition: commctrl.h:2502
#define LVHT_TORIGHT
Definition: commctrl.h:2501
#define LVHT_ONITEMICON
Definition: commctrl.h:2494
#define LVHT_ONITEMSTATEICON
Definition: commctrl.h:2496
#define LVHT_NOWHERE
Definition: commctrl.h:2493
#define LVHT_ONITEMLABEL
Definition: commctrl.h:2495
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by START_TEST().

◆ test_hover()

static void test_hover ( void  )
static

Definition at line 5372 of file listview.c.

5373{
5374 HWND hwnd, fg;
5375 DWORD r;
5376
5379 fg = GetForegroundWindow();
5380 if (fg != hwndparent)
5381 {
5382 skip("Window is not in the foreground. Skipping hover tests.\n");
5384 return;
5385 }
5386
5387 /* test WM_MOUSEHOVER forwarding */
5389 r = SendMessageA(hwnd, WM_MOUSEHOVER, 0, 0);
5390 expect(0, r);
5391 ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER allow test", TRUE);
5394 r = SendMessageA(hwnd, WM_MOUSEHOVER, 0, 0);
5395 expect(0, r);
5396 ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER block test", TRUE);
5398
5399 r = SendMessageA(hwnd, LVM_SETHOVERTIME, 0, 500);
5402 expect(500, r);
5403
5405}
#define skip(...)
Definition: atltest.h:64
static const struct message hover_parent[]
Definition: listview.c:353
#define LVM_SETHOVERTIME
Definition: commctrl.h:2792
#define HOVER_DEFAULT
Definition: commctrl.h:4986
#define LVM_GETHOVERTIME
Definition: commctrl.h:2794
#define WM_MOUSEHOVER
Definition: commctrl.h:4974
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
BOOL WINAPI SetForegroundWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_icon_spacing()

static void test_icon_spacing ( void  )
static

Definition at line 1971 of file listview.c.

1972{
1973 /* LVM_SETICONSPACING */
1974 /* note: LVM_SETICONSPACING returns the previous icon spacing if successful */
1975
1976 HWND hwnd;
1977 WORD w, h;
1978 INT r;
1979
1981 ok(hwnd != NULL, "failed to create a listview window\n");
1982
1983 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwndparent, NF_REQUERY);
1984 expect(NFR_ANSI, r);
1985
1986 /* reset the icon spacing to defaults */
1988
1989 /* now we can request what the defaults are */
1991 w = LOWORD(r);
1992 h = HIWORD(r);
1993
1995
1997 ok(r == MAKELONG(w, h) ||
1998 broken(r == MAKELONG(w, w)), /* win98 */
1999 "Expected %d, got %d\n", MAKELONG(w, h), r);
2000
2002 expect(MAKELONG(20,30), r);
2003
2005 expect(MAKELONG(25,35), r);
2006
2008
2011}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static const struct message listview_icon_spacing_seq[]
Definition: listview.c:116
UINT_PTR WPARAM
Definition: windef.h:207
#define NF_REQUERY
Definition: winuser.h:2461
#define NFR_ANSI
Definition: winuser.h:2458

Referenced by START_TEST().

◆ test_imagelists()

static void test_imagelists ( void  )
static

Definition at line 5777 of file listview.c.

5778{
5779 HWND hwnd, header;
5780 HIMAGELIST himl1, himl2, himl3;
5781 LRESULT ret;
5782
5783 himl1 = pImageList_Create(40, 40, 0, 4, 4);
5784 himl2 = pImageList_Create(40, 40, 0, 4, 4);
5785 himl3 = pImageList_Create(40, 40, 0, 4, 4);
5786 ok(himl1 != NULL, "Failed to create imagelist\n");
5787 ok(himl2 != NULL, "Failed to create imagelist\n");
5788 ok(himl3 != NULL, "Failed to create imagelist\n");
5789
5792
5793 ok(header != NULL, "Expected header\n");
5795 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5796
5798
5800 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5802 "set normal image list", FALSE);
5803
5805
5807 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5809 "set state image list", TRUE);
5810
5812 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5813
5815
5817 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5819 "set small image list", FALSE);
5820
5822 ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret);
5824
5826
5828
5830 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5832 "set normal image list", FALSE);
5833
5835
5837 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5839 "set state image list", FALSE);
5840
5842
5844 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5846 "set small image list", FALSE);
5847
5849 ok(header == NULL, "Expected no header, got %p\n", header);
5850
5852
5854 ok(header != NULL, "Expected header, got NULL\n");
5855
5857 ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret);
5858
5860}
static const struct message listview_header_set_imagelist[]
Definition: listview.c:415
static const struct message listview_set_imagelist[]
Definition: listview.c:410
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2270
#define HDM_GETIMAGELIST
Definition: commctrl.h:797

Referenced by START_TEST().

◆ test_images()

static void test_images ( void  )
static

Definition at line 888 of file listview.c.

889{
890 HWND hwnd;
891 INT r;
895 RECT r1, r2;
896 static CHAR hello[] = "hello";
897
898 himl = pImageList_Create(40, 40, 0, 4, 4);
899 ok(himl != NULL, "failed to create imagelist\n");
900
901 hbmp = CreateBitmap(40, 40, 1, 1, NULL);
902 ok(hbmp != NULL, "failed to create bitmap\n");
903
904 r = pImageList_Add(himl, hbmp, 0);
905 ok(r == 0, "should be zero\n");
906
908 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
909 ok(hwnd != NULL, "failed to create listview window\n");
910
913
914 ok(r == 0, "should return zero\n");
915
917 ok(r == 0, "should return zero\n");
918
920 ok(r != 0, "got 0\n");
921
922 /* returns dimensions */
923
925 ok(r == 0, "should be zero items\n");
926
927 item.mask = LVIF_IMAGE | LVIF_TEXT;
928 item.iItem = 0;
929 item.iSubItem = 1;
930 item.iImage = 0;
931 item.pszText = 0;
933 ok(r == -1, "should fail\n");
934
935 item.iSubItem = 0;
936 item.pszText = hello;
938 ok(r == 0, "should not fail\n");
939
940 SetRect(&r1, LVIR_ICON, 0, 0, 0);
942 expect(1, r);
943
945 ok(r == TRUE, "should not fail\n");
946
947 item.iSubItem = 0;
948 item.pszText = hello;
950 ok(r == 0, "should not fail\n");
951
952 SetRect(&r2, LVIR_ICON, 0, 0, 0);
954 expect(1, r);
955
956 ok(EqualRect(&r1, &r2), "rectangle should be the same\n");
957
959}
Definition: ctx.idl:7
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
#define LVS_EX_ONECLICKACTIVATE
Definition: commctrl.h:2735
#define LVS_EX_FLATSB
Definition: commctrl.h:2737
#define LVS_EX_UNDERLINEHOT
Definition: commctrl.h:2740
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by START_TEST().

◆ test_indentation()

static void test_indentation ( void  )
static

Definition at line 4551 of file listview.c.

4552{
4553 HWND hwnd;
4554 LVITEMA item;
4555 DWORD r;
4556
4558 ok(hwnd != NULL, "failed to create a listview window\n");
4559
4560 memset(&item, 0, sizeof(item));
4561 item.mask = LVIF_INDENT;
4562 item.iItem = 0;
4563 item.iIndent = I_INDENTCALLBACK;
4565 expect(0, r);
4566
4568
4569 item.iItem = 0;
4570 item.mask = LVIF_INDENT;
4572 expect(TRUE, r);
4573
4575 "get indent dispinfo", FALSE);
4576
4578}
#define I_INDENTCALLBACK
Definition: commctrl.h:2330

Referenced by START_TEST().

◆ test_insertitem()

static void test_insertitem ( void  )
static

Definition at line 5917 of file listview.c.

5918{
5919 LVITEMA item;
5920 UINT state;
5921 HWND hwnd;
5922 INT ret;
5923
5925
5926 /* insert item 0 focused */
5927 item.mask = LVIF_STATE;
5928 item.state = LVIS_FOCUSED;
5929 item.stateMask = LVIS_FOCUSED;
5930 item.iItem = 0;
5931 item.iSubItem = 0;
5933 ok(ret == 0, "got %d\n", ret);
5934
5936 ok(state == LVIS_FOCUSED, "got %x\n", state);
5937
5939
5940 /* insert item 1, focus shift */
5941 item.mask = LVIF_STATE;
5942 item.state = LVIS_FOCUSED;
5943 item.stateMask = LVIS_FOCUSED;
5944 item.iItem = 1;
5945 item.iSubItem = 0;
5947 ok(ret == 1, "got %d\n", ret);
5948
5950
5952 ok(state == LVIS_FOCUSED, "got %x\n", state);
5953
5954 /* insert item 2, no focus shift */
5955 item.mask = LVIF_STATE;
5956 item.state = 0;
5957 item.stateMask = LVIS_FOCUSED;
5958 item.iItem = 2;
5959 item.iSubItem = 0;
5961 ok(ret == 2, "got %d\n", ret);
5962
5964 ok(state == LVIS_FOCUSED, "got %x\n", state);
5965
5967}
static const struct message parent_insert_focused_seq[]
Definition: listview.c:421

Referenced by START_TEST().

◆ test_item_count()

static void test_item_count ( void  )
static

Definition at line 2085 of file listview.c.

2086{
2087 /* LVM_INSERTITEM, LVM_DELETEITEM, LVM_DELETEALLITEMS, LVM_GETITEMCOUNT */
2088
2089 HWND hwnd;
2090 DWORD r;
2091 HDC hdc;
2092 HFONT hOldFont;
2094 RECT rect;
2095 INT height;
2096
2097 LVITEMA item0;
2098 LVITEMA item1;
2099 LVITEMA item2;
2100 static CHAR item0text[] = "item0";
2101 static CHAR item1text[] = "item1";
2102 static CHAR item2text[] = "item2";
2103
2105 ok(hwnd != NULL, "failed to create a listview window\n");
2106
2107 /* resize in dpiaware manner to fit all 3 items added */
2108 hdc = GetDC(0);
2111 /* 2 extra pixels for bounds and header border */
2112 height = tm.tmHeight + 2;
2113 SelectObject(hdc, hOldFont);
2114 ReleaseDC(0, hdc);
2115
2117 /* 3 items + 1 header + 1 to be sure */
2118 MoveWindow(hwnd, 0, 0, rect.right - rect.left, 5 * height, FALSE);
2119
2121
2123 expect(0, r);
2124
2125 /* [item0] */
2126 item0.mask = LVIF_TEXT;
2127 item0.iItem = 0;
2128 item0.iSubItem = 0;
2129 item0.pszText = item0text;
2130 r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item0);
2131 expect(0, r);
2132
2133 /* [item0, item1] */
2134 item1.mask = LVIF_TEXT;
2135 item1.iItem = 1;
2136 item1.iSubItem = 0;
2137 item1.pszText = item1text;
2139 expect(1, r);
2140
2141 /* [item0, item1, item2] */
2142 item2.mask = LVIF_TEXT;
2143 item2.iItem = 2;
2144 item2.iSubItem = 0;
2145 item2.pszText = item2text;
2147 expect(2, r);
2148
2150 expect(3, r);
2151
2152 /* [item0, item1] */
2154 expect(TRUE, r);
2155
2157 expect(2, r);
2158
2159 /* [] */
2161 expect(TRUE, r);
2162
2164 expect(0, r);
2165
2166 /* [item0] */
2168 expect(0, r);
2169
2170 /* [item0, item1] */
2172 expect(1, r);
2173
2175 expect(2, r);
2176
2177 /* [item0, item1, item2] */
2179 expect(2, r);
2180
2182 expect(3, r);
2183
2185
2188}
static const struct message listview_item_count_seq[]
Definition: listview.c:154
static const struct metadata_item item1[]
Definition: metadata.c:2802
static const struct metadata_item item2[]
Definition: metadata.c:2807
#define SYSTEM_FONT
Definition: wingdi.h:911
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by START_TEST().

◆ test_item_position()

static void test_item_position ( void  )
static

Definition at line 2190 of file listview.c.

2191{
2192 /* LVM_SETITEMPOSITION/LVM_GETITEMPOSITION */
2193
2194 HWND hwnd;
2195 DWORD r;
2196 POINT position;
2197
2198 LVITEMA item0;
2199 LVITEMA item1;
2200 LVITEMA item2;
2201 static CHAR item0text[] = "item0";
2202 static CHAR item1text[] = "item1";
2203 static CHAR item2text[] = "item2";
2204
2206 ok(hwnd != NULL, "failed to create a listview window\n");
2207
2209
2210 /* [item0] */
2211 item0.mask = LVIF_TEXT;
2212 item0.iItem = 0;
2213 item0.iSubItem = 0;
2214 item0.pszText = item0text;
2215 r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item0);
2216 expect(0, r);
2217
2218 /* [item0, item1] */
2219 item1.mask = LVIF_TEXT;
2220 item1.iItem = 1;
2221 item1.iSubItem = 0;
2222 item1.pszText = item1text;
2224 expect(1, r);
2225
2226 /* [item0, item1, item2] */
2227 item2.mask = LVIF_TEXT;
2228 item2.iItem = 2;
2229 item2.iSubItem = 0;
2230 item2.pszText = item2text;
2232 expect(2, r);
2233
2235 expect(TRUE, r);
2236 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 1, (LPARAM) &position);
2237 expect(TRUE, r);
2238 expect2(10, 5, position.x, position.y);
2239
2241 expect(TRUE, r);
2242 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 2, (LPARAM) &position);
2243 expect(TRUE, r);
2244 expect2(0, 0, position.x, position.y);
2245
2247 expect(TRUE, r);
2248 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM) &position);
2249 expect(TRUE, r);
2250 expect2(20, 20, position.x, position.y);
2251
2253
2256}
static const struct message listview_itempos_seq[]
Definition: listview.c:174
#define expect2(expected1, expected2, got1, got2)
Definition: listview.c:50
#define LVM_SETITEMPOSITION
Definition: commctrl.h:2480

Referenced by START_TEST().

◆ test_item_state_change()

static void test_item_state_change ( void  )
static

Definition at line 6478 of file listview.c.

6479{
6480 static const DWORD styles[] = { LVS_ICON, LVS_LIST, LVS_REPORT, LVS_SMALLICON };
6481 LVITEMA item;
6482 HWND hwnd;
6483 DWORD res;
6484 int i;
6485
6486 for (i = 0; i < ARRAY_SIZE(styles); i++)
6487 {
6488 hwnd = create_listview_control(styles[i]);
6489
6490 insert_item(hwnd, 0);
6491
6492 /* LVM_SETITEMSTATE with mask */
6493 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6494 memset(&item, 0, sizeof(item));
6495 item.mask = LVIF_STATE;
6496 item.stateMask = LVIS_SELECTED;
6497 item.state = LVIS_SELECTED;
6499 ok(res, "Failed to set item state.\n");
6500
6501 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6502 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6503 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6504 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
6505 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
6506 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
6507
6508 /* LVM_SETITEMSTATE 0 mask */
6509 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6510 memset(&item, 0, sizeof(item));
6511 item.stateMask = LVIS_SELECTED;
6512 item.state = 0;
6514 ok(res, "Failed to set item state.\n");
6515
6516 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6517 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6518 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6519 ok(g_nmlistview.uNewState == 0, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6520 ok(g_nmlistview.uOldState == LVIS_SELECTED, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6521 ok(g_nmlistview.uChanged == LVIF_STATE, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6522
6523 /* LVM_SETITEM changes state */
6524 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6525 memset(&item, 0, sizeof(item));
6526 item.stateMask = LVIS_SELECTED;
6527 item.state = LVIS_SELECTED;
6528 item.mask = LVIF_STATE;
6530 ok(res, "Failed to set item.\n");
6531
6532 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6533 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6534 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6535 ok(g_nmlistview.uNewState == LVIS_SELECTED, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6536 ok(g_nmlistview.uOldState == 0, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6537 ok(g_nmlistview.uChanged == LVIF_STATE, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6538
6539 /* LVM_SETITEM no state changes */
6540 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6541 memset(&item, 0, sizeof(item));
6542 item.lParam = 11;
6543 item.mask = LVIF_PARAM;
6545 ok(res, "Failed to set item.\n");
6546
6547 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6548 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6549 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6550 ok(g_nmlistview.uNewState == 0, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6551 ok(g_nmlistview.uOldState == 0, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6552 ok(g_nmlistview.uChanged == LVIF_PARAM, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6553
6555 }
6556}
GLuint res
Definition: glext.h:9613
#define LVIF_PARAM
Definition: commctrl.h:2311
UINT uNewState
Definition: commctrl.h:3036
LPARAM lParam
Definition: commctrl.h:3040
UINT uOldState
Definition: commctrl.h:3037

Referenced by START_TEST().

◆ test_items()

static void test_items ( void  )
static

Definition at line 1188 of file listview.c.

1189{
1190 const LPARAM lparamTest = 0x42;
1191 static CHAR text[] = "Text";
1192 char buffA[5];
1193 HWND hwnd;
1194 LVITEMA item;
1195 DWORD r;
1196
1198 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1199 ok(hwnd != NULL, "failed to create listview window\n");
1200
1201 /*
1202 * Test setting/getting item params
1203 */
1204
1205 /* Set up two columns */
1206 insert_column(hwnd, 0);
1207 insert_column(hwnd, 1);
1208
1209 /* LVIS_SELECTED with zero stateMask */
1210 /* set */
1211 memset (&item, 0, sizeof (item));
1212 item.mask = LVIF_STATE;
1213 item.state = LVIS_SELECTED;
1214 item.stateMask = 0;
1215 item.iItem = 0;
1216 item.iSubItem = 0;
1218 expect(0, r);
1219 /* get */
1220 memset (&item, 0xcc, sizeof (item));
1221 item.mask = LVIF_STATE;
1222 item.stateMask = LVIS_SELECTED;
1223 item.state = 0;
1224 item.iItem = 0;
1225 item.iSubItem = 0;
1227 expect(1, r);
1228 ok(item.state & LVIS_SELECTED, "Expected LVIS_SELECTED\n");
1230 ok(r, "got %d\n", r);
1231
1232 /* LVIS_SELECTED with zero stateMask */
1233 /* set */
1234 memset (&item, 0, sizeof (item));
1235 item.mask = LVIF_STATE;
1236 item.state = LVIS_FOCUSED;
1237 item.stateMask = 0;
1238 item.iItem = 0;
1239 item.iSubItem = 0;
1241 expect(0, r);
1242 /* get */
1243 memset (&item, 0xcc, sizeof (item));
1244 item.mask = LVIF_STATE;
1245 item.stateMask = LVIS_FOCUSED;
1246 item.state = 0;
1247 item.iItem = 0;
1248 item.iSubItem = 0;
1250 expect(1, r);
1251 ok(item.state & LVIS_FOCUSED, "Expected LVIS_FOCUSED\n");
1253 ok(r, "got %d\n", r);
1254
1255 /* LVIS_CUT with LVIS_FOCUSED stateMask */
1256 /* set */
1257 memset (&item, 0, sizeof (item));
1258 item.mask = LVIF_STATE;
1259 item.state = LVIS_CUT;
1260 item.stateMask = LVIS_FOCUSED;
1261 item.iItem = 0;
1262 item.iSubItem = 0;
1264 expect(0, r);
1265 /* get */
1266 memset (&item, 0xcc, sizeof (item));
1267 item.mask = LVIF_STATE;
1268 item.stateMask = LVIS_CUT;
1269 item.state = 0;
1270 item.iItem = 0;
1271 item.iSubItem = 0;
1273 expect(1, r);
1274 ok(item.state & LVIS_CUT, "Expected LVIS_CUT\n");
1276 ok(r, "got %d\n", r);
1277
1278 /* Insert an item with just a param */
1279 memset (&item, 0xcc, sizeof (item));
1280 item.mask = LVIF_PARAM;
1281 item.iItem = 0;
1282 item.iSubItem = 0;
1283 item.lParam = lparamTest;
1285 expect(0, r);
1286
1287 /* Test getting of the param */
1288 memset (&item, 0xcc, sizeof (item));
1289 item.mask = LVIF_PARAM;
1290 item.iItem = 0;
1291 item.iSubItem = 0;
1293 expect(1, r);
1294 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1295
1296 /* Set up a subitem */
1297 memset (&item, 0xcc, sizeof (item));
1298 item.mask = LVIF_TEXT;
1299 item.iItem = 0;
1300 item.iSubItem = 1;
1301 item.pszText = text;
1303 expect(1, r);
1304
1305 item.mask = LVIF_TEXT;
1306 item.iItem = 0;
1307 item.iSubItem = 1;
1308 item.pszText = buffA;
1309 item.cchTextMax = sizeof(buffA);
1311 expect(1, r);
1312 ok(!memcmp(item.pszText, text, sizeof(text)), "got text %s, expected %s\n", item.pszText, text);
1313
1314 /* set up with extra flag */
1315 /* 1. reset subitem text */
1316 item.mask = LVIF_TEXT;
1317 item.iItem = 0;
1318 item.iSubItem = 1;
1319 item.pszText = NULL;
1321 expect(1, r);
1322
1323 item.mask = LVIF_TEXT;
1324 item.iItem = 0;
1325 item.iSubItem = 1;
1326 item.pszText = buffA;
1327 buffA[0] = 'a';
1328 item.cchTextMax = sizeof(buffA);
1330 expect(1, r);
1331 ok(item.pszText[0] == 0, "got %p\n", item.pszText);
1332
1333 /* 2. set new text with extra flag specified */
1335 item.iItem = 0;
1336 item.iSubItem = 1;
1337 item.pszText = text;
1339 ok(r == 1 || broken(r == 0) /* NT4 */, "ret %d\n", r);
1340
1341 if (r == 1)
1342 {
1343 item.mask = LVIF_TEXT;
1344 item.iItem = 0;
1345 item.iSubItem = 1;
1346 item.pszText = buffA;
1347 buffA[0] = 'a';
1348 item.cchTextMax = sizeof(buffA);
1350 expect(1, r);
1351 ok(!memcmp(item.pszText, text, sizeof(text)), "got %s, expected %s\n", item.pszText, text);
1352 }
1353
1354 /* Query param from subitem: returns main item param */
1355 memset (&item, 0xcc, sizeof (item));
1356 item.mask = LVIF_PARAM;
1357 item.iItem = 0;
1358 item.iSubItem = 1;
1360 expect(1, r);
1361 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1362
1363 /* Set up param on first subitem: no effect */
1364 memset (&item, 0xcc, sizeof (item));
1365 item.mask = LVIF_PARAM;
1366 item.iItem = 0;
1367 item.iSubItem = 1;
1368 item.lParam = lparamTest+1;
1370 expect(0, r);
1371
1372 /* Query param from subitem again: should still return main item param */
1373 memset (&item, 0xcc, sizeof (item));
1374 item.mask = LVIF_PARAM;
1375 item.iItem = 0;
1376 item.iSubItem = 1;
1378 expect(1, r);
1379 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1380
1381 /**** Some tests of state highlighting ****/
1382 memset (&item, 0xcc, sizeof (item));
1383 item.mask = LVIF_STATE;
1384 item.iItem = 0;
1385 item.iSubItem = 0;
1386 item.state = LVIS_SELECTED;
1387 item.stateMask = LVIS_SELECTED | LVIS_DROPHILITED;
1389 expect(1, r);
1390 item.iSubItem = 1;
1391 item.state = LVIS_DROPHILITED;
1393 expect(1, r);
1394
1395 memset (&item, 0xcc, sizeof (item));
1396 item.mask = LVIF_STATE;
1397 item.iItem = 0;
1398 item.iSubItem = 0;
1399 item.stateMask = -1;
1401 expect(1, r);
1402 ok(item.state == LVIS_SELECTED, "got state %x, expected %x\n", item.state, LVIS_SELECTED);
1403 item.iSubItem = 1;
1405 expect(1, r);
1406 todo_wine ok(item.state == LVIS_DROPHILITED, "got state %x, expected %x\n", item.state, LVIS_DROPHILITED);
1407
1408 /* some notnull but meaningless masks */
1409 memset (&item, 0, sizeof(item));
1410 item.mask = LVIF_NORECOMPUTE;
1411 item.iItem = 0;
1412 item.iSubItem = 0;
1414 expect(1, r);
1415 memset (&item, 0, sizeof(item));
1416 item.mask = LVIF_DI_SETITEM;
1417 item.iItem = 0;
1418 item.iSubItem = 0;
1420 expect(1, r);
1421
1422 /* set text to callback value already having it */
1424 expect(TRUE, r);
1425 memset (&item, 0, sizeof (item));
1426 item.mask = LVIF_TEXT;
1427 item.pszText = LPSTR_TEXTCALLBACKA;
1428 item.iItem = 0;
1430 expect(0, r);
1431 memset (&item, 0, sizeof (item));
1432
1434
1435 item.pszText = LPSTR_TEXTCALLBACKA;
1437 expect(TRUE, r);
1438
1440 "check callback text comparison rule", FALSE);
1441
1443}
static const struct message textcallback_set_again_parent_seq[]
Definition: listview.c:279
#define LVIF_NORECOMPUTE
Definition: commctrl.h:2314
#define LVIS_DROPHILITED
Definition: commctrl.h:2321
#define LVIF_DI_SETITEM
Definition: commctrl.h:3166
#define LVIS_CUT
Definition: commctrl.h:2320

Referenced by START_TEST().

◆ test_LVM_GETCOUNTPERPAGE()

static void test_LVM_GETCOUNTPERPAGE ( void  )
static

Definition at line 6416 of file listview.c.

6417{
6418 static const DWORD styles[] = { LVS_ICON, LVS_LIST, LVS_REPORT, LVS_SMALLICON };
6419 unsigned int i, j;
6420 WNDCLASSEXA cls;
6421 ATOM class;
6422 HWND hwnd;
6423 BOOL ret;
6424
6425 cls.cbSize = sizeof(WNDCLASSEXA);
6427 ok(ret, "Failed to get class info.\n");
6430 cls.lpszClassName = "CountPerPageClass";
6431 class = RegisterClassExA(&cls);
6432 ok(class, "Failed to register class.\n");
6433
6434 for (i = 0; i < ARRAY_SIZE(styles); i++)
6435 {
6436 static char text[] = "item text";
6437 LVITEMA item = { 0 };
6438 UINT count, count2;
6439
6440 hwnd = create_listview_control(styles[i]);
6441 ok(hwnd != NULL, "Failed to create listview window.\n");
6442
6444 if (styles[i] == LVS_LIST || styles[i] == LVS_REPORT)
6445 ok(count > 0 || broken(styles[i] == LVS_LIST && count == 0), "%u: unexpected count %u.\n", i, count);
6446 else
6447 ok(count == 0, "%u: unexpected count %u.\n", i, count);
6448
6449 for (j = 0; j < 10; j++)
6450 {
6451 item.mask = LVIF_TEXT;
6452 item.pszText = text;
6454 }
6455
6456 count2 = SendMessageA(hwnd, LVM_GETCOUNTPERPAGE, 0, 0);
6457 if (styles[i] == LVS_LIST || styles[i] == LVS_REPORT)
6458 ok(count == count2, "%u: unexpected count %u.\n", i, count2);
6459 else
6460 ok(count2 == 10, "%u: unexpected count %u.\n", i, count2);
6461
6463
6464 hwnd = CreateWindowA("CountPerPageClass", "Test", WS_VISIBLE | styles[i], 0, 0, 100, 100, NULL, NULL,
6466 ok(hwnd != NULL, "Failed to create a window.\n");
6467
6469 ok(count == 0, "%u: unexpected count %u.\n", i, count);
6470
6472 }
6473
6474 ret = UnregisterClassA("CountPerPageClass", NULL);
6475 ok(ret, "Failed to unregister test class.\n");
6476}
GLuint GLuint GLsizei count
Definition: gl.h:1545
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 GLint GLint j
Definition: glfuncs.h:250
static LRESULT CALLBACK create_item_height_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6408
#define LVM_GETCOUNTPERPAGE
Definition: commctrl.h:2666

Referenced by START_TEST().

◆ test_lvm_hittest_()

static void test_lvm_hittest_ ( HWND  hwnd,
INT  x,
INT  y,
INT  item,
UINT  flags,
UINT  broken_flags,
BOOL  todo_item,
BOOL  todo_flags,
int  line 
)
static

Definition at line 828 of file listview.c.

830{
831 LVHITTESTINFO lpht;
832 INT ret;
833
834 lpht.pt.x = x;
835 lpht.pt.y = y;
836 lpht.iSubItem = 10;
837
838 ret = SendMessageA(hwnd, LVM_HITTEST, 0, (LPARAM)&lpht);
839
840 todo_wine_if(todo_item)
841 {
842 ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
843 ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
844 ok_(__FILE__, line)(lpht.iSubItem == 10, "Expected subitem not overwrited\n");
845 }
846
847 if (todo_flags)
848 {
850 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
851 }
852 else if (broken_flags)
853 ok_(__FILE__, line)(lpht.flags == flags || broken(lpht.flags == broken_flags),
854 "Expected flags %x, got %x\n", flags, lpht.flags);
855 else
856 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
857}
GLbitfield flags
Definition: glext.h:7161
#define LVM_HITTEST
Definition: commctrl.h:2515

◆ test_LVM_REDRAWITEMS()

static void test_LVM_REDRAWITEMS ( void  )
static

Definition at line 5740 of file listview.c.

5741{
5742 HWND list;
5743 DWORD ret;
5744
5746 ok(list != NULL, "failed to create listview window\n");
5747
5749 expect(TRUE, ret);
5750
5751 insert_item(list, 0);
5752
5754 expect(TRUE, ret);
5755
5757 expect(TRUE, ret);
5758
5760 expect(TRUE, ret);
5761
5763 expect(TRUE, ret);
5764
5766 expect(TRUE, ret);
5767
5769 expect(TRUE, ret);
5770
5772 expect(TRUE, ret);
5773
5775}
#define LVM_REDRAWITEMS
Definition: commctrl.h:2524

Referenced by START_TEST().

◆ test_LVM_SETITEMTEXT()

static void test_LVM_SETITEMTEXT ( void  )
static

Definition at line 5704 of file listview.c.

5705{
5706 static char testA[] = "TEST";
5707 LVITEMA item;
5708 HWND hwnd;
5709 DWORD ret;
5710
5712 ok(hwnd != NULL, "failed to create listview window\n");
5713
5714 insert_item(hwnd, 0);
5715
5716 /* null item pointer */
5718 expect(FALSE, ret);
5719
5721 expect(FALSE, ret);
5722
5723 /* index out of bounds */
5724 item.pszText = testA;
5725 item.cchTextMax = 0; /* ignored */
5726 item.iSubItem = 0;
5727
5729 expect(FALSE, ret);
5730
5732 expect(FALSE, ret);
5733
5735 expect(TRUE, ret);
5736
5738}
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2687

Referenced by START_TEST().

◆ test_lvm_subitemhittest_()

static void test_lvm_subitemhittest_ ( HWND  hwnd,
INT  x,
INT  y,
INT  item,
INT  subitem,
UINT  flags,
BOOL  todo_item,
BOOL  todo_subitem,
BOOL  todo_flags,
int  line 
)
static

Definition at line 862 of file listview.c.

864{
865 LVHITTESTINFO lpht;
866 INT ret;
867
868 lpht.pt.x = x;
869 lpht.pt.y = y;
870
872
873 todo_wine_if(todo_item)
874 {
875 ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
876 ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
877 }
878
879 todo_wine_if(todo_subitem)
880 ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem);
881
882 todo_wine_if(todo_flags)
883 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
884}
#define LVM_SUBITEMHITTEST
Definition: commctrl.h:2764

◆ test_LVN_ENDLABELEDIT()

static void test_LVN_ENDLABELEDIT ( void  )
static

Definition at line 6357 of file listview.c.

6358{
6359 WCHAR text[] = {'l','a','l','a',0};
6360 HWND hwnd, hwndedit;
6361 LVITEMW item = {0};
6362 DWORD ret;
6363
6365
6366 insert_column(hwnd, 0);
6367
6368 item.mask = LVIF_TEXT;
6369 item.pszText = text;
6371
6372 /* Test normal editing */
6373 SetFocus(hwnd);
6374 hwndedit = (HWND)SendMessageW(hwnd, LVM_EDITLABELW, 0, 0);
6375 ok(hwndedit != NULL, "Failed to get edit control.\n");
6376
6377 ret = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)"test");
6378 ok(ret, "Failed to set edit text.\n");
6379
6381
6382 ret = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
6384
6385 /* Test editing with kill focus */
6386 SetFocus(hwnd);
6387 hwndedit = (HWND)SendMessageW(hwnd, LVM_EDITLABELW, 0, 0);
6388 ok(hwndedit != NULL, "Failed to get edit control.\n");
6389
6390 ret = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)"test2");
6391 ok(ret, "Failed to set edit text.\n");
6392
6394
6396 ret = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
6398
6400 "Label edit, kill focus", FALSE);
6401 ok(GetFocus() == hwnd, "Unexpected focused window.\n");
6402
6404
6406}
static const struct message listview_end_label_edit[]
Definition: listview.c:450
static const struct message listview_end_label_edit_kill_focus[]
Definition: listview.c:459
#define LVM_EDITLABELW
Definition: commctrl.h:2536
#define LVM_INSERTITEMW
Definition: commctrl.h:2404

Referenced by START_TEST().

◆ test_LVS_EX_HEADERINALLVIEWS()

static void test_LVS_EX_HEADERINALLVIEWS ( void  )
static

Definition at line 5312 of file listview.c.

5313{
5314 HWND hwnd, header;
5315 DWORD style;
5316
5318
5319 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5320 LVS_EX_HEADERINALLVIEWS);
5321
5323 if (!IsWindow(header))
5324 {
5325 win_skip("LVS_EX_HEADERINALLVIEWS unsupported\n");
5327 return;
5328 }
5329
5330 /* LVS_NOCOLUMNHEADER works as before */
5334 ok(style & HDS_HIDDEN, "Expected HDS_HIDDEN\n");
5338 ok(!(style & HDS_HIDDEN), "Expected HDS_HIDDEN to be unset\n");
5339
5340 /* try to remove style */
5341 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS, 0);
5343 ok(IsWindow(header), "Expected header to be created\n");
5345 ok(!(style & HDS_HIDDEN), "HDS_HIDDEN not expected\n");
5346
5348
5349 /* check other styles */
5351 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5352 LVS_EX_HEADERINALLVIEWS);
5354 ok(IsWindow(header), "Expected header to be created\n");
5356
5358 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5359 LVS_EX_HEADERINALLVIEWS);
5361 ok(IsWindow(header), "Expected header to be created\n");
5363
5365 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5366 LVS_EX_HEADERINALLVIEWS);
5368 ok(IsWindow(header), "Expected header to be created\n");
5370}

Referenced by START_TEST().

◆ test_LVS_EX_TRANSPARENTBKGND()

static void test_LVS_EX_TRANSPARENTBKGND ( void  )
static

Definition at line 4988 of file listview.c.

4989{
4990 HWND hwnd;
4991 DWORD ret;
4992 HDC hdc;
4993
4995
4996 ret = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, RGB(0, 0, 0));
4997 expect(TRUE, ret);
4998
4999 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTBKGND,
5000 LVS_EX_TRANSPARENTBKGND);
5001
5003 if (ret != CLR_NONE)
5004 {
5005 win_skip("LVS_EX_TRANSPARENTBKGND unsupported\n");
5007 return;
5008 }
5009
5010 /* try to set some back color and check this style bit */
5011 ret = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, RGB(0, 0, 0));
5012 expect(TRUE, ret);
5014 ok(!(ret & LVS_EX_TRANSPARENTBKGND), "Expected LVS_EX_TRANSPARENTBKGND to unset\n");
5015
5016 /* now test what this style actually does */
5017 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTBKGND,
5018 LVS_EX_TRANSPARENTBKGND);
5019
5021
5025 "LVS_EX_TRANSPARENTBKGND parent", FALSE);
5026
5028
5030}
static const struct message lvs_ex_transparentbkgnd_seq[]
Definition: listview.c:341
HDC WINAPI GetWindowDC(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_LVSCW_AUTOSIZE()

static void test_LVSCW_AUTOSIZE ( void  )
static

Definition at line 6313 of file listview.c.

6314{
6315 int width, width2;
6316 HWND hwnd;
6317 BOOL ret;
6318
6320 ok(hwnd != NULL, "failed to create a listview window\n");
6321
6322 insert_column(hwnd, 0);
6323 insert_column(hwnd, 1);
6324 insert_item(hwnd, 0);
6325
6327 ok(ret, "Failed to set column width.\n");
6328
6330 ok(width > 0, "Unexpected column width %d.\n", width);
6331
6332 /* Turn on checkboxes. */
6334 ok(ret == 0, "Unexpected previous extended style.\n");
6335
6337 ok(ret, "Failed to set column width.\n");
6338
6339 width2 = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
6340 ok(width2 > 0, "Unexpected column width %d.\n", width2);
6341 ok(width2 > width, "Expected increased column width.\n");
6342
6343 /* Turn off checkboxes. */
6345 ok(ret == LVS_EX_CHECKBOXES, "Unexpected previous extended style.\n");
6346
6348 ok(ret, "Failed to set column width.\n");
6349
6351 ok(width > 0, "Unexpected column width %d.\n", width2);
6352 ok(width2 > width, "Expected reduced column width.\n");
6353
6355}
GLint GLint GLsizei width
Definition: gl.h:1546
#define LVSCW_AUTOSIZE
Definition: commctrl.h:2644

Referenced by START_TEST().

◆ test_mapidindex()

static void test_mapidindex ( void  )
static

Definition at line 4705 of file listview.c.

4706{
4707 HWND hwnd;
4708 INT ret;
4709
4710 /* LVM_MAPINDEXTOID unsupported with LVS_OWNERDATA */
4712 ok(hwnd != NULL, "failed to create a listview window\n");
4713 insert_item(hwnd, 0);
4715 expect(-1, ret);
4717
4719 ok(hwnd != NULL, "failed to create a listview window\n");
4720
4721 /* LVM_MAPINDEXTOID with invalid index */
4723 expect(-1, ret);
4724
4725 insert_item(hwnd, 0);
4726 insert_item(hwnd, 1);
4727
4729 expect(-1, ret);
4731 expect(-1, ret);
4732
4734 expect(0, ret);
4736 expect(1, ret);
4737 /* remove 0 indexed item, id retained */
4740 expect(1, ret);
4741 /* new id starts from previous value */
4742 insert_item(hwnd, 1);
4744 expect(2, ret);
4745
4746 /* get index by id */
4748 expect(-1, ret);
4750 expect(-1, ret);
4752 expect(0, ret);
4754 expect(1, ret);
4755
4757}
#define LVM_MAPIDTOINDEX
Definition: commctrl.h:3016
#define LVM_MAPINDEXTOID
Definition: commctrl.h:3014

Referenced by START_TEST().

◆ test_multiselect()

static void test_multiselect ( void  )
static

Definition at line 2305 of file listview.c.

2306{
2307 typedef struct t_select_task
2308 {
2309 const char *descr;
2310 int initPos;
2311 int loopVK;
2312 int count;
2313 int result;
2314 } select_task;
2315
2316 HWND hwnd;
2317 INT r;
2318 int i, j;
2319 static const int items=5;
2320 DWORD item_count;
2321 BYTE kstate[256];
2322 select_task task;
2324 LVITEMA item;
2325
2326 static struct t_select_task task_list[] = {
2327 { "using VK_DOWN", 0, VK_DOWN, -1, -1 },
2328 { "using VK_UP", -1, VK_UP, -1, -1 },
2329 { "using VK_END", 0, VK_END, 1, -1 },
2330 { "using VK_HOME", -1, VK_HOME, 1, -1 }
2331 };
2332
2334
2335 for (i = 0; i < items; i++)
2336 insert_item(hwnd, 0);
2337
2338 item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
2339 expect(items, item_count);
2340
2342 ok(r == -1, "got %d\n", r);
2343
2345 ok(r == -1, "got %d\n", r);
2346
2348 ok(r == 0, "got %d\n", r);
2349
2350 /* out of range index */
2352 ok(r == 0, "got %d\n", r);
2353
2355 ok(r == 0, "got %d\n", r);
2356
2358 ok(r == 0, "got %d\n", r);
2359
2361 ok(r == 0, "got %d\n", r);
2362
2363 for (i = 0; i < ARRAY_SIZE(task_list); i++) {
2364 DWORD selected_count;
2365 LVITEMA item;
2366
2367 task = task_list[i];
2368
2369 /* deselect all items */
2370 item.state = 0;
2371 item.stateMask = LVIS_SELECTED;
2373 ok(r, "got %d\n", r);
2375
2376 /* set initial position */
2377 r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos));
2378 ok(r, "got %d\n", r);
2379
2380 item.state = LVIS_SELECTED;
2381 item.stateMask = LVIS_SELECTED;
2382 r = SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item);
2383 ok(r, "got %d\n", r);
2384
2385 selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
2386 ok(selected_count == 1, "expected 1, got %d\n", selected_count);
2387
2388 /* Set SHIFT key pressed */
2389 GetKeyboardState(kstate);
2390 kstate[VK_SHIFT]=0x80;
2391 SetKeyboardState(kstate);
2392
2393 for (j=1;j<=(task.count == -1 ? item_count : task.count);j++) {
2394 r = SendMessageA(hwnd, WM_KEYDOWN, task.loopVK, 0);
2395 expect(0,r);
2396 r = SendMessageA(hwnd, WM_KEYUP, task.loopVK, 0);
2397 expect(0,r);
2398 }
2399
2400 selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
2401
2402 ok((task.result == -1 ? item_count : task.result) == selected_count,
2403 "Failed multiple selection %s. There should be %d selected items (is %d)\n",
2404 task.descr, item_count, selected_count);
2405
2406 /* Set SHIFT key released */
2407 GetKeyboardState(kstate);
2408 kstate[VK_SHIFT]=0x00;
2409 SetKeyboardState(kstate);
2410 }
2412
2413 /* make multiple selection, then switch to LVS_SINGLESEL */
2415 for (i=0;i<items;i++) {
2416 insert_item(hwnd, 0);
2417 }
2418 item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
2419 expect(items,item_count);
2420
2421 /* try with NULL pointer */
2423 expect(FALSE, r);
2424
2425 /* select all, check notifications */
2426 item.state = 0;
2427 item.stateMask = LVIS_SELECTED;
2429 ok(r, "got %d\n", r);
2430
2432
2433 item.stateMask = LVIS_SELECTED;
2434 item.state = LVIS_SELECTED;
2436 expect(TRUE, r);
2437
2439 "select all notification", FALSE);
2440
2441 /* select all again (all selected already) */
2443
2445
2446 item.stateMask = LVIS_SELECTED;
2447 item.state = LVIS_SELECTED;
2449 expect(TRUE, r);
2450
2454
2456 "select all notification 2", FALSE);
2457
2458 /* deselect all items */
2460
2461 item.state = 0;
2462 item.stateMask = LVIS_SELECTED;
2464 ok(r, "got %d\n", r);
2465
2467 "deselect all notification", FALSE);
2468
2469 /* deselect all items again */
2471 item.state = 0;
2472 item.stateMask = LVIS_SELECTED;
2474 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "deselect all notification 2", FALSE);
2475
2476 /* any non-zero state value does the same */
2478
2480
2481 item.stateMask = LVIS_SELECTED;
2482 item.state = LVIS_CUT;
2484 expect(TRUE, r);
2485
2489
2491 "set state all notification 3", FALSE);
2492
2494 ok(r, "got %d\n", r);
2495 for (i = 0; i < 3; i++) {
2496 item.state = LVIS_SELECTED;
2497 item.stateMask = LVIS_SELECTED;
2499 ok(r, "got %d\n", r);
2500 }
2501
2503 expect(3, r);
2505 expect(-1, r);
2506
2508 ok(!(style & LVS_SINGLESEL), "LVS_SINGLESEL isn't expected\n");
2510 /* check that style is accepted */
2512 ok(style & LVS_SINGLESEL, "LVS_SINGLESEL expected\n");
2513
2514 for (i=0;i<3;i++) {
2516 ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
2517 }
2519 expect(3, r);
2521 ok(r == -1, "got %d\n", r);
2522
2523 /* select one more */
2524 item.state = LVIS_SELECTED;
2525 item.stateMask = LVIS_SELECTED;
2527 ok(r, "got %d\n", r);
2528
2529 for (i=0;i<3;i++) {
2531 ok(!(r & LVIS_SELECTED), "Expected item %d to be unselected\n", i);
2532 }
2533
2535 ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
2536
2538 expect(1, r);
2540 expect(-1, r);
2541
2542 /* try to select all on LVS_SINGLESEL */
2543 memset(&item, 0, sizeof(item));
2544 item.stateMask = LVIS_SELECTED;
2546 expect(TRUE, r);
2548 ok(r == -1, "got %d\n", r);
2549
2550 item.stateMask = LVIS_SELECTED;
2551 item.state = LVIS_SELECTED;
2553 expect(FALSE, r);
2554
2556 expect(0, r);
2558 expect(-1, r);
2559
2560 /* try to deselect all on LVS_SINGLESEL */
2561 item.stateMask = LVIS_SELECTED;
2562 item.state = LVIS_SELECTED;
2564 expect(TRUE, r);
2565
2566 item.stateMask = LVIS_SELECTED;
2567 item.state = 0;
2569 expect(TRUE, r);
2571 expect(0, r);
2572
2573 /* 1. selection mark is update when new focused item is set */
2576
2578 expect(-1, r);
2579
2580 item.stateMask = LVIS_FOCUSED;
2581 item.state = LVIS_FOCUSED;
2583 expect(TRUE, r);
2584
2586 expect(0, r);
2587
2588 /* it's not updated if already set */
2589 item.stateMask = LVIS_FOCUSED;
2590 item.state = LVIS_FOCUSED;
2592 expect(TRUE, r);
2593
2595 expect(0, r);
2596
2598 expect(0, r);
2599
2600 item.stateMask = LVIS_FOCUSED;
2601 item.state = LVIS_FOCUSED;
2603 expect(TRUE, r);
2604
2606 expect(-1, r);
2607
2608 /* need to reset focused item first */
2609 item.stateMask = LVIS_FOCUSED;
2610 item.state = 0;
2612 expect(TRUE, r);
2613
2614 item.stateMask = LVIS_FOCUSED;
2615 item.state = LVIS_FOCUSED;
2617 expect(TRUE, r);
2618
2620 expect(2, r);
2621
2622 item.stateMask = LVIS_FOCUSED;
2623 item.state = 0;
2625 expect(TRUE, r);
2626
2628 expect(2, r);
2629
2630 /* 2. same tests, with LVM_SETITEM */
2633
2635 expect(2, r);
2636
2637 item.stateMask = LVIS_FOCUSED;
2638 item.state = LVIS_FOCUSED;
2639 item.mask = LVIF_STATE;
2640 item.iItem = item.iSubItem = 0;
2642 expect(TRUE, r);
2643
2645 expect(0, r);
2646
2647 /* it's not updated if already set */
2648 item.stateMask = LVIS_FOCUSED;
2649 item.state = LVIS_FOCUSED;
2650 item.mask = LVIF_STATE;
2651 item.iItem = 1;
2652 item.iSubItem = 0;
2654 expect(TRUE, r);
2655
2657 expect(0, r);
2658
2660 expect(0, r);
2661
2662 item.stateMask = LVIS_FOCUSED;
2663 item.state = LVIS_FOCUSED;
2664 item.mask = LVIF_STATE;
2665 item.iItem = 1;
2666 item.iSubItem = 0;
2668 expect(TRUE, r);
2669
2671 expect(-1, r);
2672
2673 /* need to reset focused item first */
2674 item.stateMask = LVIS_FOCUSED;
2675 item.state = 0;
2677 expect(TRUE, r);
2678
2679 item.stateMask = LVIS_FOCUSED;
2680 item.state = LVIS_FOCUSED;
2681 item.mask = LVIF_STATE;
2682 item.iItem = 2;
2683 item.iSubItem = 0;
2685 expect(TRUE, r);
2686
2688 expect(2, r);
2689
2690 item.stateMask = LVIS_FOCUSED;
2691 item.state = 0;
2693 expect(TRUE, r);
2694
2696 expect(2, r);
2697
2699}
GLuint64EXT * result
Definition: glext.h:11304
static const struct message changing_all_parent_seq[]
Definition: listview.c:270
static const struct message change_all_parent_seq[]
Definition: listview.c:252
static TCHAR * items[]
Definition: page1.c:45
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define LVM_SETSELECTIONMARK
Definition: commctrl.h:2790
#define LVM_GETSELECTEDCOUNT
Definition: commctrl.h:2708
const char * descr
Definition: boot.c:45
static WCHAR ** task_list
Definition: taskkill.c:35
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
#define VK_UP
Definition: winuser.h:2225
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_DOWN
Definition: winuser.h:2227
#define VK_SHIFT
Definition: winuser.h:2202
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_norecompute()

static void test_norecompute ( void  )
static

Definition at line 3493 of file listview.c.

3494{
3495 static CHAR testA[] = "test";
3496 CHAR buff[10];
3497 LVITEMA item;
3498 HWND hwnd;
3499 DWORD res;
3500
3501 /* self containing control */
3503 ok(hwnd != NULL, "failed to create a listview window\n");
3504 memset(&item, 0, sizeof(item));
3505 item.mask = LVIF_TEXT | LVIF_STATE;
3506 item.iItem = 0;
3507 item.stateMask = LVIS_SELECTED;
3508 item.state = LVIS_SELECTED;
3509 item.pszText = testA;
3511 expect(0, res);
3512 /* retrieve with LVIF_NORECOMPUTE */
3514 item.iItem = 0;
3515 item.pszText = buff;
3516 item.cchTextMax = ARRAY_SIZE(buff);
3518 expect(TRUE, res);
3519 ok(lstrcmpA(buff, testA) == 0, "Expected (%s), got (%s)\n", testA, buff);
3520
3521 item.mask = LVIF_TEXT;
3522 item.iItem = 1;
3523 item.pszText = LPSTR_TEXTCALLBACKA;
3525 expect(1, res);
3526
3528 item.iItem = 1;
3529 item.pszText = buff;
3530 item.cchTextMax = ARRAY_SIZE(buff);
3531
3534 expect(TRUE, res);
3535 ok(item.pszText == LPSTR_TEXTCALLBACKA, "Expected (%p), got (%p)\n",
3536 LPSTR_TEXTCALLBACKA, (VOID*)item.pszText);
3537 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq", FALSE);
3538
3540
3541 /* LVS_OWNERDATA */
3543 ok(hwnd != NULL, "failed to create a listview window\n");
3544
3545 item.mask = LVIF_STATE;
3546 item.stateMask = LVIS_SELECTED;
3547 item.state = LVIS_SELECTED;
3548 item.iItem = 0;
3550 expect(0, res);
3551
3553 item.iItem = 0;
3554 item.pszText = buff;
3555 item.cchTextMax = ARRAY_SIZE(buff);
3558 expect(TRUE, res);
3559 ok(item.pszText == LPSTR_TEXTCALLBACKA, "Expected (%p), got (%p)\n",
3560 LPSTR_TEXTCALLBACKA, (VOID*)item.pszText);
3561 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq 2", FALSE);
3562
3564}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18

Referenced by START_TEST().

◆ test_nosortheader()

static void test_nosortheader ( void  )
static

Definition at line 3566 of file listview.c.

3567{
3568 HWND hwnd, header;
3570
3572 ok(hwnd != NULL, "failed to create a listview window\n");
3573
3575 ok(IsWindow(header), "header expected\n");
3576
3578 ok(style & HDS_BUTTONS, "expected header to have HDS_BUTTONS\n");
3579
3582 /* HDS_BUTTONS retained */
3584 ok(style & HDS_BUTTONS, "expected header to retain HDS_BUTTONS\n");
3585
3587
3588 /* create with LVS_NOSORTHEADER */
3590 ok(hwnd != NULL, "failed to create a listview window\n");
3591
3593 ok(IsWindow(header), "header expected\n");
3594
3596 ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
3597
3600 /* not changed here */
3602 ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
3603
3605}
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285

Referenced by START_TEST().

◆ test_notifyformat()

static void test_notifyformat ( void  )
static

Definition at line 4433 of file listview.c.

4434{
4435 HWND hwnd, header;
4436 DWORD r;
4437
4439 ok(hwnd != NULL, "failed to create a listview window\n");
4440
4441 /* CCM_GETUNICODEFORMAT == LVM_GETUNICODEFORMAT,
4442 CCM_SETUNICODEFORMAT == LVM_SETUNICODEFORMAT */
4444 expect(0, r);
4445 SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_QUERY);
4446 /* set */
4448 expect(0, r);
4450 ok(r == 1, "Unexpected return value %d.\n", r);
4452 expect(1, r);
4454 expect(0, r);
4455
4457
4458 /* test failure in parent WM_NOTIFYFORMAT */
4459 notifyFormat = 0;
4461 ok(hwnd != NULL, "failed to create a listview window\n");
4463 ok(IsWindow(header), "expected header to be created\n");
4465 expect(0, r);
4467 ok( r == 1, "Expected 1, got %d\n", r );
4468 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_QUERY);
4469 ok(r != 0, "Expected valid format\n");
4470
4472 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_REQUERY);
4475 expect(1, r);
4477 ok( r == 1, "Expected 1, got %d\n", r );
4478
4480 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_REQUERY);
4481 expect(NFR_ANSI, r);
4483 expect(0, r);
4485 ok( r == 1, "Expected 1, got %d\n", r );
4486
4488
4490 ok(IsWindow(hwndparentW), "Unicode parent creation failed\n");
4491 if (!IsWindow(hwndparentW)) return;
4492
4493 notifyFormat = -1;
4495 ok(hwnd != NULL, "failed to create a listview window\n");
4497 ok(IsWindow(header), "expected header to be created\n");
4499 expect(1, r);
4501 expect(1, r);
4503 /* receiving error code defaulting to ansi */
4504 notifyFormat = 0;
4506 ok(hwnd != NULL, "failed to create a listview window\n");
4508 ok(IsWindow(header), "expected header to be created\n");
4510 expect(0, r);
4512 expect(1, r);
4514 /* receiving ansi code from unicode window, use it */
4517 ok(hwnd != NULL, "failed to create a listview window\n");
4519 ok(IsWindow(header), "expected header to be created\n");
4521 expect(0, r);
4523 expect(1, r);
4525 /* unicode listview with ansi parent window */
4526 notifyFormat = -1;
4528 ok(hwnd != NULL, "failed to create a listview window\n");
4530 ok(IsWindow(header), "expected header to be created\n");
4532 expect(0, r);
4534 expect(1, r);
4536 /* unicode listview with ansi parent window, return error code */
4537 notifyFormat = 0;
4539 ok(hwnd != NULL, "failed to create a listview window\n");
4541 ok(IsWindow(header), "expected header to be created\n");
4543 expect(0, r);
4545 expect(1, r);
4547
4549}
static HWND create_listview_controlW(DWORD style, HWND parent)
Definition: listview.c:713
static HWND hwndparentW
Definition: listview.c:56
#define HDM_GETUNICODEFORMAT
Definition: commctrl.h:824
#define LVM_SETUNICODEFORMAT
Definition: commctrl.h:2287
#define LVM_GETUNICODEFORMAT
Definition: commctrl.h:2289
#define NFR_UNICODE
Definition: winuser.h:2459

Referenced by START_TEST().

◆ test_oneclickactivate()

static void test_oneclickactivate ( void  )
static

Definition at line 6008 of file listview.c.

6009{
6010 TRACKMOUSEEVENT track;
6011 char item1[] = "item1";
6012 LVITEMA item;
6013 HWND hwnd, fg;
6014 RECT rect;
6015 INT r;
6016 POINT orig_pos;
6017
6019 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
6020 ok(hwnd != NULL, "failed to create listview window\n");
6022 ok(r == 0, "should return zero\n");
6023
6025 flush_events();
6026 fg = GetForegroundWindow();
6027 if (fg != hwndparent)
6028 {
6029 skip("Window is not in the foreground. Skipping oneclickactivate tests.\n");
6031 return;
6032 }
6033
6034 item.mask = LVIF_TEXT;
6035 item.iItem = 0;
6036 item.iSubItem = 0;
6037 item.iImage = 0;
6038 item.pszText = item1;
6040 ok(r == 0, "should not fail\n");
6041
6043 GetCursorPos(&orig_pos);
6044 SetCursorPos(rect.left+5, rect.top+5);
6045 flush_events();
6046 r = SendMessageA(hwnd, WM_MOUSEMOVE, MAKELONG(1, 1), 0);
6047 expect(0, r);
6048
6049 track.cbSize = sizeof(track);
6050 track.dwFlags = TME_QUERY;
6051 p_TrackMouseEvent(&track);
6052 ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
6053 ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
6054
6056 expect(0, r);
6058 expect(0, r);
6060 expect(1, r);
6061
6063 SetCursorPos(orig_pos.x, orig_pos.y);
6064}
static void flush_events(void)
Definition: listview.c:5993
#define TME_LEAVE
Definition: commctrl.h:4981
#define TME_QUERY
Definition: commctrl.h:4983
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2670
#define WM_MOUSEMOVE
Definition: winuser.h:1775
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2662

Referenced by START_TEST().

◆ test_ownerdata()

static void test_ownerdata ( void  )
static

Definition at line 3075 of file listview.c.

3076{
3077 static char test_str[] = "test";
3078
3079 HWND hwnd;
3081 DWORD res;
3082 LVITEMA item;
3083
3084 /* it isn't possible to set LVS_OWNERDATA after creation */
3085 if (g_is_below_5)
3086 {
3087 win_skip("set LVS_OWNERDATA after creation leads to crash on < 5.80\n");
3088 }
3089 else
3090 {
3092 ok(hwnd != NULL, "failed to create a listview window\n");
3094 ok(!(style & LVS_OWNERDATA) && style, "LVS_OWNERDATA isn't expected\n");
3095
3097
3099 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3101 "try to switch to LVS_OWNERDATA seq", FALSE);
3102
3104 ok(!(style & LVS_OWNERDATA), "LVS_OWNERDATA isn't expected\n");
3106 }
3107
3108 /* try to set LVS_OWNERDATA after creation just having it */
3110 ok(hwnd != NULL, "failed to create a listview window\n");
3112 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3113
3115
3117 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3119 "try to switch to LVS_OWNERDATA seq", FALSE);
3121
3122 /* try to remove LVS_OWNERDATA after creation just having it */
3123 if (g_is_below_5)
3124 {
3125 win_skip("remove LVS_OWNERDATA after creation leads to crash on < 5.80\n");
3126 }
3127 else
3128 {
3130 ok(hwnd != NULL, "failed to create a listview window\n");
3132 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3133
3135
3137 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3139 "try to switch to LVS_OWNERDATA seq", FALSE);
3141 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3143 }
3144
3145 /* try select an item */
3147 ok(hwnd != NULL, "failed to create a listview window\n");
3149 expect(1, res);
3151 expect(0, res);
3152 memset(&item, 0, sizeof(item));
3153 item.stateMask = LVIS_SELECTED;
3154 item.state = LVIS_SELECTED;
3156 expect(TRUE, res);
3158 expect(1, res);
3160 expect(1, res);
3162
3163 /* LVM_SETITEM and LVM_SETITEMTEXT is unsupported on LVS_OWNERDATA */
3165 ok(hwnd != NULL, "failed to create a listview window\n");
3167 expect(1, res);
3169 expect(1, res);
3170 memset(&item, 0, sizeof(item));
3171 item.mask = LVIF_STATE;
3172 item.iItem = 0;
3173 item.stateMask = LVIS_SELECTED;
3174 item.state = LVIS_SELECTED;
3176 expect(FALSE, res);
3177 memset(&item, 0, sizeof(item));
3178 item.pszText = test_str;
3180 expect(FALSE, res);
3182
3183 /* check notifications after focused/selected changed */
3185 ok(hwnd != NULL, "failed to create a listview window\n");
3187 expect(1, res);
3188
3190
3191 memset(&item, 0, sizeof(item));
3192 item.stateMask = LVIS_SELECTED;
3193 item.state = LVIS_SELECTED;
3195 expect(TRUE, res);
3196
3198 "ownerdata select notification", TRUE);
3199
3201
3202 memset(&item, 0, sizeof(item));
3203 item.stateMask = LVIS_FOCUSED;
3204 item.state = LVIS_FOCUSED;
3206 expect(TRUE, res);
3207
3209 "ownerdata focus notification", TRUE);
3210
3211 /* select all, check notifications */
3212 item.stateMask = LVIS_SELECTED;
3213 item.state = 0;
3215 expect(TRUE, res);
3216
3218
3219 item.stateMask = LVIS_SELECTED;
3220 item.state = LVIS_SELECTED;
3221
3222 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3224 expect(TRUE, res);
3225 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3226 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3227 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
3228 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3229 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3230 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3231 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3232
3234 "ownerdata select all notification", FALSE);
3235
3236 /* select all again, note that all items are selected already */
3238 item.stateMask = LVIS_SELECTED;
3239 item.state = LVIS_SELECTED;
3240
3241 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3243 expect(TRUE, res);
3244 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3245 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3246 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
3247 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3248 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3249 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3250 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3251
3253 "ownerdata select all notification", FALSE);
3254
3255 /* deselect all */
3257 item.stateMask = LVIS_SELECTED;
3258 item.state = 0;
3259
3260 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3262 expect(TRUE, res);
3263 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3264 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3265 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3266 ok(g_nmlistview.uOldState == LVIS_SELECTED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3267 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3268 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3269 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3270
3272 "ownerdata deselect all notification", TRUE);
3273
3274 /* nothing selected, deselect all again */
3276 item.stateMask = LVIS_SELECTED;
3277 item.state = 0;
3278
3280 expect(TRUE, res);
3281
3282 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", FALSE);
3283
3284 /* select one, then deselect all */
3285 item.stateMask = LVIS_SELECTED;
3286 item.state = LVIS_SELECTED;
3288 expect(TRUE, res);
3290 item.stateMask = LVIS_SELECTED;
3291 item.state = 0;
3292
3293 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3295 expect(TRUE, res);
3296 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3297 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3298 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3299 ok(g_nmlistview.uOldState == LVIS_SELECTED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3300 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3301 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3302 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3303
3305 "ownerdata select all notification", TRUE);
3306
3307 /* remove focused, try to focus all */
3308 item.stateMask = LVIS_FOCUSED;
3309 item.state = LVIS_FOCUSED;
3311 expect(TRUE, res);
3312 item.stateMask = LVIS_FOCUSED;
3313 item.state = 0;
3315 expect(TRUE, res);
3316 item.stateMask = LVIS_FOCUSED;
3318 expect(0, res);
3319
3320 /* setting all to focused returns failure value */
3322 item.stateMask = LVIS_FOCUSED;
3323 item.state = LVIS_FOCUSED;
3324
3326 expect(FALSE, res);
3327
3329 "ownerdata focus all notification", FALSE);
3330
3331 /* focus single item, remove all */
3332 item.stateMask = LVIS_FOCUSED;
3333 item.state = LVIS_FOCUSED;
3335 expect(TRUE, res);
3337 item.stateMask = LVIS_FOCUSED;
3338 item.state = 0;
3339
3340 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3342 expect(TRUE, res);
3343 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3344 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3345 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3346 ok(g_nmlistview.uOldState == LVIS_FOCUSED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3347 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3348 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3349 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3350
3352 "ownerdata remove focus all notification", TRUE);
3353
3354 /* set all cut */
3356 item.stateMask = LVIS_CUT;
3357 item.state = LVIS_CUT;
3358
3359 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3361 expect(TRUE, res);
3362 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3363 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3364 ok(g_nmlistview.uNewState == LVIS_CUT, "got new state 0x%08x\n", g_nmlistview.uNewState);
3365 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3366 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3367 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3368 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3369
3371 "ownerdata cut all notification", FALSE);
3372
3373 /* all marked cut, try again */
3375 item.stateMask = LVIS_CUT;
3376 item.state = LVIS_CUT;
3377
3378 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3380 expect(TRUE, res);
3381 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3382 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3383 ok(g_nmlistview.uNewState == LVIS_CUT, "got new state 0x%08x\n", g_nmlistview.uNewState);
3384 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3385 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3386 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3387 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3388
3390 "ownerdata cut all notification #2", FALSE);
3391
3393
3394 /* check notifications on LVM_GETITEM */
3395 /* zero callback mask */
3397 ok(hwnd != NULL, "failed to create a listview window\n");
3399 expect(1, res);
3400
3402
3403 memset(&item, 0, sizeof(item));
3404 item.stateMask = LVIS_SELECTED;
3405 item.mask = LVIF_STATE;
3407 expect(TRUE, res);
3408
3410 "ownerdata getitem selected state 1", FALSE);
3411
3412 /* non zero callback mask but not we asking for */
3414 expect(TRUE, res);
3415
3417
3418 memset(&item, 0, sizeof(item));
3419 item.stateMask = LVIS_SELECTED;
3420 item.mask = LVIF_STATE;
3422 expect(TRUE, res);
3423
3425 "ownerdata getitem selected state 2", FALSE);
3426
3427 /* LVIS_OVERLAYMASK callback mask, asking for index */
3429
3430 memset(&item, 0, sizeof(item));
3431 item.stateMask = LVIS_OVERLAYMASK;
3432 item.mask = LVIF_STATE;
3434 expect(TRUE, res);
3435
3437 "ownerdata getitem selected state 2", FALSE);
3438
3440
3441 /* LVS_SORTASCENDING/LVS_SORTDESCENDING aren't compatible with LVS_OWNERDATA */
3443 ok(hwnd != NULL, "failed to create a listview window\n");
3445 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3446 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
3449 ok(!(style & LVS_SORTASCENDING), "Expected LVS_SORTASCENDING not set\n");
3451 /* apparently it's allowed to switch these style on after creation */
3453 ok(hwnd != NULL, "failed to create a listview window\n");
3455 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3458 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
3460
3462 ok(hwnd != NULL, "failed to create a listview window\n");
3464 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3467 ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n");
3469
3470 /* The focused item is updated after the invalidation */
3472 ok(hwnd != NULL, "failed to create a listview window\n");
3474 expect(TRUE, res);
3475
3476 memset(&item, 0, sizeof(item));
3477 item.stateMask = LVIS_FOCUSED;
3478 item.state = LVIS_FOCUSED;
3480 expect(TRUE, res);
3481
3484 expect(TRUE, res);
3486 "ownerdata setitemcount", FALSE);
3487
3489 expect(-1, res);
3491}
static const struct message listview_ownerdata_switchto_seq[]
Definition: listview.c:189
static const struct message ownerdata_select_focus_parent_seq[]
Definition: listview.c:226
static const struct message ownerdata_deselect_all_parent_seq[]
Definition: listview.c:246
static const struct message ownerdata_setstate_all_parent_seq[]
Definition: listview.c:233
static const struct message ownerdata_defocus_all_parent_seq[]
Definition: listview.c:238
#define LVIS_OVERLAYMASK
Definition: commctrl.h:2325
#define LVS_SORTASCENDING
Definition: commctrl.h:2268
#define LVS_SORTDESCENDING
Definition: commctrl.h:2269
POINT ptAction
Definition: commctrl.h:3039

Referenced by START_TEST().

◆ test_redraw()

static void test_redraw ( void  )
static

Definition at line 1793 of file listview.c.

1794{
1795 HWND hwnd;
1796 HDC hdc;
1797 BOOL res;
1798 DWORD r;
1799 RECT rect;
1800
1803
1805
1809
1811
1812 /* forward WM_ERASEBKGND to parent on CLR_NONE background color */
1813 /* 1. Without backbuffer */
1815 expect(TRUE, res);
1816
1818
1821 ok(r == 1, "Expected not zero result\n");
1823 "forward WM_ERASEBKGND on CLR_NONE", FALSE);
1824
1826 expect(TRUE, res);
1827
1830 expect(1, r);
1832 "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
1833
1834 /* 2. With backbuffer */
1838 expect(TRUE, res);
1839
1842 expect(1, r);
1844 "forward WM_ERASEBKGND on CLR_NONE", FALSE);
1845
1847 expect(TRUE, res);
1848
1851 todo_wine expect(1, r);
1853 "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
1854
1856
1857 /* test setting the window style to what it already was */
1861 ok(rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
1862 "Expected empty update rect, got %s\n", wine_dbgstr_rect(&rect));
1863
1865}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
static const struct message redraw_listview_seq[]
Definition: listview.c:105
static const struct message forward_erasebkgnd_parent_seq[]
Definition: listview.c:221
#define LVS_EX_DOUBLEBUFFER
Definition: commctrl.h:2745

Referenced by START_TEST().

◆ test_scrollnotify()

static void test_scrollnotify ( void  )
static

Definition at line 4949 of file listview.c.

4950{
4951 HWND hwnd;
4952 DWORD ret;
4953
4955
4956 insert_column(hwnd, 0);
4957 insert_column(hwnd, 1);
4958 insert_item(hwnd, 0);
4959
4960 /* make it scrollable - resize */
4962 expect(TRUE, ret);
4964 expect(TRUE, ret);
4965
4966 /* try with dummy call */
4968 ret = SendMessageA(hwnd, LVM_SCROLL, 0, 0);
4969 expect(TRUE, ret);
4971 "scroll notify 1", TRUE);
4972
4974 ret = SendMessageA(hwnd, LVM_SCROLL, 1, 0);
4975 expect(TRUE, ret);
4977 "scroll notify 2", TRUE);
4978
4980 ret = SendMessageA(hwnd, LVM_SCROLL, 1, 1);
4981 expect(TRUE, ret);
4983 "scroll notify 3", TRUE);
4984
4986}
static const struct message scroll_parent_seq[]
Definition: listview.c:330
#define LVM_SCROLL
Definition: commctrl.h:2521

Referenced by START_TEST().

◆ test_setredraw()

static void test_setredraw ( void  )
static

Definition at line 3607 of file listview.c.

3608{
3609 HWND hwnd;
3611 DWORD ret;
3612 HDC hdc;
3613 RECT rect;
3614
3616 ok(hwnd != NULL, "failed to create a listview window\n");
3617
3618 /* Passing WM_SETREDRAW to DefWinProc removes WS_VISIBLE.
3619 ListView seems to handle it internally without DefWinProc */
3620
3621 /* default value first */
3623 expect(0, ret);
3624 /* disable */
3626 ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
3628 expect(0, ret);
3630 ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
3632 expect(0, ret);
3633
3634 /* check update rect after redrawing */
3636 expect(0, ret);
3639 rect.right = rect.bottom = 1;
3641 expect(0, rect.right);
3642 expect(0, rect.bottom);
3643
3644 /* WM_ERASEBKGND */
3647 expect(TRUE, ret);
3649 expect(0, ret);
3651 expect(TRUE, ret);
3653 expect(0, ret);
3655
3656 /* check notification messages to show that repainting is disabled */
3658 expect(TRUE, ret);
3660 expect(0, ret);
3662
3666 "redraw after WM_SETREDRAW (FALSE)", FALSE);
3667
3669 expect(TRUE, ret);
3674 "redraw after WM_SETREDRAW (FALSE) with CLR_NONE bkgnd", FALSE);
3675
3676 /* message isn't forwarded to header */
3680 expect(0, ret);
3682 "WM_SETREDRAW: not forwarded to header", FALSE);
3683
3685}
static const struct message setredraw_seq[]
Definition: listview.c:336
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define RDW_UPDATENOW
Definition: winuser.h:1220
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by START_TEST().

◆ test_sorting()

static void test_sorting ( void  )
static

Definition at line 2897 of file listview.c.

2898{
2899 HWND hwnd;
2900 LVITEMA item = {0};
2901 INT r;
2903 static CHAR names[][5] = {"A", "B", "C", "D", "0"};
2904 CHAR buff[10];
2905
2907 ok(hwnd != NULL, "failed to create a listview window\n");
2908
2909 /* insert some items */
2910 item.mask = LVIF_PARAM | LVIF_STATE;
2911 item.state = LVIS_SELECTED;
2912 item.iItem = 0;
2913 item.iSubItem = 0;
2914 item.lParam = 3;
2916 expect(0, r);
2917
2918 item.mask = LVIF_PARAM;
2919 item.iItem = 1;
2920 item.iSubItem = 0;
2921 item.lParam = 2;
2923 expect(1, r);
2924
2925 item.mask = LVIF_STATE | LVIF_PARAM;
2926 item.state = LVIS_SELECTED;
2927 item.iItem = 2;
2928 item.iSubItem = 0;
2929 item.lParam = 4;
2931 expect(2, r);
2932
2934 expect(-1, r);
2935
2937 expect(2, r);
2938
2940 expect(TRUE, r);
2941
2943 expect(2, r);
2945 expect(-1, r);
2947 expect(0, r);
2952
2954
2955 /* switch to LVS_SORTASCENDING when some items added */
2957 ok(hwnd != NULL, "failed to create a listview window\n");
2958
2959 item.mask = LVIF_TEXT;
2960 item.iItem = 0;
2961 item.iSubItem = 0;
2962 item.pszText = names[1];
2964 expect(0, r);
2965
2966 item.mask = LVIF_TEXT;
2967 item.iItem = 1;
2968 item.iSubItem = 0;
2969 item.pszText = names[2];
2971 expect(1, r);
2972
2973 item.mask = LVIF_TEXT;
2974 item.iItem = 2;
2975 item.iSubItem = 0;
2976 item.pszText = names[0];
2978 expect(2, r);
2979
2983 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
2984
2985 /* no sorting performed when switched to LVS_SORTASCENDING */
2986 item.mask = LVIF_TEXT;
2987 item.iItem = 0;
2988 item.pszText = buff;
2989 item.cchTextMax = sizeof(buff);
2991 expect(TRUE, r);
2992 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
2993
2994 item.iItem = 1;
2996 expect(TRUE, r);
2997 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
2998
2999 item.iItem = 2;
3001 expect(TRUE, r);
3002 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3003
3004 /* adding new item doesn't resort list */
3005 item.mask = LVIF_TEXT;
3006 item.iItem = 3;
3007 item.iSubItem = 0;
3008 item.pszText = names[3];
3010 expect(3, r);
3011
3012 item.mask = LVIF_TEXT;
3013 item.iItem = 0;
3014 item.pszText = buff;
3015 item.cchTextMax = sizeof(buff);
3017 expect(TRUE, r);
3018 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
3019
3020 item.iItem = 1;
3022 expect(TRUE, r);
3023 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
3024
3025 item.iItem = 2;
3027 expect(TRUE, r);
3028 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3029
3030 item.iItem = 3;
3032 expect(TRUE, r);
3033 ok(lstrcmpA(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
3034
3035 /* corner case - item should be placed at first position */
3036 item.mask = LVIF_TEXT;
3037 item.iItem = 4;
3038 item.iSubItem = 0;
3039 item.pszText = names[4];
3041 expect(0, r);
3042
3043 item.iItem = 0;
3044 item.pszText = buff;
3045 item.cchTextMax = sizeof(buff);
3047 expect(TRUE, r);
3048 ok(lstrcmpA(buff, names[4]) == 0, "Expected '%s', got '%s'\n", names[4], buff);
3049
3050 item.iItem = 1;
3051 item.pszText = buff;
3052 item.cchTextMax = sizeof(buff);
3054 expect(TRUE, r);
3055 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
3056
3057 item.iItem = 2;
3059 expect(TRUE, r);
3060 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
3061
3062 item.iItem = 3;
3064 expect(TRUE, r);
3065 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3066
3067 item.iItem = 4;
3069 expect(TRUE, r);
3070 ok(lstrcmpA(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
3071
3073}
GLuint GLuint * names
Definition: glext.h:11545
static INT WINAPI test_CallBackCompare(LPARAM first, LPARAM second, LPARAM lParam)
Definition: listview.c:2891
#define LVM_SORTITEMS
Definition: commctrl.h:2702

Referenced by START_TEST().

◆ test_state_image()

static void test_state_image ( void  )
static

Definition at line 6201 of file listview.c.

6202{
6203 static const DWORD styles[] =
6204 {
6205 LVS_ICON,
6206 LVS_REPORT,
6208 LVS_LIST,
6209 };
6210 int i;
6211
6212 for (i = 0; i < ARRAY_SIZE(styles); i++)
6213 {
6214 static char text[] = "Item";
6215 static char subtext[] = "Subitem";
6216 char buff[16];
6217 LVITEMA item;
6218 HWND hwnd;
6219 int r;
6220
6221 hwnd = create_listview_control(styles[i]);
6222
6223 insert_column(hwnd, 0);
6224 insert_column(hwnd, 1);
6225
6226 item.mask = LVIF_TEXT | LVIF_PARAM;
6227 item.iItem = 0;
6228 item.iSubItem = 0;
6229 item.pszText = text;
6230 item.lParam = 123456;
6232 ok(r == 0, "Failed to insert an item.\n");
6233
6234 item.mask = LVIF_STATE;
6237 item.iItem = 0;
6238 item.iSubItem = 0;
6240 ok(r, "Failed to set item state.\n");
6241
6242 item.mask = LVIF_TEXT;
6243 item.iItem = 0;
6244 item.iSubItem = 1;
6245 item.pszText = subtext;
6247 ok(r, "Failed to set subitem text.\n");
6248
6249 item.mask = LVIF_STATE | LVIF_PARAM;
6250 item.stateMask = ~0u;
6251 item.state = 0;
6252 item.iItem = 0;
6253 item.iSubItem = 0;
6254 item.lParam = 0;
6256 ok(r, "Failed to get item state.\n");
6258 "Unexpected item state %#x.\n", item.state);
6259 ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
6260
6261 item.mask = 0;
6262 item.stateMask = ~0u;
6263 item.state = INDEXTOSTATEIMAGEMASK(2);
6264 item.iItem = 0;
6265 item.iSubItem = 1;
6267 ok(r, "Failed to get subitem state.\n");
6268 ok(item.state == INDEXTOSTATEIMAGEMASK(2), "Unexpected state %#x.\n", item.state);
6269
6270 item.mask = LVIF_STATE | LVIF_PARAM;
6271 item.stateMask = ~0u;
6272 item.state = INDEXTOSTATEIMAGEMASK(2);
6273 item.iItem = 0;
6274 item.iSubItem = 1;
6275 item.lParam = 0;
6277 ok(r, "Failed to get subitem state.\n");
6278 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6279 ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
6280
6281 item.mask = LVIF_STATE;
6282 item.stateMask = LVIS_FOCUSED;
6283 item.state = 0;
6284 item.iItem = 0;
6285 item.iSubItem = 1;
6287 ok(r, "Failed to get subitem state.\n");
6288 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6289
6290 item.mask = LVIF_STATE;
6291 item.stateMask = ~0u;
6292 item.state = INDEXTOSTATEIMAGEMASK(2);
6293 item.iItem = 0;
6294 item.iSubItem = 2;
6296 ok(r, "Failed to get subitem state.\n");
6297 todo_wine
6298 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6299
6300 item.mask = LVIF_TEXT;
6301 item.iItem = 0;
6302 item.iSubItem = 1;
6303 item.pszText = buff;
6304 item.cchTextMax = sizeof(buff);
6306 ok(r, "Failed to get subitem text %d.\n", r);
6307 ok(!strcmp(buff, subtext), "Unexpected subitem text %s.\n", buff);
6308
6310 }
6311}

Referenced by START_TEST().

◆ test_subitem_rect()

static void test_subitem_rect ( void  )
static

Definition at line 2701 of file listview.c.

2702{
2703 HWND hwnd;
2704 DWORD r;
2705 LVCOLUMNA col;
2706 RECT rect, rect2;
2707 INT arr[3];
2708
2709 /* test LVM_GETSUBITEMRECT for header */
2711 ok(hwnd != NULL, "failed to create a listview window\n");
2712 /* add some columns */
2713 memset(&col, 0, sizeof(LVCOLUMNA));
2714 col.mask = LVCF_WIDTH;
2715 col.cx = 100;
2717 expect(0, r);
2718 col.cx = 150;
2720 expect(1, r);
2721 col.cx = 200;
2723 expect(2, r);
2724 /* item = -1 means header, subitem index is 1 based */
2725 SetRect(&rect, LVIR_BOUNDS, 0, 0, 0);
2727 expect(0, r);
2728
2729 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2731 expect(1, r);
2732
2733 expect(100, rect.left);
2734 expect(250, rect.right);
2735 expect(3, rect.top);
2736
2737 SetRect(&rect, LVIR_BOUNDS, 2, 0, 0);
2739 expect(1, r);
2740
2741 expect(250, rect.left);
2742 expect(450, rect.right);
2743 expect(3, rect.top);
2744
2745 /* item LVS_REPORT padding isn't applied to subitems */
2746 insert_item(hwnd, 0);
2747
2748 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2750 expect(1, r);
2751 expect(100, rect.left);
2752 expect(250, rect.right);
2753
2754 SetRect(&rect, LVIR_ICON, 1, 0, 0);
2756 expect(1, r);
2757 /* no icon attached - zero width rectangle, with no left padding */
2758 expect(100, rect.left);
2759 expect(100, rect.right);
2760
2761 SetRect(&rect, LVIR_LABEL, 1, 0, 0);
2763 expect(1, r);
2764 /* same as full LVIR_BOUNDS */
2765 expect(100, rect.left);
2766 expect(250, rect.right);
2767
2768 r = SendMessageA(hwnd, LVM_SCROLL, 10, 0);
2769 ok(r, "got %d\n", r);
2770
2771 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2773 expect(1, r);
2774 expect(90, rect.left);
2775 expect(240, rect.right);
2776
2777 SendMessageA(hwnd, LVM_SCROLL, -10, 0);
2778
2779 /* test header interaction */
2782
2783 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2785 expect(1, r);
2786
2787 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2789 expect(1, r);
2790
2791 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2793 expect(1, r);
2794
2795 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2797 expect(1, r);
2798
2799 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getsubitemrect_seq, "LVM_GETSUBITEMRECT negative index", FALSE);
2800
2802
2803 /* test subitem rects after re-arranging columns */
2805 ok(hwnd != NULL, "failed to create a listview window\n");
2806 memset(&col, 0, sizeof(LVCOLUMNA));
2807 col.mask = LVCF_WIDTH;
2808
2809 col.cx = 100;
2811 expect(0, r);
2812
2813 col.cx = 200;
2815 expect(1, r);
2816
2817 col.cx = 300;
2819 expect(2, r);
2820
2821 insert_item(hwnd, 0);
2822 insert_item(hwnd, 1);
2823
2824 /* wrong item is refused for main item */
2825 SetRect(&rect, LVIR_BOUNDS, 0, -1, -1);
2827 expect(FALSE, r);
2828
2829 /* for subitems rectangle is calculated even if there's no item added */
2830 SetRect(&rect, LVIR_BOUNDS, 1, -1, -1);
2832 expect(TRUE, r);
2833
2834 SetRect(&rect2, LVIR_BOUNDS, 1, -1, -1);
2836 expect(TRUE, r);
2837 expect(rect.right, rect2.right);
2838 expect(rect.left, rect2.left);
2839 expect(rect.bottom, rect2.top);
2840 ok(rect2.bottom > rect2.top, "expected not zero height\n");
2841
2842 arr[0] = 1; arr[1] = 0; arr[2] = 2;
2844 expect(TRUE, r);
2845
2846 SetRect(&rect, LVIR_BOUNDS, 0, -1, -1);
2848 expect(TRUE, r);
2849 expect(0, rect.left);
2850 expect(600, rect.right);
2851
2852 SetRect(&rect, LVIR_BOUNDS, 1, -1, -1);
2854 expect(TRUE, r);
2855 expect(0, rect.left);
2856 expect(200, rect.right);
2857
2858 SetRect(&rect2, LVIR_BOUNDS, 1, -1, -1);
2860 expect(TRUE, r);
2861 expect(0, rect2.left);
2862 expect(200, rect2.right);
2863 /* items are of the same height */
2864 ok(rect2.top > 0, "expected positive item height\n");
2865 expect(rect.bottom, rect2.top);
2866 expect(rect.bottom * 2 - rect.top, rect2.bottom);
2867
2868 SetRect(&rect, LVIR_BOUNDS, 2, -1, -1);
2870 expect(TRUE, r);
2871 expect(300, rect.left);
2872 expect(600, rect.right);
2873
2875
2876 /* try it for non LVS_REPORT style */
2877 hwnd = CreateWindowA(WC_LISTVIEWA, "Test", LVS_ICON, 0, 0, 100, 100, NULL, NULL,
2879 SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
2881 expect(0, r);
2882 /* rect is unchanged */
2883 expect(0, rect.left);
2884 expect(-10, rect.right);
2885 expect(1, rect.top);
2886 expect(-10, rect.bottom);
2888}
RECT rect2
Definition: edittest.c:51
static const struct message getsubitemrect_seq[]
Definition: listview.c:301

Referenced by START_TEST().

Variable Documentation

◆ blockEdit

BOOL blockEdit
static

Definition at line 58 of file listview.c.

Referenced by create_parent_window(), parent_wnd_proc(), and test_editbox().

◆ change_all_parent_seq

const struct message change_all_parent_seq[]
static
Initial value:

Definition at line 252 of file listview.c.

Referenced by test_multiselect().

◆ changing_all_parent_seq

const struct message changing_all_parent_seq[]
static
Initial value:

Definition at line 270 of file listview.c.

Referenced by test_multiselect().

◆ create_ownerdrawfixed_parent_seq

const struct message create_ownerdrawfixed_parent_seq[]
static
Initial value:
= {
{ WM_NOTIFYFORMAT, sent },
{ WM_QUERYUISTATE, sent|optional },
{ 0 }
}
#define WM_MEASUREITEM
Definition: winuser.h:1646
#define WM_PARENTNOTIFY
Definition: winuser.h:1803

Definition at line 97 of file listview.c.

Referenced by test_create().

◆ edit_end_nochange

const struct message edit_end_nochange[]
static
Initial value:
= {
{ 0 }
}
#define NM_SETFOCUS
Definition: commctrl.h:135

Definition at line 346 of file listview.c.

Referenced by test_editbox().

◆ editbox_create_pos

◆ empty_seq

◆ forward_erasebkgnd_parent_seq

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

Definition at line 221 of file listview.c.

Referenced by test_redraw().

◆ g_block_hover

BOOL g_block_hover
static

Definition at line 60 of file listview.c.

Referenced by parent_wnd_proc(), and test_hover().

◆ g_disp_A_to_W

BOOL g_disp_A_to_W
static

Definition at line 73 of file listview.c.

Referenced by parent_wnd_proc(), and test_dispinfo().

◆ g_editbox_disp_info

NMLVDISPINFOA g_editbox_disp_info
static

Definition at line 75 of file listview.c.

Referenced by parent_wnd_proc(), and test_editbox().

◆ g_focus_test_LVN_DELETEITEM

BOOL g_focus_test_LVN_DELETEITEM
static

Definition at line 77 of file listview.c.

Referenced by parent_wnd_proc(), and test_deleteitem().

◆ g_is_below_5

BOOL g_is_below_5
static

Definition at line 69 of file listview.c.

Referenced by START_TEST(), and test_ownerdata().

◆ g_itema

LVITEMA g_itema
static

Definition at line 71 of file listview.c.

Referenced by parent_wnd_proc(), and test_columns().

◆ g_nmlistview

NMLISTVIEW g_nmlistview
static

Definition at line 62 of file listview.c.

Referenced by parent_wnd_proc(), test_item_state_change(), and test_ownerdata().

◆ g_nmlistview_changing

NMLISTVIEW g_nmlistview_changing
static

Definition at line 64 of file listview.c.

Referenced by parent_wnd_proc(), and test_multiselect().

◆ g_WM_KILLFOCUS_on_LVN_ENDLABELEDIT

BOOL g_WM_KILLFOCUS_on_LVN_ENDLABELEDIT
static

Definition at line 79 of file listview.c.

Referenced by parent_wnd_proc(), and test_LVN_ENDLABELEDIT().

◆ getitemposition_seq1

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

Definition at line 290 of file listview.c.

Referenced by test_getitemposition().

◆ getitemposition_seq2

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

Definition at line 295 of file listview.c.

Referenced by test_getitemposition().

◆ getsubitemrect_seq

const struct message getsubitemrect_seq[]
static
Initial value:

Definition at line 301 of file listview.c.

Referenced by test_subitem_rect().

◆ HBITMAP

HBITMAP

Definition at line 33 of file listview.c.

◆ hover_parent

const struct message hover_parent[]
static
Initial value:
= {
{ WM_NOTIFY, sent|id, 0, 0, NM_HOVER },
{ 0 }
}
#define WM_GETDLGCODE
Definition: winuser.h:1689

Definition at line 353 of file listview.c.

Referenced by test_hover().

◆ hwndparent

◆ hwndparentW

HWND hwndparentW
static

Definition at line 56 of file listview.c.

Referenced by test_notifyformat().

◆ int

int

Definition at line 31 of file listview.c.

◆ listview_color_seq

const struct message listview_color_seq[]
static
Initial value:

Definition at line 123 of file listview.c.

Referenced by test_color().

◆ listview_destroy

const struct message listview_destroy[]
static
Initial value:
= {
{ 0x0090, sent|optional },
{ 0 }
}
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3134
#define WM_SHOWWINDOW
Definition: winuser.h:1628
#define WM_NCDESTROY
Definition: winuser.h:1684
#define WM_DESTROY
Definition: winuser.h:1609

Definition at line 359 of file listview.c.

Referenced by test_destroynotify().

◆ listview_end_label_edit

const struct message listview_end_label_edit[]
static
Initial value:

Definition at line 450 of file listview.c.

Referenced by test_LVN_ENDLABELEDIT().

◆ listview_end_label_edit_kill_focus

const struct message listview_end_label_edit_kill_focus[]
static
Initial value:

Definition at line 459 of file listview.c.

Referenced by test_LVN_ENDLABELEDIT().

◆ listview_getorderarray_seq

const struct message listview_getorderarray_seq[]
static
Initial value:
= {
{ 0 }
}
#define HDM_GETORDERARRAY
Definition: commctrl.h:806

Definition at line 195 of file listview.c.

Referenced by test_columns().

◆ listview_header_changed_seq

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

Definition at line 388 of file listview.c.

Referenced by test_header_notification().

◆ listview_header_set_imagelist

const struct message listview_header_set_imagelist[]
static
Initial value:
= {
{ 0 }
}
#define HDM_SETIMAGELIST
Definition: commctrl.h:794

Definition at line 415 of file listview.c.

Referenced by test_imagelists().

◆ listview_icon_spacing_seq

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

Definition at line 116 of file listview.c.

Referenced by test_icon_spacing().

◆ listview_item_count_seq

◆ listview_itempos_seq

◆ listview_ownerdata_deleteall

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

Definition at line 382 of file listview.c.

Referenced by test_destroynotify().

◆ listview_ownerdata_destroy

const struct message listview_ownerdata_destroy[]
static
Initial value:

Definition at line 371 of file listview.c.

Referenced by test_destroynotify().

◆ listview_ownerdata_switchto_seq

const struct message listview_ownerdata_switchto_seq[]
static
Initial value:
= {
{ WM_STYLECHANGING, sent },
{ WM_STYLECHANGED, sent },
{ 0 }
}

Definition at line 189 of file listview.c.

Referenced by test_ownerdata().

◆ listview_set_imagelist

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

Definition at line 410 of file listview.c.

Referenced by test_imagelists().

◆ listview_setorderarray_seq

const struct message listview_setorderarray_seq[]
static
Initial value:
= {
{ 0 }
}
#define HDM_SETORDERARRAY
Definition: commctrl.h:809

Definition at line 203 of file listview.c.

Referenced by test_columns().

◆ listviewWndProc

WNDPROC listviewWndProc
static

◆ lvs_ex_transparentbkgnd_seq

const struct message lvs_ex_transparentbkgnd_seq[]
static
Initial value:
= {
{ 0 }
}
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define PRF_ERASEBKGND
Definition: winuser.h:2526

Definition at line 341 of file listview.c.

Referenced by test_LVS_EX_TRANSPARENTBKGND().

◆ notifyFormat

INT notifyFormat
static

Definition at line 67 of file listview.c.

Referenced by create_parent_window(), parent_wnd_proc(), and test_notifyformat().

◆ ownerdata_defocus_all_parent_seq

const struct message ownerdata_defocus_all_parent_seq[]
static
Initial value:

Definition at line 238 of file listview.c.

Referenced by test_ownerdata().

◆ ownerdata_deselect_all_parent_seq

const struct message ownerdata_deselect_all_parent_seq[]
static
Initial value:
= {
{ 0 }
}
#define LVN_ODCACHEHINT
Definition: commctrl.h:3143

Definition at line 246 of file listview.c.

Referenced by test_ownerdata().

◆ ownerdata_select_focus_parent_seq

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

Definition at line 226 of file listview.c.

Referenced by test_ownerdata().

◆ ownerdata_setstate_all_parent_seq

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

Definition at line 233 of file listview.c.

Referenced by test_ownerdata().

◆ parent_focus_change_ownerdata_seq

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

Definition at line 215 of file listview.c.

Referenced by test_callback_mask().

◆ parent_header_click_seq

const struct message parent_header_click_seq[]
static
Initial value:
= {
{ 0 }
}
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139

Definition at line 395 of file listview.c.

Referenced by test_header_notification2().

◆ parent_header_divider_dclick_seq

const struct message parent_header_divider_dclick_seq[]
static
Initial value:

Definition at line 401 of file listview.c.

Referenced by test_header_notification2().

◆ parent_insert_focused_seq

const struct message parent_insert_focused_seq[]
static
Initial value:
= {
{ 0 }
}
#define LVN_INSERTITEM
Definition: commctrl.h:3132

Definition at line 421 of file listview.c.

Referenced by test_insertitem().

◆ parent_list_cd_seq

const struct message parent_list_cd_seq[]
static
Initial value:

Definition at line 442 of file listview.c.

Referenced by test_customdraw().

◆ parent_report_cd_seq

◆ redraw_listview_seq

const struct message redraw_listview_seq[]
static
Initial value:

Definition at line 105 of file listview.c.

Referenced by test_redraw().

◆ scroll_parent_seq

const struct message scroll_parent_seq[]
static
Initial value:
= {
{ 0 }
}
#define LVN_ENDSCROLL
Definition: commctrl.h:3236
#define LVN_BEGINSCROLL
Definition: commctrl.h:3235

Definition at line 330 of file listview.c.

Referenced by test_scrollnotify().

◆ sequences

◆ setredraw_seq

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

Definition at line 336 of file listview.c.

Referenced by test_setredraw().

◆ single_getdispinfo_parent_seq

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

Definition at line 285 of file listview.c.

Referenced by test_columns(), test_indentation(), and test_ownerdata().

◆ test_create_imagelist

HIMAGELIST test_create_imagelist
static

Definition at line 1553 of file listview.c.

Referenced by create_test_wndproc(), and test_create().

◆ testparentclassW

const WCHAR testparentclassW[]
static
Initial value:
=
{'L','i','s','t','v','i','e','w',' ','t','e','s','t',' ','p','a','r','e','n','t','W', 0}

Definition at line 53 of file listview.c.

Referenced by create_parent_window(), and register_parent_wnd_class().

◆ textcallback_set_again_parent_seq

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

Definition at line 279 of file listview.c.

Referenced by test_items().

◆ UINT

Definition at line 31 of file listview.c.