comctl32/listview: Filter invalid indices when setting selection mark.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
28bb9d15a6
commit
5faab43d34
|
@ -9053,7 +9053,8 @@ static INT LISTVIEW_SetSelectionMark(LISTVIEW_INFO *infoPtr, INT nIndex)
|
|||
|
||||
TRACE("(nIndex=%d)\n", nIndex);
|
||||
|
||||
infoPtr->nSelectionMark = nIndex;
|
||||
if (nIndex >= -1 && nIndex < infoPtr->nItemCount)
|
||||
infoPtr->nSelectionMark = nIndex;
|
||||
|
||||
return nOldIndex;
|
||||
}
|
||||
|
|
|
@ -2257,7 +2257,29 @@ static void test_multiselect(void)
|
|||
item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0);
|
||||
expect(items, item_count);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1);
|
||||
ok(r == -1, "got %d\n", r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, 0);
|
||||
ok(r == -1, "got %d\n", r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, 0);
|
||||
ok(r == 0, "got %d\n", r);
|
||||
|
||||
/* out of range index */
|
||||
r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, items);
|
||||
ok(r == 0, "got %d\n", r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0);
|
||||
ok(r == 0, "got %d\n", r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -2);
|
||||
ok(r == 0, "got %d\n", r);
|
||||
|
||||
r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0);
|
||||
ok(r == 0, "got %d\n", r);
|
||||
|
||||
for (i = 0; i < sizeof(task_list)/sizeof(task_list[0]); i++) {
|
||||
DWORD selected_count;
|
||||
LVITEMA item;
|
||||
|
||||
|
|
Loading…
Reference in New Issue