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, ...@@ -1365,8 +1365,6 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
if (last == -1) last = descr->nb_items - 1; if (last == -1) last = descr->nb_items - 1;
if ((first < 0) || (first >= descr->nb_items)) return LB_ERR; if ((first < 0) || (first >= descr->nb_items)) return LB_ERR;
if ((last < 0) || (last >= 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 */ if (on) /* Turn selection on */
{ {
...@@ -1376,7 +1374,6 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first, ...@@ -1376,7 +1374,6 @@ static LRESULT LISTBOX_SelectItemRange( LB_DESCR *descr, INT first,
descr->items[i].selected = TRUE; descr->items[i].selected = TRUE;
LISTBOX_InvalidateItemRect(descr, i); LISTBOX_InvalidateItemRect(descr, i);
} }
LISTBOX_SetCaretIndex( descr, last, TRUE );
} }
else /* Turn selection off */ else /* Turn selection off */
{ {
......
...@@ -64,6 +64,7 @@ struct listbox_test { ...@@ -64,6 +64,7 @@ struct listbox_test {
struct listbox_stat init, init_todo; struct listbox_stat init, init_todo;
struct listbox_stat click, click_todo; struct listbox_stat click, click_todo;
struct listbox_stat step, step_todo; struct listbox_stat step, step_todo;
struct listbox_stat sel, sel_todo;
}; };
void void
...@@ -133,6 +134,13 @@ check (const struct listbox_test test) ...@@ -133,6 +134,13 @@ check (const struct listbox_test test)
listbox_query (hLB, &answer); listbox_query (hLB, &answer);
listbox_ok (test, step, 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; WAIT;
DestroyWindow (hLB); DestroyWindow (hLB);
} }
...@@ -155,6 +163,8 @@ void check_item_height() ...@@ -155,6 +163,8 @@ void check_item_height()
itemHeight = SendMessageW(hLB, LB_GETITEMHEIGHT, 0, 0); itemHeight = SendMessageW(hLB, LB_GETITEMHEIGHT, 0, 0);
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight); ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
DestroyWindow (hLB);
} }
START_TEST(listbox) START_TEST(listbox)
...@@ -164,43 +174,51 @@ START_TEST(listbox) ...@@ -164,43 +174,51 @@ START_TEST(listbox)
{{0}, {{0},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, 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} */ /* {selected, anchor, caret, selcount}{TODO fields} */
const struct listbox_test SS_NS = const struct listbox_test SS_NS =
{{LBS_NOSEL}, {{LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, 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 = const struct listbox_test MS =
{{LBS_MULTIPLESEL}, {{LBS_MULTIPLESEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0}, { 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {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 = const struct listbox_test MS_NS =
{{LBS_MULTIPLESEL | LBS_NOSEL}, {{LBS_MULTIPLESEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, 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 = const struct listbox_test ES =
{{LBS_EXTENDEDSEL}, {{LBS_EXTENDEDSEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0}, { 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {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 = const struct listbox_test ES_NS =
{{LBS_EXTENDEDSEL | LBS_NOSEL}, {{LBS_EXTENDEDSEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, 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 = const struct listbox_test EMS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL}, {{LBS_EXTENDEDSEL | LBS_MULTIPLESEL},
{ 0, LB_ERR, 0, 0}, {0,0,0,0}, { 0, LB_ERR, 0, 0}, {0,0,0,0},
{ 1, 1, 1, 1}, {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 = const struct listbox_test EMS_NS =
{{LBS_EXTENDEDSEL | LBS_MULTIPLESEL | LBS_NOSEL}, {{LBS_EXTENDEDSEL | LBS_MULTIPLESEL | LBS_NOSEL},
{LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0}, {LB_ERR, LB_ERR, 0, LB_ERR}, {0,0,0,0},
{ 1, 1, 1, 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"); trace (" Testing single selection...\n");
check (SS); 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