comctl32: Conformance test for multiple selection in listbox.
This commit is contained in:
parent
5315da8445
commit
1f051b8a7d
|
@ -1127,6 +1127,81 @@ static void test_getorigin(void)
|
|||
|
||||
}
|
||||
|
||||
static void test_multiselect(void)
|
||||
{
|
||||
typedef struct t_select_task
|
||||
{
|
||||
const char *descr;
|
||||
int initPos;
|
||||
int loopVK;
|
||||
int count;
|
||||
int result;
|
||||
} select_task;
|
||||
|
||||
HWND hwnd;
|
||||
DWORD r;
|
||||
int i,j,item_count,selected_count;
|
||||
static const int items=5;
|
||||
BYTE kstate[256];
|
||||
select_task task;
|
||||
|
||||
static struct t_select_task task_list[] = {
|
||||
{ "using VK_DOWN", 0, VK_DOWN, -1, -1 },
|
||||
{ "using VK_UP", -1, VK_UP, -1, -1 },
|
||||
{ "using VK_END", 0, VK_END, 1, -1 },
|
||||
{ "using VK_HOME", -1, VK_HOME, 1, -1 }
|
||||
};
|
||||
|
||||
|
||||
hwnd = create_listview_control();
|
||||
|
||||
for (i=0;i<items;i++) {
|
||||
insert_item(hwnd, 0);
|
||||
}
|
||||
|
||||
item_count = (int)SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0);
|
||||
|
||||
expect(items,item_count);
|
||||
|
||||
for (i=0;i<4;i++) {
|
||||
task = task_list[i];
|
||||
|
||||
/* deselect all items */
|
||||
ListView_SetItemState(hwnd, -1, 0, LVIS_SELECTED);
|
||||
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, -1);
|
||||
|
||||
/* set initial position */
|
||||
SendMessage(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count : task.initPos));
|
||||
ListView_SetItemState(hwnd,(task.initPos == -1 ? item_count -1 : task.initPos),LVIS_SELECTED ,LVIS_SELECTED);
|
||||
|
||||
selected_count = (int)SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||
|
||||
ok(selected_count == 1, "There should be only one selected item at the begining (is %d)\n",selected_count);
|
||||
|
||||
/* Set SHIFT key pressed */
|
||||
GetKeyboardState(kstate);
|
||||
kstate[VK_SHIFT]=0x80;
|
||||
SetKeyboardState(kstate);
|
||||
|
||||
for (j=1;j<=(task.count == -1 ? item_count : task.count);j++) {
|
||||
r = SendMessage(hwnd, WM_KEYDOWN, task.loopVK, 0);
|
||||
expect(0,r);
|
||||
r = SendMessage(hwnd, WM_KEYUP, task.loopVK, 0);
|
||||
expect(0,r);
|
||||
}
|
||||
|
||||
selected_count = (int)SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||
|
||||
ok((task.result == -1 ? item_count : task.result) == selected_count, "Failed multiple selection %s. There should be %d selected items (is %d)\n", task.descr, item_count, selected_count);
|
||||
|
||||
/* Set SHIFT key released */
|
||||
GetKeyboardState(kstate);
|
||||
kstate[VK_SHIFT]=0x00;
|
||||
SetKeyboardState(kstate);
|
||||
}
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(listview)
|
||||
{
|
||||
HMODULE hComctl32;
|
||||
|
@ -1163,4 +1238,5 @@ START_TEST(listview)
|
|||
test_item_position();
|
||||
test_columns();
|
||||
test_getorigin();
|
||||
test_multiselect();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue