[PATCH] comctl32/tests: Add tests for negative subitems independent of local settings

Austin Lund austin.lund at gmail.com
Mon Oct 4 18:54:26 CDT 2010


Second part to bug 24514.
---
 dlls/comctl32/tests/listview.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index de7369c..d249af8 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2992,7 +2992,8 @@ static void test_hittest(void)
     LVITEMA item;
     static CHAR text[] = "1234567890ABCDEFGHIJKLMNOPQRST";
     POINT pos;
-    INT x, y;
+    INT x, y, i;
+    WORD horiz, vert;
     HIMAGELIST himl, himl2;
     HBITMAP hbmp;
 
@@ -3020,6 +3021,11 @@ static void test_hittest(void)
     r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&bounds);
     ok(bounds.bottom - bounds.top > 0, "Expected non zero item height\n");
     ok(bounds.right - bounds.left > 0, "Expected non zero item width\n");
+    r = SendMessage(hwnd, LVM_GETITEMSPACING, TRUE, 0);
+    horiz = LOWORD(r);
+    vert = HIWORD(r);
+    ok(bounds.bottom - bounds.top == vert,
+        "Horizontal spacing inconsistent (%d != %d)\n", bounds.bottom - bounds.top, vert);
     r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pos);
     expect(TRUE, r);
 
@@ -3052,8 +3058,18 @@ static void test_hittest(void)
     test_lvm_subitemhittest(hwnd, x, y, -1, -1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
     /* subitem returned with -1 item too */
     x = pos.x + 150;
-    y = -1;
+    y = bounds.top - vert;
     test_lvm_subitemhittest(hwnd, x, y, -1, 1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
+    test_lvm_subitemhittest(hwnd, x, y - vert + 1, -1, 1, LVHT_NOWHERE, FALSE, FALSE, FALSE);
+    /* return values appear to underflow with negative indices */
+    i = -2;
+    y = y - vert;
+    while (i > -10) {
+        test_lvm_subitemhittest(hwnd, x, y, i, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE);
+        test_lvm_subitemhittest(hwnd, x, y - vert + 1, i, 1, LVHT_ONITEMLABEL, TRUE, FALSE, TRUE);
+        y = y - vert;
+        i--;
+    }
     /* parent client area is 100x100 by default */
     MoveWindow(hwnd, 0, 0, 300, 100, FALSE);
     x = pos.x + 150; /* outside column */
-- 
1.7.0.4




More information about the wine-patches mailing list