comctl32: Return TRUE from LVM_REDRAWITEMS with bad indices.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2017-02-20 00:06:12 -07:00 committed by Alexandre Julliard
parent 0cf4728d01
commit 690022c61b
2 changed files with 40 additions and 6 deletions

View File

@ -7989,12 +7989,8 @@ static BOOL LISTVIEW_IsItemVisible(const LISTVIEW_INFO *infoPtr, INT nItem)
static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
{
INT i;
if (nLast < nFirst || min(nFirst, nLast) < 0 ||
max(nFirst, nLast) >= infoPtr->nItemCount)
return FALSE;
for (i = nFirst; i <= nLast; i++)
for (i = max(nFirst, 0); i <= min(nLast, infoPtr->nItemCount - 1); i++)
LISTVIEW_InvalidateItem(infoPtr, i);
return TRUE;

View File

@ -5529,6 +5529,43 @@ static void test_LVM_SETITEMTEXT(void)
DestroyWindow(hwnd);
}
static void test_LVM_REDRAWITEMS(void)
{
HWND list;
DWORD ret;
list = create_listview_control(LVS_ICON);
ok(list != NULL, "failed to create listview window\n");
ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0);
expect(TRUE, ret);
insert_item(list, 0);
ret = SendMessageA(list, LVM_REDRAWITEMS, -1, 0);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 0, -1);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 1);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 2);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 1, 0);
expect(TRUE, ret);
ret = SendMessageA(list, LVM_REDRAWITEMS, 2, 3);
expect(TRUE, ret);
DestroyWindow(list);
}
static void test_imagelists(void)
{
HWND hwnd, header;
@ -5903,6 +5940,7 @@ START_TEST(listview)
test_createdragimage();
test_dispinfo();
test_LVM_SETITEMTEXT();
test_LVM_REDRAWITEMS();
test_imagelists();
test_deleteitem();
test_insertitem();