Mike McCormack : user:
The height of a ListBox item can be no more than MAXBYTE.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 9 06:28:53 CST 2006
Module: wine
Branch: refs/heads/master
Commit: abf3a570afbd506c08d344d5bae38e40e193c56e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=abf3a570afbd506c08d344d5bae38e40e193c56e
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Mar 9 14:22:30 2006 +0900
user: The height of a ListBox item can be no more than MAXBYTE.
---
dlls/user/listbox.c | 3 +++
dlls/user/tests/listbox.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/dlls/user/listbox.c b/dlls/user/listbox.c
index e40cc80..ca4c4d4 100644
--- a/dlls/user/listbox.c
+++ b/dlls/user/listbox.c
@@ -1187,6 +1187,9 @@ static LRESULT LISTBOX_GetItemHeight( LB
*/
static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BOOL repaint )
{
+ if (height > MAXBYTE)
+ return -1;
+
if (!height) height = 1;
if (descr->style & LBS_OWNERDRAWVARIABLE)
diff --git a/dlls/user/tests/listbox.c b/dlls/user/tests/listbox.c
index 7f22412..8b02b71 100644
--- a/dlls/user/tests/listbox.c
+++ b/dlls/user/tests/listbox.c
@@ -390,6 +390,45 @@ static void test_selection(void)
DestroyWindow(hLB);
}
+static void test_listbox_height(void)
+{
+ HWND hList;
+ int r, id;
+
+ hList = CreateWindow( "ListBox", "list test", 0,
+ 1, 1, 600, 100, NULL, NULL, NULL, NULL );
+ ok( hList != NULL, "failed to create listbox\n");
+
+ id = SendMessage( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
+ ok( id == 0, "item id wrong\n");
+
+ r = SendMessage( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 20, 0 ));
+ ok( r == 0, "send message failed\n");
+
+ r = SendMessage(hList, LB_GETITEMHEIGHT, 0, 0 );
+ ok( r == 20, "height wrong\n");
+
+ r = SendMessage( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 0, 30 ));
+ ok( r == -1, "send message failed\n");
+
+ r = SendMessage(hList, LB_GETITEMHEIGHT, 0, 0 );
+ ok( r == 20, "height wrong\n");
+
+ r = SendMessage( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 0x100, 0 ));
+ ok( r == -1, "send message failed\n");
+
+ r = SendMessage(hList, LB_GETITEMHEIGHT, 0, 0 );
+ ok( r == 20, "height wrong\n");
+
+ r = SendMessage( hList, LB_SETITEMHEIGHT, 0, MAKELPARAM( 0xff, 0 ));
+ ok( r == 0, "send message failed\n");
+
+ r = SendMessage(hList, LB_GETITEMHEIGHT, 0, 0 );
+ ok( r == 0xff, "height wrong\n");
+
+ DestroyWindow( hList );
+}
+
START_TEST(listbox)
{
const struct listbox_test SS =
@@ -463,4 +502,5 @@ START_TEST(listbox)
check_item_height();
test_ownerdraw();
test_selection();
+ test_listbox_height();
}
More information about the wine-cvs
mailing list