user: The height of a ListBox item can be no more than MAXBYTE.

This commit is contained in:
Mike McCormack 2006-03-09 14:22:30 +09:00 committed by Alexandre Julliard
parent fe8cd38812
commit abf3a570af
2 changed files with 43 additions and 0 deletions

View File

@ -1187,6 +1187,9 @@ static LRESULT LISTBOX_GetItemHeight( LB_DESCR *descr, INT index )
*/
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)

View File

@ -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();
}