mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
update comctl32 winetest
svn path=/trunk/; revision=23818
This commit is contained in:
parent
42b655b8f9
commit
0ce8d02acc
3 changed files with 171 additions and 31 deletions
|
@ -72,12 +72,14 @@ static void test_comboboxex(void) {
|
|||
HWND myHwnd = 0;
|
||||
LONG res = -1;
|
||||
COMBOBOXEXITEM cbexItem;
|
||||
|
||||
#define FIRST_ITEM "First Item"
|
||||
#define SECOND_ITEM "Second Item"
|
||||
#define THIRD_ITEM "Third Item"
|
||||
#define MIDDLE_ITEM "Between First and Second Items"
|
||||
#define REPLACEMENT_ITEM "Between First and Second Items"
|
||||
static TCHAR first_item[] = {'F','i','r','s','t',' ','I','t','e','m',0},
|
||||
second_item[] = {'S','e','c','o','n','d',' ','I','t','e','m',0},
|
||||
third_item[] = {'T','h','i','r','d',' ','I','t','e','m',0},
|
||||
middle_item[] = {'B','e','t','w','e','e','n',' ','F','i','r','s','t',' ','a','n','d',' ',
|
||||
'S','e','c','o','n','d',' ','I','t','e','m','s',0},
|
||||
replacement_item[] = {'B','e','t','w','e','e','n',' ','F','i','r','s','t',' ','a','n','d',' ',
|
||||
'S','e','c','o','n','d',' ','I','t','e','m','s',0},
|
||||
out_of_range_item[] = {'O','u','t',' ','o','f',' ','R','a','n','g','e',' ','I','t','e','m',0};
|
||||
|
||||
/* Allocate space for result */
|
||||
textBuffer = malloc(MAX_CHARS);
|
||||
|
@ -86,19 +88,19 @@ static void test_comboboxex(void) {
|
|||
myHwnd = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN);
|
||||
|
||||
/* Add items onto the end of the combobox */
|
||||
res = addItem(myHwnd, -1, FIRST_ITEM);
|
||||
res = addItem(myHwnd, -1, first_item);
|
||||
ok(res == 0, "Adding simple item failed (%ld)\n", res);
|
||||
res = addItem(myHwnd, -1, SECOND_ITEM);
|
||||
res = addItem(myHwnd, -1, second_item);
|
||||
ok(res == 1, "Adding simple item failed (%ld)\n", res);
|
||||
res = addItem(myHwnd, 2, THIRD_ITEM);
|
||||
res = addItem(myHwnd, 2, third_item);
|
||||
ok(res == 2, "Adding simple item failed (%ld)\n", res);
|
||||
res = addItem(myHwnd, 1, MIDDLE_ITEM);
|
||||
res = addItem(myHwnd, 1, middle_item);
|
||||
ok(res == 1, "Inserting simple item failed (%ld)\n", res);
|
||||
|
||||
/* Add an item completely out of range */
|
||||
res = addItem(myHwnd, 99, "Out Of Range Item");
|
||||
res = addItem(myHwnd, 99, out_of_range_item);
|
||||
ok(res == -1, "Adding using out of range index worked unexpectedly (%ld)\n", res);
|
||||
res = addItem(myHwnd, 5, "Out Of Range Item");
|
||||
res = addItem(myHwnd, 5, out_of_range_item);
|
||||
ok(res == -1, "Adding using out of range index worked unexpectedly (%ld)\n", res);
|
||||
/* Removed: Causes traps on Windows XP
|
||||
res = addItem(myHwnd, -2, "Out Of Range Item");
|
||||
|
@ -116,32 +118,32 @@ static void test_comboboxex(void) {
|
|||
/* Get an item in range */
|
||||
res = getItem(myHwnd, 0, &cbexItem);
|
||||
ok(res != 0, "Getting item using valid index failed unexpectedly (%ld)\n", res);
|
||||
ok(strcmp(FIRST_ITEM, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
ok(strcmp(first_item, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
|
||||
res = getItem(myHwnd, 1, &cbexItem);
|
||||
ok(res != 0, "Getting item using valid index failed unexpectedly (%ld)\n", res);
|
||||
ok(strcmp(MIDDLE_ITEM, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
ok(strcmp(middle_item, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
|
||||
res = getItem(myHwnd, 2, &cbexItem);
|
||||
ok(res != 0, "Getting item using valid index failed unexpectedly (%ld)\n", res);
|
||||
ok(strcmp(SECOND_ITEM, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
ok(strcmp(second_item, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
|
||||
res = getItem(myHwnd, 3, &cbexItem);
|
||||
ok(res != 0, "Getting item using valid index failed unexpectedly (%ld)\n", res);
|
||||
ok(strcmp(THIRD_ITEM, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
ok(strcmp(third_item, cbexItem.pszText) == 0, "Getting item returned wrong string (%s)\n", cbexItem.pszText);
|
||||
|
||||
/* Set an item completely out of range */
|
||||
res = setItem(myHwnd, 99, REPLACEMENT_ITEM);
|
||||
res = setItem(myHwnd, 99, replacement_item);
|
||||
ok(res == 0, "Setting item using out of range index worked unexpectedly (%ld)\n", res);
|
||||
res = setItem(myHwnd, 4, REPLACEMENT_ITEM);
|
||||
res = setItem(myHwnd, 4, replacement_item);
|
||||
ok(res == 0, "Setting item using out of range index worked unexpectedly (%ld)\n", res);
|
||||
res = setItem(myHwnd, -2, REPLACEMENT_ITEM);
|
||||
res = setItem(myHwnd, -2, replacement_item);
|
||||
ok(res == 0, "Setting item using out of range index worked unexpectedly (%ld)\n", res);
|
||||
|
||||
/* Set an item in range */
|
||||
res = setItem(myHwnd, 0, REPLACEMENT_ITEM);
|
||||
res = setItem(myHwnd, 0, replacement_item);
|
||||
ok(res != 0, "Setting first item failed (%ld)\n", res);
|
||||
res = setItem(myHwnd, 3, REPLACEMENT_ITEM);
|
||||
res = setItem(myHwnd, 3, replacement_item);
|
||||
ok(res != 0, "Setting last item failed (%ld)\n", res);
|
||||
|
||||
/* Remove items completely out of range (4 items in control at this point) */
|
||||
|
|
|
@ -56,7 +56,7 @@ static void dont_expect_notify(INT iCode)
|
|||
unexpectedNotify[nUnexpectedNotify++] = iCode;
|
||||
}
|
||||
|
||||
static BOOL notifies_received()
|
||||
static BOOL notifies_received(void)
|
||||
{
|
||||
BOOL fRet = (nExpectedNotify == nReceivedNotify);
|
||||
nExpectedNotify = nReceivedNotify = 0;
|
||||
|
@ -323,7 +323,7 @@ static void check_auto_fields(void)
|
|||
/* field from comctl >4.0 not tested as the system probably won't touch them */
|
||||
}
|
||||
|
||||
static void check_mask()
|
||||
static void check_mask(void)
|
||||
{
|
||||
HDITEMA hdi;
|
||||
static CHAR text[] = "ABC";
|
||||
|
|
|
@ -24,19 +24,15 @@
|
|||
|
||||
#include "wine/test.h"
|
||||
|
||||
START_TEST(listview)
|
||||
static void test_images(void)
|
||||
{
|
||||
HWND hwnd, hwndparent = 0;
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
DWORD r;
|
||||
LVITEM item;
|
||||
HIMAGELIST himl;
|
||||
HBITMAP hbmp;
|
||||
RECT r1, r2;
|
||||
|
||||
icc.dwICC = 0;
|
||||
icc.dwSize = sizeof icc;
|
||||
InitCommonControlsEx(&icc);
|
||||
static CHAR hello[] = "hello";
|
||||
|
||||
himl = ImageList_Create(40, 40, 0, 4, 4);
|
||||
ok(himl != NULL, "failed to create imagelist\n");
|
||||
|
@ -71,7 +67,7 @@ START_TEST(listview)
|
|||
ok(r == -1, "should fail\n");
|
||||
|
||||
item.iSubItem = 0;
|
||||
item.pszText = "hello";
|
||||
item.pszText = hello;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
|
||||
ok(r == 0, "should not fail\n");
|
||||
|
||||
|
@ -83,7 +79,7 @@ START_TEST(listview)
|
|||
ok(r == TRUE, "should not fail\n");
|
||||
|
||||
item.iSubItem = 0;
|
||||
item.pszText = "hello";
|
||||
item.pszText = hello;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM) &item);
|
||||
ok(r == 0, "should not fail\n");
|
||||
|
||||
|
@ -95,3 +91,145 @@ START_TEST(listview)
|
|||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_checkboxes(void)
|
||||
{
|
||||
HWND hwnd, hwndparent = 0;
|
||||
LVITEMA item;
|
||||
DWORD r;
|
||||
static CHAR text[] = "Text",
|
||||
text2[] = "Text2",
|
||||
text3[] = "Text3";
|
||||
|
||||
hwnd = CreateWindowEx(0, "SysListView32", "foo", LVS_REPORT,
|
||||
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "failed to create listview window\n");
|
||||
|
||||
/* first without LVS_EX_CHECKBOXES set and an item and check that state is preserved */
|
||||
item.mask = LVIF_TEXT | LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
item.state = 0xfccc;
|
||||
item.iItem = 0;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = text;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
|
||||
ok(r == 0, "ret %ld\n", r);
|
||||
|
||||
item.iItem = 0;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0xfccc, "state %x\n", item.state);
|
||||
|
||||
/* Don't set LVIF_STATE */
|
||||
item.mask = LVIF_TEXT;
|
||||
item.stateMask = 0xffff;
|
||||
item.state = 0xfccc;
|
||||
item.iItem = 1;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = text;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
|
||||
ok(r == 1, "ret %ld\n", r);
|
||||
|
||||
item.iItem = 1;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0, "state %x\n", item.state);
|
||||
|
||||
r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
|
||||
ok(r == 0, "should return zero\n");
|
||||
|
||||
/* Having turned on checkboxes, check that all existing items are set to 0x1000 (unchecked) */
|
||||
item.iItem = 0;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x1ccc, "state %x\n", item.state);
|
||||
|
||||
/* Now add an item without specifying a state and check that it's state goes to 0x1000 */
|
||||
item.iItem = 2;
|
||||
item.mask = LVIF_TEXT;
|
||||
item.state = 0;
|
||||
item.pszText = text2;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
|
||||
ok(r == 2, "ret %ld\n", r);
|
||||
|
||||
item.iItem = 2;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x1000, "state %x\n", item.state);
|
||||
|
||||
/* Add a further item this time specifying a state and still it's state goes to 0x1000 */
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_TEXT | LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
item.state = 0x2aaa;
|
||||
item.pszText = text3;
|
||||
r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
|
||||
ok(r == 3, "ret %ld\n", r);
|
||||
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x1aaa, "state %x\n", item.state);
|
||||
|
||||
/* Set an item's state to checked */
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xf000;
|
||||
item.state = 0x2000;
|
||||
r = SendMessage(hwnd, LVM_SETITEMA, 0, (LPARAM) &item);
|
||||
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x2aaa, "state %x\n", item.state);
|
||||
|
||||
/* Set the style again and check that doesn't change an item's state */
|
||||
r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
|
||||
ok(r == LVS_EX_CHECKBOXES, "ret %lx\n", r);
|
||||
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x2aaa, "state %x\n", item.state);
|
||||
|
||||
/* Unsetting the checkbox extended style doesn't change an item's state */
|
||||
r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, 0);
|
||||
ok(r == LVS_EX_CHECKBOXES, "ret %lx\n", r);
|
||||
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x2aaa, "state %x\n", item.state);
|
||||
|
||||
/* Now setting the style again will change an item's state */
|
||||
r = SendMessage(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
|
||||
ok(r == 0, "ret %lx\n", r);
|
||||
|
||||
item.iItem = 3;
|
||||
item.mask = LVIF_STATE;
|
||||
item.stateMask = 0xffff;
|
||||
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
|
||||
ok(item.state == 0x1aaa, "state %x\n", item.state);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(listview)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
|
||||
icc.dwICC = 0;
|
||||
icc.dwSize = sizeof icc;
|
||||
InitCommonControlsEx(&icc);
|
||||
|
||||
test_images();
|
||||
test_checkboxes();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue