Angelo Haller : comctl32/tests: Add multi select tests for ownerdata listviews.

Alexandre Julliard julliard at winehq.org
Thu May 5 15:56:01 CDT 2022


Module: wine
Branch: master
Commit: ca9e3586de3957716391f76abdb9a16cb6093c32
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ca9e3586de3957716391f76abdb9a16cb6093c32

Author: Angelo Haller <angelo at 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 at szanni.org>
Signed-off-by: Alexandre Julliard <julliard at 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 160925a073a..124f463908e 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -3530,6 +3530,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";
@@ -6878,6 +6928,7 @@ START_TEST(listview)
     test_subitem_rect();
     test_sorting();
     test_ownerdata();
+    test_ownerdata_multiselect();
     test_norecompute();
     test_nosortheader();
     test_setredraw();
@@ -6937,6 +6988,7 @@ START_TEST(listview)
     test_columns();
     test_sorting();
     test_ownerdata();
+    test_ownerdata_multiselect();
     test_norecompute();
     test_nosortheader();
     test_indentation();




More information about the wine-cvs mailing list