[USER32_WINETEST] Sync edit.c and listbox.c with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=70164
This commit is contained in:
Amine Khaldi 2015-11-27 22:10:38 +00:00
parent d7073f8614
commit 35001c37a3
2 changed files with 165 additions and 11 deletions

View file

@ -841,12 +841,14 @@ static void zero_notify(void)
}
#define test_notify(enchange, enmaxtext, enupdate) \
do { \
ok(notifications.en_change == enchange, "expected %d EN_CHANGE notifications, " \
"got %d\n", enchange, notifications.en_change); \
ok(notifications.en_maxtext == enmaxtext, "expected %d EN_MAXTEXT notifications, " \
"got %d\n", enmaxtext, notifications.en_maxtext); \
ok(notifications.en_update == enupdate, "expected %d EN_UPDATE notifications, " \
"got %d\n", enupdate, notifications.en_update)
"got %d\n", enupdate, notifications.en_update); \
} while(0)
static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
@ -907,8 +909,10 @@ static void test_edit_control_3(void)
zero_notify();
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) > len, "text should have been truncated\n");
test_notify(1, 1, 1);
if (len == lstrlenA(str)) /* Win 8 */
test_notify(1, 0, 1);
else
test_notify(1, 1, 1);
SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
zero_notify();
@ -998,8 +1002,13 @@ static void test_edit_control_3(void)
zero_notify();
SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
test_notify(1, 1, 1);
if (len == lstrlenA(str)) /* Win 8 */
test_notify(1, 0, 1);
else
{
ok(0 == len, "text should have been truncated, expected 0, got %d\n", len);
test_notify(1, 1, 1);
}
SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)"");
zero_notify();
@ -1467,10 +1476,23 @@ static void test_margins(void)
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(10, 10));
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
ok(new_rect.left == old_rect.left, "The left border of the rectangle has changed\n");
ok(new_rect.right == old_rect.right, "The right border of the rectangle has changed\n");
ok(new_rect.top == old_rect.top, "The top border of the rectangle has changed\n");
ok(new_rect.bottom == old_rect.bottom, "The bottom border of the rectangle has changed\n");
ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
/* The lParam argument of the WM_SIZE message should be ignored. */
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&old_rect);
SendMessageA(hwEdit, WM_SIZE, SIZE_RESTORED, 0);
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
SendMessageA(hwEdit, WM_SIZE, SIZE_MINIMIZED, 0);
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
SendMessageA(hwEdit, WM_SIZE, SIZE_MAXIMIZED, 0);
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
SendMessageA(hwEdit, WM_SIZE, SIZE_RESTORED, MAKELONG(10, 10));
SendMessageA(hwEdit, EM_GETRECT, 0, (LPARAM)&new_rect);
ok(EqualRect(&old_rect, &new_rect), "The border of the rectangle has changed\n");
DestroyWindow (hwEdit);

View file

@ -349,7 +349,7 @@ static void test_ownerdraw(void)
ok(exp.caret == got.caret, "expected caret %d, got %d\n", exp.caret, got.caret); \
ok(exp.selcount == got.selcount, "expected selcount %d, got %d\n", exp.selcount, got.selcount);
static void test_selection(void)
static void test_LB_SELITEMRANGE(void)
{
static const struct listbox_stat test_nosel = { 0, LB_ERR, 0, 0 };
static const struct listbox_stat test_1 = { 0, LB_ERR, 0, 2 };
@ -429,6 +429,34 @@ static void test_selection(void)
DestroyWindow(hLB);
}
static void test_LB_SETCURSEL(void)
{
HWND parent, hLB;
INT ret;
trace("testing LB_SETCURSEL\n");
parent = create_parent();
assert(parent);
hLB = create_listbox(LBS_NOINTEGRALHEIGHT | WS_CHILD, parent);
assert(hLB);
SendMessageA(hLB, LB_SETITEMHEIGHT, 0, 32);
ret = SendMessageA(hLB, LB_SETCURSEL, 2, 0);
ok(ret == 2, "LB_SETCURSEL returned %d instead of 2\n", ret);
ret = GetScrollPos(hLB, SB_VERT);
ok(ret == 0, "expected vscroll 0, got %d\n", ret);
ret = SendMessageA(hLB, LB_SETCURSEL, 3, 0);
ok(ret == 3, "LB_SETCURSEL returned %d instead of 3\n", ret);
ret = GetScrollPos(hLB, SB_VERT);
ok(ret == 1, "expected vscroll 1, got %d\n", ret);
DestroyWindow(hLB);
}
static void test_listbox_height(void)
{
HWND hList;
@ -1637,7 +1665,10 @@ static void test_extents(void)
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 100, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
/* horizontal extent < width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
@ -1649,6 +1680,23 @@ static void test_extents(void)
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 100, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
/* horizontal extent > width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 100, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
DestroyWindow(listbox);
@ -1664,7 +1712,10 @@ static void test_extents(void)
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 100, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
/* horizontal extent < width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
@ -1676,6 +1727,23 @@ static void test_extents(void)
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 63, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
/* horizontal extent > width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 183, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) != 0,
"List box should have a horizontal scroll bar\n");
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
@ -1688,6 +1756,69 @@ static void test_extents(void)
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 0, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) == 0,
"List box should not have a horizontal scroll bar\n");
DestroyWindow(listbox);
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL | LBS_DISABLENOSCROLL, parent);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 0, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) != 0,
"List box should have a horizontal scroll bar\n");
/* horizontal extent < width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 63, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) != 0,
"List box should have a horizontal scroll bar\n");
/* horizontal extent > width */
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 183, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) != 0,
"List box should have a horizontal scroll bar\n");
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
ok(res == 0, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
br = GetScrollInfo(listbox, SB_HORZ, &sinfo);
ok(br == TRUE, "GetScrollInfo failed\n");
ok(sinfo.nMin == 0, "got wrong min: %u\n", sinfo.nMin);
ok(sinfo.nMax == 0, "got wrong max: %u\n", sinfo.nMax);
ok((GetWindowLongA(listbox, GWL_STYLE) & WS_HSCROLL) != 0,
"List box should have a horizontal scroll bar\n");
DestroyWindow(listbox);
@ -1766,7 +1897,8 @@ START_TEST(listbox)
check_item_height();
test_ownerdraw();
test_selection();
test_LB_SELITEMRANGE();
test_LB_SETCURSEL();
test_listbox_height();
test_itemfrompoint();
test_listbox_item_data();