Module: wine Branch: oldstable Commit: a911175205c2aec6e29803aa93071a1066307977 URL: https://gitlab.winehq.org/wine/wine/-/commit/a911175205c2aec6e29803aa93071a1...
Author: Angelo Haller angelo@szanni.org Date: Thu Apr 28 08:20:10 2022 -0500
comctl32/tests: Add multi select tests for ownerdata listviews.
Add tests for selecting multiple items in ownerdata listviews by using SHIFT/CTRL and arrow keys.
Signed-off-by: Angelo Haller angelo@szanni.org Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit ca9e3586de3957716391f76abdb9a16cb6093c32) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/comctl32/tests/listview.c | 52 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index ffdb30bcaca..129d51ec7f8 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -3529,6 +3529,56 @@ static void test_ownerdata(void) DestroyWindow(hwnd); }
+static void test_ownerdata_multiselect(void) +{ + HWND hwnd; + DWORD res; + LVITEMA item; + + hwnd = create_listview_control(LVS_OWNERDATA | LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n"); + res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 20, 0); + expect(1, res); + res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(0, res); + + memset(&item, 0, sizeof(item)); + item.state = LVIS_SELECTED | LVIS_FOCUSED; + item.stateMask = LVIS_SELECTED | LVIS_FOCUSED; + res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item); + expect(TRUE, res); + res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(1, res); + + res = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, 0); + expect(0, res); + + hold_key(VK_SHIFT); + + res = SendMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0); + expect(0, res); + res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0); + expect(0, res); + + res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(2, res); + + hold_key(VK_CONTROL); + + res = SendMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0); + expect(0, res); + res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0); + expect(0, res); + + release_key(VK_CONTROL); + release_key(VK_SHIFT); + + res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(3, res); + + DestroyWindow(hwnd); +} + static void test_norecompute(void) { static CHAR testA[] = "test"; @@ -6682,6 +6732,7 @@ START_TEST(listview) test_subitem_rect(); test_sorting(); test_ownerdata(); + test_ownerdata_multiselect(); test_norecompute(); test_nosortheader(); test_setredraw(); @@ -6740,6 +6791,7 @@ START_TEST(listview) test_columns(); test_sorting(); test_ownerdata(); + test_ownerdata_multiselect(); test_norecompute(); test_nosortheader(); test_indentation();