ReactOS 0.4.16-dev-188-g678aa63
listview.c
Go to the documentation of this file.
1/*
2 * ListView tests
3 *
4 * Copyright 2006 Mike McCormack for CodeWeavers
5 * Copyright 2007 George Gov
6 * Copyright 2009-2014 Nikolay Sivov
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include <stdio.h>
24#include <windows.h>
25#include <commctrl.h>
26
27#include "wine/test.h"
28#include "v6util.h"
29#include "msg.h"
30
31static HIMAGELIST (WINAPI *pImageList_Create)(int, int, UINT, int, int);
32static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST);
33static int (WINAPI *pImageList_Add)(HIMAGELIST, HBITMAP, HBITMAP);
34static BOOL (WINAPI *p_TrackMouseEvent)(TRACKMOUSEEVENT *);
35
44};
45
46#define LISTVIEW_ID 0
47#define HEADER_ID 1
48
49#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
50#define expect2(expected1, expected2, got1, got2) ok(expected1 == got1 && expected2 == got2, \
51 "expected (%d,%d), got (%d,%d)\n", expected1, expected2, got1, got2)
52
53static const WCHAR testparentclassW[] =
54 {'L','i','s','t','v','i','e','w',' ','t','e','s','t',' ','p','a','r','e','n','t','W', 0};
55
57/* prevents edit box creation, LVN_BEGINLABELEDIT return value */
59/* return nonzero on NM_HOVER */
61/* notification data for LVN_ITEMCHANGED */
63/* notification data for LVN_ITEMCHANGING */
65/* format reported to control:
66 -1 falls to defproc, anything else returned */
68/* indicates we're running < 5.80 version */
70/* item data passed to LVN_GETDISPINFOA */
72/* alter notification code A->W */
74/* dispinfo data sent with LVN_LVN_ENDLABELEDIT */
76/* when this is set focus will be tested on LVN_DELETEITEM */
78/* Whether to send WM_KILLFOCUS to the edit control during LVN_ENDLABELEDIT */
80
81static HWND subclass_editbox(HWND hwndListview);
82
83static void init_functions(void)
84{
85 HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
86
87#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
92#undef X
93}
94
96
98 { WM_NOTIFYFORMAT, sent },
99 { WM_QUERYUISTATE, sent|optional }, /* Win2K and higher */
100 { WM_MEASUREITEM, sent },
102 { 0 }
103};
104
105static const struct message redraw_listview_seq[] = {
106 { WM_PAINT, sent|id, 0, 0, LISTVIEW_ID },
107 { WM_PAINT, sent|id, 0, 0, HEADER_ID },
108 { WM_NCPAINT, sent|id|defwinproc, 0, 0, HEADER_ID },
110 { WM_NOTIFY, sent|id|defwinproc, 0, 0, LISTVIEW_ID },
111 { WM_NCPAINT, sent|id|defwinproc, 0, 0, LISTVIEW_ID },
113 { 0 }
114};
115
116static const struct message listview_icon_spacing_seq[] = {
117 { LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(20, 30) },
118 { LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(25, 35) },
119 { LVM_SETICONSPACING, sent|lparam, 0, MAKELPARAM(-1, -1) },
120 { 0 }
121};
122
123static const struct message listview_color_seq[] = {
124 { LVM_SETBKCOLOR, sent|lparam, 0, RGB(0,0,0) },
125 { LVM_GETBKCOLOR, sent },
126 { LVM_SETTEXTCOLOR, sent|lparam, 0, RGB(0,0,0) },
128 { LVM_SETTEXTBKCOLOR, sent|lparam, 0, RGB(0,0,0) },
130
131 { LVM_SETBKCOLOR, sent|lparam, 0, RGB(100,50,200) },
132 { LVM_GETBKCOLOR, sent },
133 { LVM_SETTEXTCOLOR, sent|lparam, 0, RGB(100,50,200) },
135 { LVM_SETTEXTBKCOLOR, sent|lparam, 0, RGB(100,50,200) },
137
139 { LVM_GETBKCOLOR, sent },
144
145 { LVM_SETBKCOLOR, sent|lparam, 0, RGB(255,255,255) },
146 { LVM_GETBKCOLOR, sent },
147 { LVM_SETTEXTCOLOR, sent|lparam, 0, RGB(255,255,255) },
149 { LVM_SETTEXTBKCOLOR, sent|lparam, 0, RGB(255,255,255) },
151 { 0 }
152};
153
154static const struct message listview_item_count_seq[] = {
160 { LVM_DELETEITEM, sent|wparam, 2 },
171 { 0 }
172};
173
174static const struct message listview_itempos_seq[] = {
186 { 0 }
187};
188
190 { WM_STYLECHANGING, sent },
191 { WM_STYLECHANGED, sent },
192 { 0 }
193};
194
195static const struct message listview_getorderarray_seq[] = {
197 { HDM_GETORDERARRAY, sent|id|wparam, 2, 0, HEADER_ID },
199 { HDM_GETORDERARRAY, sent|id|wparam, 0, 0, HEADER_ID },
200 { 0 }
201};
202
203static const struct message listview_setorderarray_seq[] = {
205 { HDM_SETORDERARRAY, sent|id|wparam, 2, 0, HEADER_ID },
207 { HDM_SETORDERARRAY, sent|id|wparam, 0, 0, HEADER_ID },
208 { 0 }
209};
210
211static const struct message empty_seq[] = {
212 { 0 }
213};
214
216 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
217 { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
218 { 0 }
219};
220
221static const struct message forward_erasebkgnd_parent_seq[] = {
222 { WM_ERASEBKGND, sent },
223 { 0 }
224};
225
227 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
228 { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
229 { WM_NOTIFY, sent|id|optional, 0, 0, LVN_GETDISPINFOA }, /* version 4.7x */
230 { 0 }
231};
232
234 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
235 { 0 }
236};
237
239 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
240 { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
242 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
243 { 0 }
244};
245
247 { WM_NOTIFY, sent|id, 0, 0, LVN_ODCACHEHINT },
248 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
249 { 0 }
250};
251
252static const struct message change_all_parent_seq[] = {
253 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
254 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
255
256 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
257 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
258
259 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
260 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
261
262 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
263 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
264
265 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
266 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
267 { 0 }
268};
269
270static const struct message changing_all_parent_seq[] = {
271 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
272 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
273 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
274 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
275 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
276 { 0 }
277};
278
280 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
281 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
282 { 0 }
283};
284
285static const struct message single_getdispinfo_parent_seq[] = {
286 { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
287 { 0 }
288};
289
290static const struct message getitemposition_seq1[] = {
292 { 0 }
293};
294
295static const struct message getitemposition_seq2[] = {
297 { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
298 { 0 }
299};
300
301static const struct message getsubitemrect_seq[] = {
303 { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
305 { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
306 { LVM_GETSUBITEMRECT, sent|id|wparam, -10, 0, LISTVIEW_ID },
307 { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
309 { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
310 { 0 }
311};
312
313static const struct message editbox_create_pos[] = {
314 /* sequence sent after LVN_BEGINLABELEDIT */
315 /* next two are 4.7x specific */
318
320 { WM_NCCALCSIZE, sent },
324 /* the rest is todo, skipped in 4.7x */
327 { 0 }
328};
329
330static const struct message scroll_parent_seq[] = {
331 { WM_NOTIFY, sent|id, 0, 0, LVN_BEGINSCROLL },
332 { WM_NOTIFY, sent|id, 0, 0, LVN_ENDSCROLL },
333 { 0 }
334};
335
336static const struct message setredraw_seq[] = {
338 { 0 }
339};
340
341static const struct message lvs_ex_transparentbkgnd_seq[] = {
343 { 0 }
344};
345
346static const struct message edit_end_nochange[] = {
348 { WM_NOTIFY, sent|id, 0, 0, NM_CUSTOMDRAW }, /* todo */
349 { WM_NOTIFY, sent|id, 0, 0, NM_SETFOCUS },
350 { 0 }
351};
352
353static const struct message hover_parent[] = {
354 { WM_GETDLGCODE, sent }, /* todo_wine */
355 { WM_NOTIFY, sent|id, 0, 0, NM_HOVER },
356 { 0 }
357};
358
359static const struct message listview_destroy[] = {
360 { 0x0090, sent|optional }, /* Vista */
362 { WM_SHOWWINDOW, sent },
365 { WM_DESTROY, sent },
367 { WM_NCDESTROY, sent },
368 { 0 }
369};
370
371static const struct message listview_ownerdata_destroy[] = {
372 { 0x0090, sent|optional }, /* Vista */
374 { WM_SHOWWINDOW, sent },
377 { WM_DESTROY, sent },
378 { WM_NCDESTROY, sent },
379 { 0 }
380};
381
382static const struct message listview_ownerdata_deleteall[] = {
385 { 0 }
386};
387
388static const struct message listview_header_changed_seq[] = {
389 { LVM_SETCOLUMNA, sent },
390 { WM_NOTIFY, sent|id|defwinproc, 0, 0, LISTVIEW_ID },
391 { WM_NOTIFY, sent|id|defwinproc, 0, 0, LISTVIEW_ID },
392 { 0 }
393};
394
395static const struct message parent_header_click_seq[] = {
396 { WM_NOTIFY, sent|id, 0, 0, LVN_COLUMNCLICK },
397 { WM_NOTIFY, sent|id, 0, 0, HDN_ITEMCLICKA },
398 { 0 }
399};
400
403 { WM_NOTIFY, sent|id, 0, 0, NM_CUSTOMDRAW },
404 { WM_NOTIFY, sent|id, 0, 0, NM_CUSTOMDRAW },
405 { WM_NOTIFY, sent|id, 0, 0, HDN_ITEMCHANGEDA },
407 { 0 }
408};
409
410static const struct message listview_set_imagelist[] = {
412 { 0 }
413};
414
415static const struct message listview_header_set_imagelist[] = {
417 { HDM_SETIMAGELIST, sent|id, 0, 0, HEADER_ID },
418 { 0 }
419};
420
421static const struct message parent_insert_focused_seq[] = {
422 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
423 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
424 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
425 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
426 { WM_NOTIFY, sent|id, 0, 0, LVN_INSERTITEM },
427 { 0 }
428};
429
430static const struct message parent_report_cd_seq[] = {
439 { 0 }
440};
441
442static const struct message parent_list_cd_seq[] = {
447 { 0 }
448};
449
450static const struct message listview_end_label_edit[] = {
453 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
454 { WM_NOTIFY, sent|id|optional, 0, 0, NM_CUSTOMDRAW }, /* XP */
455 { WM_NOTIFY, sent|id, 0, 0, NM_SETFOCUS },
456 { 0 }
457};
458
461 { WM_COMMAND, sent|id|optional, 0, 0, EN_KILLFOCUS }, /* todo: not sent by wine yet */
462 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
463 { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
464 { WM_NOTIFY, sent|id|optional, 0, 0, NM_CUSTOMDRAW }, /* XP */
465 { WM_NOTIFY, sent|id, 0, 0, NM_SETFOCUS },
466 { 0 }
467};
468
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}
604
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}
639
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}
667
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}
689
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}
711
712/* unicode listview window with specified parent */
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}
735
736static BOOL is_win_xp(void)
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}
750
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}
771
772static HWND subclass_header(HWND hwndListview)
773{
774 WNDPROC oldproc;
775 HWND hwnd;
776
777 hwnd = (HWND)SendMessageA(hwndListview, LVM_GETHEADER, 0, 0);
781
782 return hwnd;
783}
784
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}
813
814static HWND subclass_editbox(HWND hwndListview)
815{
816 WNDPROC oldproc;
817 HWND hwnd;
818
819 hwnd = (HWND)SendMessageA(hwndListview, LVM_GETEDITCONTROL, 0, 0);
823
824 return hwnd;
825}
826
827/* Performs a single LVM_HITTEST test */
828static void test_lvm_hittest_(HWND hwnd, INT x, INT y, INT item, UINT flags, UINT broken_flags,
829 BOOL todo_item, BOOL todo_flags, int line)
830{
831 LVHITTESTINFO lpht;
832 INT ret;
833
834 lpht.pt.x = x;
835 lpht.pt.y = y;
836 lpht.iSubItem = 10;
837
838 ret = SendMessageA(hwnd, LVM_HITTEST, 0, (LPARAM)&lpht);
839
840 todo_wine_if(todo_item)
841 {
842 ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
843 ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
844 ok_(__FILE__, line)(lpht.iSubItem == 10, "Expected subitem not overwrited\n");
845 }
846
847 if (todo_flags)
848 {
850 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
851 }
852 else if (broken_flags)
853 ok_(__FILE__, line)(lpht.flags == flags || broken(lpht.flags == broken_flags),
854 "Expected flags %x, got %x\n", flags, lpht.flags);
855 else
856 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
857}
858
859#define test_lvm_hittest(a,b,c,d,e,f,g,h) test_lvm_hittest_(a,b,c,d,e,f,g,h,__LINE__)
860
861/* Performs a single LVM_SUBITEMHITTEST test */
863 BOOL todo_item, BOOL todo_subitem, BOOL todo_flags, int line)
864{
865 LVHITTESTINFO lpht;
866 INT ret;
867
868 lpht.pt.x = x;
869 lpht.pt.y = y;
870
872
873 todo_wine_if(todo_item)
874 {
875 ok_(__FILE__, line)(ret == item, "Expected %d retval, got %d\n", item, ret);
876 ok_(__FILE__, line)(lpht.iItem == item, "Expected %d item, got %d\n", item, lpht.iItem);
877 }
878
879 todo_wine_if(todo_subitem)
880 ok_(__FILE__, line)(lpht.iSubItem == subitem, "Expected subitem %d, got %d\n", subitem, lpht.iSubItem);
881
882 todo_wine_if(todo_flags)
883 ok_(__FILE__, line)(lpht.flags == flags, "Expected flags 0x%x, got 0x%x\n", flags, lpht.flags);
884}
885
886#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__)
887
888static void test_images(void)
889{
890 HWND hwnd;
891 INT r;
895 RECT r1, r2;
896 static CHAR hello[] = "hello";
897
898 himl = pImageList_Create(40, 40, 0, 4, 4);
899 ok(himl != NULL, "failed to create imagelist\n");
900
901 hbmp = CreateBitmap(40, 40, 1, 1, NULL);
902 ok(hbmp != NULL, "failed to create bitmap\n");
903
904 r = pImageList_Add(himl, hbmp, 0);
905 ok(r == 0, "should be zero\n");
906
908 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
909 ok(hwnd != NULL, "failed to create listview window\n");
910
913
914 ok(r == 0, "should return zero\n");
915
917 ok(r == 0, "should return zero\n");
918
920 ok(r != 0, "got 0\n");
921
922 /* returns dimensions */
923
925 ok(r == 0, "should be zero items\n");
926
927 item.mask = LVIF_IMAGE | LVIF_TEXT;
928 item.iItem = 0;
929 item.iSubItem = 1;
930 item.iImage = 0;
931 item.pszText = 0;
933 ok(r == -1, "should fail\n");
934
935 item.iSubItem = 0;
936 item.pszText = hello;
938 ok(r == 0, "should not fail\n");
939
940 SetRect(&r1, LVIR_ICON, 0, 0, 0);
942 expect(1, r);
943
945 ok(r == TRUE, "should not fail\n");
946
947 item.iSubItem = 0;
948 item.pszText = hello;
950 ok(r == 0, "should not fail\n");
951
952 SetRect(&r2, LVIR_ICON, 0, 0, 0);
954 expect(1, r);
955
956 ok(EqualRect(&r1, &r2), "rectangle should be the same\n");
957
959
960 /* I_IMAGECALLBACK set for item, try to get image with invalid subitem. */
962 ok(hwnd != NULL, "Failed to create listview.\n");
963
964 memset(&item, 0, sizeof(item));
965 item.mask = LVIF_IMAGE;
966 item.iImage = I_IMAGECALLBACK;
968 ok(!r, "Failed to insert item.\n");
969
971
972 memset(&item, 0, sizeof(item));
973 item.mask = LVIF_IMAGE;
975 ok(r, "Failed to get item.\n");
976
978
980
981 memset(&item, 0, sizeof(item));
982 item.mask = LVIF_IMAGE;
983 item.iSubItem = 1;
985 ok(r, "Failed to get item.\n");
986
987 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "get image dispinfo 2", FALSE);
988
990}
991
992static void test_checkboxes(void)
993{
994 HWND hwnd;
996 DWORD r;
997 static CHAR text[] = "Text",
998 text2[] = "Text2",
999 text3[] = "Text3";
1000
1002 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1003 ok(hwnd != NULL, "failed to create listview window\n");
1004
1005 /* first without LVS_EX_CHECKBOXES set and an item and check that state is preserved */
1006 item.mask = LVIF_TEXT | LVIF_STATE;
1007 item.stateMask = 0xffff;
1008 item.state = 0xfccc;
1009 item.iItem = 0;
1010 item.iSubItem = 0;
1011 item.pszText = text;
1013 expect(0, r);
1014
1015 item.iItem = 0;
1016 item.mask = LVIF_STATE;
1017 item.stateMask = 0xffff;
1019 expect(1, r);
1020 ok(item.state == 0xfccc, "state %x\n", item.state);
1021
1022 /* Don't set LVIF_STATE */
1023 item.mask = LVIF_TEXT;
1024 item.stateMask = 0xffff;
1025 item.state = 0xfccc;
1026 item.iItem = 1;
1027 item.iSubItem = 0;
1028 item.pszText = text;
1030 expect(1, r);
1031
1032 item.iItem = 1;
1033 item.mask = LVIF_STATE;
1034 item.stateMask = 0xffff;
1036 expect(1, r);
1037 ok(item.state == 0, "state %x\n", item.state);
1038
1040 expect(0, r);
1041
1042 /* Having turned on checkboxes, check that all existing items are set to 0x1000 (unchecked) */
1043 item.iItem = 0;
1044 item.mask = LVIF_STATE;
1045 item.stateMask = 0xffff;
1047 expect(1, r);
1048 if (item.state != 0x1ccc)
1049 {
1050 win_skip("LVS_EX_CHECKBOXES style is unavailable. Skipping.\n");
1052 return;
1053 }
1054
1055 /* Now add an item without specifying a state and check that its state goes to 0x1000 */
1056 item.iItem = 2;
1057 item.mask = LVIF_TEXT;
1058 item.state = 0;
1059 item.pszText = text2;
1061 expect(2, r);
1062
1063 item.iItem = 2;
1064 item.mask = LVIF_STATE;
1065 item.stateMask = 0xffff;
1067 expect(1, r);
1068 ok(item.state == 0x1000, "state %x\n", item.state);
1069
1070 /* Add a further item this time specifying a state and still its state goes to 0x1000 */
1071 item.iItem = 3;
1072 item.mask = LVIF_TEXT | LVIF_STATE;
1073 item.stateMask = 0xffff;
1074 item.state = 0x2aaa;
1075 item.pszText = text3;
1077 expect(3, r);
1078
1079 item.iItem = 3;
1080 item.mask = LVIF_STATE;
1081 item.stateMask = 0xffff;
1083 expect(1, r);
1084 ok(item.state == 0x1aaa, "state %x\n", item.state);
1085
1086 /* Set an item's state to checked */
1087 item.iItem = 3;
1088 item.mask = LVIF_STATE;
1089 item.stateMask = 0xf000;
1090 item.state = 0x2000;
1092 expect(1, r);
1093
1094 item.iItem = 3;
1095 item.mask = LVIF_STATE;
1096 item.stateMask = 0xffff;
1098 expect(1, r);
1099 ok(item.state == 0x2aaa, "state %x\n", item.state);
1100
1101 /* Check that only the bits we asked for are returned,
1102 * and that all the others are set to zero
1103 */
1104 item.iItem = 3;
1105 item.mask = LVIF_STATE;
1106 item.stateMask = 0xf000;
1107 item.state = 0xffff;
1109 expect(1, r);
1110 ok(item.state == 0x2000, "state %x\n", item.state);
1111
1112 /* Set the style again and check that doesn't change an item's state */
1114 ok(r == LVS_EX_CHECKBOXES, "ret %x\n", r);
1115
1116 item.iItem = 3;
1117 item.mask = LVIF_STATE;
1118 item.stateMask = 0xffff;
1120 expect(1, r);
1121 ok(item.state == 0x2aaa, "state %x\n", item.state);
1122
1123 /* Unsetting the checkbox extended style doesn't change an item's state */
1125 ok(r == LVS_EX_CHECKBOXES, "ret %x\n", r);
1126
1127 item.iItem = 3;
1128 item.mask = LVIF_STATE;
1129 item.stateMask = 0xffff;
1131 expect(1, r);
1132 ok(item.state == 0x2aaa, "state %x\n", item.state);
1133
1134 /* Now setting the style again will change an item's state */
1136 expect(0, r);
1137
1138 item.iItem = 3;
1139 item.mask = LVIF_STATE;
1140 item.stateMask = 0xffff;
1142 expect(1, r);
1143 ok(item.state == 0x1aaa, "state %x\n", item.state);
1144
1145 /* Toggle checkbox tests (bug 9934) */
1146 memset (&item, 0xcc, sizeof(item));
1147 item.mask = LVIF_STATE;
1148 item.iItem = 3;
1149 item.iSubItem = 0;
1150 item.state = LVIS_FOCUSED;
1151 item.stateMask = LVIS_FOCUSED;
1153 expect(1, r);
1154
1155 item.iItem = 3;
1156 item.mask = LVIF_STATE;
1157 item.stateMask = 0xffff;
1159 expect(1, r);
1160 ok(item.state == 0x1aab, "state %x\n", item.state);
1161
1163 expect(0, r);
1165 expect(0, r);
1166
1167 item.iItem = 3;
1168 item.mask = LVIF_STATE;
1169 item.stateMask = 0xffff;
1171 expect(1, r);
1172 ok(item.state == 0x2aab, "state %x\n", item.state);
1173
1175 expect(0, r);
1177 expect(0, r);
1178
1179 item.iItem = 3;
1180 item.mask = LVIF_STATE;
1181 item.stateMask = 0xffff;
1183 expect(1, r);
1184 ok(item.state == 0x1aab, "state %x\n", item.state);
1185
1187}
1188
1189static void insert_column(HWND hwnd, int idx)
1190{
1192 INT rc;
1193
1194 memset(&column, 0xcc, sizeof(column));
1195 column.mask = LVCF_SUBITEM;
1196 column.iSubItem = idx;
1197
1199 expect(idx, rc);
1200}
1201
1202static void insert_item(HWND hwnd, int idx)
1203{
1204 static CHAR text[] = "foo";
1205
1206 LVITEMA item;
1207 INT rc;
1208
1209 memset(&item, 0xcc, sizeof (item));
1210 item.mask = LVIF_TEXT;
1211 item.iItem = idx;
1212 item.iSubItem = 0;
1213 item.pszText = text;
1214
1216 expect(idx, rc);
1217}
1218
1219static void test_items(void)
1220{
1221 const LPARAM lparamTest = 0x42;
1222 static CHAR text[] = "Text";
1223 char buffA[5];
1224 HWND hwnd;
1225 LVITEMA item;
1226 DWORD r;
1227
1229 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1230 ok(hwnd != NULL, "failed to create listview window\n");
1231
1232 /*
1233 * Test setting/getting item params
1234 */
1235
1236 /* Set up two columns */
1237 insert_column(hwnd, 0);
1238 insert_column(hwnd, 1);
1239
1240 /* LVIS_SELECTED with zero stateMask */
1241 /* set */
1242 memset (&item, 0, sizeof (item));
1243 item.mask = LVIF_STATE;
1244 item.state = LVIS_SELECTED;
1245 item.stateMask = 0;
1246 item.iItem = 0;
1247 item.iSubItem = 0;
1249 expect(0, r);
1250 /* get */
1251 memset (&item, 0xcc, sizeof (item));
1252 item.mask = LVIF_STATE;
1253 item.stateMask = LVIS_SELECTED;
1254 item.state = 0;
1255 item.iItem = 0;
1256 item.iSubItem = 0;
1258 expect(1, r);
1259 ok(item.state & LVIS_SELECTED, "Expected LVIS_SELECTED\n");
1261 ok(r, "got %d\n", r);
1262
1263 /* LVIS_SELECTED with zero stateMask */
1264 /* set */
1265 memset (&item, 0, sizeof (item));
1266 item.mask = LVIF_STATE;
1267 item.state = LVIS_FOCUSED;
1268 item.stateMask = 0;
1269 item.iItem = 0;
1270 item.iSubItem = 0;
1272 expect(0, r);
1273 /* get */
1274 memset (&item, 0xcc, sizeof (item));
1275 item.mask = LVIF_STATE;
1276 item.stateMask = LVIS_FOCUSED;
1277 item.state = 0;
1278 item.iItem = 0;
1279 item.iSubItem = 0;
1281 expect(1, r);
1282 ok(item.state & LVIS_FOCUSED, "Expected LVIS_FOCUSED\n");
1284 ok(r, "got %d\n", r);
1285
1286 /* LVIS_CUT with LVIS_FOCUSED stateMask */
1287 /* set */
1288 memset (&item, 0, sizeof (item));
1289 item.mask = LVIF_STATE;
1290 item.state = LVIS_CUT;
1291 item.stateMask = LVIS_FOCUSED;
1292 item.iItem = 0;
1293 item.iSubItem = 0;
1295 expect(0, r);
1296 /* get */
1297 memset (&item, 0xcc, sizeof (item));
1298 item.mask = LVIF_STATE;
1299 item.stateMask = LVIS_CUT;
1300 item.state = 0;
1301 item.iItem = 0;
1302 item.iSubItem = 0;
1304 expect(1, r);
1305 ok(item.state & LVIS_CUT, "Expected LVIS_CUT\n");
1307 ok(r, "got %d\n", r);
1308
1309 /* Insert an item with just a param */
1310 memset (&item, 0xcc, sizeof (item));
1311 item.mask = LVIF_PARAM;
1312 item.iItem = 0;
1313 item.iSubItem = 0;
1314 item.lParam = lparamTest;
1316 expect(0, r);
1317
1318 /* Test getting of the param */
1319 memset (&item, 0xcc, sizeof (item));
1320 item.mask = LVIF_PARAM;
1321 item.iItem = 0;
1322 item.iSubItem = 0;
1324 expect(1, r);
1325 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1326
1327 /* Set up a subitem */
1328 memset (&item, 0xcc, sizeof (item));
1329 item.mask = LVIF_TEXT;
1330 item.iItem = 0;
1331 item.iSubItem = 1;
1332 item.pszText = text;
1334 expect(1, r);
1335
1336 item.mask = LVIF_TEXT;
1337 item.iItem = 0;
1338 item.iSubItem = 1;
1339 item.pszText = buffA;
1340 item.cchTextMax = sizeof(buffA);
1342 expect(1, r);
1343 ok(!memcmp(item.pszText, text, sizeof(text)), "got text %s, expected %s\n", item.pszText, text);
1344
1345 /* set up with extra flag */
1346 /* 1. reset subitem text */
1347 item.mask = LVIF_TEXT;
1348 item.iItem = 0;
1349 item.iSubItem = 1;
1350 item.pszText = NULL;
1352 expect(1, r);
1353
1354 item.mask = LVIF_TEXT;
1355 item.iItem = 0;
1356 item.iSubItem = 1;
1357 item.pszText = buffA;
1358 buffA[0] = 'a';
1359 item.cchTextMax = sizeof(buffA);
1361 expect(1, r);
1362 ok(item.pszText[0] == 0, "got %p\n", item.pszText);
1363
1364 /* 2. set new text with extra flag specified */
1366 item.iItem = 0;
1367 item.iSubItem = 1;
1368 item.pszText = text;
1370 ok(r == 1 || broken(r == 0) /* NT4 */, "ret %d\n", r);
1371
1372 if (r == 1)
1373 {
1374 item.mask = LVIF_TEXT;
1375 item.iItem = 0;
1376 item.iSubItem = 1;
1377 item.pszText = buffA;
1378 buffA[0] = 'a';
1379 item.cchTextMax = sizeof(buffA);
1381 expect(1, r);
1382 ok(!memcmp(item.pszText, text, sizeof(text)), "got %s, expected %s\n", item.pszText, text);
1383 }
1384
1385 /* Query param from subitem: returns main item param */
1386 memset (&item, 0xcc, sizeof (item));
1387 item.mask = LVIF_PARAM;
1388 item.iItem = 0;
1389 item.iSubItem = 1;
1391 expect(1, r);
1392 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1393
1394 /* Set up param on first subitem: no effect */
1395 memset (&item, 0xcc, sizeof (item));
1396 item.mask = LVIF_PARAM;
1397 item.iItem = 0;
1398 item.iSubItem = 1;
1399 item.lParam = lparamTest+1;
1401 expect(0, r);
1402
1403 /* Query param from subitem again: should still return main item param */
1404 memset (&item, 0xcc, sizeof (item));
1405 item.mask = LVIF_PARAM;
1406 item.iItem = 0;
1407 item.iSubItem = 1;
1409 expect(1, r);
1410 ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
1411
1412 /**** Some tests of state highlighting ****/
1413 memset (&item, 0xcc, sizeof (item));
1414 item.mask = LVIF_STATE;
1415 item.iItem = 0;
1416 item.iSubItem = 0;
1417 item.state = LVIS_SELECTED;
1418 item.stateMask = LVIS_SELECTED | LVIS_DROPHILITED;
1420 expect(1, r);
1421 item.iSubItem = 1;
1422 item.state = LVIS_DROPHILITED;
1424 expect(1, r);
1425
1426 memset (&item, 0xcc, sizeof (item));
1427 item.mask = LVIF_STATE;
1428 item.iItem = 0;
1429 item.iSubItem = 0;
1430 item.stateMask = -1;
1432 expect(1, r);
1433 ok(item.state == LVIS_SELECTED, "got state %x, expected %x\n", item.state, LVIS_SELECTED);
1434 item.iSubItem = 1;
1436 expect(1, r);
1437 todo_wine ok(item.state == LVIS_DROPHILITED, "got state %x, expected %x\n", item.state, LVIS_DROPHILITED);
1438
1439 /* some notnull but meaningless masks */
1440 memset (&item, 0, sizeof(item));
1441 item.mask = LVIF_NORECOMPUTE;
1442 item.iItem = 0;
1443 item.iSubItem = 0;
1445 expect(1, r);
1446 memset (&item, 0, sizeof(item));
1447 item.mask = LVIF_DI_SETITEM;
1448 item.iItem = 0;
1449 item.iSubItem = 0;
1451 expect(1, r);
1452
1453 /* set text to callback value already having it */
1455 expect(TRUE, r);
1456 memset (&item, 0, sizeof (item));
1457 item.mask = LVIF_TEXT;
1458 item.pszText = LPSTR_TEXTCALLBACKA;
1459 item.iItem = 0;
1461 expect(0, r);
1462 memset (&item, 0, sizeof (item));
1463
1465
1466 item.pszText = LPSTR_TEXTCALLBACKA;
1468 expect(TRUE, r);
1469
1471 "check callback text comparison rule", FALSE);
1472
1474}
1475
1476static void test_columns(void)
1477{
1478 HWND hwnd, header;
1480 LVITEMA item;
1481 INT order[2];
1482 CHAR buff[5];
1483 DWORD rc;
1484
1486 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1487 ok(hwnd != NULL, "failed to create listview window\n");
1488
1490 ok(header == NULL, "got %p\n", header);
1491
1493 ok(rc == 0, "got %d\n", rc);
1494
1496 ok(header == NULL, "got %p\n", header);
1497
1499
1501 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
1502 ok(hwnd != NULL, "failed to create listview window\n");
1503
1504 rc = SendMessageA(hwnd, LVM_DELETECOLUMN, -1, 0);
1505 ok(!rc, "got %d\n", rc);
1506
1507 rc = SendMessageA(hwnd, LVM_DELETECOLUMN, 0, 0);
1508 ok(!rc, "got %d\n", rc);
1509
1510 /* Add a column with no mask */
1511 memset(&column, 0xcc, sizeof(column));
1512 column.mask = 0;
1514 ok(rc == 0, "Inserting column with no mask failed with %d\n", rc);
1515
1516 /* Check its width */
1518 ok(rc == 10, "Inserting column with no mask failed to set width to 10 with %d\n", rc);
1519
1521
1522 /* LVM_GETCOLUMNORDERARRAY */
1525
1526 memset(&column, 0, sizeof(column));
1527 column.mask = LVCF_WIDTH;
1528 column.cx = 100;
1530 expect(0, rc);
1531
1532 column.cx = 200;
1534 expect(1, rc);
1535
1537
1539 expect(1, rc);
1540 ok(order[0] == 0, "Expected order 0, got %d\n", order[0]);
1541 ok(order[1] == 1, "Expected order 1, got %d\n", order[1]);
1542
1544 expect(0, rc);
1545
1547
1548 /* LVM_SETCOLUMNORDERARRAY */
1550
1551 order[0] = 0;
1552 order[1] = 1;
1554 expect(1, rc);
1555
1557 expect(0, rc);
1558
1560
1561 /* after column added subitem is considered as present */
1562 insert_item(hwnd, 0);
1563
1565
1566 item.pszText = buff;
1567 item.cchTextMax = sizeof(buff);
1568 item.iItem = 0;
1569 item.iSubItem = 1;
1570 item.mask = LVIF_TEXT;
1571 memset(&g_itema, 0, sizeof(g_itema));
1573 expect(1, rc);
1574 ok(g_itema.iSubItem == 1, "got %d\n", g_itema.iSubItem);
1575
1577 "get subitem text after column added", FALSE);
1578
1580
1581 /* Columns are not created right away. */
1583 ok(hwnd != NULL, "Failed to create a listview window.\n");
1584
1585 insert_item(hwnd, 0);
1586
1588 ok(IsWindow(header), "Expected header handle.\n");
1590 ok(!rc, "Unexpected column count.\n");
1591
1593}
1594
1595/* test setting imagelist between WM_NCCREATE and WM_CREATE */
1598
1600{
1601 LRESULT ret;
1602
1603 if (uMsg == WM_CREATE)
1604 {
1606 lpcs->style |= LVS_REPORT;
1607 }
1610 return ret;
1611}
1612
1613/* Header creation is delayed in classic implementation. */
1614#define TEST_NO_HEADER(a) test_header_presence_(a, FALSE, __LINE__)
1615#define TEST_HEADER_EXPECTED(a) test_header_presence_(a, TRUE, __LINE__)
1616#define TEST_NO_HEADER2(a, b) test_header_presence_(a, b, __LINE__)
1617static void test_header_presence_(HWND hwnd, BOOL present, int line)
1618{
1620
1621 if (present)
1622 {
1623 ok_(__FILE__, line)(IsWindow(header), "Header should have been created.\n");
1624 if (header) /* FIXME: remove when todo's are fixed */
1625 ok_(__FILE__, line)(header == GetDlgItem(hwnd, 0), "Dialog item expected.\n");
1626 }
1627 else
1628 {
1629 ok_(__FILE__, line)(!IsWindow(header), "Header shouldn't be created.\n");
1630 ok_(__FILE__, line)(NULL == GetDlgItem(hwnd, 0), "NULL dialog item expected.\n");
1631 }
1632}
1633
1634static void test_create(BOOL is_version_6)
1635{
1636 static const WCHAR testtextW[] = {'t','e','s','t',' ','t','e','x','t',0};
1637 char buff[16];
1638 HWND hList;
1639 HWND hHeader;
1640 LONG_PTR ret;
1641 LONG r;
1642 LVCOLUMNA col;
1643 RECT rect;
1644 WNDCLASSEXA cls;
1645 DWORD style;
1646 ATOM class;
1647
1648 if (is_win_xp() && is_version_6)
1649 {
1650 win_skip("Skipping some tests on XP.\n");
1651 return;
1652 }
1653
1654 cls.cbSize = sizeof(WNDCLASSEXA);
1656 ok(r, "Failed to get class info.\n");
1659 cls.lpszClassName = "MyListView32";
1660 class = RegisterClassExA(&cls);
1661 ok(class, "Failed to register class.\n");
1662
1663 test_create_imagelist = pImageList_Create(16, 16, 0, 5, 10);
1664 hList = CreateWindowA("MyListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1665 ok((HIMAGELIST)SendMessageA(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
1666 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1667 ok(IsWindow(hHeader) && IsWindowVisible(hHeader), "Listview not in report mode\n");
1668 ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
1670
1671 /* header isn't created on LVS_ICON and LVS_LIST styles */
1672 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1674
1675 /* insert column */
1676 memset(&col, 0, sizeof(LVCOLUMNA));
1677 col.mask = LVCF_WIDTH;
1678 col.cx = 100;
1680 expect(0, r);
1682 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1683 style = GetWindowLongA(hHeader, GWL_STYLE);
1684 ok(!(style & HDS_HIDDEN), "Not expected HDS_HIDDEN\n");
1686
1687 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
1690 /* insert column */
1691 memset(&col, 0, sizeof(LVCOLUMNA));
1692 col.mask = LVCF_WIDTH;
1693 col.cx = 100;
1695 expect(0, r);
1698
1699 /* try to switch LVS_ICON -> LVS_REPORT and back LVS_ICON -> LVS_REPORT */
1700 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
1703 ok(ret & WS_VISIBLE, "Style wrong, should have WS_VISIBLE\n");
1706 ok((ret & WS_VISIBLE) && (ret & LVS_REPORT), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
1709
1710 /* try to switch LVS_LIST -> LVS_REPORT and back LVS_LIST -> LVS_REPORT */
1711 hList = CreateWindowA(WC_LISTVIEWA, "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
1715 ok(((ret & WS_VISIBLE) && (ret & LVS_LIST)), "Style wrong, should have WS_VISIBLE|LVS_LIST\n");
1718 ok(((ret & WS_VISIBLE) && (ret & LVS_REPORT)), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
1721
1722 /* LVS_REPORT without WS_VISIBLE */
1723 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1725 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1726todo_wine_if(is_version_6)
1727 TEST_NO_HEADER2(hList, is_version_6);
1728
1729 /* insert column */
1730 memset(&col, 0, sizeof(LVCOLUMNA));
1731 col.mask = LVCF_WIDTH;
1732 col.cx = 100;
1734 expect(0, r);
1737
1738 /* LVS_REPORT without WS_VISIBLE, try to show it */
1739 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1741todo_wine_if(is_version_6)
1742 TEST_NO_HEADER2(hList, is_version_6);
1743
1747
1748 /* LVS_REPORT with LVS_NOCOLUMNHEADER */
1750 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0);
1752 hHeader = (HWND)SendMessageA(hList, LVM_GETHEADER, 0, 0);
1753 /* HDS_DRAGDROP set by default */
1754 ok(GetWindowLongPtrA(hHeader, GWL_STYLE) & HDS_DRAGDROP, "Expected header to have HDS_DRAGDROP\n");
1756
1757 /* setting LVS_EX_HEADERDRAGDROP creates header */
1758 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1760todo_wine_if(is_version_6)
1761 TEST_NO_HEADER2(hList, is_version_6);
1762
1766
1767 /* setting LVS_EX_GRIDLINES creates header */
1768 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1770todo_wine_if(is_version_6)
1771 TEST_NO_HEADER2(hList, is_version_6);
1772
1776
1777 /* setting LVS_EX_FULLROWSELECT creates header */
1778 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1780todo_wine_if(is_version_6)
1781 TEST_NO_HEADER2(hList, is_version_6);
1785
1786 /* not report style accepts LVS_EX_HEADERDRAGDROP too */
1790 ok(r & LVS_EX_HEADERDRAGDROP, "Expected LVS_EX_HEADERDRAGDROP to be set\n");
1792
1793 /* requesting header info with LVM_GETSUBITEMRECT doesn't create it */
1794 hList = CreateWindowA(WC_LISTVIEWA, "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
1796todo_wine_if(is_version_6)
1797 TEST_NO_HEADER2(hList, is_version_6);
1798
1799 SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
1801 ok(r == 1, "Unexpected ret value %d.\n", r);
1802 /* right value contains garbage, probably because header columns are not set up */
1803 ok(rect.bottom >= 0, "Unexpected rectangle.\n");
1804
1805todo_wine_if(is_version_6)
1806 TEST_NO_HEADER2(hList, is_version_6);
1808
1809 /* WM_MEASUREITEM should be sent when created with LVS_OWNERDRAWFIXED */
1813 "created with LVS_OWNERDRAWFIXED|LVS_REPORT - parent seq", FALSE);
1815
1816 /* Test that window text is preserved. */
1818 0, 0, 100, 100, hwndparent, NULL, GetModuleHandleA(NULL), NULL);
1819 ok(hList != NULL, "Failed to create ListView window.\n");
1820 *buff = 0;
1821 GetWindowTextA(hList, buff, sizeof(buff));
1822 ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff);
1824
1826 0, 0, 100, 100, hwndparent, NULL, GetModuleHandleA(NULL), NULL);
1827 ok(hList != NULL, "Failed to create ListView window.\n");
1828 *buff = 0;
1829 GetWindowTextA(hList, buff, sizeof(buff));
1830 ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff);
1832
1833 r = UnregisterClassA("MyListView32", NULL);
1834 ok(r, "Failed to unregister test class.\n");
1835}
1836
1837static void test_redraw(void)
1838{
1839 HWND hwnd;
1840 HDC hdc;
1841 BOOL res;
1842 DWORD r;
1843 RECT rect;
1844
1847
1849
1853
1855
1856 /* forward WM_ERASEBKGND to parent on CLR_NONE background color */
1857 /* 1. Without backbuffer */
1859 expect(TRUE, res);
1860
1862
1865 ok(r == 1, "Expected not zero result\n");
1867 "forward WM_ERASEBKGND on CLR_NONE", FALSE);
1868
1870 expect(TRUE, res);
1871
1874 expect(1, r);
1876 "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
1877
1878 /* 2. With backbuffer */
1882 expect(TRUE, res);
1883
1886 expect(1, r);
1888 "forward WM_ERASEBKGND on CLR_NONE", FALSE);
1889
1891 expect(TRUE, res);
1892
1895 todo_wine expect(1, r);
1897 "don't forward WM_ERASEBKGND on non-CLR_NONE", FALSE);
1898
1900
1901 /* test setting the window style to what it already was */
1905 ok(rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
1906 "Expected empty update rect, got %s\n", wine_dbgstr_rect(&rect));
1907
1909}
1910
1912{
1913 COLORREF clr, c0ffee = RGB(0xc0, 0xff, 0xee);
1914
1915 if(message == WM_NOTIFY) {
1916 NMHDR *nmhdr = (NMHDR*)lParam;
1917 if(nmhdr->code == NM_CUSTOMDRAW) {
1918 NMLVCUSTOMDRAW *nmlvcd = (NMLVCUSTOMDRAW*)nmhdr;
1919 BOOL showsel_always = !!(GetWindowLongA(nmlvcd->nmcd.hdr.hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS);
1920 BOOL is_selected = !!(nmlvcd->nmcd.uItemState & CDIS_SELECTED);
1921 struct message msg;
1922
1923 msg.message = message;
1924 msg.flags = sent|wparam|lparam|custdraw;
1925 msg.wParam = wParam;
1926 msg.lParam = lParam;
1927 msg.id = nmhdr->code;
1928 msg.stage = nmlvcd->nmcd.dwDrawStage;
1930
1931 switch(nmlvcd->nmcd.dwDrawStage) {
1932 case CDDS_PREPAINT:
1933 SetBkColor(nmlvcd->nmcd.hdc, c0ffee);
1935 case CDDS_ITEMPREPAINT:
1936 clr = GetBkColor(nmlvcd->nmcd.hdc);
1937 todo_wine_if(nmlvcd->iSubItem)
1938 ok(clr == c0ffee, "Unexpected background color %#x.\n", clr);
1939 nmlvcd->clrTextBk = CLR_DEFAULT;
1940 nmlvcd->clrText = RGB(0, 255, 0);
1943 clr = GetBkColor(nmlvcd->nmcd.hdc);
1944 todo_wine_if(showsel_always && is_selected && nmlvcd->iSubItem)
1945 {
1946 ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background %#x.\n", nmlvcd->clrTextBk);
1947 ok(nmlvcd->clrText == RGB(0, 255, 0), "Unexpected text color %#x.\n", nmlvcd->clrText);
1948 }
1949 if (showsel_always && is_selected && nmlvcd->iSubItem)
1950 ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
1951 else
1952 todo_wine_if(nmlvcd->iSubItem)
1953 ok(clr == c0ffee, "clr=%.8x\n", clr);
1954 return CDRF_NOTIFYPOSTPAINT;
1956 clr = GetBkColor(nmlvcd->nmcd.hdc);
1957 if (showsel_always && is_selected)
1958 ok(clr == GetSysColor(COLOR_3DFACE), "Unexpected background color %#x.\n", clr);
1959 else
1960 {
1961 todo_wine
1962 ok(clr == c0ffee, "Unexpected background color %#x.\n", clr);
1963 }
1964
1965 todo_wine_if(showsel_always)
1966 {
1967 ok(nmlvcd->clrTextBk == CLR_DEFAULT, "Unexpected text background color %#x.\n", nmlvcd->clrTextBk);
1968 ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText);
1969 }
1970 return CDRF_DODEFAULT;
1971 }
1972 return CDRF_DODEFAULT;
1973 }
1974 }
1975
1977}
1978
1979static void test_customdraw(void)
1980{
1981 HWND hwnd;
1982 WNDPROC oldwndproc;
1983 LVITEMA item;
1984
1986
1987 insert_column(hwnd, 0);
1988 insert_column(hwnd, 1);
1989 insert_item(hwnd, 0);
1990
1993
1996
1997 /* message tests */
2001 ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_report_cd_seq, "parent customdraw, LVS_REPORT", FALSE);
2002
2003 /* Check colors when item is selected. */
2004 item.mask = LVIF_STATE;
2005 item.stateMask = LVIS_SELECTED;
2006 item.state = LVIS_SELECTED;
2008
2013 "parent customdraw, item selected, LVS_REPORT, selection", FALSE);
2014
2020 "parent customdraw, item selected, LVS_SHOWSELALWAYS, LVS_REPORT", FALSE);
2021
2023
2025
2026 insert_column(hwnd, 0);
2027 insert_column(hwnd, 1);
2028 insert_item(hwnd, 0);
2029
2033 ok_sequence(sequences, PARENT_CD_SEQ_INDEX, parent_list_cd_seq, "parent customdraw, LVS_LIST", FALSE);
2034
2037}
2038
2039static void test_icon_spacing(void)
2040{
2041 /* LVM_SETICONSPACING */
2042 /* note: LVM_SETICONSPACING returns the previous icon spacing if successful */
2043
2044 HWND hwnd;
2045 WORD w, h;
2046 INT r;
2047
2049 ok(hwnd != NULL, "failed to create a listview window\n");
2050
2051 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwndparent, NF_REQUERY);
2052 expect(NFR_ANSI, r);
2053
2054 /* reset the icon spacing to defaults */
2056
2057 /* now we can request what the defaults are */
2059 w = LOWORD(r);
2060 h = HIWORD(r);
2061
2063
2065 ok(r == MAKELONG(w, h) ||
2066 broken(r == MAKELONG(w, w)), /* win98 */
2067 "Expected %d, got %d\n", MAKELONG(w, h), r);
2068
2070 expect(MAKELONG(20,30), r);
2071
2073 expect(MAKELONG(25,35), r);
2074
2076
2079}
2080
2081static void test_color(void)
2082{
2083 RECT rect;
2084 HWND hwnd;
2085 DWORD r;
2086 int i;
2087
2089 COLORREF colors[4] = {RGB(0,0,0), RGB(100,50,200), CLR_NONE, RGB(255,255,255)};
2090
2092 ok(hwnd != NULL, "failed to create a listview window\n");
2093
2095
2096 for (i = 0; i < 4; i++)
2097 {
2098 color = colors[i];
2099
2101 expect(TRUE, r);
2103 expect(color, r);
2104
2106 expect (TRUE, r);
2108 expect(color, r);
2109
2111 expect(TRUE, r);
2113 expect(color, r);
2114 }
2115
2118
2119 /* invalidation test done separately to avoid a message chain mess */
2120 r = ValidateRect(hwnd, NULL);
2121 expect(TRUE, r);
2122 r = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, colors[0]);
2123 expect(TRUE, r);
2124
2125 rect.right = rect.bottom = 1;
2128 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2129
2130 r = ValidateRect(hwnd, NULL);
2131 expect(TRUE, r);
2132 r = SendMessageA(hwnd, LVM_SETTEXTCOLOR, 0, colors[0]);
2133 expect(TRUE, r);
2134
2135 rect.right = rect.bottom = 1;
2138 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2139
2140 r = ValidateRect(hwnd, NULL);
2141 expect(TRUE, r);
2142 r = SendMessageA(hwnd, LVM_SETTEXTBKCOLOR, 0, colors[0]);
2143 expect(TRUE, r);
2144
2145 rect.right = rect.bottom = 1;
2148 ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
2149
2151}
2152
2153static void test_item_count(void)
2154{
2155 /* LVM_INSERTITEM, LVM_DELETEITEM, LVM_DELETEALLITEMS, LVM_GETITEMCOUNT */
2156
2157 HWND hwnd;
2158 DWORD r;
2159 HDC hdc;
2160 HFONT hOldFont;
2162 RECT rect;
2163 INT height;
2164
2165 LVITEMA item0;
2166 LVITEMA item1;
2167 LVITEMA item2;
2168 static CHAR item0text[] = "item0";
2169 static CHAR item1text[] = "item1";
2170 static CHAR item2text[] = "item2";
2171
2173 ok(hwnd != NULL, "failed to create a listview window\n");
2174
2175 /* resize in dpiaware manner to fit all 3 items added */
2176 hdc = GetDC(0);
2179 /* 2 extra pixels for bounds and header border */
2180 height = tm.tmHeight + 2;
2181 SelectObject(hdc, hOldFont);
2182 ReleaseDC(0, hdc);
2183
2185 /* 3 items + 1 header + 1 to be sure */
2186 MoveWindow(hwnd, 0, 0, rect.right - rect.left, 5 * height, FALSE);
2187
2189
2191 expect(0, r);
2192
2193 /* [item0] */
2194 item0.mask = LVIF_TEXT;
2195 item0.iItem = 0;
2196 item0.iSubItem = 0;
2197 item0.pszText = item0text;
2198 r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item0);
2199 expect(0, r);
2200
2201 /* [item0, item1] */
2202 item1.mask = LVIF_TEXT;
2203 item1.iItem = 1;
2204 item1.iSubItem = 0;
2205 item1.pszText = item1text;
2207 expect(1, r);
2208
2209 /* [item0, item1, item2] */
2210 item2.mask = LVIF_TEXT;
2211 item2.iItem = 2;
2212 item2.iSubItem = 0;
2213 item2.pszText = item2text;
2215 expect(2, r);
2216
2218 expect(3, r);
2219
2220 /* [item0, item1] */
2222 expect(TRUE, r);
2223
2225 expect(2, r);
2226
2227 /* [] */
2229 expect(TRUE, r);
2230
2232 expect(0, r);
2233
2234 /* [item0] */
2236 expect(0, r);
2237
2238 /* [item0, item1] */
2240 expect(1, r);
2241
2243 expect(2, r);
2244
2245 /* [item0, item1, item2] */
2247 expect(2, r);
2248
2250 expect(3, r);
2251
2253
2256}
2257
2258static void test_item_position(void)
2259{
2260 /* LVM_SETITEMPOSITION/LVM_GETITEMPOSITION */
2261
2262 HWND hwnd;
2263 DWORD r;
2264 POINT position;
2265
2266 LVITEMA item0;
2267 LVITEMA item1;
2268 LVITEMA item2;
2269 static CHAR item0text[] = "item0";
2270 static CHAR item1text[] = "item1";
2271 static CHAR item2text[] = "item2";
2272
2274 ok(hwnd != NULL, "failed to create a listview window\n");
2275
2277
2278 /* [item0] */
2279 item0.mask = LVIF_TEXT;
2280 item0.iItem = 0;
2281 item0.iSubItem = 0;
2282 item0.pszText = item0text;
2283 r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item0);
2284 expect(0, r);
2285
2286 /* [item0, item1] */
2287 item1.mask = LVIF_TEXT;
2288 item1.iItem = 1;
2289 item1.iSubItem = 0;
2290 item1.pszText = item1text;
2292 expect(1, r);
2293
2294 /* [item0, item1, item2] */
2295 item2.mask = LVIF_TEXT;
2296 item2.iItem = 2;
2297 item2.iSubItem = 0;
2298 item2.pszText = item2text;
2300 expect(2, r);
2301
2303 expect(TRUE, r);
2304 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 1, (LPARAM) &position);
2305 expect(TRUE, r);
2306 expect2(10, 5, position.x, position.y);
2307
2309 expect(TRUE, r);
2310 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 2, (LPARAM) &position);
2311 expect(TRUE, r);
2312 expect2(0, 0, position.x, position.y);
2313
2315 expect(TRUE, r);
2316 r = SendMessageA(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM) &position);
2317 expect(TRUE, r);
2318 expect2(20, 20, position.x, position.y);
2319
2321
2324}
2325
2326static void test_getorigin(void)
2327{
2328 /* LVM_GETORIGIN */
2329
2330 HWND hwnd;
2331 DWORD r;
2332 POINT position;
2333
2334 position.x = position.y = 0;
2335
2337 ok(hwnd != NULL, "failed to create a listview window\n");
2339
2340 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2341 expect(TRUE, r);
2344
2346 ok(hwnd != NULL, "failed to create a listview window\n");
2348
2349 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2350 expect(TRUE, r);
2353
2355 ok(hwnd != NULL, "failed to create a listview window\n");
2357
2358 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2359 expect(FALSE, r);
2362
2364 ok(hwnd != NULL, "failed to create a listview window\n");
2366
2367 r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position);
2368 expect(FALSE, r);
2371}
2372
2373static void test_multiselect(void)
2374{
2375 typedef struct t_select_task
2376 {
2377 const char *descr;
2378 int initPos;
2379 int loopVK;
2380 int count;
2381 int result;
2382 } select_task;
2383
2384 HWND hwnd;
2385 INT r;
2386 int i, j;
2387 static const int items=5;
2388 DWORD item_count;
2389 BYTE kstate[256];
2390 select_task task;
2392 LVITEMA item;
2393
2394 static struct t_select_task task_list[] = {
2395 { "using VK_DOWN", 0, VK_DOWN, -1, -1 },
2396 { "using VK_UP", -1, VK_UP, -1, -1 },
2397 { "using VK_END", 0, VK_END, 1, -1 },
2398 { "using VK_HOME", -1, VK_HOME, 1, -1 }
2399 };
2400
2402
2403 for (i = 0; i < items; i++)
2404 insert_item(hwnd, 0);
2405
2406 item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
2407 expect(items, item_count);
2408
2410 ok(r == -1, "got %d\n", r);
2411
2413 ok(r == -1, "got %d\n", r);
2414
2416 ok(r == 0, "got %d\n", r);
2417
2418 /* out of range index */
2420 ok(r == 0, "got %d\n", r);
2421
2423 ok(r == 0, "got %d\n", r);
2424
2426 ok(r == 0, "got %d\n", r);
2427
2429 ok(r == 0, "got %d\n", r);
2430
2431 for (i = 0; i < ARRAY_SIZE(task_list); i++) {
2432 DWORD selected_count;
2433 LVITEMA item;
2434
2435 task = task_list[i];
2436
2437 /* deselect all items */
2438 item.state = 0;
2439 item.stateMask = LVIS_SELECTED;
2441 ok(r, "got %d\n", r);
2443
2444 /* set initial position */
2445 r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos));
2446 ok(r, "got %d\n", r);
2447
2448 item.state = LVIS_SELECTED;
2449 item.stateMask = LVIS_SELECTED;
2450 r = SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item);
2451 ok(r, "got %d\n", r);
2452
2453 selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
2454 ok(selected_count == 1, "expected 1, got %d\n", selected_count);
2455
2456 /* Set SHIFT key pressed */
2457 GetKeyboardState(kstate);
2458 kstate[VK_SHIFT]=0x80;
2459 SetKeyboardState(kstate);
2460
2461 for (j=1;j<=(task.count == -1 ? item_count : task.count);j++) {
2462 r = SendMessageA(hwnd, WM_KEYDOWN, task.loopVK, 0);
2463 expect(0,r);
2464 r = SendMessageA(hwnd, WM_KEYUP, task.loopVK, 0);
2465 expect(0,r);
2466 }
2467
2468 selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
2469
2470 ok((task.result == -1 ? item_count : task.result) == selected_count,
2471 "Failed multiple selection %s. There should be %d selected items (is %d)\n",
2472 task.descr, item_count, selected_count);
2473
2474 /* Set SHIFT key released */
2475 GetKeyboardState(kstate);
2476 kstate[VK_SHIFT]=0x00;
2477 SetKeyboardState(kstate);
2478 }
2480
2481 /* make multiple selection, then switch to LVS_SINGLESEL */
2483 for (i=0;i<items;i++) {
2484 insert_item(hwnd, 0);
2485 }
2486 item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
2487 expect(items,item_count);
2488
2489 /* try with NULL pointer */
2491 expect(FALSE, r);
2492
2493 /* select all, check notifications */
2494 item.state = 0;
2495 item.stateMask = LVIS_SELECTED;
2497 ok(r, "got %d\n", r);
2498
2500
2501 item.stateMask = LVIS_SELECTED;
2502 item.state = LVIS_SELECTED;
2504 expect(TRUE, r);
2505
2507 "select all notification", FALSE);
2508
2509 /* select all again (all selected already) */
2511
2513
2514 item.stateMask = LVIS_SELECTED;
2515 item.state = LVIS_SELECTED;
2517 expect(TRUE, r);
2518
2522
2524 "select all notification 2", FALSE);
2525
2526 /* deselect all items */
2528
2529 item.state = 0;
2530 item.stateMask = LVIS_SELECTED;
2532 ok(r, "got %d\n", r);
2533
2535 "deselect all notification", FALSE);
2536
2537 /* deselect all items again */
2539 item.state = 0;
2540 item.stateMask = LVIS_SELECTED;
2542 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "deselect all notification 2", FALSE);
2543
2544 /* any non-zero state value does the same */
2546
2548
2549 item.stateMask = LVIS_SELECTED;
2550 item.state = LVIS_CUT;
2552 expect(TRUE, r);
2553
2557
2559 "set state all notification 3", FALSE);
2560
2562 ok(r, "got %d\n", r);
2563 for (i = 0; i < 3; i++) {
2564 item.state = LVIS_SELECTED;
2565 item.stateMask = LVIS_SELECTED;
2567 ok(r, "got %d\n", r);
2568 }
2569
2571 expect(3, r);
2573 expect(-1, r);
2574
2576 ok(!(style & LVS_SINGLESEL), "LVS_SINGLESEL isn't expected\n");
2578 /* check that style is accepted */
2580 ok(style & LVS_SINGLESEL, "LVS_SINGLESEL expected\n");
2581
2582 for (i=0;i<3;i++) {
2584 ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
2585 }
2587 expect(3, r);
2589 ok(r == -1, "got %d\n", r);
2590
2591 /* select one more */
2592 item.state = LVIS_SELECTED;
2593 item.stateMask = LVIS_SELECTED;
2595 ok(r, "got %d\n", r);
2596
2597 for (i=0;i<3;i++) {
2599 ok(!(r & LVIS_SELECTED), "Expected item %d to be unselected\n", i);
2600 }
2601
2603 ok(r & LVIS_SELECTED, "Expected item %d to be selected\n", i);
2604
2606 expect(1, r);
2608 expect(-1, r);
2609
2610 /* try to select all on LVS_SINGLESEL */
2611 memset(&item, 0, sizeof(item));
2612 item.stateMask = LVIS_SELECTED;
2614 expect(TRUE, r);
2616 ok(r == -1, "got %d\n", r);
2617
2618 item.stateMask = LVIS_SELECTED;
2619 item.state = LVIS_SELECTED;
2621 expect(FALSE, r);
2622
2624 expect(0, r);
2626 expect(-1, r);
2627
2628 /* try to deselect all on LVS_SINGLESEL */
2629 item.stateMask = LVIS_SELECTED;
2630 item.state = LVIS_SELECTED;
2632 expect(TRUE, r);
2633
2634 item.stateMask = LVIS_SELECTED;
2635 item.state = 0;
2637 expect(TRUE, r);
2639 expect(0, r);
2640
2641 /* 1. selection mark is update when new focused item is set */
2644
2646 expect(-1, r);
2647
2648 item.stateMask = LVIS_FOCUSED;
2649 item.state = LVIS_FOCUSED;
2651 expect(TRUE, r);
2652
2654 expect(0, r);
2655
2656 /* it's not updated if already set */
2657 item.stateMask = LVIS_FOCUSED;
2658 item.state = LVIS_FOCUSED;
2660 expect(TRUE, r);
2661
2663 expect(0, r);
2664
2666 expect(0, r);
2667
2668 item.stateMask = LVIS_FOCUSED;
2669 item.state = LVIS_FOCUSED;
2671 expect(TRUE, r);
2672
2674 expect(-1, r);
2675
2676 /* need to reset focused item first */
2677 item.stateMask = LVIS_FOCUSED;
2678 item.state = 0;
2680 expect(TRUE, r);
2681
2682 item.stateMask = LVIS_FOCUSED;
2683 item.state = LVIS_FOCUSED;
2685 expect(TRUE, r);
2686
2688 expect(2, r);
2689
2690 item.stateMask = LVIS_FOCUSED;
2691 item.state = 0;
2693 expect(TRUE, r);
2694
2696 expect(2, r);
2697
2698 /* 2. same tests, with LVM_SETITEM */
2701
2703 expect(2, r);
2704
2705 item.stateMask = LVIS_FOCUSED;
2706 item.state = LVIS_FOCUSED;
2707 item.mask = LVIF_STATE;
2708 item.iItem = item.iSubItem = 0;
2710 expect(TRUE, r);
2711
2713 expect(0, r);
2714
2715 /* it's not updated if already set */
2716 item.stateMask = LVIS_FOCUSED;
2717 item.state = LVIS_FOCUSED;
2718 item.mask = LVIF_STATE;
2719 item.iItem = 1;
2720 item.iSubItem = 0;
2722 expect(TRUE, r);
2723
2725 expect(0, r);
2726
2728 expect(0, r);
2729
2730 item.stateMask = LVIS_FOCUSED;
2731 item.state = LVIS_FOCUSED;
2732 item.mask = LVIF_STATE;
2733 item.iItem = 1;
2734 item.iSubItem = 0;
2736 expect(TRUE, r);
2737
2739 expect(-1, r);
2740
2741 /* need to reset focused item first */
2742 item.stateMask = LVIS_FOCUSED;
2743 item.state = 0;
2745 expect(TRUE, r);
2746
2747 item.stateMask = LVIS_FOCUSED;
2748 item.state = LVIS_FOCUSED;
2749 item.mask = LVIF_STATE;
2750 item.iItem = 2;
2751 item.iSubItem = 0;
2753 expect(TRUE, r);
2754
2756 expect(2, r);
2757
2758 item.stateMask = LVIS_FOCUSED;
2759 item.state = 0;
2761 expect(TRUE, r);
2762
2764 expect(2, r);
2765
2767}
2768
2769static void test_subitem_rect(void)
2770{
2771 HWND hwnd;
2772 DWORD r;
2773 LVCOLUMNA col;
2774 RECT rect, rect2;
2775 INT arr[3];
2776
2777 /* test LVM_GETSUBITEMRECT for header */
2779 ok(hwnd != NULL, "failed to create a listview window\n");
2780 /* add some columns */
2781 memset(&col, 0, sizeof(LVCOLUMNA));
2782 col.mask = LVCF_WIDTH;
2783 col.cx = 100;
2785 expect(0, r);
2786 col.cx = 150;
2788 expect(1, r);
2789 col.cx = 200;
2791 expect(2, r);
2792 /* item = -1 means header, subitem index is 1 based */
2793 SetRect(&rect, LVIR_BOUNDS, 0, 0, 0);
2795 expect(0, r);
2796
2797 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2799 expect(1, r);
2800
2801 expect(100, rect.left);
2802 expect(250, rect.right);
2803 expect(3, rect.top);
2804
2805 SetRect(&rect, LVIR_BOUNDS, 2, 0, 0);
2807 expect(1, r);
2808
2809 expect(250, rect.left);
2810 expect(450, rect.right);
2811 expect(3, rect.top);
2812
2813 /* item LVS_REPORT padding isn't applied to subitems */
2814 insert_item(hwnd, 0);
2815
2816 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2818 expect(1, r);
2819 expect(100, rect.left);
2820 expect(250, rect.right);
2821
2822 SetRect(&rect, LVIR_ICON, 1, 0, 0);
2824 expect(1, r);
2825 /* no icon attached - zero width rectangle, with no left padding */
2826 expect(100, rect.left);
2827 expect(100, rect.right);
2828
2829 SetRect(&rect, LVIR_LABEL, 1, 0, 0);
2831 expect(1, r);
2832 /* same as full LVIR_BOUNDS */
2833 expect(100, rect.left);
2834 expect(250, rect.right);
2835
2836 r = SendMessageA(hwnd, LVM_SCROLL, 10, 0);
2837 ok(r, "got %d\n", r);
2838
2839 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2841 expect(1, r);
2842 expect(90, rect.left);
2843 expect(240, rect.right);
2844
2845 SendMessageA(hwnd, LVM_SCROLL, -10, 0);
2846
2847 /* test header interaction */
2850
2851 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2853 expect(1, r);
2854
2855 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2857 expect(1, r);
2858
2859 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2861 expect(1, r);
2862
2863 SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
2865 expect(1, r);
2866
2867 ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getsubitemrect_seq, "LVM_GETSUBITEMRECT negative index", FALSE);
2868
2870
2871 /* test subitem rects after re-arranging columns */
2873 ok(hwnd != NULL, "failed to create a listview window\n");
2874 memset(&col, 0, sizeof(LVCOLUMNA));
2875 col.mask = LVCF_WIDTH;
2876
2877 col.cx = 100;
2879 expect(0, r);
2880
2881 col.cx = 200;
2883 expect(1, r);
2884
2885 col.cx = 300;
2887 expect(2, r);
2888
2889 insert_item(hwnd, 0);
2890 insert_item(hwnd, 1);
2891
2892 /* wrong item is refused for main item */
2893 SetRect(&rect, LVIR_BOUNDS, 0, -1, -1);
2895 expect(FALSE, r);
2896
2897 /* for subitems rectangle is calculated even if there's no item added */
2898 SetRect(&rect, LVIR_BOUNDS, 1, -1, -1);
2900 expect(TRUE, r);
2901
2902 SetRect(&rect2, LVIR_BOUNDS, 1, -1, -1);
2904 expect(TRUE, r);
2905 expect(rect.right, rect2.right);
2906 expect(rect.left, rect2.left);
2907 expect(rect.bottom, rect2.top);
2908 ok(rect2.bottom > rect2.top, "expected not zero height\n");
2909
2910 arr[0] = 1; arr[1] = 0; arr[2] = 2;
2912 expect(TRUE, r);
2913
2914 SetRect(&rect, LVIR_BOUNDS, 0, -1, -1);
2916 expect(TRUE, r);
2917 expect(0, rect.left);
2918 expect(600, rect.right);
2919
2920 SetRect(&rect, LVIR_BOUNDS, 1, -1, -1);
2922 expect(TRUE, r);
2923 expect(0, rect.left);
2924 expect(200, rect.right);
2925
2926 SetRect(&rect2, LVIR_BOUNDS, 1, -1, -1);
2928 expect(TRUE, r);
2929 expect(0, rect2.left);
2930 expect(200, rect2.right);
2931 /* items are of the same height */
2932 ok(rect2.top > 0, "expected positive item height\n");
2933 expect(rect.bottom, rect2.top);
2934 expect(rect.bottom * 2 - rect.top, rect2.bottom);
2935
2936 SetRect(&rect, LVIR_BOUNDS, 2, -1, -1);
2938 expect(TRUE, r);
2939 expect(300, rect.left);
2940 expect(600, rect.right);
2941
2943
2944 /* try it for non LVS_REPORT style */
2945 hwnd = CreateWindowA(WC_LISTVIEWA, "Test", LVS_ICON, 0, 0, 100, 100, NULL, NULL,
2947 SetRect(&rect, LVIR_BOUNDS, 1, -10, -10);
2949 expect(0, r);
2950 /* rect is unchanged */
2951 expect(0, rect.left);
2952 expect(-10, rect.right);
2953 expect(1, rect.top);
2954 expect(-10, rect.bottom);
2956}
2957
2958/* comparison callback for test_sorting */
2960{
2961 if (first == second) return 0;
2962 return (first > second ? 1 : -1);
2963}
2964
2965static void test_sorting(void)
2966{
2967 HWND hwnd;
2968 LVITEMA item = {0};
2969 INT r;
2971 static CHAR names[][5] = {"A", "B", "C", "D", "0"};
2972 CHAR buff[10];
2973
2975 ok(hwnd != NULL, "failed to create a listview window\n");
2976
2977 /* insert some items */
2978 item.mask = LVIF_PARAM | LVIF_STATE;
2979 item.state = LVIS_SELECTED;
2980 item.iItem = 0;
2981 item.iSubItem = 0;
2982 item.lParam = 3;
2984 expect(0, r);
2985
2986 item.mask = LVIF_PARAM;
2987 item.iItem = 1;
2988 item.iSubItem = 0;
2989 item.lParam = 2;
2991 expect(1, r);
2992
2993 item.mask = LVIF_STATE | LVIF_PARAM;
2994 item.state = LVIS_SELECTED;
2995 item.iItem = 2;
2996 item.iSubItem = 0;
2997 item.lParam = 4;
2999 expect(2, r);
3000
3002 expect(-1, r);
3003
3005 expect(2, r);
3006
3008 expect(TRUE, r);
3009
3011 expect(2, r);
3013 expect(-1, r);
3015 expect(0, r);
3020
3022
3023 /* switch to LVS_SORTASCENDING when some items added */
3025 ok(hwnd != NULL, "failed to create a listview window\n");
3026
3027 item.mask = LVIF_TEXT;
3028 item.iItem = 0;
3029 item.iSubItem = 0;
3030 item.pszText = names[1];
3032 expect(0, r);
3033
3034 item.mask = LVIF_TEXT;
3035 item.iItem = 1;
3036 item.iSubItem = 0;
3037 item.pszText = names[2];
3039 expect(1, r);
3040
3041 item.mask = LVIF_TEXT;
3042 item.iItem = 2;
3043 item.iSubItem = 0;
3044 item.pszText = names[0];
3046 expect(2, r);
3047
3051 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
3052
3053 /* no sorting performed when switched to LVS_SORTASCENDING */
3054 item.mask = LVIF_TEXT;
3055 item.iItem = 0;
3056 item.pszText = buff;
3057 item.cchTextMax = sizeof(buff);
3059 expect(TRUE, r);
3060 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
3061
3062 item.iItem = 1;
3064 expect(TRUE, r);
3065 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
3066
3067 item.iItem = 2;
3069 expect(TRUE, r);
3070 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3071
3072 /* adding new item doesn't resort list */
3073 item.mask = LVIF_TEXT;
3074 item.iItem = 3;
3075 item.iSubItem = 0;
3076 item.pszText = names[3];
3078 expect(3, r);
3079
3080 item.mask = LVIF_TEXT;
3081 item.iItem = 0;
3082 item.pszText = buff;
3083 item.cchTextMax = sizeof(buff);
3085 expect(TRUE, r);
3086 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
3087
3088 item.iItem = 1;
3090 expect(TRUE, r);
3091 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
3092
3093 item.iItem = 2;
3095 expect(TRUE, r);
3096 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3097
3098 item.iItem = 3;
3100 expect(TRUE, r);
3101 ok(lstrcmpA(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
3102
3103 /* corner case - item should be placed at first position */
3104 item.mask = LVIF_TEXT;
3105 item.iItem = 4;
3106 item.iSubItem = 0;
3107 item.pszText = names[4];
3109 expect(0, r);
3110
3111 item.iItem = 0;
3112 item.pszText = buff;
3113 item.cchTextMax = sizeof(buff);
3115 expect(TRUE, r);
3116 ok(lstrcmpA(buff, names[4]) == 0, "Expected '%s', got '%s'\n", names[4], buff);
3117
3118 item.iItem = 1;
3119 item.pszText = buff;
3120 item.cchTextMax = sizeof(buff);
3122 expect(TRUE, r);
3123 ok(lstrcmpA(buff, names[1]) == 0, "Expected '%s', got '%s'\n", names[1], buff);
3124
3125 item.iItem = 2;
3127 expect(TRUE, r);
3128 ok(lstrcmpA(buff, names[2]) == 0, "Expected '%s', got '%s'\n", names[2], buff);
3129
3130 item.iItem = 3;
3132 expect(TRUE, r);
3133 ok(lstrcmpA(buff, names[0]) == 0, "Expected '%s', got '%s'\n", names[0], buff);
3134
3135 item.iItem = 4;
3137 expect(TRUE, r);
3138 ok(lstrcmpA(buff, names[3]) == 0, "Expected '%s', got '%s'\n", names[3], buff);
3139
3141}
3142
3143static void test_ownerdata(void)
3144{
3145 static char test_str[] = "test";
3146
3147 HWND hwnd;
3149 DWORD res;
3150 LVITEMA item;
3151
3152 /* it isn't possible to set LVS_OWNERDATA after creation */
3153 if (g_is_below_5)
3154 {
3155 win_skip("set LVS_OWNERDATA after creation leads to crash on < 5.80\n");
3156 }
3157 else
3158 {
3160 ok(hwnd != NULL, "failed to create a listview window\n");
3162 ok(!(style & LVS_OWNERDATA) && style, "LVS_OWNERDATA isn't expected\n");
3163
3165
3167 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3169 "try to switch to LVS_OWNERDATA seq", FALSE);
3170
3172 ok(!(style & LVS_OWNERDATA), "LVS_OWNERDATA isn't expected\n");
3174 }
3175
3176 /* try to set LVS_OWNERDATA after creation just having it */
3178 ok(hwnd != NULL, "failed to create a listview window\n");
3180 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3181
3183
3185 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3187 "try to switch to LVS_OWNERDATA seq", FALSE);
3189
3190 /* try to remove LVS_OWNERDATA after creation just having it */
3191 if (g_is_below_5)
3192 {
3193 win_skip("remove LVS_OWNERDATA after creation leads to crash on < 5.80\n");
3194 }
3195 else
3196 {
3198 ok(hwnd != NULL, "failed to create a listview window\n");
3200 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3201
3203
3205 ok(ret == style, "Expected set GWL_STYLE to succeed\n");
3207 "try to switch to LVS_OWNERDATA seq", FALSE);
3209 ok(style & LVS_OWNERDATA, "LVS_OWNERDATA is expected\n");
3211 }
3212
3213 /* try select an item */
3215 ok(hwnd != NULL, "failed to create a listview window\n");
3217 expect(1, res);
3219 expect(0, res);
3220 memset(&item, 0, sizeof(item));
3221 item.stateMask = LVIS_SELECTED;
3222 item.state = LVIS_SELECTED;
3224 expect(TRUE, res);
3226 expect(1, res);
3228 expect(1, res);
3230
3231 /* LVM_SETITEM and LVM_SETITEMTEXT is unsupported on LVS_OWNERDATA */
3233 ok(hwnd != NULL, "failed to create a listview window\n");
3235 expect(1, res);
3237 expect(1, res);
3238 memset(&item, 0, sizeof(item));
3239 item.mask = LVIF_STATE;
3240 item.iItem = 0;
3241 item.stateMask = LVIS_SELECTED;
3242 item.state = LVIS_SELECTED;
3244 expect(FALSE, res);
3245 memset(&item, 0, sizeof(item));
3246 item.pszText = test_str;
3248 expect(FALSE, res);
3250
3251 /* check notifications after focused/selected changed */
3253 ok(hwnd != NULL, "failed to create a listview window\n");
3255 expect(1, res);
3256
3258
3259 memset(&item, 0, sizeof(item));
3260 item.stateMask = LVIS_SELECTED;
3261 item.state = LVIS_SELECTED;
3263 expect(TRUE, res);
3264
3266 "ownerdata select notification", TRUE);
3267
3269
3270 memset(&item, 0, sizeof(item));
3271 item.stateMask = LVIS_FOCUSED;
3272 item.state = LVIS_FOCUSED;
3274 expect(TRUE, res);
3275
3277 "ownerdata focus notification", TRUE);
3278
3279 /* select all, check notifications */
3280 item.stateMask = LVIS_SELECTED;
3281 item.state = 0;
3283 expect(TRUE, res);
3284
3286
3287 item.stateMask = LVIS_SELECTED;
3288 item.state = LVIS_SELECTED;
3289
3290 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3292 expect(TRUE, res);
3293 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3294 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3295 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
3296 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3297 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3298 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3299 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3300
3302 "ownerdata select all notification", FALSE);
3303
3304 /* select all again, note that all items are selected already */
3306 item.stateMask = LVIS_SELECTED;
3307 item.state = LVIS_SELECTED;
3308
3309 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3311 expect(TRUE, res);
3312 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3313 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3314 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
3315 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3316 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3317 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3318 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3319
3321 "ownerdata select all notification", FALSE);
3322
3323 /* deselect all */
3325 item.stateMask = LVIS_SELECTED;
3326 item.state = 0;
3327
3328 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3330 expect(TRUE, res);
3331 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3332 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3333 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3334 ok(g_nmlistview.uOldState == LVIS_SELECTED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3335 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3336 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3337 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3338
3340 "ownerdata deselect all notification", TRUE);
3341
3342 /* nothing selected, deselect all again */
3344 item.stateMask = LVIS_SELECTED;
3345 item.state = 0;
3346
3348 expect(TRUE, res);
3349
3350 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "ownerdata deselect all notification", FALSE);
3351
3352 /* select one, then deselect all */
3353 item.stateMask = LVIS_SELECTED;
3354 item.state = LVIS_SELECTED;
3356 expect(TRUE, res);
3358 item.stateMask = LVIS_SELECTED;
3359 item.state = 0;
3360
3361 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3363 expect(TRUE, res);
3364 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3365 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3366 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3367 ok(g_nmlistview.uOldState == LVIS_SELECTED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3368 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3369 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3370 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3371
3373 "ownerdata select all notification", TRUE);
3374
3375 /* remove focused, try to focus all */
3376 item.stateMask = LVIS_FOCUSED;
3377 item.state = LVIS_FOCUSED;
3379 expect(TRUE, res);
3380 item.stateMask = LVIS_FOCUSED;
3381 item.state = 0;
3383 expect(TRUE, res);
3384 item.stateMask = LVIS_FOCUSED;
3386 expect(0, res);
3387
3388 /* setting all to focused returns failure value */
3390 item.stateMask = LVIS_FOCUSED;
3391 item.state = LVIS_FOCUSED;
3392
3394 expect(FALSE, res);
3395
3397 "ownerdata focus all notification", FALSE);
3398
3399 /* focus single item, remove all */
3400 item.stateMask = LVIS_FOCUSED;
3401 item.state = LVIS_FOCUSED;
3403 expect(TRUE, res);
3405 item.stateMask = LVIS_FOCUSED;
3406 item.state = 0;
3407
3408 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3410 expect(TRUE, res);
3411 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3412 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3413 ok(g_nmlistview.uNewState == 0, "got new state 0x%08x\n", g_nmlistview.uNewState);
3414 ok(g_nmlistview.uOldState == LVIS_FOCUSED, "got old state 0x%08x\n", g_nmlistview.uOldState);
3415 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3416 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3417 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3418
3420 "ownerdata remove focus all notification", TRUE);
3421
3422 /* set all cut */
3424 item.stateMask = LVIS_CUT;
3425 item.state = LVIS_CUT;
3426
3427 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3429 expect(TRUE, res);
3430 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3431 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3432 ok(g_nmlistview.uNewState == LVIS_CUT, "got new state 0x%08x\n", g_nmlistview.uNewState);
3433 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3434 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3435 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3436 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3437
3439 "ownerdata cut all notification", FALSE);
3440
3441 /* all marked cut, try again */
3443 item.stateMask = LVIS_CUT;
3444 item.state = LVIS_CUT;
3445
3446 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
3448 expect(TRUE, res);
3449 ok(g_nmlistview.iItem == -1, "got item %d\n", g_nmlistview.iItem);
3450 ok(g_nmlistview.iSubItem == 0, "got subitem %d\n", g_nmlistview.iSubItem);
3451 ok(g_nmlistview.uNewState == LVIS_CUT, "got new state 0x%08x\n", g_nmlistview.uNewState);
3452 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
3453 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
3454 ok(g_nmlistview.ptAction.x == 0 && g_nmlistview.ptAction.y == 0, "got wrong ptAction value\n");
3455 ok(g_nmlistview.lParam == 0, "got wrong lparam\n");
3456
3458 "ownerdata cut all notification #2", FALSE);
3459
3461
3462 /* check notifications on LVM_GETITEM */
3463 /* zero callback mask */
3465 ok(hwnd != NULL, "failed to create a listview window\n");
3467 expect(1, res);
3468
3470
3471 memset(&item, 0, sizeof(item));
3472 item.stateMask = LVIS_SELECTED;
3473 item.mask = LVIF_STATE;
3475 expect(TRUE, res);
3476
3478 "ownerdata getitem selected state 1", FALSE);
3479
3480 /* non zero callback mask but not we asking for */
3482 expect(TRUE, res);
3483
3485
3486 memset(&item, 0, sizeof(item));
3487 item.stateMask = LVIS_SELECTED;
3488 item.mask = LVIF_STATE;
3490 expect(TRUE, res);
3491
3493 "ownerdata getitem selected state 2", FALSE);
3494
3495 /* LVIS_OVERLAYMASK callback mask, asking for index */
3497
3498 memset(&item, 0, sizeof(item));
3499 item.stateMask = LVIS_OVERLAYMASK;
3500 item.mask = LVIF_STATE;
3502 expect(TRUE, res);
3503
3505 "ownerdata getitem selected state 2", FALSE);
3506
3508
3509 /* LVS_SORTASCENDING/LVS_SORTDESCENDING aren't compatible with LVS_OWNERDATA */
3511 ok(hwnd != NULL, "failed to create a listview window\n");
3513 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3514 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
3517 ok(!(style & LVS_SORTASCENDING), "Expected LVS_SORTASCENDING not set\n");
3519 /* apparently it's allowed to switch these style on after creation */
3521 ok(hwnd != NULL, "failed to create a listview window\n");
3523 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3526 ok(style & LVS_SORTASCENDING, "Expected LVS_SORTASCENDING to be set\n");
3528
3530 ok(hwnd != NULL, "failed to create a listview window\n");
3532 ok(style & LVS_OWNERDATA, "Expected LVS_OWNERDATA\n");
3535 ok(style & LVS_SORTDESCENDING, "Expected LVS_SORTDESCENDING to be set\n");
3537
3538 /* The focused item is updated after the invalidation */
3540 ok(hwnd != NULL, "failed to create a listview window\n");
3542 expect(TRUE, res);
3543
3544 memset(&item, 0, sizeof(item));
3545 item.stateMask = LVIS_FOCUSED;
3546 item.state = LVIS_FOCUSED;
3548 expect(TRUE, res);
3549
3552 expect(TRUE, res);
3554 "ownerdata setitemcount", FALSE);
3555
3557 expect(-1, res);
3559}
3560
3561static void test_norecompute(void)
3562{
3563 static CHAR testA[] = "test";
3564 CHAR buff[10];
3565 LVITEMA item;
3566 HWND hwnd;
3567 DWORD res;
3568
3569 /* self containing control */
3571 ok(hwnd != NULL, "failed to create a listview window\n");
3572 memset(&item, 0, sizeof(item));
3573 item.mask = LVIF_TEXT | LVIF_STATE;
3574 item.iItem = 0;
3575 item.stateMask = LVIS_SELECTED;
3576 item.state = LVIS_SELECTED;
3577 item.pszText = testA;
3579 expect(0, res);
3580 /* retrieve with LVIF_NORECOMPUTE */
3582 item.iItem = 0;
3583 item.pszText = buff;
3584 item.cchTextMax = ARRAY_SIZE(buff);
3586 expect(TRUE, res);
3587 ok(lstrcmpA(buff, testA) == 0, "Expected (%s), got (%s)\n", testA, buff);
3588
3589 item.mask = LVIF_TEXT;
3590 item.iItem = 1;
3591 item.pszText = LPSTR_TEXTCALLBACKA;
3593 expect(1, res);
3594
3596 item.iItem = 1;
3597 item.pszText = buff;
3598 item.cchTextMax = ARRAY_SIZE(buff);
3599
3602 expect(TRUE, res);
3603 ok(item.pszText == LPSTR_TEXTCALLBACKA, "Expected (%p), got (%p)\n",
3604 LPSTR_TEXTCALLBACKA, (VOID*)item.pszText);
3605 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq", FALSE);
3606
3608
3609 /* LVS_OWNERDATA */
3611 ok(hwnd != NULL, "failed to create a listview window\n");
3612
3613 item.mask = LVIF_STATE;
3614 item.stateMask = LVIS_SELECTED;
3615 item.state = LVIS_SELECTED;
3616 item.iItem = 0;
3618 expect(0, res);
3619
3621 item.iItem = 0;
3622 item.pszText = buff;
3623 item.cchTextMax = ARRAY_SIZE(buff);
3626 expect(TRUE, res);
3627 ok(item.pszText == LPSTR_TEXTCALLBACKA, "Expected (%p), got (%p)\n",
3628 LPSTR_TEXTCALLBACKA, (VOID*)item.pszText);
3629 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq 2", FALSE);
3630
3632}
3633
3634static void test_nosortheader(void)
3635{
3636 HWND hwnd, header;
3638
3640 ok(hwnd != NULL, "failed to create a listview window\n");
3641
3643 ok(IsWindow(header), "header expected\n");
3644
3646 ok(style & HDS_BUTTONS, "expected header to have HDS_BUTTONS\n");
3647
3650 /* HDS_BUTTONS retained */
3652 ok(style & HDS_BUTTONS, "expected header to retain HDS_BUTTONS\n");
3653
3655
3656 /* create with LVS_NOSORTHEADER */
3658 ok(hwnd != NULL, "failed to create a listview window\n");
3659
3661 ok(IsWindow(header), "header expected\n");
3662
3664 ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
3665
3668 /* not changed here */
3670 ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
3671
3673}
3674
3675static void test_setredraw(void)
3676{
3677 HWND hwnd;
3679 DWORD ret;
3680 HDC hdc;
3681 RECT rect;
3682
3684 ok(hwnd != NULL, "failed to create a listview window\n");
3685
3686 /* Passing WM_SETREDRAW to DefWinProc removes WS_VISIBLE.
3687 ListView seems to handle it internally without DefWinProc */
3688
3689 /* default value first */
3691 expect(0, ret);
3692 /* disable */
3694 ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
3696 expect(0, ret);
3698 ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
3700 expect(0, ret);
3701
3702 /* check update rect after redrawing */
3704 expect(0, ret);
3707 rect.right = rect.bottom = 1;
3709 expect(0, rect.right);
3710 expect(0, rect.bottom);
3711
3712 /* WM_ERASEBKGND */
3715 expect(TRUE, ret);
3717 expect(0, ret);
3719 expect(TRUE, ret);
3721 expect(0, ret);
3723
3724 /* check notification messages to show that repainting is disabled */
3726 expect(TRUE, ret);
3728 expect(0, ret);
3730
3734 "redraw after WM_SETREDRAW (FALSE)", FALSE);
3735
3737 expect(TRUE, ret);
3742 "redraw after WM_SETREDRAW (FALSE) with CLR_NONE bkgnd", FALSE);
3743
3744 /* message isn't forwarded to header */
3748 expect(0, ret);
3750 "WM_SETREDRAW: not forwarded to header", FALSE);
3751
3753}
3754
3755static void test_hittest(void)
3756{
3757 HWND hwnd;
3758 DWORD r;
3759 RECT bounds;
3760 LVITEMA item;
3761 static CHAR text[] = "1234567890ABCDEFGHIJKLMNOPQRST";
3762 POINT pos;
3763 INT x, y, i;
3764 WORD vert;
3765 HIMAGELIST himl, himl2;
3766 HBITMAP hbmp;
3767
3769 ok(hwnd != NULL, "failed to create a listview window\n");
3770
3771 /* LVS_REPORT with a single subitem (2 columns) */
3772 insert_column(hwnd, 0);
3773 insert_column(hwnd, 1);
3774 insert_item(hwnd, 0);
3775
3776 item.iSubItem = 0;
3777 /* the only purpose of that line is to be as long as a half item rect */
3778 item.pszText = text;
3780 expect(TRUE, r);
3781
3783 expect(TRUE, r);
3785 expect(TRUE, r);
3786
3787 SetRect(&bounds, LVIR_BOUNDS, 0, 0, 0);
3788 r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&bounds);
3789 expect(1, r);
3790 ok(bounds.bottom - bounds.top > 0, "Expected non zero item height\n");
3791 ok(bounds.right - bounds.left > 0, "Expected non zero item width\n");
3793 vert = HIWORD(r);
3794 ok(bounds.bottom - bounds.top == vert,
3795 "Vertical spacing inconsistent (%d != %d)\n", bounds.bottom - bounds.top, vert);
3797 expect(TRUE, r);
3798
3799 /* LVS_EX_FULLROWSELECT not set, no icons attached */
3800
3801 /* outside columns by x position - valid is [0, 199] */
3802 x = -1;
3803 y = pos.y + (bounds.bottom - bounds.top) / 2;
3806
3807 x = pos.x + 50; /* column half width */
3808 y = pos.y + (bounds.bottom - bounds.top) / 2;
3811 x = pos.x + 150; /* outside column */
3812 y = pos.y + (bounds.bottom - bounds.top) / 2;
3815 y = (bounds.bottom - bounds.top) / 2;
3818 /* outside possible client rectangle (to right) */
3819 x = pos.x + 500;
3820 y = pos.y + (bounds.bottom - bounds.top) / 2;
3823 y = (bounds.bottom - bounds.top) / 2;
3826 /* subitem returned with -1 item too */
3827 x = pos.x + 150;
3828 y = bounds.top - vert;
3830 test_lvm_subitemhittest(hwnd, x, y - vert + 1, -1, 1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
3831 /* return values appear to underflow with negative indices */
3832 i = -2;
3833 y = y - vert;
3834 while (i > -10) {
3837 y = y - vert;
3838 i--;
3839 }
3840 /* parent client area is 100x100 by default */
3841 MoveWindow(hwnd, 0, 0, 300, 100, FALSE);
3842 x = pos.x + 150; /* outside column */
3843 y = pos.y + (bounds.bottom - bounds.top) / 2;
3846 y = (bounds.bottom - bounds.top) / 2;
3849 /* the same with LVS_EX_FULLROWSELECT */
3851 x = pos.x + 150; /* outside column */
3852 y = pos.y + (bounds.bottom - bounds.top) / 2;
3855 y = (bounds.bottom - bounds.top) / 2;
3857 MoveWindow(hwnd, 0, 0, 100, 100, FALSE);
3858 x = pos.x + 150; /* outside column */
3859 y = pos.y + (bounds.bottom - bounds.top) / 2;
3862 y = (bounds.bottom - bounds.top) / 2;
3865 /* outside possible client rectangle (to right) */
3866 x = pos.x + 500;
3867 y = pos.y + (bounds.bottom - bounds.top) / 2;
3870 y = (bounds.bottom - bounds.top) / 2;
3873 /* try with icons, state icons index is 1 based so at least 2 bitmaps needed */
3874 himl = pImageList_Create(16, 16, 0, 4, 4);
3875 ok(himl != NULL, "failed to create imagelist\n");
3876 hbmp = CreateBitmap(16, 16, 1, 1, NULL);
3877 ok(hbmp != NULL, "failed to create bitmap\n");
3878 r = pImageList_Add(himl, hbmp, 0);
3879 ok(r == 0, "should be zero\n");
3880 hbmp = CreateBitmap(16, 16, 1, 1, NULL);
3881 ok(hbmp != NULL, "failed to create bitmap\n");
3882 r = pImageList_Add(himl, hbmp, 0);
3883 ok(r == 1, "should be one\n");
3884
3886 expect(0, r);
3887
3888 item.mask = LVIF_IMAGE;
3889 item.iImage = 0;
3890 item.iItem = 0;
3891 item.iSubItem = 0;
3893 expect(TRUE, r);
3894 /* on state icon */
3895 x = pos.x + 8;
3896 y = pos.y + (bounds.bottom - bounds.top) / 2;
3899 y = (bounds.bottom - bounds.top) / 2;
3901
3902 /* state icons indices are 1 based, check with valid index */
3903 item.mask = LVIF_STATE;
3904 item.state = INDEXTOSTATEIMAGEMASK(1);
3905 item.stateMask = LVIS_STATEIMAGEMASK;
3906 item.iItem = 0;
3907 item.iSubItem = 0;
3909 expect(TRUE, r);
3910 /* on state icon */
3911 x = pos.x + 8;
3912 y = pos.y + (bounds.bottom - bounds.top) / 2;
3915 y = (bounds.bottom - bounds.top) / 2;
3917
3919 ok(himl2 == himl, "should return handle\n");
3920
3922 expect(0, r);
3923 /* on item icon */
3924 x = pos.x + 8;
3925 y = pos.y + (bounds.bottom - bounds.top) / 2;
3928 y = (bounds.bottom - bounds.top) / 2;
3930
3932}
3933
3934static void test_getviewrect(void)
3935{
3936 HWND hwnd;
3937 DWORD r;
3938 RECT rect;
3939 LVITEMA item;
3940
3942 ok(hwnd != NULL, "failed to create a listview window\n");
3943
3944 /* empty */
3946 expect(TRUE, r);
3947
3948 insert_column(hwnd, 0);
3949 insert_column(hwnd, 1);
3950
3951 memset(&item, 0, sizeof(item));
3952 item.iItem = 0;
3953 item.iSubItem = 0;
3955 ok(!r, "got %d\n", r);
3956
3958 expect(TRUE, r);
3960 expect(TRUE, r);
3961
3962 SetRect(&rect, -1, -1, -1, -1);
3964 expect(TRUE, r);
3965 /* left is set to (2e31-1) - XP SP2 */
3966 expect(0, rect.right);
3967 expect(0, rect.top);
3968 expect(0, rect.bottom);
3969
3970 /* switch to LVS_ICON */
3972
3973 SetRect(&rect, -1, -1, -1, -1);
3975 expect(TRUE, r);
3976 expect(0, rect.left);
3977 expect(0, rect.top);
3978 /* precise value differs for 2k, XP and Vista */
3979 ok(rect.bottom > 0, "Expected positive bottom value, got %d\n", rect.bottom);
3980 ok(rect.right > 0, "Expected positive right value, got %d\n", rect.right);
3981
3983}
3984
3985static void test_getitemposition(void)
3986{
3987 HWND hwnd, header;
3988 DWORD r;
3989 POINT pt;
3990 RECT rect;
3991
3993 ok(hwnd != NULL, "failed to create a listview window\n");
3995
3996 /* LVS_REPORT, single item, no columns added */
3997 insert_item(hwnd, 0);
3998
4000
4001 pt.x = pt.y = -1;
4003 expect(TRUE, r);
4005
4006 /* LVS_REPORT, single item, single column */
4007 insert_column(hwnd, 0);
4008
4010
4011 pt.x = pt.y = -1;
4013 expect(TRUE, r);
4015
4018 ok(r, "got %d\n", r);
4019 /* some padding? */
4020 expect(2, pt.x);
4021 /* offset by header height */
4022 expect(rect.bottom - rect.top, pt.y);
4023
4025}
4026
4027static void test_getitemrect(void)
4028{
4029 HWND hwnd;
4030 HIMAGELIST himl, himl_ret;
4031 HBITMAP hbm;
4032 RECT rect;
4033 DWORD r;
4034 LVITEMA item;
4035 LVCOLUMNA col;
4036 INT order[2];
4037 POINT pt;
4038
4039 /* rectangle isn't empty for empty text items */
4041 memset(&item, 0, sizeof(item));
4042 item.mask = 0;
4043 item.iItem = 0;
4045 expect(0, r);
4046 rect.left = LVIR_LABEL;
4048 expect(TRUE, r);
4049 expect(0, rect.left);
4050 expect(0, rect.top);
4051 /* estimate it as width / height ratio */
4053 ok((rect.right / rect.bottom) >= 5, "got right %d, bottom %d\n", rect.right, rect.bottom);
4055
4057 ok(hwnd != NULL, "failed to create a listview window\n");
4058
4059 /* empty item */
4060 memset(&item, 0, sizeof(item));
4061 item.iItem = 0;
4062 item.iSubItem = 0;
4064 expect(0, r);
4065
4066 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4068 expect(TRUE, r);
4069
4070 /* zero width rectangle with no padding */
4071 expect(0, rect.left);
4072 expect(0, rect.right);
4073
4074 insert_column(hwnd, 0);
4075 insert_column(hwnd, 1);
4076
4077 col.mask = LVCF_WIDTH;
4078 col.cx = 50;
4079 r = SendMessageA(hwnd, LVM_SETCOLUMNA, 0, (LPARAM)&col);
4080 expect(TRUE, r);
4081
4082 col.mask = LVCF_WIDTH;
4083 col.cx = 100;
4084 r = SendMessageA(hwnd, LVM_SETCOLUMNA, 1, (LPARAM)&col);
4085 expect(TRUE, r);
4086
4087 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4089 expect(TRUE, r);
4090
4091 /* still no left padding */
4092 expect(0, rect.left);
4093 expect(150, rect.right);
4094
4095 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4097 expect(TRUE, r);
4098 /* padding */
4099 expect(2, rect.left);
4100
4101 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4103 expect(TRUE, r);
4104 /* padding, column width */
4105 expect(2, rect.left);
4106 expect(50, rect.right);
4107
4108 /* no icons attached */
4109 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4111 expect(TRUE, r);
4112 /* padding */
4113 expect(2, rect.left);
4114 expect(2, rect.right);
4115
4116 /* change order */
4117 order[0] = 1; order[1] = 0;
4119 expect(TRUE, r);
4120 pt.x = -1;
4122 expect(TRUE, r);
4123 /* 1 indexed column width + padding */
4124 expect(102, pt.x);
4125 /* rect is at zero too */
4126 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4128 expect(TRUE, r);
4129 expect(0, rect.left);
4130 /* just width sum */
4131 expect(150, rect.right);
4132
4133 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4135 expect(TRUE, r);
4136 /* column width + padding */
4137 expect(102, rect.left);
4138
4139 /* back to initial order */
4140 order[0] = 0; order[1] = 1;
4142 expect(TRUE, r);
4143
4144 /* state icons */
4145 himl = pImageList_Create(16, 16, 0, 2, 2);
4146 ok(himl != NULL, "failed to create imagelist\n");
4147 hbm = CreateBitmap(16, 16, 1, 1, NULL);
4148 ok(hbm != NULL, "failed to create bitmap\n");
4149 r = pImageList_Add(himl, hbm, 0);
4150 expect(0, r);
4151 hbm = CreateBitmap(16, 16, 1, 1, NULL);
4152 ok(hbm != NULL, "failed to create bitmap\n");
4153 r = pImageList_Add(himl, hbm, 0);
4154 expect(1, r);
4155
4157 expect(0, r);
4158
4159 item.mask = LVIF_STATE;
4160 item.state = INDEXTOSTATEIMAGEMASK(1);
4161 item.stateMask = LVIS_STATEIMAGEMASK;
4162 item.iItem = 0;
4163 item.iSubItem = 0;
4165 expect(TRUE, r);
4166
4167 /* icon bounds */
4168 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4170 expect(TRUE, r);
4171 /* padding + stateicon width */
4172 expect(18, rect.left);
4173 expect(18, rect.right);
4174 /* label bounds */
4175 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4177 expect(TRUE, r);
4178 /* padding + stateicon width -> column width */
4179 expect(18, rect.left);
4180 expect(50, rect.right);
4181
4183 ok(himl_ret == himl, "got %p, expected %p\n", himl_ret, himl);
4184
4186 expect(0, r);
4187
4188 item.mask = LVIF_STATE | LVIF_IMAGE;
4189 item.iImage = 1;
4190 item.state = 0;
4191 item.stateMask = ~0;
4192 item.iItem = 0;
4193 item.iSubItem = 0;
4195 expect(TRUE, r);
4196
4197 /* icon bounds */
4198 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4200 expect(TRUE, r);
4201 /* padding, icon width */
4202 expect(2, rect.left);
4203 expect(18, rect.right);
4204 /* label bounds */
4205 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4207 expect(TRUE, r);
4208 /* padding + icon width -> column width */
4209 expect(18, rect.left);
4210 expect(50, rect.right);
4211
4212 /* select bounds */
4213 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4215 expect(TRUE, r);
4216 /* padding, column width */
4217 expect(2, rect.left);
4218 expect(50, rect.right);
4219
4220 /* try with indentation */
4221 item.mask = LVIF_INDENT;
4222 item.iIndent = 1;
4223 item.iItem = 0;
4224 item.iSubItem = 0;
4226 expect(TRUE, r);
4227
4228 /* bounds */
4229 SetRect(&rect, LVIR_BOUNDS, -1, -1, -1);
4231 expect(TRUE, r);
4232 /* padding + 1 icon width, column width */
4233 expect(0, rect.left);
4234 expect(150, rect.right);
4235
4236 /* select bounds */
4237 SetRect(&rect, LVIR_SELECTBOUNDS, -1, -1, -1);
4239 expect(TRUE, r);
4240 /* padding + 1 icon width, column width */
4241 expect(2 + 16, rect.left);
4242 expect(50, rect.right);
4243
4244 /* label bounds */
4245 SetRect(&rect, LVIR_LABEL, -1, -1, -1);
4247 expect(TRUE, r);
4248 /* padding + 2 icon widths, column width */
4249 expect(2 + 16*2, rect.left);
4250 expect(50, rect.right);
4251
4252 /* icon bounds */
4253 SetRect(&rect, LVIR_ICON, -1, -1, -1);
4255 expect(TRUE, r);
4256 /* padding + 1 icon width indentation, icon width */
4257 expect(2 + 16, rect.left);
4258 expect(34, rect.right);
4259
4261}
4262
4263static void test_editbox(void)
4264{
4265 static CHAR testitemA[] = "testitem";
4266 static CHAR testitem1A[] = "testitem_quitelongname";
4267 static CHAR testitem2A[] = "testITEM_quitelongname";
4268 static CHAR buffer[25];
4269 HWND hwnd, hwndedit, hwndedit2, header;
4270 LVITEMA item;
4271 INT r;
4272
4274 ok(hwnd != NULL, "failed to create a listview window\n");
4275
4276 insert_column(hwnd, 0);
4277
4278 memset(&item, 0, sizeof(item));
4279 item.mask = LVIF_TEXT;
4280 item.pszText = testitemA;
4281 item.iItem = 0;
4282 item.iSubItem = 0;
4284 expect(0, r);
4285
4286 /* test notifications without edit created */
4289 expect(0, r);
4291 "edit box WM_COMMAND (EN_SETFOCUS), no edit created", FALSE);
4292 /* same thing but with valid window */
4293 hwndedit = CreateWindowA(WC_EDITA, "Test edit", WS_VISIBLE | WS_CHILD, 0, 0, 20,
4297 expect(0, r);
4299 "edit box WM_COMMAND (EN_SETFOCUS), no edit created #2", FALSE);
4300 DestroyWindow(hwndedit);
4301
4302 /* setting focus is necessary */
4303 SetFocus(hwnd);
4304 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4305 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4306
4307 /* test children Z-order after Edit box created */
4309 ok(IsWindow(header), "Expected header to be created\n");
4310 ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n");
4311 ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT));
4312
4313 /* modify initial string */
4314 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A);
4315 expect(TRUE, r);
4316
4317 /* edit window is resized and repositioned,
4318 check again for Z-order - it should be preserved */
4319 ok(GetTopWindow(hwnd) == header, "Expected header to be on top\n");
4320 ok(GetNextWindow(header, GW_HWNDNEXT) == hwndedit, "got %p\n", GetNextWindow(header, GW_HWNDNEXT));
4321
4322 /* return focus to listview */
4323 SetFocus(hwnd);
4324
4325 memset(&item, 0, sizeof(item));
4326 item.mask = LVIF_TEXT;
4327 item.pszText = buffer;
4328 item.cchTextMax = sizeof(buffer);
4329 item.iItem = 0;
4330 item.iSubItem = 0;
4332 expect(TRUE, r);
4333
4334 ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
4335
4336 /* send LVM_EDITLABEL on already created edit */
4337 SetFocus(hwnd);
4338 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4339 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4340 /* focus will be set to edit */
4341 ok(GetFocus() == hwndedit, "Expected Edit window to be focused\n");
4342 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4343 ok(IsWindow(hwndedit2), "Expected Edit window to be created\n");
4344
4345 /* creating label disabled when control isn't focused */
4346 SetFocus(0);
4347 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4348 todo_wine ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4349
4350 /* check EN_KILLFOCUS handling */
4351 memset(&item, 0, sizeof(item));
4352 item.pszText = testitemA;
4353 item.iItem = 0;
4354 item.iSubItem = 0;
4356 expect(TRUE, r);
4357
4358 SetFocus(hwnd);
4359 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4360 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4361 /* modify edit and notify control that it lost focus */
4362 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A);
4363 expect(TRUE, r);
4366 expect(0, r);
4367 ok(g_editbox_disp_info.item.pszText != NULL, "expected notification with not null text\n");
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, testitem1A) == 0, "Expected item text to change\n");
4377 ok(!IsWindow(hwndedit), "Expected Edit window to be freed\n");
4378
4379 /* change item name to differ in casing only */
4380 SetFocus(hwnd);
4381 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4382 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4383 /* modify edit and notify control that it lost focus */
4384 r = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem2A);
4385 expect(TRUE, r);
4388 expect(0, r);
4390
4391 memset(&item, 0, sizeof(item));
4392 item.pszText = buffer;
4393 item.cchTextMax = sizeof(buffer);
4394 item.iItem = 0;
4395 item.iSubItem = 0;
4397 expect(lstrlenA(item.pszText), r);
4398 ok(strcmp(buffer, testitem2A) == 0, "got %s, expected %s\n", buffer, testitem2A);
4399 ok(!IsWindow(hwndedit), "Expected Edit window to be freed\n");
4400
4401 /* end edit without saving */
4402 SetFocus(hwnd);
4403 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4405 r = SendMessageA(hwndedit, WM_KEYDOWN, VK_ESCAPE, 0);
4406 expect(0, r);
4408 "edit box - end edit, no change, escape", TRUE);
4409 /* end edit with saving */
4410 SetFocus(hwnd);
4411 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4413 r = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
4414 expect(0, r);
4416 "edit box - end edit, no change, return", TRUE);
4417
4418 memset(&item, 0, sizeof(item));
4419 item.pszText = buffer;
4420 item.cchTextMax = sizeof(buffer);
4421 item.iItem = 0;
4422 item.iSubItem = 0;
4424 expect(lstrlenA(item.pszText), r);
4425 ok(strcmp(buffer, testitem2A) == 0, "Expected item text to change\n");
4426
4427 /* LVM_EDITLABEL with -1 destroys current edit */
4428 hwndedit = (HWND)SendMessageA(hwnd, LVM_GETEDITCONTROL, 0, 0);
4429 ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4430 /* no edit present */
4431 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -1, 0);
4432 ok(hwndedit == NULL, "Expected Edit window not to be created\n");
4433 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4434 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4435 /* edit present */
4436 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4437 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -1, 0);
4438 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4439 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4440 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4441 /* check another negative value */
4442 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4443 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4444 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4445 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, -2, 0);
4446 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4447 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4448 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4449 /* and value greater than max item index */
4450 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4451 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4452 ok(GetFocus() == hwndedit, "Expected Edit to be focused\n");
4454 hwndedit2 = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, r, 0);
4455 ok(hwndedit2 == NULL, "Expected Edit window not to be created\n");
4456 ok(!IsWindow(hwndedit), "Expected Edit window to be destroyed\n");
4457 ok(GetFocus() == hwnd, "Expected List to be focused\n");
4458
4459 /* messaging tests */
4460 SetFocus(hwnd);
4462 blockEdit = FALSE;
4463 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4464 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4465 /* testing only sizing messages */
4467 "edit box create - sizing", FALSE);
4468
4469 /* WM_COMMAND with EN_KILLFOCUS isn't forwarded to parent */
4470 SetFocus(hwnd);
4471 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4472 ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
4475 expect(0, r);
4477 "edit box WM_COMMAND (EN_KILLFOCUS)", TRUE);
4478
4480}
4481
4482static void test_notifyformat(void)
4483{
4484 HWND hwnd, header;
4485 DWORD r;
4486
4488 ok(hwnd != NULL, "failed to create a listview window\n");
4489
4490 /* CCM_GETUNICODEFORMAT == LVM_GETUNICODEFORMAT,
4491 CCM_SETUNICODEFORMAT == LVM_SETUNICODEFORMAT */
4493 expect(0, r);
4494 SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_QUERY);
4495 /* set */
4497 expect(0, r);
4499 ok(r == 1, "Unexpected return value %d.\n", r);
4501 expect(1, r);
4503 expect(0, r);
4504
4506
4507 /* test failure in parent WM_NOTIFYFORMAT */
4508 notifyFormat = 0;
4510 ok(hwnd != NULL, "failed to create a listview window\n");
4512 ok(IsWindow(header), "expected header to be created\n");
4514 expect(0, r);
4516 ok( r == 1, "Expected 1, got %d\n", r );
4517 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_QUERY);
4518 ok(r != 0, "Expected valid format\n");
4519
4521 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_REQUERY);
4524 expect(1, r);
4526 ok( r == 1, "Expected 1, got %d\n", r );
4527
4529 r = SendMessageA(hwnd, WM_NOTIFYFORMAT, 0, NF_REQUERY);
4530 expect(NFR_ANSI, r);
4532 expect(0, r);
4534 ok( r == 1, "Expected 1, got %d\n", r );
4535
4537
4539 ok(IsWindow(hwndparentW), "Unicode parent creation failed\n");
4540 if (!IsWindow(hwndparentW)) return;
4541
4542 notifyFormat = -1;
4544 ok(hwnd != NULL, "failed to create a listview window\n");
4546 ok(IsWindow(header), "expected header to be created\n");
4548 expect(1, r);
4550 expect(1, r);
4552 /* receiving error code defaulting to ansi */
4553 notifyFormat = 0;
4555 ok(hwnd != NULL, "failed to create a listview window\n");
4557 ok(IsWindow(header), "expected header to be created\n");
4559 expect(0, r);
4561 expect(1, r);
4563 /* receiving ansi code from unicode window, use it */
4566 ok(hwnd != NULL, "failed to create a listview window\n");
4568 ok(IsWindow(header), "expected header to be created\n");
4570 expect(0, r);
4572 expect(1, r);
4574 /* unicode listview with ansi parent window */
4575 notifyFormat = -1;
4577 ok(hwnd != NULL, "failed to create a listview window\n");
4579 ok(IsWindow(header), "expected header to be created\n");
4581 expect(0, r);
4583 expect(1, r);
4585 /* unicode listview with ansi parent window, return error code */
4586 notifyFormat = 0;
4588 ok(hwnd != NULL, "failed to create a listview window\n");
4590 ok(IsWindow(header), "expected header to be created\n");
4592 expect(0, r);
4594 expect(1, r);
4596
4598}
4599
4600static void test_indentation(void)
4601{
4602 HWND hwnd;
4603 LVITEMA item;
4604 DWORD r;
4605
4607 ok(hwnd != NULL, "failed to create a listview window\n");
4608
4609 memset(&item, 0, sizeof(item));
4610 item.mask = LVIF_INDENT;
4611 item.iItem = 0;
4612 item.iIndent = I_INDENTCALLBACK;
4614 expect(0, r);
4615
4617
4618 item.iItem = 0;
4619 item.mask = LVIF_INDENT;
4621 expect(TRUE, r);
4622
4624 "get indent dispinfo", FALSE);
4625
4626 /* Ask for iIndent with invalid subitem. */
4628
4629 memset(&item, 0, sizeof(item));
4630 item.mask = LVIF_INDENT;
4631 item.iSubItem = 1;
4633 ok(r, "Failed to get item.\n");
4634
4635 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "get indent dispinfo 2", FALSE);
4636
4638}
4639
4641{
4642 return 0;
4643}
4644
4646{
4647 HWND hwnd;
4648 BOOL ret;
4649
4651 ok(hwnd != NULL, "failed to create a listview window\n");
4652 insert_item(hwnd, 0);
4653
4655
4657
4658 return !ret;
4659}
4660
4661static void test_get_set_view(void)
4662{
4663 HWND hwnd;
4664 DWORD ret;
4666
4667 /* test style->view mapping */
4669 ok(hwnd != NULL, "failed to create a listview window\n");
4670
4671 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4673
4675 /* LVS_ICON == 0 */
4677 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4679
4682 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4684
4687 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4689
4690 /* switching view doesn't touch window style */
4692 expect(1, ret);
4694 ok(style & LVS_LIST, "Expected style to be preserved\n");
4696 expect(1, ret);
4698 ok(style & LVS_LIST, "Expected style to be preserved\n");
4700 expect(1, ret);
4702 ok(style & LVS_LIST, "Expected style to be preserved\n");
4703
4704 /* now change window style to see if view is remapped */
4707 ret = SendMessageA(hwnd, LVM_GETVIEW, 0, 0);
4709
4711}
4712
4713static void test_canceleditlabel(void)
4714{
4715 HWND hwnd, hwndedit;
4716 DWORD ret;
4717 CHAR buff[10];
4718 LVITEMA itema;
4719 static CHAR test[] = "test";
4720 static const CHAR test1[] = "test1";
4721
4723 ok(hwnd != NULL, "failed to create a listview window\n");
4724
4725 insert_item(hwnd, 0);
4726
4727 /* try without edit created */
4730 expect(TRUE, ret);
4732 "cancel edit label without edit", FALSE);
4733
4734 /* cancel without data change */
4735 SetFocus(hwnd);
4736 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4737 ok(IsWindow(hwndedit), "Expected edit control to be created\n");
4739 expect(TRUE, ret);
4740 ok(!IsWindow(hwndedit), "Expected edit control to be destroyed\n");
4741
4742 /* cancel after data change */
4743 memset(&itema, 0, sizeof(itema));
4744 itema.pszText = test;
4746 expect(TRUE, ret);
4747 SetFocus(hwnd);
4748 hwndedit = (HWND)SendMessageA(hwnd, LVM_EDITLABELA, 0, 0);
4749 ok(IsWindow(hwndedit), "Expected edit control to be created\n");
4750 ret = SetWindowTextA(hwndedit, test1);
4751 expect(1, ret);
4753 expect(TRUE, ret);
4754 ok(!IsWindow(hwndedit), "Expected edit control to be destroyed\n");
4755 memset(&itema, 0, sizeof(itema));
4756 itema.pszText = buff;
4757 itema.cchTextMax = ARRAY_SIZE(buff);
4759 expect(5, ret);
4760 ok(strcmp(buff, test1) == 0, "Expected label text not to change\n");
4761
4763}
4764
4765static void test_mapidindex(void)
4766{
4767 HWND hwnd;
4768 INT ret;
4769
4770 /* LVM_MAPINDEXTOID unsupported with LVS_OWNERDATA */
4772 ok(hwnd != NULL, "failed to create a listview window\n");
4773 insert_item(hwnd, 0);
4775 expect(-1, ret);
4777
4779 ok(hwnd != NULL, "failed to create a listview window\n");
4780
4781 /* LVM_MAPINDEXTOID with invalid index */
4783 expect(-1, ret);
4784
4785 insert_item(hwnd, 0);
4786 insert_item(hwnd, 1);
4787
4789 expect(-1, ret);
4791 expect(-1, ret);
4792
4794 expect(0, ret);
4796 expect(1, ret);
4797 /* remove 0 indexed item, id retained */
4800 expect(1, ret);
4801 /* new id starts from previous value */
4802 insert_item(hwnd, 1);
4804 expect(2, ret);
4805
4806 /* get index by id */
4808 expect(-1, ret);
4810 expect(-1, ret);
4812 expect(0, ret);
4814 expect(1, ret);
4815
4817}
4818
4819static void test_getitemspacing(void)
4820{
4821 HWND hwnd;
4822 DWORD ret;
4823 INT cx, cy;
4824 HIMAGELIST himl40, himl80;
4825
4828
4829 /* LVS_ICON */
4832 expect(cx, LOWORD(ret));
4833 expect(cy, HIWORD(ret));
4834
4835 /* now try with icons */
4836 himl40 = pImageList_Create(40, 40, 0, 4, 4);
4837 ok(himl40 != NULL, "failed to create imagelist\n");
4838 himl80 = pImageList_Create(80, 80, 0, 4, 4);
4839 ok(himl80 != NULL, "failed to create imagelist\n");
4841 expect(0, ret);
4842
4844 /* spacing + icon size returned */
4845 expect(cx + 40, LOWORD(ret));
4846 expect(cy + 40, HIWORD(ret));
4847 /* try changing icon size */
4849
4851 /* spacing + icon size returned */
4852 expect(cx + 80, LOWORD(ret));
4853 expect(cy + 80, HIWORD(ret));
4854
4855 /* set own icon spacing */
4857 expect(cx + 80, LOWORD(ret));
4858 expect(cy + 80, HIWORD(ret));
4859
4861 /* set size returned */
4862 expect(100, LOWORD(ret));
4863 expect(100, HIWORD(ret));
4864
4865 /* now change image list - icon spacing should be unaffected */
4867
4869 /* set size returned */
4870 expect(100, LOWORD(ret));
4871 expect(100, HIWORD(ret));
4872
4873 /* spacing = 0 - keep previous value */
4875 expect(100, LOWORD(ret));
4876 expect(100, HIWORD(ret));
4877
4879 expect(100, LOWORD(ret));
4880
4881 expect(0xFFFF, HIWORD(ret));
4882
4883 if (sizeof(void*) == 8)
4884 {
4885 /* NOTE: -1 is not treated the same as (DWORD)-1 by 64bit listview */
4887 expect(100, LOWORD(ret));
4888 expect(0xFFFF, HIWORD(ret));
4889
4891 expect(0xFFFF, LOWORD(ret));
4892 expect(0xFFFF, HIWORD(ret));
4893 }
4894 else
4895 {
4897 expect(100, LOWORD(ret));
4898 expect(0xFFFF, HIWORD(ret));
4899 }
4901 /* spacing + icon size returned */
4902 expect(cx + 40, LOWORD(ret));
4903 expect(cy + 40, HIWORD(ret));
4904
4906 pImageList_Destroy(himl80);
4908 /* LVS_SMALLICON */
4911 expect(cx, LOWORD(ret));
4912 expect(cy, HIWORD(ret));
4913
4914 /* spacing does not depend on selected view type */
4916 expect(0, ret);
4917
4919 /* spacing + icon size returned */
4920 expect(cx + 40, LOWORD(ret));
4921 expect(cy + 40, HIWORD(ret));
4922
4924 pImageList_Destroy(himl40);
4926 /* LVS_REPORT */
4929 expect(cx, LOWORD(ret));
4930 expect(cy, HIWORD(ret));
4931
4933 /* LVS_LIST */
4936 expect(cx, LOWORD(ret));
4937 expect(cy, HIWORD(ret));
4938
4940}
4941
4943{
4945 HFONT hfont;
4946 HWND hwnd;
4947 HDC hdc;
4948
4949 hwnd = (HWND)SendMessageA(listview, LVM_GETHEADER, 0, 0);
4950 if (!hwnd)
4951 hwnd = listview;
4952
4954 if (!hfont) {
4955 hdc = GetDC(hwnd);
4957 ReleaseDC(hwnd, hdc);
4958 }
4959 else {
4960 HFONT oldfont;
4961
4962 hdc = GetDC(0);
4963 oldfont = SelectObject(hdc, hfont);
4965 SelectObject(hdc, oldfont);
4966 ReleaseDC(0, hdc);
4967 }
4968
4969 return tm.tmHeight;
4970}
4971
4972static void test_getcolumnwidth(void)
4973{
4974 HWND hwnd;
4975 INT ret;
4977 LVCOLUMNA col;
4978 LVITEMA itema;
4979 INT height;
4980
4981 /* default column width */
4984 expect(0, ret);
4988 todo_wine expect(8, ret);
4989 style = GetWindowLongA(hwnd, GWL_STYLE) & ~LVS_LIST;
4991 col.mask = 0;
4993 expect(0, ret);
4995 expect(10, ret);
4997
4998 /* default column width with item added */
5000 memset(&itema, 0, sizeof(itema));
5001 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
5002 ok(!ret, "got %d\n", ret);
5005 ok((ret / height) >= 6, "got width %d, height %d\n", ret, height);
5007}
5008
5009static void test_scrollnotify(void)
5010{
5011 HWND hwnd;
5012 DWORD ret;
5013
5015
5016 insert_column(hwnd, 0);
5017 insert_column(hwnd, 1);
5018 insert_item(hwnd, 0);
5019
5020 /* make it scrollable - resize */
5022 expect(TRUE, ret);
5024 expect(TRUE, ret);
5025
5026 /* try with dummy call */
5028 ret = SendMessageA(hwnd, LVM_SCROLL, 0, 0);
5029 expect(TRUE, ret);
5031 "scroll notify 1", TRUE);
5032
5034 ret = SendMessageA(hwnd, LVM_SCROLL, 1, 0);
5035 expect(TRUE, ret);
5037 "scroll notify 2", TRUE);
5038
5040 ret = SendMessageA(hwnd, LVM_SCROLL, 1, 1);
5041 expect(TRUE, ret);
5043 "scroll notify 3", TRUE);
5044
5046}
5047
5049{
5050 HWND hwnd;
5051 DWORD ret;
5052 HDC hdc;
5053
5055
5056 ret = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, RGB(0, 0, 0));
5057 expect(TRUE, ret);
5058
5059 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTBKGND,
5060 LVS_EX_TRANSPARENTBKGND);
5061
5063 if (ret != CLR_NONE)
5064 {
5065 win_skip("LVS_EX_TRANSPARENTBKGND unsupported\n");
5067 return;
5068 }
5069
5070 /* try to set some back color and check this style bit */
5071 ret = SendMessageA(hwnd, LVM_SETBKCOLOR, 0, RGB(0, 0, 0));
5072 expect(TRUE, ret);
5074 ok(!(ret & LVS_EX_TRANSPARENTBKGND), "Expected LVS_EX_TRANSPARENTBKGND to unset\n");
5075
5076 /* now test what this style actually does */
5077 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_TRANSPARENTBKGND,
5078 LVS_EX_TRANSPARENTBKGND);
5079
5081
5085 "LVS_EX_TRANSPARENTBKGND parent", FALSE);
5086
5088
5090}
5091
5093{
5094 static CHAR test[] = "abracadabra, a very long item label";
5095 DWORD item_width, item_height, header_height;
5096 static CHAR column_header[] = "Header";
5097 unsigned const column_width = 100;
5098 DWORD ret, item_count;
5100 LVITEMA itema;
5101 LVCOLUMNA col;
5102 HBITMAP hbmp;
5103 HWND hwnd;
5104
5105 /* LVS_ICON */
5107 himl = pImageList_Create(40, 40, 0, 4, 4);
5108 ok(himl != NULL, "failed to create imagelist\n");
5109 hbmp = CreateBitmap(40, 40, 1, 1, NULL);
5110 ok(hbmp != NULL, "failed to create bitmap\n");
5111 ret = pImageList_Add(himl, hbmp, 0);
5112 expect(0, ret);
5114 expect(0, ret);
5115
5116 itema.mask = LVIF_IMAGE;
5117 itema.iImage = 0;
5118 itema.iItem = 0;
5119 itema.iSubItem = 0;
5120 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
5121 expect(0, ret);
5122
5124 ok(ret != 0, "Unexpected return value %#x.\n", ret);
5125
5127 expect(MAKELONG(77,827), ret);
5128
5130 ok(ret != 0, "got 0\n");
5131
5133 expect(MAKELONG(102,302), ret);
5134
5136 expect(MAKELONG(52,52), ret);
5137
5138 itema.pszText = test;
5140 expect(TRUE, ret);
5142 expect(MAKELONG(52,52), ret);
5143
5145 expect(MAKELONG(52,2), ret);
5147 expect(MAKELONG(52,52), ret);
5149 expect(MAKELONG(102,52), ret);
5151 expect(MAKELONG(102,102), ret);
5153 expect(MAKELONG(102,102), ret);
5155 expect(MAKELONG(102,152), ret);
5157 expect(MAKELONG(102,152), ret);
5159 expect(MAKELONG(152,152), ret);
5160
5162
5163 /* LVS_REPORT */
5165
5166 /* Empty control without columns */
5169 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5170 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5171
5173 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5175 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5176
5177 header_height = HIWORD(ret);
5178
5180 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5182 ok(HIWORD(ret) > header_height, "Unexpected height %d.\n", HIWORD(ret));
5183
5184 item_height = HIWORD(ret) - header_height;
5185
5187 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5188 ok(HIWORD(ret) == (header_height - 2 * item_height), "Unexpected height %d.\n", HIWORD(ret)) ;
5189
5191 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5192 ok(HIWORD(ret) == header_height, "Unexpected height.\n");
5194 ok(LOWORD(ret) == 0, "Unexpected width %d.\n", LOWORD(ret));
5195 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5196
5197 /* Insert column */
5198 col.mask = LVCF_TEXT | LVCF_WIDTH;
5199 col.pszText = column_header;
5200 col.cx = column_width;
5202 ok(ret == 0, "Unexpected return value %d.\n", ret);
5203
5204 /* Empty control with column */
5206todo_wine {
5207 ok(LOWORD(ret) >= column_width, "Unexpected width %d.\n", LOWORD(ret));
5208 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5209}
5210 header_height = HIWORD(ret);
5211 item_width = LOWORD(ret);
5212
5214 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5216 ok(HIWORD(ret) > header_height, "Unexpected height %d.\n", HIWORD(ret));
5217
5218 item_height = HIWORD(ret) - header_height;
5219
5221 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5222 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5223
5225 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5226 ok(HIWORD(ret) == header_height, "Unexpected height %d.\n", HIWORD(ret));
5227
5229 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5230 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5231
5232 for (item_count = 1; item_count <= 2; ++item_count)
5233 {
5234 itema.mask = LVIF_TEXT;
5235 itema.iItem = 0;
5236 itema.iSubItem = 0;
5237 itema.pszText = test;
5238 ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
5239 ok(ret == 0, "Unexpected return value %d.\n", ret);
5240
5242 ok(LOWORD(ret) >= column_width, "Unexpected width %d.\n", LOWORD(ret));
5243 todo_wine
5244 ok(HIWORD(ret) != 0, "Unexpected height %d.\n", HIWORD(ret));
5245
5246 header_height = HIWORD(ret);
5247 item_width = LOWORD(ret);
5248
5250 ok(LOWORD(ret) == item_width, "Unexpected width %d, item %d\n", LOWORD(ret), item_count - 1);
5251 ok(HIWORD(ret) > header_height, "Unexpected height %d. item %d.\n", HIWORD(ret), item_count - 1);
5252
5253 item_height = HIWORD(ret) - header_height;
5254
5256 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5257 todo_wine
5258 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5259
5261 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5262 ok(HIWORD(ret) == header_height + item_count * item_height, "Unexpected height %d.\n", HIWORD(ret));
5263
5265 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5266 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5267
5268 ret = SendMessageA(hwnd, LVM_APPROXIMATEVIEWRECT, 2, MAKELONG(item_width * 2, header_height + 3 * item_height));
5269 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5270 ok(HIWORD(ret) == header_height + 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5271
5272 ret = SendMessageA(hwnd, LVM_APPROXIMATEVIEWRECT, -2, MAKELONG(item_width * 2, 0));
5273 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5274 todo_wine
5275 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5276
5278 ok(LOWORD(ret) == item_width, "Unexpected width %d.\n", LOWORD(ret));
5279 todo_wine
5280 ok(HIWORD(ret) == header_height - 2 * item_height, "Unexpected height %d.\n", HIWORD(ret));
5281 }
5282
5284
5285}
5286
5287static void test_finditem(void)
5288{
5289 LVFINDINFOA fi;
5290 static char f[5];
5291 HWND hwnd;
5292 INT r;
5293
5295 insert_item(hwnd, 0);
5296
5297 memset(&fi, 0, sizeof(fi));
5298
5299 /* full string search, inserted text was "foo" */
5300 strcpy(f, "foo");
5301 fi.flags = LVFI_STRING;
5302 fi.psz = f;
5303 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5304 expect(0, r);
5305
5307 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5308 expect(0, r);
5309
5310 fi.flags = LVFI_PARTIAL;
5311 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5312 expect(0, r);
5313
5314 /* partial string search, inserted text was "foo" */
5315 strcpy(f, "fo");
5317 fi.psz = f;
5318 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5319 expect(0, r);
5320
5321 fi.flags = LVFI_STRING;
5322 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5323 expect(-1, r);
5324
5325 fi.flags = LVFI_PARTIAL;
5326 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5327 expect(0, r);
5328
5329 /* partial string search, part after start char */
5330 strcpy(f, "oo");
5332 fi.psz = f;
5333 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5334 expect(-1, r);
5335
5336 /* try with LVFI_SUBSTRING */
5337 strcpy(f, "fo");
5338 fi.flags = LVFI_SUBSTRING;
5339 fi.psz = f;
5340 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5341 expect(0, r);
5342 strcpy(f, "f");
5343 fi.flags = LVFI_SUBSTRING;
5344 fi.psz = f;
5345 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5346 expect(0, r);
5347 strcpy(f, "o");
5348 fi.flags = LVFI_SUBSTRING;
5349 fi.psz = f;
5350 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5351 expect(-1, r);
5352
5353 strcpy(f, "o");
5355 fi.psz = f;
5356 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5357 expect(-1, r);
5358
5359 strcpy(f, "f");
5361 fi.psz = f;
5362 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5363 expect(0, r);
5364
5366 r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi);
5367 expect(0, r);
5368
5370}
5371
5373{
5374 HWND hwnd, header;
5375 DWORD style;
5376
5378
5379 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5380 LVS_EX_HEADERINALLVIEWS);
5381
5383 if (!IsWindow(header))
5384 {
5385 win_skip("LVS_EX_HEADERINALLVIEWS unsupported\n");
5387 return;
5388 }
5389
5390 /* LVS_NOCOLUMNHEADER works as before */
5394 ok(style & HDS_HIDDEN, "Expected HDS_HIDDEN\n");
5398 ok(!(style & HDS_HIDDEN), "Expected HDS_HIDDEN to be unset\n");
5399
5400 /* try to remove style */
5401 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS, 0);
5403 ok(IsWindow(header), "Expected header to be created\n");
5405 ok(!(style & HDS_HIDDEN), "HDS_HIDDEN not expected\n");
5406
5408
5409 /* check other styles */
5411 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5412 LVS_EX_HEADERINALLVIEWS);
5414 ok(IsWindow(header), "Expected header to be created\n");
5416
5418 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5419 LVS_EX_HEADERINALLVIEWS);
5421 ok(IsWindow(header), "Expected header to be created\n");
5423
5425 SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_HEADERINALLVIEWS,
5426 LVS_EX_HEADERINALLVIEWS);
5428 ok(IsWindow(header), "Expected header to be created\n");
5430}
5431
5432static void test_hover(void)
5433{
5434 HWND hwnd, fg;
5435 DWORD r;
5436
5439 fg = GetForegroundWindow();
5440 if (fg != hwndparent)
5441 {
5442 skip("Window is not in the foreground. Skipping hover tests.\n");
5444 return;
5445 }
5446
5447 /* test WM_MOUSEHOVER forwarding */
5449 r = SendMessageA(hwnd, WM_MOUSEHOVER, 0, 0);
5450 expect(0, r);
5451 ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER allow test", TRUE);
5454 r = SendMessageA(hwnd, WM_MOUSEHOVER, 0, 0);
5455 expect(0, r);
5456 ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER block test", TRUE);
5458
5459 r = SendMessageA(hwnd, LVM_SETHOVERTIME, 0, 500);
5462 expect(500, r);
5463
5465}
5466
5467static void test_destroynotify(void)
5468{
5469 HWND hwnd;
5470 BOOL ret;
5471
5473 ok(hwnd != NULL, "failed to create listview window\n");
5474
5478
5479 /* same for ownerdata list */
5481 ok(hwnd != NULL, "failed to create listview window\n");
5482
5485 ok_sequence(sequences, COMBINED_SEQ_INDEX, listview_ownerdata_destroy, "check destroy order, ownerdata", FALSE);
5486
5488 ok(hwnd != NULL, "failed to create listview window\n");
5489
5492 ok(ret == TRUE, "got %d\n", ret);
5495}
5496
5498{
5499 static char textA[] = "newtext";
5500 HWND list, header;
5501 HDITEMA item;
5502 NMHEADERA nmh;
5503 LVCOLUMNA col;
5504 DWORD ret;
5505 BOOL r;
5506
5508 ok(list != NULL, "failed to create listview window\n");
5509
5510 memset(&col, 0, sizeof(col));
5511 col.mask = LVCF_WIDTH;
5512 col.cx = 100;
5514 expect(0, ret);
5515
5516 /* check list parent notification after header item changed,
5517 this test should be placed before header subclassing to avoid
5518 Listview -> Header messages to be logged */
5520
5521 col.mask = LVCF_TEXT;
5522 col.pszText = textA;
5523 r = SendMessageA(list, LVM_SETCOLUMNA, 0, (LPARAM)&col);
5524 expect(TRUE, r);
5525
5527 "header notify, listview", FALSE);
5529 "header notify, parent", FALSE);
5530
5532
5534 expect(1, ret);
5535
5536 memset(&item, 0, sizeof(item));
5537 item.mask = HDI_WIDTH;
5539 expect(1, ret);
5540 expect(100, item.cxy);
5541
5542 nmh.hdr.hwndFrom = header;
5545 nmh.iItem = 0;
5546 nmh.iButton = 0;
5547 item.mask = HDI_WIDTH;
5548 item.cxy = 50;
5549 nmh.pitem = &item;
5550 ret = SendMessageA(list, WM_NOTIFY, 0, (LPARAM)&nmh);
5551 expect(0, ret);
5552
5554}
5555
5557{
5558 static char textA[] = "newtext";
5559 HWND list, header;
5560 HDITEMW itemW;
5561 NMHEADERW nmhdr;
5562 LVCOLUMNA col;
5563 DWORD ret;
5564 WCHAR buffer[100];
5565 struct message parent_header_notify_seq[] = {
5566 { WM_NOTIFY, sent|id, 0, 0, 0 },
5567 { 0 }
5568 };
5569
5571 ok(list != NULL, "failed to create listview window\n");
5572
5573 memset(&col, 0, sizeof(col));
5574 col.mask = LVCF_WIDTH | LVCF_TEXT;
5575 col.cx = 100;
5576 col.pszText = textA;
5578 expect(0, ret);
5579
5581 ok(header != 0, "No header\n");
5582 memset(&itemW, 0, sizeof(itemW));
5583 itemW.mask = HDI_WIDTH | HDI_ORDER | HDI_TEXT;
5584 itemW.pszText = buffer;
5585 itemW.cchTextMax = ARRAY_SIZE(buffer);
5587 expect(1, ret);
5588
5589 nmhdr.hdr.hwndFrom = header;
5591 nmhdr.iItem = 0;
5592 nmhdr.iButton = 0;
5593 nmhdr.pitem = &itemW;
5594
5596 nmhdr.hdr.code = HDN_ITEMCHANGINGW;
5597 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5598 ok(ret == 0, "got %d\n", ret);
5599 parent_header_notify_seq[0].id = HDN_ITEMCHANGINGA;
5600 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5601 "header notify, parent", TRUE);
5602 todo_wine
5603 ok(nmhdr.hdr.code == HDN_ITEMCHANGINGA, "Expected ANSI notification code\n");
5605 nmhdr.hdr.code = HDN_ITEMCHANGEDW;
5606 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5607 ok(ret == 0, "got %d\n", ret);
5608 parent_header_notify_seq[0].id = HDN_ITEMCHANGEDA;
5609 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5610 "header notify, parent", TRUE);
5611 todo_wine
5612 ok(nmhdr.hdr.code == HDN_ITEMCHANGEDA, "Expected ANSI notification code\n");
5613 /* HDN_ITEMCLICK sets focus to list, which generates messages we don't want to check */
5614 SetFocus(list);
5616 nmhdr.hdr.code = HDN_ITEMCLICKW;
5617 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5618 ok(ret == 0, "got %d\n", ret);
5620 "header notify, parent", FALSE);
5621 ok(nmhdr.hdr.code == HDN_ITEMCLICKA, "Expected ANSI notification code\n");
5623 nmhdr.hdr.code = HDN_ITEMDBLCLICKW;
5624 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5625 ok(ret == 0, "got %d\n", ret);
5627 "header notify, parent", FALSE);
5628 ok(nmhdr.hdr.code == HDN_ITEMDBLCLICKW, "Expected Unicode notification code\n");
5631 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5632 ok(ret == 0, "got %d\n", ret);
5634 "header notify, parent", TRUE);
5635 ok(nmhdr.hdr.code == HDN_DIVIDERDBLCLICKA, "Expected ANSI notification code\n");
5637 nmhdr.hdr.code = HDN_BEGINTRACKW;
5638 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5639 ok(ret == 0, "got %d\n", ret);
5641 "header notify, parent", FALSE);
5642 ok(nmhdr.hdr.code == HDN_BEGINTRACKW, "Expected Unicode notification code\n");
5644 nmhdr.hdr.code = HDN_ENDTRACKW;
5645 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5646 ok(ret == 0, "got %d\n", ret);
5647 parent_header_notify_seq[0].id = HDN_ENDTRACKA;
5648 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5649 "header notify, parent", FALSE);
5650 ok(nmhdr.hdr.code == HDN_ENDTRACKA, "Expected ANSI notification code\n");
5652 nmhdr.hdr.code = HDN_TRACKW;
5653 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5654 ok(ret == 0, "got %d\n", ret);
5655 parent_header_notify_seq[0].id = HDN_TRACKA;
5656 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5657 "header notify, parent", FALSE);
5658 ok(nmhdr.hdr.code == HDN_TRACKA, "Expected ANSI notification code\n");
5660 nmhdr.hdr.code = HDN_BEGINDRAG;
5661 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5662 ok(ret == 1, "got %d\n", ret);
5664 "header notify, parent", FALSE);
5666 nmhdr.hdr.code = HDN_ENDDRAG;
5667 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5668 ok(ret == 0, "got %d\n", ret);
5669 parent_header_notify_seq[0].id = HDN_ENDDRAG;
5670 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5671 "header notify, parent", FALSE);
5673 nmhdr.hdr.code = HDN_FILTERCHANGE;
5674 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5675 ok(ret == 0, "got %d\n", ret);
5676 parent_header_notify_seq[0].id = HDN_FILTERCHANGE;
5677 parent_header_notify_seq[0].flags |= optional; /* NT4 does not send this message */
5678 ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq,
5679 "header notify, parent", FALSE);
5680 parent_header_notify_seq[0].flags &= ~optional;
5683 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5684 ok(ret == 0, "got %d\n", ret);
5686 "header notify, parent", FALSE);
5688 nmhdr.hdr.code = HDN_ENDFILTEREDIT;
5689 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5690 ok(ret == 0, "got %d\n", ret);
5692 "header notify, parent", FALSE);
5695 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5696 ok(ret == 0, "got %d\n", ret);
5698 "header notify, parent", FALSE);
5700 nmhdr.hdr.code = HDN_ITEMKEYDOWN;
5701 ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr);
5702 ok(ret == 0, "got %d\n", ret);
5704 "header notify, parent", FALSE);
5705
5707
5709}
5710
5711static void test_createdragimage(void)
5712{
5714 POINT pt;
5715 HWND list;
5716
5718 ok(list != NULL, "failed to create listview window\n");
5719
5720 insert_item(list, 0);
5721
5722 /* NULL point */
5724 ok(himl == NULL, "got %p\n", himl);
5725
5727 ok(himl != NULL, "got %p\n", himl);
5728 pImageList_Destroy(himl);
5729
5731}
5732
5733static void test_dispinfo(void)
5734{
5735 static const char testA[] = "TEST";
5736 WCHAR buff[10];
5737 LVITEMA item;
5738 HWND hwnd;
5739 DWORD ret;
5740
5742 ok(hwnd != NULL, "failed to create listview window\n");
5743
5744 insert_item(hwnd, 0);
5745
5746 memset(&item, 0, sizeof(item));
5747 item.pszText = LPSTR_TEXTCALLBACKA;
5749 expect(1, ret);
5750
5752 item.pszText = (char*)buff;
5753 item.cchTextMax = ARRAY_SIZE(buff);
5755 ok(ret == sizeof(testA)-1, "got %d, expected 4\n", ret);
5757
5758 ok(memcmp(item.pszText, testA, sizeof(testA)) == 0,
5759 "got %s, expected %s\n", item.pszText, testA);
5760
5762}
5763
5764static void test_LVM_SETITEMTEXT(void)
5765{
5766 static char testA[] = "TEST";
5767 LVITEMA item;
5768 HWND hwnd;
5769 DWORD ret;
5770
5772 ok(hwnd != NULL, "failed to create listview window\n");
5773
5774 insert_item(hwnd, 0);
5775
5776 /* null item pointer */
5778 expect(FALSE, ret);
5779
5781 expect(FALSE, ret);
5782
5783 /* index out of bounds */
5784 item.pszText = testA;
5785 item.cchTextMax = 0; /* ignored */
5786 item.iSubItem = 0;
5787
5789 expect(FALSE, ret);
5790
5792 expect(FALSE, ret);
5793
5795 expect(TRUE, ret);
5796
5798}
5799
5800static void test_LVM_REDRAWITEMS(void)
5801{
5802 HWND list;
5803 DWORD ret;
5804
5806 ok(list != NULL, "failed to create listview window\n");
5807
5809 expect(TRUE, ret);
5810
5811 insert_item(list, 0);
5812
5814 expect(TRUE, ret);
5815
5817 expect(TRUE, ret);
5818
5820 expect(TRUE, ret);
5821
5823 expect(TRUE, ret);
5824
5826 expect(TRUE, ret);
5827
5829 expect(TRUE, ret);
5830
5832 expect(TRUE, ret);
5833
5835}
5836
5837static void test_imagelists(void)
5838{
5839 HWND hwnd, header;
5840 HIMAGELIST himl1, himl2, himl3;
5841 LRESULT ret;
5842
5843 himl1 = pImageList_Create(40, 40, 0, 4, 4);
5844 himl2 = pImageList_Create(40, 40, 0, 4, 4);
5845 himl3 = pImageList_Create(40, 40, 0, 4, 4);
5846 ok(himl1 != NULL, "Failed to create imagelist\n");
5847 ok(himl2 != NULL, "Failed to create imagelist\n");
5848 ok(himl3 != NULL, "Failed to create imagelist\n");
5849
5852
5853 ok(header != NULL, "Expected header\n");
5855 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5856
5858
5860 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5862 "set normal image list", FALSE);
5863
5865
5867 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5869 "set state image list", TRUE);
5870
5872 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5873
5875
5877 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5879 "set small image list", FALSE);
5880
5882 ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret);
5884
5886
5888
5890 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5892 "set normal image list", FALSE);
5893
5895
5897 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5899 "set state image list", FALSE);
5900
5902
5904 ok(ret == 0, "Expected no imagelist, got %p\n", (HIMAGELIST)ret);
5906 "set small image list", FALSE);
5907
5909 ok(header == NULL, "Expected no header, got %p\n", header);
5910
5912
5914 ok(header != NULL, "Expected header, got NULL\n");
5915
5917 ok((HIMAGELIST)ret == himl3, "Expected imagelist %p, got %p\n", himl3, (HIMAGELIST)ret);
5918
5920}
5921
5922static void test_deleteitem(void)
5923{
5924 LVITEMA item;
5925 UINT state;
5926 HWND hwnd;
5927 BOOL ret;
5928
5930
5931 insert_item(hwnd, 0);
5932 insert_item(hwnd, 0);
5933 insert_item(hwnd, 0);
5934 insert_item(hwnd, 0);
5935 insert_item(hwnd, 0);
5936
5938
5939 /* delete focused item (not the last index) */
5940 item.stateMask = LVIS_FOCUSED;
5941 item.state = LVIS_FOCUSED;
5943 ok(ret == TRUE, "got %d\n", ret);
5945 ok(ret == TRUE, "got %d\n", ret);
5946 /* next item gets focus */
5948 ok(state == LVIS_FOCUSED, "got %x\n", state);
5949
5950 /* focus last item and delete it */
5951 item.stateMask = LVIS_FOCUSED;
5952 item.state = LVIS_FOCUSED;
5954 ok(ret == TRUE, "got %d\n", ret);
5956 ok(ret == TRUE, "got %d\n", ret);
5957 /* new last item gets focus */
5959 ok(state == LVIS_FOCUSED, "got %x\n", state);
5960
5961 /* focus first item and delete it */
5962 item.stateMask = LVIS_FOCUSED;
5963 item.state = LVIS_FOCUSED;
5965 ok(ret == TRUE, "got %d\n", ret);
5967 ok(ret == TRUE, "got %d\n", ret);
5968 /* new first item gets focus */
5970 ok(state == LVIS_FOCUSED, "got %x\n", state);
5971
5973
5975}
5976
5977static void test_insertitem(void)
5978{
5979 LVITEMA item;
5980 UINT state;
5981 HWND hwnd;
5982 INT ret;
5983
5985
5986 /* insert item 0 focused */
5987 item.mask = LVIF_STATE;
5988 item.state = LVIS_FOCUSED;
5989 item.stateMask = LVIS_FOCUSED;
5990 item.iItem = 0;
5991 item.iSubItem = 0;
5993 ok(ret == 0, "got %d\n", ret);
5994
5996 ok(state == LVIS_FOCUSED, "got %x\n", state);
5997
5999
6000 /* insert item 1, focus shift */
6001 item.mask = LVIF_STATE;
6002 item.state = LVIS_FOCUSED;
6003 item.stateMask = LVIS_FOCUSED;
6004 item.iItem = 1;
6005 item.iSubItem = 0;
6007 ok(ret == 1, "got %d\n", ret);
6008
6010
6012 ok(state == LVIS_FOCUSED, "got %x\n", state);
6013
6014 /* insert item 2, no focus shift */
6015 item.mask = LVIF_STATE;
6016 item.state = 0;
6017 item.stateMask = LVIS_FOCUSED;
6018 item.iItem = 2;
6019 item.iSubItem = 0;
6021 ok(ret == 2, "got %d\n", ret);
6022
6024 ok(state == LVIS_FOCUSED, "got %x\n", state);
6025
6027}
6028
6029static void test_header_proc(void)
6030{
6031 HWND hwnd, header, hdr;
6032 WNDPROC proc1, proc2;
6033
6035
6037 ok(header != NULL, "got %p\n", header);
6038
6041 0, 0, 0, 0,
6042 NULL, NULL, NULL, NULL);
6043 ok(hdr != NULL, "got %p\n", hdr);
6044
6047 ok(proc1 == proc2, "got %p, expected %p\n", proc1, proc2);
6048
6051}
6052
6053static void flush_events(void)
6054{
6055 MSG msg;
6056 int diff = 200;
6057 int min_timeout = 100;
6058 DWORD time = GetTickCount() + diff;
6059
6060 while (diff > 0)
6061 {
6062 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
6063 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
6064 diff = time - GetTickCount();
6065 }
6066}
6067
6068static void test_oneclickactivate(void)
6069{
6070 TRACKMOUSEEVENT track;
6071 char item1[] = "item1";
6072 LVITEMA item;
6073 HWND hwnd, fg;
6074 RECT rect;
6075 INT r;
6076 POINT orig_pos;
6077
6079 10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
6080 ok(hwnd != NULL, "failed to create listview window\n");
6082 ok(r == 0, "should return zero\n");
6083
6085 flush_events();
6086 fg = GetForegroundWindow();
6087 if (fg != hwndparent)
6088 {
6089 skip("Window is not in the foreground. Skipping oneclickactivate tests.\n");
6091 return;
6092 }
6093
6094 item.mask = LVIF_TEXT;
6095 item.iItem = 0;
6096 item.iSubItem = 0;
6097 item.iImage = 0;
6098 item.pszText = item1;
6100 ok(r == 0, "should not fail\n");
6101
6103 GetCursorPos(&orig_pos);
6104 SetCursorPos(rect.left+5, rect.top+5);
6105 flush_events();
6106 r = SendMessageA(hwnd, WM_MOUSEMOVE, MAKELONG(1, 1), 0);
6107 expect(0, r);
6108
6109 track.cbSize = sizeof(track);
6110 track.dwFlags = TME_QUERY;
6111 p_TrackMouseEvent(&track);
6112 ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n");
6113 ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags);
6114
6116 expect(0, r);
6118 expect(0, r);
6120 expect(1, r);
6121
6123 SetCursorPos(orig_pos.x, orig_pos.y);
6124}
6125
6126static void test_callback_mask(void)
6127{
6128 LVITEMA item;
6129 DWORD mask;
6130 HWND hwnd;
6131 BOOL ret;
6132
6134
6136 ok(ret, "got %d\n", ret);
6137
6139 ok(ret, "got %d\n", ret);
6140
6142 ok(mask == ~0u, "got 0x%08x\n", mask);
6143
6144 /* Ask for state, invalid subitem. */
6145 insert_item(hwnd, 0);
6146
6148 ok(ret, "Failed to set callback mask.\n");
6149
6151
6152 memset(&item, 0, sizeof(item));
6153 item.iSubItem = 1;
6154 item.mask = LVIF_STATE;
6155 item.stateMask = LVIS_SELECTED;
6157 ok(ret, "Failed to get item data.\n");
6158
6159 memset(&item, 0, sizeof(item));
6160 item.mask = LVIF_STATE;
6161 item.stateMask = LVIS_SELECTED;
6163 ok(ret, "Failed to get item data.\n");
6164
6165 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, callback mask/invalid subitem 1", TRUE);
6166
6168
6169 memset(&item, 0, sizeof(item));
6170 memset(&g_itema, 0, sizeof(g_itema));
6171 item.iSubItem = 1;
6172 item.mask = LVIF_STATE;
6173 item.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
6175 ok(ret, "Failed to get item data.\n");
6176 ok(g_itema.iSubItem == 1, "Unexpected LVN_DISPINFO subitem %d.\n", g_itema.iSubItem);
6177 ok(g_itema.stateMask == LVIS_FOCUSED, "Unexpected state mask %#x.\n", g_itema.stateMask);
6178
6180 "parent seq, callback mask/invalid subitem 2", FALSE);
6181
6183
6184 /* LVS_OWNERDATA, mask LVIS_FOCUSED */
6186
6188 ok(mask == 0, "Unexpected callback mask %#x.\n", mask);
6189
6191 ok(ret, "Failed to set callback mask, %d\n", ret);
6192
6194 ok(mask == LVIS_FOCUSED, "Unexpected callback mask %#x.\n", mask);
6195
6197 ok(ret, "Failed to set item count.\n");
6198
6200 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6201
6202 item.stateMask = LVIS_FOCUSED;
6203 item.state = LVIS_FOCUSED;
6205 ok(ret, "Failed to set item state.\n");
6206
6208
6211 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6212
6215 ok(ret == 0, "Unexpected selection mark, %d\n", ret);
6216
6218 ok(ret, "Failed to set item count.\n");
6219
6221 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6222
6224 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6225
6227 ok(ret, "Failed to set item count.\n");
6228
6230 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6231
6232 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 1", FALSE);
6233
6234 /* LVS_OWNDERDATA, empty mask */
6236 ok(ret, "Failed to set callback mask, %d\n", ret);
6237
6239 ok(ret, "Failed to set item count.\n");
6240
6242 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6243
6244 item.stateMask = LVIS_FOCUSED;
6245 item.state = LVIS_FOCUSED;
6247 ok(ret, "Failed to set item state.\n");
6248
6250 ok(ret == 0, "Unexpected selection mark, %d\n", ret);
6251
6253
6255 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6256
6258 ok(ret, "Failed to set item count.\n");
6259
6261 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6262
6265 ok(ret == -1, "Unexpected selection mark, %d\n", ret);
6266
6268 ok(ret, "Failed to set item count.\n");
6269
6271 ok(ret == -1, "Unexpected focused item, ret %d\n", ret);
6272
6273 ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent seq, owner data/focus 2", FALSE);
6274
6275 /* 2 items, focus on index 0, reduce to 1 item. */
6277
6279 ok(ret, "Failed to set item count.\n");
6280
6282 ok(ret, "Failed to set item state.\n");
6283
6285 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6286
6288 ok(ret, "Failed to set item count.\n");
6289
6291 ok(ret == 0, "Unexpected focused item, ret %d\n", ret);
6292
6294 "parent seq, owner data/focus 3", TRUE);
6295
6297}
6298
6299static void test_state_image(void)
6300{
6301 static const DWORD styles[] =
6302 {
6303 LVS_ICON,
6304 LVS_REPORT,
6306 LVS_LIST,
6307 };
6308 int i;
6309
6310 for (i = 0; i < ARRAY_SIZE(styles); i++)
6311 {
6312 static char text[] = "Item";
6313 static char subtext[] = "Subitem";
6314 char buff[16];
6315 LVITEMA item;
6316 HWND hwnd;
6317 int r;
6318
6319 hwnd = create_listview_control(styles[i]);
6320
6321 insert_column(hwnd, 0);
6322 insert_column(hwnd, 1);
6323
6324 item.mask = LVIF_TEXT | LVIF_PARAM;
6325 item.iItem = 0;
6326 item.iSubItem = 0;
6327 item.pszText = text;
6328 item.lParam = 123456;
6330 ok(r == 0, "Failed to insert an item.\n");
6331
6332 item.mask = LVIF_STATE;
6335 item.iItem = 0;
6336 item.iSubItem = 0;
6338 ok(r, "Failed to set item state.\n");
6339
6340 item.mask = LVIF_TEXT;
6341 item.iItem = 0;
6342 item.iSubItem = 1;
6343 item.pszText = subtext;
6345 ok(r, "Failed to set subitem text.\n");
6346
6347 item.mask = LVIF_STATE | LVIF_PARAM;
6348 item.stateMask = ~0u;
6349 item.state = 0;
6350 item.iItem = 0;
6351 item.iSubItem = 0;
6352 item.lParam = 0;
6354 ok(r, "Failed to get item state.\n");
6356 "Unexpected item state %#x.\n", item.state);
6357 ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
6358
6359 item.mask = 0;
6360 item.stateMask = ~0u;
6361 item.state = INDEXTOSTATEIMAGEMASK(2);
6362 item.iItem = 0;
6363 item.iSubItem = 1;
6365 ok(r, "Failed to get subitem state.\n");
6366 ok(item.state == INDEXTOSTATEIMAGEMASK(2), "Unexpected state %#x.\n", item.state);
6367
6368 item.mask = LVIF_STATE | LVIF_PARAM;
6369 item.stateMask = ~0u;
6370 item.state = INDEXTOSTATEIMAGEMASK(2);
6371 item.iItem = 0;
6372 item.iSubItem = 1;
6373 item.lParam = 0;
6375 ok(r, "Failed to get subitem state.\n");
6376 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6377 ok(item.lParam == 123456, "Unexpected lParam %ld.\n", item.lParam);
6378
6379 item.mask = LVIF_STATE;
6380 item.stateMask = LVIS_FOCUSED;
6381 item.state = 0;
6382 item.iItem = 0;
6383 item.iSubItem = 1;
6385 ok(r, "Failed to get subitem state.\n");
6386 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6387
6388 item.mask = LVIF_STATE;
6389 item.stateMask = ~0u;
6390 item.state = INDEXTOSTATEIMAGEMASK(2);
6391 item.iItem = 0;
6392 item.iSubItem = 2;
6394 ok(r, "Failed to get subitem state.\n");
6395 ok(item.state == 0, "Unexpected state %#x.\n", item.state);
6396
6397 item.mask = LVIF_TEXT;
6398 item.iItem = 0;
6399 item.iSubItem = 1;
6400 item.pszText = buff;
6401 item.cchTextMax = sizeof(buff);
6403 ok(r, "Failed to get subitem text %d.\n", r);
6404 ok(!strcmp(buff, subtext), "Unexpected subitem text %s.\n", buff);
6405
6407 }
6408}
6409
6410static void test_LVSCW_AUTOSIZE(void)
6411{
6412 int width, width2;
6413 HWND hwnd;
6414 BOOL ret;
6415
6417 ok(hwnd != NULL, "failed to create a listview window\n");
6418
6419 insert_column(hwnd, 0);
6420 insert_column(hwnd, 1);
6421 insert_item(hwnd, 0);
6422
6424 ok(ret, "Failed to set column width.\n");
6425
6427 ok(width > 0, "Unexpected column width %d.\n", width);
6428
6429 /* Turn on checkboxes. */
6431 ok(ret == 0, "Unexpected previous extended style.\n");
6432
6434 ok(ret, "Failed to set column width.\n");
6435
6436 width2 = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
6437 ok(width2 > 0, "Unexpected column width %d.\n", width2);
6438 ok(width2 > width, "Expected increased column width.\n");
6439
6440 /* Turn off checkboxes. */
6442 ok(ret == LVS_EX_CHECKBOXES, "Unexpected previous extended style.\n");
6443
6445 ok(ret, "Failed to set column width.\n");
6446
6448 ok(width > 0, "Unexpected column width %d.\n", width2);
6449 ok(width2 > width, "Expected reduced column width.\n");
6450
6452}
6453
6454static void test_LVN_ENDLABELEDIT(void)
6455{
6456 WCHAR text[] = {'l','a','l','a',0};
6457 HWND hwnd, hwndedit;
6458 LVITEMW item = {0};
6459 DWORD ret;
6460
6462
6463 insert_column(hwnd, 0);
6464
6465 item.mask = LVIF_TEXT;
6466 item.pszText = text;
6468
6469 /* Test normal editing */
6470 SetFocus(hwnd);
6471 hwndedit = (HWND)SendMessageW(hwnd, LVM_EDITLABELW, 0, 0);
6472 ok(hwndedit != NULL, "Failed to get edit control.\n");
6473
6474 ret = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)"test");
6475 ok(ret, "Failed to set edit text.\n");
6476
6478
6479 ret = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
6481
6482 /* Test editing with kill focus */
6483 SetFocus(hwnd);
6484 hwndedit = (HWND)SendMessageW(hwnd, LVM_EDITLABELW, 0, 0);
6485 ok(hwndedit != NULL, "Failed to get edit control.\n");
6486
6487 ret = SendMessageA(hwndedit, WM_SETTEXT, 0, (LPARAM)"test2");
6488 ok(ret, "Failed to set edit text.\n");
6489
6491
6493 ret = SendMessageA(hwndedit, WM_KEYDOWN, VK_RETURN, 0);
6495
6497 "Label edit, kill focus", FALSE);
6498 ok(GetFocus() == hwnd, "Unexpected focused window.\n");
6499
6501
6503}
6504
6506{
6507 if (msg == WM_CREATE)
6508 return 0;
6509
6511}
6512
6514{
6515 static const DWORD styles[] = { LVS_ICON, LVS_LIST, LVS_REPORT, LVS_SMALLICON };
6516 unsigned int i, j;
6517 WNDCLASSEXA cls;
6518 ATOM class;
6519 HWND hwnd;
6520 BOOL ret;
6521
6522 cls.cbSize = sizeof(WNDCLASSEXA);
6524 ok(ret, "Failed to get class info.\n");
6527 cls.lpszClassName = "CountPerPageClass";
6528 class = RegisterClassExA(&cls);
6529 ok(class, "Failed to register class.\n");
6530
6531 for (i = 0; i < ARRAY_SIZE(styles); i++)
6532 {
6533 static char text[] = "item text";
6534 LVITEMA item = { 0 };
6535 UINT count, count2;
6536
6537 hwnd = create_listview_control(styles[i]);
6538 ok(hwnd != NULL, "Failed to create listview window.\n");
6539
6541 if (styles[i] == LVS_LIST || styles[i] == LVS_REPORT)
6542 ok(count > 0 || broken(styles[i] == LVS_LIST && count == 0), "%u: unexpected count %u.\n", i, count);
6543 else
6544 ok(count == 0, "%u: unexpected count %u.\n", i, count);
6545
6546 for (j = 0; j < 10; j++)
6547 {
6548 item.mask = LVIF_TEXT;
6549 item.pszText = text;
6551 }
6552
6553 count2 = SendMessageA(hwnd, LVM_GETCOUNTPERPAGE, 0, 0);
6554 if (styles[i] == LVS_LIST || styles[i] == LVS_REPORT)
6555 ok(count == count2, "%u: unexpected count %u.\n", i, count2);
6556 else
6557 ok(count2 == 10, "%u: unexpected count %u.\n", i, count2);
6558
6560
6561 hwnd = CreateWindowA("CountPerPageClass", "Test", WS_VISIBLE | styles[i], 0, 0, 100, 100, NULL, NULL,
6563 ok(hwnd != NULL, "Failed to create a window.\n");
6564
6566 ok(count == 0, "%u: unexpected count %u.\n", i, count);
6567
6569 }
6570
6571 ret = UnregisterClassA("CountPerPageClass", NULL);
6572 ok(ret, "Failed to unregister test class.\n");
6573}
6574
6575static void test_item_state_change(void)
6576{
6577 static const DWORD styles[] = { LVS_ICON, LVS_LIST, LVS_REPORT, LVS_SMALLICON };
6578 LVITEMA item;
6579 HWND hwnd;
6580 DWORD res;
6581 int i;
6582
6583 for (i = 0; i < ARRAY_SIZE(styles); i++)
6584 {
6585 hwnd = create_listview_control(styles[i]);
6586
6587 insert_item(hwnd, 0);
6588
6589 /* LVM_SETITEMSTATE with mask */
6590 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6591 memset(&item, 0, sizeof(item));
6592 item.mask = LVIF_STATE;
6593 item.stateMask = LVIS_SELECTED;
6594 item.state = LVIS_SELECTED;
6596 ok(res, "Failed to set item state.\n");
6597
6598 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6599 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6600 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6601 ok(g_nmlistview.uNewState == LVIS_SELECTED, "got new state 0x%08x\n", g_nmlistview.uNewState);
6602 ok(g_nmlistview.uOldState == 0, "got old state 0x%08x\n", g_nmlistview.uOldState);
6603 ok(g_nmlistview.uChanged == LVIF_STATE, "got changed 0x%08x\n", g_nmlistview.uChanged);
6604
6605 /* LVM_SETITEMSTATE 0 mask */
6606 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6607 memset(&item, 0, sizeof(item));
6608 item.stateMask = LVIS_SELECTED;
6609 item.state = 0;
6611 ok(res, "Failed to set item state.\n");
6612
6613 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6614 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6615 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6616 ok(g_nmlistview.uNewState == 0, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6617 ok(g_nmlistview.uOldState == LVIS_SELECTED, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6618 ok(g_nmlistview.uChanged == LVIF_STATE, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6619
6620 /* LVM_SETITEM changes state */
6621 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6622 memset(&item, 0, sizeof(item));
6623 item.stateMask = LVIS_SELECTED;
6624 item.state = LVIS_SELECTED;
6625 item.mask = LVIF_STATE;
6627 ok(res, "Failed to set item.\n");
6628
6629 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6630 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6631 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6632 ok(g_nmlistview.uNewState == LVIS_SELECTED, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6633 ok(g_nmlistview.uOldState == 0, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6634 ok(g_nmlistview.uChanged == LVIF_STATE, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6635
6636 /* LVM_SETITEM no state changes */
6637 memset(&g_nmlistview, 0xcc, sizeof(g_nmlistview));
6638 memset(&item, 0, sizeof(item));
6639 item.lParam = 11;
6640 item.mask = LVIF_PARAM;
6642 ok(res, "Failed to set item.\n");
6643
6644 ok(g_nmlistview.iItem == item.iItem, "Unexpected item %d.\n", g_nmlistview.iItem);
6645 ok(g_nmlistview.iSubItem == item.iSubItem, "Unexpected subitem %d.\n", g_nmlistview.iSubItem);
6646 ok(g_nmlistview.lParam == item.lParam, "Unexpected lParam.\n");
6647 ok(g_nmlistview.uNewState == 0, "Unexpected new state %#x.\n", g_nmlistview.uNewState);
6648 ok(g_nmlistview.uOldState == 0, "Unexpected old state %#x.\n", g_nmlistview.uOldState);
6649 ok(g_nmlistview.uChanged == LVIF_PARAM, "Unexpected change mask %#x.\n", g_nmlistview.uChanged);
6650
6652 }
6653}
6654
6655START_TEST(listview)
6656{
6657 ULONG_PTR ctx_cookie;
6658 HANDLE hCtx;
6659
6661
6663
6666
6668
6671 test_images();
6673 test_items();
6675 test_redraw();
6678 test_color();
6681 test_columns();
6686 test_sorting();
6691 test_hittest();
6694 test_editbox();
6700 test_finditem();
6701 test_hover();
6704 test_dispinfo();
6718
6719 if (!load_v6_module(&ctx_cookie, &hCtx))
6720 {
6722 return;
6723 }
6724
6726
6727 /* comctl32 version 6 tests start here */
6738 test_images();
6740 test_items();
6742 test_color();
6743 test_columns();
6744 test_sorting();
6749 test_finditem();
6750 test_hover();
6753 test_dispinfo();
6762
6763 unload_v6_module(ctx_cookie, hCtx);
6764
6766}
static HFONT hfont
@ sent
Definition: SystemMenu.c:27
@ defwinproc
Definition: SystemMenu.c:32
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
@ optional
Definition: SystemMenu.c:34
#define add_message(msg)
Definition: SystemMenu.c:98
#define ok_sequence(exp, contx, todo)
Definition: SystemMenu.c:275
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
Arabic default style
Definition: afstyles.h:94
static int state
Definition: maze.c:121
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define msg(x)
Definition: auth_time.c:54
static const WCHAR nameW[]
Definition: main.c:49
#define ARRAY_SIZE(A)
Definition: main.h:20
HBITMAP hbmp
HIMAGELIST himl
Definition: list.h:37
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
@ custdraw
Definition: msg.h:47
static void init_msg_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:393
static void flush_sequences(struct msg_sequence **seq, int n)
Definition: msg.h:99
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1214
#define WAIT_TIMEOUT
Definition: dderror.h:14
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
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
HANDLE HWND
Definition: compat.h:19
#define CALLBACK
Definition: compat.h:35
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4195
const WCHAR * text
Definition: package.c:1794
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define pt(x, y)
Definition: drawing.c:79
#define RGB(r, g, b)
Definition: precomp.h:71
r parent
Definition: btrfs.c:3010
RECT rect2
Definition: edittest.c:51
void test1()
Definition: ehthrow.cxx:277
static const WCHAR itemW[]
Definition: enumerator.c:37
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint res
Definition: glext.h:9613
GLuint GLuint * names
Definition: glext.h:11545
GLuint buffer
Definition: glext.h:5915
GLuint color
Definition: glext.h:6243
GLenum GLint GLuint mask
Definition: glext.h:6028
GLfloat f
Definition: glext.h:7540
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
GLfloat param
Definition: glext.h:5796
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLenum GLsizei len
Definition: glext.h:6722
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLuint64EXT * result
Definition: glext.h:11304
GLuint id
Definition: glext.h:5910
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: ctx.idl:7
char hdr[14]
Definition: iptest.cpp:33
static const WCHAR testW[]
Definition: jsregexp.c:44
#define f
Definition: ke_i.h:83
HWND hList
Definition: livecd.c:10
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HDC hdc
Definition: main.c:9
static const char textA[]
Definition: registrar.c:40
static HBITMAP
Definition: button.c:44
seq_index
Definition: edit.c:37
static BOOL register_parent_wnd_class(void)
Definition: header.c:458
static HDC
Definition: imagelist.c:88
static const struct message textcallback_set_again_parent_seq[]
Definition: listview.c:279
static NMLVDISPINFOA g_editbox_disp_info
Definition: listview.c:75
static INT get_current_font_height(HWND listview)
Definition: listview.c:4942
static void test_finditem(void)
Definition: listview.c:5287
static INT CALLBACK DummyCompareEx(LPARAM first, LPARAM second, LPARAM param)
Definition: listview.c:4640
static const struct message listview_destroy[]
Definition: listview.c:359
#define HEADER_ID
Definition: listview.c:47
static const struct message parent_report_cd_seq[]
Definition: listview.c:430
static void test_LVM_GETCOUNTPERPAGE(void)
Definition: listview.c:6513
static void test_hittest(void)
Definition: listview.c:3755
static void test_imagelists(void)
Definition: listview.c:5837
static HWND subclass_header(HWND hwndListview)
Definition: listview.c:772
static const struct message parent_header_divider_dclick_seq[]
Definition: listview.c:401
static void test_sorting(void)
Definition: listview.c:2965
static const struct message listview_header_changed_seq[]
Definition: listview.c:388
static void test_subitem_rect(void)
Definition: listview.c:2769
static const struct message listview_ownerdata_switchto_seq[]
Definition: listview.c:189
static const struct message listview_end_label_edit[]
Definition: listview.c:450
static void test_hover(void)
Definition: listview.c:5432
static void insert_item(HWND hwnd, int idx)
Definition: listview.c:1202
static void test_multiselect(void)
Definition: listview.c:2373
static const struct message listview_itempos_seq[]
Definition: listview.c:174
static void test_LVN_ENDLABELEDIT(void)
Definition: listview.c:6454
static void test_items(void)
Definition: listview.c:1219
static const struct message setredraw_seq[]
Definition: listview.c:336
static void test_customdraw(void)
Definition: listview.c:1979
static const struct message listview_setorderarray_seq[]
Definition: listview.c:203
static void test_indentation(void)
Definition: listview.c:4600
static void test_LVM_SETITEMTEXT(void)
Definition: listview.c:5764
static HWND hwndparent
Definition: listview.c:56
@ 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
static void test_checkboxes(void)
Definition: listview.c:992
static BOOL g_focus_test_LVN_DELETEITEM
Definition: listview.c:77
static const struct message single_getdispinfo_parent_seq[]
Definition: listview.c:285
#define X(f)
static void test_LVS_EX_HEADERINALLVIEWS(void)
Definition: listview.c:5372
static LRESULT CALLBACK create_test_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:1599
#define TEST_HEADER_EXPECTED(a)
Definition: listview.c:1615
static void test_norecompute(void)
Definition: listview.c:3561
static void test_editbox(void)
Definition: listview.c:4263
static const WCHAR testparentclassW[]
Definition: listview.c:53
static const struct message listview_header_set_imagelist[]
Definition: listview.c:415
static const struct message ownerdata_select_focus_parent_seq[]
Definition: listview.c:226
static const struct message parent_header_click_seq[]
Definition: listview.c:395
static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:1911
static const struct message ownerdata_deselect_all_parent_seq[]
Definition: listview.c:246
static const struct message hover_parent[]
Definition: listview.c:353
static const struct message create_ownerdrawfixed_parent_seq[]
Definition: listview.c:97
static void test_ownerdata(void)
Definition: listview.c:3143
static const struct message ownerdata_setstate_all_parent_seq[]
Definition: listview.c:233
static void test_notifyformat(void)
Definition: listview.c:4482
static const struct message redraw_listview_seq[]
Definition: listview.c:105
static void test_header_notification2(void)
Definition: listview.c:5556
#define test_lvm_subitemhittest(a, b, c, d, e, f, g, h, i)
Definition: listview.c:886
static void test_approximate_viewrect(void)
Definition: listview.c:5092
static void test_LVM_REDRAWITEMS(void)
Definition: listview.c:5800
static void test_header_presence_(HWND hwnd, BOOL present, int line)
Definition: listview.c:1617
static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:751
static BOOL is_below_comctl_5(void)
Definition: listview.c:4645
static NMLISTVIEW g_nmlistview_changing
Definition: listview.c:64
static void test_scrollnotify(void)
Definition: listview.c:5009
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:469
static const struct message listview_getorderarray_seq[]
Definition: listview.c:195
static void test_dispinfo(void)
Definition: listview.c:5733
static void test_destroynotify(void)
Definition: listview.c:5467
static void test_color(void)
Definition: listview.c:2081
#define LISTVIEW_ID
Definition: listview.c:46
static LVITEMA g_itema
Definition: listview.c:71
static void test_nosortheader(void)
Definition: listview.c:3634
static const struct message listview_set_imagelist[]
Definition: listview.c:410
static void test_state_image(void)
Definition: listview.c:6299
static const struct message scroll_parent_seq[]
Definition: listview.c:330
static void test_setredraw(void)
Definition: listview.c:3675
static const struct message listview_ownerdata_destroy[]
Definition: listview.c:371
static void test_item_position(void)
Definition: listview.c:2258
static HWND create_listview_control(DWORD style)
Definition: listview.c:690
static const struct message changing_all_parent_seq[]
Definition: listview.c:270
static NMLISTVIEW g_nmlistview
Definition: listview.c:62
static INT WINAPI test_CallBackCompare(LPARAM first, LPARAM second, LPARAM lParam)
Definition: listview.c:2959
static BOOL blockEdit
Definition: listview.c:58
static struct msg_sequence * sequences[NUM_MSG_SEQUENCES]
Definition: listview.c:95
static HIMAGELIST test_create_imagelist
Definition: listview.c:1597
static void flush_events(void)
Definition: listview.c:6053
static void test_getitemposition(void)
Definition: listview.c:3985
static void test_item_count(void)
Definition: listview.c:2153
static void test_LVS_EX_TRANSPARENTBKGND(void)
Definition: listview.c:5048
static HWND create_listview_controlW(DWORD style, HWND parent)
Definition: listview.c:713
static BOOL g_disp_A_to_W
Definition: listview.c:73
static const struct message listview_item_count_seq[]
Definition: listview.c:154
#define expect(expected, got)
Definition: listview.c:49
static void test_mapidindex(void)
Definition: listview.c:4765
static void test_oneclickactivate(void)
Definition: listview.c:6068
static void test_columns(void)
Definition: listview.c:1476
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:668
static WNDPROC listviewWndProc
Definition: listview.c:1596
static void test_insertitem(void)
Definition: listview.c:5977
static LRESULT WINAPI editbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: listview.c:785
#define test_lvm_hittest(a, b, c, d, e, f, g, h)
Definition: listview.c:859
static const struct message listview_ownerdata_deleteall[]
Definition: listview.c:382
static HWND hwndparentW
Definition: listview.c:56
static const struct message listview_color_seq[]
Definition: listview.c:123
static void test_getorigin(void)
Definition: listview.c:2326
static BOOL g_block_hover
Definition: listview.c:60
static void test_redraw(void)
Definition: listview.c:1837
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)
Definition: listview.c:828
static void test_get_set_view(void)
Definition: listview.c:4661
static const struct message listview_icon_spacing_seq[]
Definition: listview.c:116
static const struct message lvs_ex_transparentbkgnd_seq[]
Definition: listview.c:341
static BOOL g_WM_KILLFOCUS_on_LVN_ENDLABELEDIT
Definition: listview.c:79
#define TEST_NO_HEADER2(a, b)
Definition: listview.c:1616
static void test_deleteitem(void)
Definition: listview.c:5922
static const struct message editbox_create_pos[]
Definition: listview.c:313
static void test_LVSCW_AUTOSIZE(void)
Definition: listview.c:6410
static void test_getitemrect(void)
Definition: listview.c:4027
static HWND subclass_editbox(HWND hwndListview)
Definition: listview.c:814
static void test_header_proc(void)
Definition: listview.c:6029
static void test_getcolumnwidth(void)
Definition: listview.c:4972
static const struct message change_all_parent_seq[]
Definition: listview.c:252
static void test_images(void)
Definition: listview.c:888
static void insert_column(HWND hwnd, int idx)
Definition: listview.c:1189
static const struct message parent_list_cd_seq[]
Definition: listview.c:442
static void test_icon_spacing(void)
Definition: listview.c:2039
static const struct message getitemposition_seq1[]
Definition: listview.c:290
static void test_callback_mask(void)
Definition: listview.c:6126
static INT notifyFormat
Definition: listview.c:67
static void test_canceleditlabel(void)
Definition: listview.c:4713
static void init_functions(void)
Definition: listview.c:83
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)
Definition: listview.c:862
static const struct message forward_erasebkgnd_parent_seq[]
Definition: listview.c:221
#define expect2(expected1, expected2, got1, got2)
Definition: listview.c:50
#define TEST_NO_HEADER(a)
Definition: listview.c:1614
static const struct message getsubitemrect_seq[]
Definition: listview.c:301
static void test_getviewrect(void)
Definition: listview.c:3934
static const struct message ownerdata_defocus_all_parent_seq[]
Definition: listview.c:238
static const struct message parent_insert_focused_seq[]
Definition: listview.c:421
static const struct message edit_end_nochange[]
Definition: listview.c:346
static void test_getitemspacing(void)
Definition: listview.c:4819
static const struct message getitemposition_seq2[]
Definition: listview.c:295
static BOOL g_is_below_5
Definition: listview.c:69
static LRESULT CALLBACK create_item_height_wndproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6505
static BOOL is_win_xp(void)
Definition: listview.c:736
static const struct message parent_focus_change_ownerdata_seq[]
Definition: listview.c:215
static void test_createdragimage(void)
Definition: listview.c:5711
static const struct message empty_seq[]
Definition: listview.c:211
static const struct message listview_end_label_edit_kill_focus[]
Definition: listview.c:459
static void test_header_notification(void)
Definition: listview.c:5497
static void test_item_state_change(void)
Definition: listview.c:6575
static HWND create_parent_window(void)
Definition: monthcal.c:599
static void test_create(void)
Definition: monthcal.c:1595
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CHAR testA[]
Definition: run.c:171
#define todo_wine_if(is_todo)
Definition: custom.c:86
#define todo_wine
Definition: custom.c:89
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static ATOM item
Definition: dde.c:856
static const WCHAR testtextW[]
Definition: dialog.c:1384
static const struct metadata_item item1[]
Definition: metadata.c:2802
static const struct metadata_item item2[]
Definition: metadata.c:2807
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
static TCHAR * items[]
Definition: page1.c:45
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_BORDER
Definition: pedump.c:625
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define ES_MULTILINE
Definition: pedump.c:667
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define LVIR_ICON
Definition: commctrl.h:2478
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define LVM_GETCALLBACKMASK
Definition: commctrl.h:2421
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2418
#define LVM_CREATEDRAGIMAGE
Definition: commctrl.h:2657
#define LV_VIEW_DETAILS
Definition: commctrl.h:2846
#define LVIS_OVERLAYMASK
Definition: commctrl.h:2330
#define LVSIL_SMALL
Definition: commctrl.h:2304
#define I_IMAGECALLBACK
Definition: commctrl.h:2390
#define LVM_GETITEMA
Definition: commctrl.h:2394
#define LVN_GETDISPINFOA
Definition: commctrl.h:3158
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define WC_LISTVIEWA
Definition: commctrl.h:2261
#define HDM_SETORDERARRAY
Definition: commctrl.h:809
#define HDS_BUTTONS
Definition: commctrl.h:629
#define LVS_EX_ONECLICKACTIVATE
Definition: commctrl.h:2740
#define HDS_HIDDEN
Definition: commctrl.h:631
#define LVN_ENDSCROLL
Definition: commctrl.h:3241
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2692
#define LVM_SETHOVERTIME
Definition: commctrl.h:2797
#define LVS_SINGLESEL
Definition: commctrl.h:2271
#define TME_LEAVE
Definition: commctrl.h:4986
#define LVM_SETTEXTCOLOR
Definition: commctrl.h:2663
#define LVS_ICON
Definition: commctrl.h:2266
#define HDI_TEXT
Definition: commctrl.h:704
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2275
#define LVM_INSERTCOLUMNA
Definition: commctrl.h:2636
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2311
#define LVM_GETITEMSTATE
Definition: commctrl.h:2680
#define LVN_COLUMNCLICK
Definition: commctrl.h:3144
#define WC_HEADERA
Definition: commctrl.h:623
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define LVIF_NORECOMPUTE
Definition: commctrl.h:2319
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2289
#define LVFI_SUBSTRING
Definition: commctrl.h:2443
#define LVM_GETCOLUMNORDERARRAY
Definition: commctrl.h:2773
#define LVM_GETHEADER
Definition: commctrl.h:2655
#define LVM_GETITEMSPACING
Definition: commctrl.h:2716
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define LVM_SETCOLUMNA
Definition: commctrl.h:2629
#define LVM_SETCOLUMNWIDTH
Definition: commctrl.h:2651
#define LVM_SETBKCOLOR
Definition: commctrl.h:2298
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVS_EX_GRIDLINES
Definition: commctrl.h:2734
#define LVS_OWNERDATA
Definition: commctrl.h:2279
#define WC_LISTVIEWW
Definition: commctrl.h:2262
#define HOVER_DEFAULT
Definition: commctrl.h:4991
#define CDDS_SUBITEM
Definition: commctrl.h:289
#define CDRF_NOTIFYSUBITEMDRAW
Definition: commctrl.h:276
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2288
#define HDM_GETUNICODEFORMAT
Definition: commctrl.h:824
#define LVM_GETITEMPOSITION
Definition: commctrl.h:2488
#define HDN_ITEMKEYDOWN
Definition: commctrl.h:862
#define LVM_SETITEMSTATE
Definition: commctrl.h:2677
#define LVHT_ONITEM
Definition: commctrl.h:2502
#define LVS_EX_FLATSB
Definition: commctrl.h:2742
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2738
#define CLR_NONE
Definition: commctrl.h:319
#define LVHT_TOLEFT
Definition: commctrl.h:2507
#define LVM_EDITLABELW
Definition: commctrl.h:2541
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2386
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2272
#define LVM_DELETECOLUMN
Definition: commctrl.h:2643
#define LVS_REPORT
Definition: commctrl.h:2267
#define LVM_SETITEMPOSITION
Definition: commctrl.h:2485
#define LVS_SMALLICON
Definition: commctrl.h:2268
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3139
#define LVN_BEGINSCROLL
Definition: commctrl.h:3240
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2424
#define LVM_SETUNICODEFORMAT
Definition: commctrl.h:2292
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2547
#define LVM_EDITLABELA
Definition: commctrl.h:2540
#define HDM_GETITEMCOUNT
Definition: commctrl.h:733
#define WC_EDITA
Definition: commctrl.h:4691
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define LVM_REDRAWITEMS
Definition: commctrl.h:2529
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVM_APPROXIMATEVIEWRECT
Definition: commctrl.h:2783
#define LVM_GETHOVERTIME
Definition: commctrl.h:2799
#define LVNI_FOCUSED
Definition: commctrl.h:2428
#define LVM_SETIMAGELIST
Definition: commctrl.h:2308
_Out_opt_ int * cx
Definition: commctrl.h:585
#define LVIF_INDENT
Definition: commctrl.h:2318
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define LVN_INSERTITEM
Definition: commctrl.h:3137
#define HDM_GETITEMA
Definition: commctrl.h:746
#define CDIS_SELECTED
Definition: commctrl.h:291
#define HDI_WIDTH
Definition: commctrl.h:702
#define NM_HOVER
Definition: commctrl.h:138
#define LVN_ITEMCHANGING
Definition: commctrl.h:3135
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define LVM_GETVIEWRECT
Definition: commctrl.h:2659
#define LVM_GETNEXTITEM
Definition: commctrl.h:2438
#define LV_VIEW_LIST
Definition: commctrl.h:2848
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2736
#define LVHT_TORIGHT
Definition: commctrl.h:2506
#define LVN_ODCACHEHINT
Definition: commctrl.h:3148
#define LVFI_PARTIAL
Definition: commctrl.h:2444
#define LVM_MAPIDTOINDEX
Definition: commctrl.h:3021
#define LVM_MAPINDEXTOID
Definition: commctrl.h:3019
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2739
#define LVS_SORTASCENDING
Definition: commctrl.h:2273
#define LVM_GETSUBITEMRECT
Definition: commctrl.h:2767
#define HDN_ITEMSTATEICONCLICK
Definition: commctrl.h:861
#define LVS_SORTDESCENDING
Definition: commctrl.h:2274
#define HDS_DRAGDROP
Definition: commctrl.h:632
#define HDN_ITEMCHANGINGA
Definition: commctrl.h:837
#define LVN_BEGINLABELEDITA
Definition: commctrl.h:3140
#define LVM_GETVIEW
Definition: commctrl.h:2853
#define LVM_SETSELECTIONMARK
Definition: commctrl.h:2795
#define LVM_SETITEMTEXTA
Definition: commctrl.h:2691
#define LVM_CANCELEDITLABEL
Definition: commctrl.h:3017
#define HDN_ITEMCLICKA
Definition: commctrl.h:841
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define HDN_ENDTRACKA
Definition: commctrl.h:849
#define HDN_ITEMDBLCLICKW
Definition: commctrl.h:844
#define LVIS_DROPHILITED
Definition: commctrl.h:2326
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define LVSCW_AUTOSIZE
Definition: commctrl.h:2649
#define LVM_SETITEMCOUNT
Definition: commctrl.h:2701
#define LVIR_LABEL
Definition: commctrl.h:2479
#define HDM_SETIMAGELIST
Definition: commctrl.h:794
#define LVM_SCROLL
Definition: commctrl.h:2526
#define LVM_GETIMAGELIST
Definition: commctrl.h:2300
#define HDN_FILTERCHANGE
Definition: commctrl.h:857
#define LVM_INSERTITEMA
Definition: commctrl.h:2408
#define LVM_GETCOUNTPERPAGE
Definition: commctrl.h:2671
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define HDM_GETORDERARRAY
Definition: commctrl.h:806
#define LVM_SUBITEMHITTEST
Definition: commctrl.h:2769
#define LVN_ENDLABELEDITA
Definition: commctrl.h:3142
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVM_GETITEMRECT
Definition: commctrl.h:2482
#define LVS_NOSORTHEADER
Definition: commctrl.h:2290
#define LVM_GETITEMTEXTA
Definition: commctrl.h:2684
#define LVS_EDITLABELS
Definition: commctrl.h:2278
#define LVM_GETBKCOLOR
Definition: commctrl.h:2296
#define CLR_DEFAULT
Definition: commctrl.h:320
#define HDS_HORZ
Definition: commctrl.h:628
#define LVHT_ONITEMICON
Definition: commctrl.h:2499
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVM_DELETEITEM
Definition: commctrl.h:2415
#define HDN_ENDFILTEREDIT
Definition: commctrl.h:860
#define LVIR_SELECTBOUNDS
Definition: commctrl.h:2480
#define HDM_GETITEMW
Definition: commctrl.h:747
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2732
#define LVM_SETITEMA
Definition: commctrl.h:2401
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define LVM_SETVIEW
Definition: commctrl.h:2851
#define LVM_GETSELECTIONMARK
Definition: commctrl.h:2793
#define LVM_GETORIGIN
Definition: commctrl.h:2673
#define HDM_GETITEMRECT
Definition: commctrl.h:791
#define NM_SETFOCUS
Definition: commctrl.h:135
#define LVM_SETICONSPACING
Definition: commctrl.h:2726
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2333
#define WM_MOUSEHOVER
Definition: commctrl.h:4979
#define CDDS_POSTPAINT
Definition: commctrl.h:281
#define HDN_BEGINTRACKW
Definition: commctrl.h:848
#define LVN_GETDISPINFOW
Definition: commctrl.h:3159
#define LVM_GETSELECTEDCOUNT
Definition: commctrl.h:2713
#define LVS_EX_DOUBLEBUFFER
Definition: commctrl.h:2750
#define LVM_GETUNICODEFORMAT
Definition: commctrl.h:2294
#define LVS_EX_UNDERLINEHOT
Definition: commctrl.h:2745
#define LVM_GETTEXTCOLOR
Definition: commctrl.h:2661
#define LVSIL_STATE
Definition: commctrl.h:2305
#define LVM_SETTEXTBKCOLOR
Definition: commctrl.h:2667
#define TME_QUERY
Definition: commctrl.h:4988
#define LVIF_IMAGE
Definition: commctrl.h:2315
#define LVM_SORTITEMSEX
Definition: commctrl.h:2805
#define HDN_TRACKA
Definition: commctrl.h:851
#define LVM_SETCOLUMNORDERARRAY
Definition: commctrl.h:2771
#define LV_VIEW_SMALLICON
Definition: commctrl.h:2847
#define LVHT_ONITEMSTATEICON
Definition: commctrl.h:2501
#define LVHT_NOWHERE
Definition: commctrl.h:2498
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
#define LVIF_DI_SETITEM
Definition: commctrl.h:3171
#define HDN_ITEMCHANGEDA
Definition: commctrl.h:839
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
#define LVCF_TEXT
Definition: commctrl.h:2593
#define HDM_GETIMAGELIST
Definition: commctrl.h:797
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2331
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
#define LVN_DELETEITEM
Definition: commctrl.h:3138
#define LVM_SORTITEMS
Definition: commctrl.h:2707
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define LV_VIEW_ICON
Definition: commctrl.h:2845
#define LVM_FINDITEMA
Definition: commctrl.h:2470
#define HDN_DIVIDERDBLCLICKA
Definition: commctrl.h:845
#define HDN_BEGINFILTEREDIT
Definition: commctrl.h:859
#define LVM_GETCOLUMNWIDTH
Definition: commctrl.h:2646
#define LVHT_ONITEMLABEL
Definition: commctrl.h:2500
#define LVM_HITTEST
Definition: commctrl.h:2520
#define LVM_GETTEXTBKCOLOR
Definition: commctrl.h:2665
#define LVS_LIST
Definition: commctrl.h:2269
#define HDI_ORDER
Definition: commctrl.h:710
#define LVIR_BOUNDS
Definition: commctrl.h:2477
#define I_INDENTCALLBACK
Definition: commctrl.h:2335
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2729
#define LVSIL_NORMAL
Definition: commctrl.h:2303
#define LVIS_CUT
Definition: commctrl.h:2325
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define EM_GETLIMITTEXT
Definition: richedit.h:74
#define WM_NOTIFY
Definition: richedit.h:61
#define list
Definition: rosglue.h:35
#define test
Definition: rosglue.h:37
#define win_skip
Definition: test.h:163
const char * descr
Definition: boot.c:45
#define memset(x, y, z)
Definition: compat.h:39
& rect
Definition: startmenu.cpp:1413
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
UINT cbSize
Definition: winuser.h:3204
WNDPROC lpfnWndProc
Definition: winuser.h:3206
LPCSTR lpszClassName
Definition: winuser.h:3214
LPCWSTR lpszClassName
Definition: winuser.h:3188
LPCWSTR lpszMenuName
Definition: winuser.h:3187
HBRUSH hbrBackground
Definition: winuser.h:3186
HICON hIcon
Definition: winuser.h:3184
HINSTANCE hInstance
Definition: winuser.h:3183
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
Definition: inflate.c:139
Definition: parser.c:49
Definition: tftpd.h:60
UINT id
Definition: msg.h:56
UINT message
Definition: SystemMenu.c:42
msg_flags_t flags
Definition: SystemMenu.c:43
LPSTR pszText
Definition: commctrl.h:2561
LVITEMA item
Definition: commctrl.h:3179
UINT stateMask
Definition: commctrl.h:2352
int iSubItem
Definition: commctrl.h:2350
int cchTextMax
Definition: commctrl.h:2354
LPSTR pszText
Definition: commctrl.h:2353
UINT mask
Definition: commctrl.h:2348
int iImage
Definition: commctrl.h:2355
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
NMHDR hdr
Definition: commctrl.h:881
HDITEMA * pitem
Definition: commctrl.h:884
HDITEMW * pitem
Definition: commctrl.h:891
NMHDR hdr
Definition: commctrl.h:888
POINT ptAction
Definition: commctrl.h:3044
UINT uNewState
Definition: commctrl.h:3041
LPARAM lParam
Definition: commctrl.h:3045
UINT uOldState
Definition: commctrl.h:3042
COLORREF clrTextBk
Definition: commctrl.h:3069
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3067
COLORREF clrText
Definition: commctrl.h:3068
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
Definition: time.h:68
static WCHAR ** task_list
Definition: taskkill.c:35
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t DWORD_PTR
Definition: typedefs.h:65
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:73
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:65
int ret
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1302
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define WHITE_BRUSH
Definition: wingdi.h:902
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define SYSTEM_FONT
Definition: wingdi.h:911
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define WM_PAINT
Definition: winuser.h:1623
HWND WINAPI GetFocus(void)
Definition: window.c:1865
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1628
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
DWORD WINAPI GetSysColor(_In_ int)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define SetWindowLongPtrA
Definition: winuser.h:5357
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4832
HDC WINAPI GetWindowDC(_In_opt_ HWND)
BOOL WINAPI SetKeyboardState(_In_reads_(256) LPBYTE)
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define WM_KEYUP
Definition: winuser.h:1719
#define EN_KILLFOCUS
Definition: winuser.h:2028
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 ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define HWND_TOPMOST
Definition: winuser.h:1211
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define WM_CREATE
Definition: winuser.h:1611
#define EN_SETFOCUS
Definition: winuser.h:2030
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define VK_SPACE
Definition: winuser.h:2222
#define WM_SIZE
Definition: winuser.h:1614
#define PRF_ERASEBKGND
Definition: winuser.h:2529
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SWP_NOMOVE
Definition: winuser.h:1247
BOOL WINAPI ValidateRect(_In_opt_ HWND, _In_opt_ LPCRECT)
#define WM_COMMAND
Definition: winuser.h:1743
#define SM_CYICONSPACING
Definition: winuser.h:1005
HWND WINAPI GetTopWindow(_In_opt_ HWND)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2722
#define WM_NCHITTEST
Definition: winuser.h:1689
#define VK_UP
Definition: winuser.h:2228
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define QS_ALLINPUT
Definition: winuser.h:906
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
#define SWP_NOSIZE
Definition: winuser.h:1248
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define WM_GETTEXT
Definition: winuser.h:1621
#define RDW_UPDATENOW
Definition: winuser.h:1223
#define GetWindowLongPtrA
Definition: winuser.h:4831
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define WM_DEVICECHANGE
Definition: winuser.h:1814
#define NF_REQUERY
Definition: winuser.h:2464
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2714
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define WM_GETFONT
Definition: winuser.h:1654
#define GWLP_HINSTANCE
Definition: winuser.h:859
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define GW_HWNDNEXT
Definition: winuser.h:764
#define WM_SHOWWINDOW
Definition: winuser.h:1631
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define WM_SETTEXT
Definition: winuser.h:1620
BOOL WINAPI IsWindowUnicode(_In_ HWND)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define VK_RETURN
Definition: winuser.h:2204
#define SM_CYICON
Definition: winuser.h:976
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define VK_END
Definition: winuser.h:2225
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 VK_HOME
Definition: winuser.h:2226
#define PM_REMOVE
Definition: winuser.h:1199
BOOL WINAPI UpdateWindow(_In_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_MEASUREITEM
Definition: winuser.h:1649
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define GetNextWindow(h, c)
Definition: winuser.h:4730
#define WM_MOVE
Definition: winuser.h:1613
#define NFR_ANSI
Definition: winuser.h:2461
#define WM_NCDESTROY
Definition: winuser.h:1687
#define VK_DOWN
Definition: winuser.h:2230
#define GWLP_ID
Definition: winuser.h:863
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_USER
Definition: winuser.h:1898
#define VK_SHIFT
Definition: winuser.h:2205
struct _WNDCLASSEXA WNDCLASSEXA
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define WM_KEYDOWN
Definition: winuser.h:1718
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define WM_PARENTNOTIFY
Definition: winuser.h:1806
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define NFR_UNICODE
Definition: winuser.h:2462
#define WM_NCCALCSIZE
Definition: winuser.h:1688
#define GWL_STYLE
Definition: winuser.h:855
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
#define SM_CXICON
Definition: winuser.h:975
#define VK_ESCAPE
Definition: winuser.h:2217
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1665
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_KILLFOCUS
Definition: winuser.h:1617
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SM_CXICONSPACING
Definition: winuser.h:1004
#define WM_GETDLGCODE
Definition: winuser.h:1692
#define NF_QUERY
Definition: winuser.h:2463
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2142
#define WM_NCPAINT
Definition: winuser.h:1690
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define COLOR_3DFACE
Definition: winuser.h:932
#define WM_SETREDRAW
Definition: winuser.h:1619
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193