Alex Villacís Lasso : user32: Fix LB_ITEMFROMPOINT tests for listbox control.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 07:07:29 CST 2007


Module: wine
Branch: master
Commit: 5f603f823e3f9da62d44b28a4df0895d5e3549ec
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5f603f823e3f9da62d44b28a4df0895d5e3549ec

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Wed Nov  7 10:34:55 2007 -0500

user32: Fix LB_ITEMFROMPOINT tests for listbox control.

---

 dlls/user32/tests/listbox.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 663e37f..7fd5659 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -441,7 +441,12 @@ static void test_listbox_height(void)
 
 static void test_itemfrompoint(void)
 {
-    HWND hList = CreateWindow( "ListBox", "list test", 0,
+    /* WS_POPUP is required in order to have a more accurate size calculation (
+       without caption). LBS_NOINTEGRALHEIGHT is required in order to test
+       behavior of partially-displayed item.
+     */
+    HWND hList = CreateWindow( "ListBox", "list test",
+                               WS_VISIBLE|WS_POPUP|LBS_NOINTEGRALHEIGHT,
                                1, 1, 600, 100, NULL, NULL, NULL, NULL );
     LONG r, id;
     RECT rc;
@@ -464,10 +469,14 @@ static void test_itemfrompoint(void)
     r = SendMessage(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
     ok( r == 0x1, "ret %x\n", r );
 
-    r = SendMessage(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 37 ));
+    r = SendMessage(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 601 ));
     ok( r == 0x10001, "ret %x\n", r );
 
-
+    /* Resize control so that below assertions about sizes are valid */
+    r = SendMessage( hList, LB_GETITEMRECT, 0, (LPARAM)&rc);
+    ok( r == 1, "ret %x\n", r);
+    r = MoveWindow(hList, 1, 1, 600, (rc.bottom - rc.top + 1) * 9 / 2, TRUE);
+    ok( r != 0, "ret %x\n", r);
 
     id = SendMessage( hList, LB_ADDSTRING, 0, (LPARAM) "hi2");
     ok( id == 2, "item id wrong\n");




More information about the wine-cvs mailing list