Commit 9ef65cf3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tests: Test that callback mask is stored as is, check more message results.

parent 74a03b1a
...@@ -1179,7 +1179,8 @@ static void test_items(void) ...@@ -1179,7 +1179,8 @@ static void test_items(void)
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
expect(1, r); expect(1, r);
ok(item.state & LVIS_SELECTED, "Expected LVIS_SELECTED\n"); ok(item.state & LVIS_SELECTED, "Expected LVIS_SELECTED\n");
SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0);
ok(r, "got %d\n", r);
/* LVIS_SELECTED with zero stateMask */ /* LVIS_SELECTED with zero stateMask */
/* set */ /* set */
...@@ -1201,7 +1202,8 @@ static void test_items(void) ...@@ -1201,7 +1202,8 @@ static void test_items(void)
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
expect(1, r); expect(1, r);
ok(item.state & LVIS_FOCUSED, "Expected LVIS_FOCUSED\n"); ok(item.state & LVIS_FOCUSED, "Expected LVIS_FOCUSED\n");
SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0);
ok(r, "got %d\n", r);
/* LVIS_CUT with LVIS_FOCUSED stateMask */ /* LVIS_CUT with LVIS_FOCUSED stateMask */
/* set */ /* set */
...@@ -1223,7 +1225,8 @@ static void test_items(void) ...@@ -1223,7 +1225,8 @@ static void test_items(void)
r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
expect(1, r); expect(1, r);
ok(item.state & LVIS_CUT, "Expected LVIS_CUT\n"); ok(item.state & LVIS_CUT, "Expected LVIS_CUT\n");
SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0);
ok(r, "got %d\n", r);
/* Insert an item with just a param */ /* Insert an item with just a param */
memset (&item, 0xcc, sizeof (item)); memset (&item, 0xcc, sizeof (item));
...@@ -2294,15 +2297,18 @@ static void test_multiselect(void) ...@@ -2294,15 +2297,18 @@ static void test_multiselect(void)
/* deselect all items */ /* deselect all items */
item.state = 0; item.state = 0;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
ok(r, "got %d\n", r);
SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1);
/* set initial position */ /* set initial position */
SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos)); r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos));
ok(r, "got %d\n", r);
item.state = LVIS_SELECTED; item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item);
ok(r, "got %d\n", r);
selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
ok(selected_count == 1, "expected 1, got %d\n", selected_count); ok(selected_count == 1, "expected 1, got %d\n", selected_count);
...@@ -2347,7 +2353,8 @@ static void test_multiselect(void) ...@@ -2347,7 +2353,8 @@ static void test_multiselect(void)
/* select all, check notifications */ /* select all, check notifications */
item.state = 0; item.state = 0;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
ok(r, "got %d\n", r);
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
...@@ -2381,7 +2388,8 @@ static void test_multiselect(void) ...@@ -2381,7 +2388,8 @@ static void test_multiselect(void)
item.state = 0; item.state = 0;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
ok(r, "got %d\n", r);
ok_sequence(sequences, PARENT_SEQ_INDEX, change_all_parent_seq, ok_sequence(sequences, PARENT_SEQ_INDEX, change_all_parent_seq,
"deselect all notification", FALSE); "deselect all notification", FALSE);
...@@ -2410,11 +2418,13 @@ static void test_multiselect(void) ...@@ -2410,11 +2418,13 @@ static void test_multiselect(void)
ok_sequence(sequences, PARENT_SEQ_INDEX, changing_all_parent_seq, ok_sequence(sequences, PARENT_SEQ_INDEX, changing_all_parent_seq,
"set state all notification 3", FALSE); "set state all notification 3", FALSE);
SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1);
ok(r, "got %d\n", r);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
item.state = LVIS_SELECTED; item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, i, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, i, (LPARAM)&item);
ok(r, "got %d\n", r);
} }
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
...@@ -2435,13 +2445,14 @@ static void test_multiselect(void) ...@@ -2435,13 +2445,14 @@ static void test_multiselect(void)
} }
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(3, r); expect(3, r);
SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0); r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0);
expect(3, r); ok(r == -1, "got %d\n", r);
/* select one more */ /* select one more */
item.state = LVIS_SELECTED; item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
SendMessageA(hwnd, LVM_SETITEMSTATE, 3, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, 3, (LPARAM)&item);
ok(r, "got %d\n", r);
for (i=0;i<3;i++) { for (i=0;i<3;i++) {
r = SendMessageA(hwnd, LVM_GETITEMSTATE, i, LVIS_SELECTED); r = SendMessageA(hwnd, LVM_GETITEMSTATE, i, LVIS_SELECTED);
...@@ -2461,7 +2472,8 @@ static void test_multiselect(void) ...@@ -2461,7 +2472,8 @@ static void test_multiselect(void)
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item);
expect(TRUE, r); expect(TRUE, r);
SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1);
ok(r == -1, "got %d\n", r);
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
item.state = LVIS_SELECTED; item.state = LVIS_SELECTED;
...@@ -2681,7 +2693,8 @@ static void test_subitem_rect(void) ...@@ -2681,7 +2693,8 @@ static void test_subitem_rect(void)
expect(100, rect.left); expect(100, rect.left);
expect(250, rect.right); expect(250, rect.right);
SendMessageA(hwnd, LVM_SCROLL, 10, 0); r = SendMessageA(hwnd, LVM_SCROLL, 10, 0);
ok(r, "got %d\n", r);
SetRect(&rect, LVIR_BOUNDS, 1, 0, 0); SetRect(&rect, LVIR_BOUNDS, 1, 0, 0);
r = SendMessageA(hwnd, LVM_GETSUBITEMRECT, 0, (LPARAM)&rect); r = SendMessageA(hwnd, LVM_GETSUBITEMRECT, 0, (LPARAM)&rect);
...@@ -3798,7 +3811,8 @@ static void test_getviewrect(void) ...@@ -3798,7 +3811,8 @@ static void test_getviewrect(void)
memset(&item, 0, sizeof(item)); memset(&item, 0, sizeof(item));
item.iItem = 0; item.iItem = 0;
item.iSubItem = 0; item.iSubItem = 0;
SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
ok(!r, "got %d\n", r);
r = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(100, 0)); r = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(100, 0));
expect(TRUE, r); expect(TRUE, r);
...@@ -3860,7 +3874,8 @@ static void test_getitemposition(void) ...@@ -3860,7 +3874,8 @@ static void test_getitemposition(void)
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getitemposition_seq2, "get item position 2", TRUE); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getitemposition_seq2, "get item position 2", TRUE);
SetRectEmpty(&rect); SetRectEmpty(&rect);
SendMessageA(header, HDM_GETITEMRECT, 0, (LPARAM)&rect); r = SendMessageA(header, HDM_GETITEMRECT, 0, (LPARAM)&rect);
ok(r, "got %d\n", r);
/* some padding? */ /* some padding? */
expect(2, pt.x); expect(2, pt.x);
/* offset by header height */ /* offset by header height */
...@@ -4859,7 +4874,8 @@ static void test_getcolumnwidth(void) ...@@ -4859,7 +4874,8 @@ static void test_getcolumnwidth(void)
/* default column width with item added */ /* default column width with item added */
hwnd = create_listview_control(LVS_LIST); hwnd = create_listview_control(LVS_LIST);
memset(&itema, 0, sizeof(itema)); memset(&itema, 0, sizeof(itema));
SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema); ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema);
ok(!ret, "got %d\n", ret);
ret = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); ret = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0);
height = get_current_font_height(hwnd); height = get_current_font_height(hwnd);
ok((ret / height) >= 6, "got width %d, height %d\n", ret, height); ok((ret / height) >= 6, "got width %d, height %d\n", ret, height);
...@@ -5798,6 +5814,26 @@ static void test_oneclickactivate(void) ...@@ -5798,6 +5814,26 @@ static void test_oneclickactivate(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
static void test_callback_mask(void)
{
DWORD mask;
HWND hwnd;
BOOL ret;
hwnd = create_listview_control(LVS_REPORT);
ret = SendMessageA(hwnd, LVM_SETCALLBACKMASK, ~0u, 0);
ok(ret, "got %d\n", ret);
ret = SendMessageA(hwnd, LVM_SETCALLBACKMASK, ~0u, 1);
ok(ret, "got %d\n", ret);
mask = SendMessageA(hwnd, LVM_GETCALLBACKMASK, 0, 0);
ok(mask == ~0u, "got 0x%08x\n", mask);
DestroyWindow(hwnd);
}
START_TEST(listview) START_TEST(listview)
{ {
HMODULE hComctl32; HMODULE hComctl32;
...@@ -5868,6 +5904,7 @@ START_TEST(listview) ...@@ -5868,6 +5904,7 @@ START_TEST(listview)
test_insertitem(); test_insertitem();
test_header_proc(); test_header_proc();
test_oneclickactivate(); test_oneclickactivate();
test_callback_mask();
if (!load_v6_module(&ctx_cookie, &hCtx)) if (!load_v6_module(&ctx_cookie, &hCtx))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment