comctl32/listview: Add partial implementation of LVM_GETNEXTITEMINDEX.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2022-01-21 19:08:24 +03:00 committed by Alexandre Julliard
parent b74b634335
commit c16b65cdd9
2 changed files with 46 additions and 0 deletions

View File

@ -7452,6 +7452,17 @@ static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uF
return -1;
}
static BOOL LISTVIEW_GetNextItemIndex(const LISTVIEW_INFO *infoPtr, LVITEMINDEX *index, UINT flags)
{
/* FIXME: specified item group is ignored */
if (!index)
return FALSE;
index->iItem = LISTVIEW_GetNextItem(infoPtr, index->iItem, flags);
return index->iItem != -1;
}
/* LISTVIEW_GetNumberOfWorkAreas */
/***
@ -11426,6 +11437,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case LVM_GETNEXTITEM:
return LISTVIEW_GetNextItem(infoPtr, (INT)wParam, LOWORD(lParam));
case LVM_GETNEXTITEMINDEX:
return LISTVIEW_GetNextItemIndex(infoPtr, (LVITEMINDEX *)wParam, lParam);
case LVM_GETNUMBEROFWORKAREAS:
FIXME("LVM_GETNUMBEROFWORKAREAS: unimplemented\n");
return 1;

View File

@ -6624,6 +6624,37 @@ static void test_selected_column(void)
}
}
static void test_LVM_GETNEXTITEMINDEX(void)
{
LVITEMINDEX index;
HWND hwnd;
BOOL ret;
hwnd = create_listview_control(LVS_REPORT);
insert_item(hwnd, 0);
insert_item(hwnd, 1);
ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, 0, LVNI_ALL);
ok(!ret, "Unexpected return value %d.\n", ret);
index.iItem = -1;
index.iGroup = 0;
ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL);
ok(ret, "Unexpected return value %d.\n", ret);
ok(index.iItem == 0, "Unexpected item index %d.\n", index.iItem);
ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL);
ok(ret, "Unexpected return value %d.\n", ret);
ok(index.iItem == 1, "Unexpected item index %d.\n", index.iItem);
ret = SendMessageA(hwnd, LVM_GETNEXTITEMINDEX, (WPARAM)&index, LVNI_ALL);
ok(!ret, "Unexpected return value %d.\n", ret);
ok(index.iItem == -1, "Unexpected item index %d.\n", index.iItem);
DestroyWindow(hwnd);
}
START_TEST(listview)
{
ULONG_PTR ctx_cookie;
@ -6730,6 +6761,7 @@ START_TEST(listview)
test_LVM_GETCOUNTPERPAGE();
test_item_state_change();
test_selected_column();
test_LVM_GETNEXTITEMINDEX();
unload_v6_module(ctx_cookie, hCtx);