Commit 31b894d0 authored by Lauri Tulmin's avatar Lauri Tulmin Committed by Alexandre Julliard

Add test for LB_SELITEMRANGE and make it pass.

parent 26c92d72
......@@ -1365,8 +1365,6 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
if (last == -1) last = descr->nb_items - 1;
if ((first < 0) || (first >= descr->nb_items)) return LB_ERR;
if ((last < 0) || (last >= descr->nb_items)) return LB_ERR;
/* selected_item reflects last selected/unselected item on multiple sel */
descr->selected_item = last;
if (on) /* Turn selection on */
{
......@@ -1376,7 +1374,6 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
descr->items[i].selected = TRUE;
LISTBOX_InvalidateItemRect(descr, i);
}
LISTBOX_SetCaretIndex( descr, last, TRUE );
}
else /* Turn selection off */
{
......
......@@ -64,6 +64,7 @@ struct listbox_test {
struct listbox_stat init, init_todo;
struct listbox_stat click, click_todo;
struct listbox_stat step, step_todo;
struct listbox_stat sel, sel_todo;
};
void
......@@ -133,6 +134,13 @@ check (const struct listbox_test test)
listbox_query (hLB, &answer);
listbox_ok (test, step, answer);
DestroyWindow (hLB);
hLB=create_listbox (test.prop.add_style);
SendMessage (hLB, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 2));
listbox_query (hLB, &answer);
listbox_ok (test, sel, answer);
WAIT;
DestroyWindow (hLB);
}
......@@ -155,6 +163,8 @@ void check_item_height()
itemHeight = SendMessageW(hLB, LB_GETITEMHEIGHT, 0, 0);
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
DestroyWindow (hLB);
}
START_TEST(listbox)
......@@ -164,43 +174,51 @@ START_TEST(listbox)
{{0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
{ 2, 2, 2, LB_ERR}, {0,0,0,0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}};
/* {selected, anchor, caret, selcount}{TODO fields} */
const struct listbox_test SS_NS =
{{LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
{ 2, 2, 2, LB_ERR}, {0,0,0,0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}};
const struct listbox_test MS =
{{LBS_MULTIPLESEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {0,0,0,0},
{ 2, 1, 2, 1}, {0,0,0,0}};
{ 2, 1, 2, 1}, {0,0,0,0},
{ 0, LB_ERR, 0, 2}, {0,0,0,0}};
const struct listbox_test MS_NS =
{{LBS_MULTIPLESEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
{ 2, 2, 2, LB_ERR}, {0,0,0,0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}};
const struct listbox_test ES =
{{LBS_EXTENDEDSEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {0,0,0,0},
{ 2, 2, 2, 1}, {0,0,0,0}};
{ 2, 2, 2, 1}, {0,0,0,0},
{ 0, LB_ERR, 0, 2}, {0,0,0,0}};
const struct listbox_test ES_NS =
{{LBS_EXTENDEDSEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
{ 2, 2, 2, LB_ERR}, {0,0,0,0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}};
const struct listbox_test EMS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {0,0,0,0},
{ 2, 2, 2, 1}, {0,0,0,0}};
{ 2, 2, 2, 1}, {0,0,0,0},
{ 0, LB_ERR, 0, 2}, {0,0,0,0}};
const struct listbox_test EMS_NS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, LB_ERR}, {0,0,0,0},
{ 2, 2, 2, LB_ERR}, {0,0,0,0}};
{ 2, 2, 2, LB_ERR}, {0,0,0,0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}};
trace (" Testing single selection...\n");
check (SS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment