Author: akhaldi
Date: Fri Nov 27 22:10:38 2015
New Revision: 70164
URL:
http://svn.reactos.org/svn/reactos?rev=70164&view=rev
Log:
[USER32_WINETEST] Sync edit.c and listbox.c with Wine Staging 1.7.55. CORE-10536
Modified:
trunk/rostests/winetests/user32/edit.c
trunk/rostests/winetests/user32/listbox.c
Modified: trunk/rostests/winetests/user32/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/edit.c?r…
==============================================================================
--- trunk/rostests/winetests/user32/edit.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/edit.c [iso-8859-1] Fri Nov 27 22:10:38 2015
@@ -841,12 +841,14 @@
}
#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 @@
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 @@
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 @@
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);
Modified: trunk/rostests/winetests/user32/listbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/listbox.…
==============================================================================
--- trunk/rostests/winetests/user32/listbox.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/user32/listbox.c [iso-8859-1] Fri Nov 27 22:10:38 2015
@@ -349,7 +349,7 @@
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 };
@@ -425,6 +425,34 @@
ok(ret == LB_OKAY, "LB_SELITEMRANGE returned %d instead of LB_OKAY\n",
ret);
listbox_query(hLB, &answer);
listbox_test_query(test_2, answer);
+
+ 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);
}
@@ -1637,7 +1665,10 @@
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,14 +1680,14 @@
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);
-
- DestroyWindow(listbox);
-
-
- listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
+ 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 == 0, "Got wrong initial horizontal extent: %u\n", res);
+ ok(res == 184, "Got wrong horizontal extent: %u\n", res);
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SIF_RANGE;
@@ -1664,7 +1695,27 @@
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);
+
+
+ listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, 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 == 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 @@
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 @@
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 @@
check_item_height();
test_ownerdraw();
- test_selection();
+ test_LB_SELITEMRANGE();
+ test_LB_SETCURSEL();
test_listbox_height();
test_itemfrompoint();
test_listbox_item_data();