ReactOS 0.4.15-dev-8119-g4fb2fdb
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:2121
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:163
#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