From: Amine Khaldi Date: Fri, 27 Nov 2015 22:10:38 +0000 (+0000) Subject: [USER32_WINETEST] Sync edit.c and listbox.c with Wine Staging 1.7.55. CORE-10536 X-Git-Tag: ReactOS-0.4.0~59^2~157 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=35001c37a3ed0494841e50afa2c653bc3565820e [USER32_WINETEST] Sync edit.c and listbox.c with Wine Staging 1.7.55. CORE-10536 svn path=/trunk/; revision=70164 --- diff --git a/rostests/winetests/user32/edit.c b/rostests/winetests/user32/edit.c index e5c05db574b..6ff72251d77 100755 --- a/rostests/winetests/user32/edit.c +++ b/rostests/winetests/user32/edit.c @@ -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); diff --git a/rostests/winetests/user32/listbox.c b/rostests/winetests/user32/listbox.c index d99a82c8b8e..9380457ea1f 100644 --- a/rostests/winetests/user32/listbox.c +++ b/rostests/winetests/user32/listbox.c @@ -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,71 @@ 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); + 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 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); + + 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 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); @@ -1676,6 +1788,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 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 +1817,8 @@ 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 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();