diff --git a/rostests/winetests/comctl32/header.c b/rostests/winetests/comctl32/header.c index c646c29119f..bf02f1139b2 100644 --- a/rostests/winetests/comctl32/header.c +++ b/rostests/winetests/comctl32/header.c @@ -1361,8 +1361,8 @@ static void test_hds_nosizing(HWND hParent) ok(nm->lItemlParam == lparam, "Invalid lItemlParam %d vs %ld\n", lparam, nm->lItemlParam); \ ok((nm->rc.top == _top && nm->rc.bottom == _bottom && nm->rc.left == _left && nm->rc.right == _right) || \ broken(draw_stage != CDDS_ITEMPREPAINT), /* comctl32 < 5.80 */ \ - "Invalid rect (%d,%d) (%d,%d) vs (%d,%d) (%d,%d)\n", _left, _top, _right, _bottom, \ - nm->rc.left, nm->rc.top, nm->rc.right, nm->rc.bottom); + "Invalid rect (%d,%d)-(%d,%d) vs %s\n", _left, _top, _right, _bottom, \ + wine_dbgstr_rect(&nm->rc)); static LRESULT customdraw_1(int n, NMCUSTOMDRAW *nm) { diff --git a/rostests/winetests/comctl32/listview.c b/rostests/winetests/comctl32/listview.c index 2bdbb817718..fddce6e5a1e 100644 --- a/rostests/winetests/comctl32/listview.c +++ b/rostests/winetests/comctl32/listview.c @@ -893,8 +893,7 @@ static void test_images(void) r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item); ok(r == 0, "should not fail\n"); - memset(&r1, 0, sizeof r1); - r1.left = LVIR_ICON; + SetRect(&r1, LVIR_ICON, 0, 0, 0); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM) &r1); expect(1, r); @@ -906,12 +905,11 @@ static void test_images(void) r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item); ok(r == 0, "should not fail\n"); - memset(&r2, 0, sizeof r2); - r2.left = LVIR_ICON; + SetRect(&r2, LVIR_ICON, 0, 0, 0); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM) &r2); expect(1, r); - ok(!memcmp(&r1, &r2, sizeof r1), "rectangle should be the same\n"); + ok(EqualRect(&r1, &r2), "rectangle should be the same\n"); DestroyWindow(hwnd); } @@ -1184,7 +1182,8 @@ static void test_items(void) r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); expect(1, r); ok(item.state & LVIS_SELECTED, "Expected LVIS_SELECTED\n"); - SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + ok(r, "got %d\n", r); /* LVIS_SELECTED with zero stateMask */ /* set */ @@ -1206,7 +1205,8 @@ static void test_items(void) r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); expect(1, r); ok(item.state & LVIS_FOCUSED, "Expected LVIS_FOCUSED\n"); - SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + ok(r, "got %d\n", r); /* LVIS_CUT with LVIS_FOCUSED stateMask */ /* set */ @@ -1228,7 +1228,8 @@ static void test_items(void) r = SendMessageA(hwnd, LVM_GETITEMA, 0, (LPARAM) &item); expect(1, r); ok(item.state & LVIS_CUT, "Expected LVIS_CUT\n"); - SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + r = SendMessageA(hwnd, LVM_DELETEITEM, 0, 0); + ok(r, "got %d\n", r); /* Insert an item with just a param */ memset (&item, 0xcc, sizeof (item)); @@ -1425,6 +1426,12 @@ static void test_columns(void) 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); ok(hwnd != NULL, "failed to create listview window\n"); + rc = SendMessageA(hwnd, LVM_DELETECOLUMN, -1, 0); + ok(!rc, "got %d\n", rc); + + rc = SendMessageA(hwnd, LVM_DELETECOLUMN, 0, 0); + ok(!rc, "got %d\n", rc); + /* Add a column with no mask */ memset(&column, 0xcc, sizeof(column)); column.mask = 0; @@ -1826,14 +1833,16 @@ static LRESULT WINAPI cd_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM clr = GetBkColor(nmlvcd->nmcd.hdc); ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk); ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText); - if (nmlvcd->iSubItem) - todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); - else - ok(clr == c0ffee, "clr=%.8x\n", clr); + if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS)) + { + todo_wine_if(nmlvcd->iSubItem) + ok(clr == c0ffee, "clr=%.8x\n", clr); + } return CDRF_NOTIFYPOSTPAINT; case CDDS_ITEMPOSTPAINT | CDDS_SUBITEM: clr = GetBkColor(nmlvcd->nmcd.hdc); - todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); + if (!(GetWindowLongW(nmhdr->hwndFrom, GWL_STYLE) & LVS_SHOWSELALWAYS)) + todo_wine ok(clr == c0ffee, "clr=%.8x\n", clr); ok(nmlvcd->clrTextBk == CLR_DEFAULT, "got 0x%x\n", nmlvcd->clrTextBk); ok(nmlvcd->clrText == RGB(0, 255, 0), "got 0x%x\n", nmlvcd->clrText); return CDRF_DODEFAULT; @@ -2275,7 +2284,29 @@ static void test_multiselect(void) item_count = SendMessageA(hwnd, LVM_GETITEMCOUNT, 0, 0); expect(items, item_count); - for (i = 0; i < 4; i++) { + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); + ok(r == -1, "got %d\n", r); + + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, 0); + ok(r == -1, "got %d\n", r); + + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, 0); + ok(r == 0, "got %d\n", r); + + /* out of range index */ + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, items); + ok(r == 0, "got %d\n", r); + + r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0); + ok(r == 0, "got %d\n", r); + + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -2); + ok(r == 0, "got %d\n", r); + + r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0); + ok(r == 0, "got %d\n", r); + + for (i = 0; i < sizeof(task_list)/sizeof(task_list[0]); i++) { DWORD selected_count; LVITEMA item; @@ -2284,15 +2315,18 @@ static void test_multiselect(void) /* deselect all items */ item.state = 0; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + ok(r, "got %d\n", r); SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); /* set initial position */ - SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos)); + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, (task.initPos == -1 ? item_count -1 : task.initPos)); + ok(r, "got %d\n", r); item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, task.initPos == -1 ? item_count-1 : task.initPos, (LPARAM)&item); + ok(r, "got %d\n", r); selected_count = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); ok(selected_count == 1, "expected 1, got %d\n", selected_count); @@ -2337,7 +2371,8 @@ static void test_multiselect(void) /* select all, check notifications */ item.state = 0; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + ok(r, "got %d\n", r); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -2371,7 +2406,8 @@ static void test_multiselect(void) item.state = 0; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); + ok(r, "got %d\n", r); ok_sequence(sequences, PARENT_SEQ_INDEX, change_all_parent_seq, "deselect all notification", FALSE); @@ -2400,11 +2436,13 @@ static void test_multiselect(void) ok_sequence(sequences, PARENT_SEQ_INDEX, changing_all_parent_seq, "set state all notification 3", FALSE); - SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); + ok(r, "got %d\n", r); for (i = 0; i < 3; i++) { item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, i, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, i, (LPARAM)&item); + ok(r, "got %d\n", r); } r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); @@ -2425,13 +2463,14 @@ static void test_multiselect(void) } r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); expect(3, r); - SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0); - expect(3, r); + r = SendMessageA(hwnd, LVM_GETSELECTIONMARK, 0, 0); + ok(r == -1, "got %d\n", r); /* select one more */ item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; - SendMessageA(hwnd, LVM_SETITEMSTATE, 3, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_SETITEMSTATE, 3, (LPARAM)&item); + ok(r, "got %d\n", r); for (i=0;i<3;i++) { r = SendMessageA(hwnd, LVM_GETITEMSTATE, i, LVIS_SELECTED); @@ -2451,7 +2490,8 @@ static void test_multiselect(void) item.stateMask = LVIS_SELECTED; r = SendMessageA(hwnd, LVM_SETITEMSTATE, -1, (LPARAM)&item); expect(TRUE, r); - SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); + r = SendMessageA(hwnd, LVM_SETSELECTIONMARK, 0, -1); + ok(r == -1, "got %d\n", r); item.stateMask = LVIS_SELECTED; item.state = LVIS_SELECTED; @@ -2671,7 +2711,8 @@ static void test_subitem_rect(void) expect(100, rect.left); expect(250, rect.right); - SendMessageA(hwnd, LVM_SCROLL, 10, 0); + r = SendMessageA(hwnd, LVM_SCROLL, 10, 0); + ok(r, "got %d\n", r); SetRect(&rect, LVIR_BOUNDS, 1, 0, 0); r = SendMessageA(hwnd, LVM_GETSUBITEMRECT, 0, (LPARAM)&rect); @@ -3621,8 +3662,7 @@ static void test_hittest(void) r = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 1, MAKELPARAM(100, 0)); expect(TRUE, r); - memset(&bounds, 0, sizeof(bounds)); - bounds.left = LVIR_BOUNDS; + SetRect(&bounds, LVIR_BOUNDS, 0, 0, 0); r = SendMessageA(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&bounds); expect(1, r); ok(bounds.bottom - bounds.top > 0, "Expected non zero item height\n"); @@ -3789,7 +3829,8 @@ static void test_getviewrect(void) memset(&item, 0, sizeof(item)); item.iItem = 0; item.iSubItem = 0; - SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); + r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item); + ok(!r, "got %d\n", r); r = SendMessageA(hwnd, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(100, 0)); expect(TRUE, r); @@ -3850,8 +3891,9 @@ static void test_getitemposition(void) expect(TRUE, r); ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getitemposition_seq2, "get item position 2", TRUE); - memset(&rect, 0, sizeof(rect)); - SendMessageA(header, HDM_GETITEMRECT, 0, (LPARAM)&rect); + SetRectEmpty(&rect); + r = SendMessageA(header, HDM_GETITEMRECT, 0, (LPARAM)&rect); + ok(r, "got %d\n", r); /* some padding? */ expect(2, pt.x); /* offset by header height */ @@ -4850,7 +4892,8 @@ static void test_getcolumnwidth(void) /* default column width with item added */ hwnd = create_listview_control(LVS_LIST); memset(&itema, 0, sizeof(itema)); - SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema); + ret = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&itema); + ok(!ret, "got %d\n", ret); ret = SendMessageA(hwnd, LVM_GETCOLUMNWIDTH, 0, 0); height = get_current_font_height(hwnd); ok((ret / height) >= 6, "got width %d, height %d\n", ret, height); @@ -5789,6 +5832,26 @@ static void test_oneclickactivate(void) DestroyWindow(hwnd); } +static void test_callback_mask(void) +{ + DWORD mask; + HWND hwnd; + BOOL ret; + + hwnd = create_listview_control(LVS_REPORT); + + ret = SendMessageA(hwnd, LVM_SETCALLBACKMASK, ~0u, 0); + ok(ret, "got %d\n", ret); + + ret = SendMessageA(hwnd, LVM_SETCALLBACKMASK, ~0u, 1); + ok(ret, "got %d\n", ret); + + mask = SendMessageA(hwnd, LVM_GETCALLBACKMASK, 0, 0); + ok(mask == ~0u, "got 0x%08x\n", mask); + + DestroyWindow(hwnd); +} + START_TEST(listview) { HMODULE hComctl32; @@ -5859,6 +5922,7 @@ START_TEST(listview) test_insertitem(); test_header_proc(); test_oneclickactivate(); + test_callback_mask(); if (!load_v6_module(&ctx_cookie, &hCtx)) { diff --git a/rostests/winetests/comctl32/progress.c b/rostests/winetests/comctl32/progress.c index f7ae328e5e9..7f69c35232f 100644 --- a/rostests/winetests/comctl32/progress.c +++ b/rostests/winetests/comctl32/progress.c @@ -206,10 +206,8 @@ static void test_redraw(void) SetRectEmpty(&last_paint_rect); SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0); GetClientRect(hProgressWnd, &client_rect); - ok(EqualRect(&last_paint_rect, &client_rect), - "last_paint_rect was { %d, %d, %d, %d } instead of { %d, %d, %d, %d }\n", - last_paint_rect.left, last_paint_rect.top, last_paint_rect.right, last_paint_rect.bottom, - client_rect.left, client_rect.top, client_rect.right, client_rect.bottom); + ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n", + wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect)); update_window(hProgressWnd); ok(!erased, "Progress bar shouldn't have erased the background\n"); @@ -218,10 +216,8 @@ static void test_redraw(void) SetRectEmpty(&last_paint_rect); SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0); GetClientRect(hProgressWnd, &client_rect); - ok(EqualRect(&last_paint_rect, &client_rect), - "last_paint_rect was { %d, %d, %d, %d } instead of { %d, %d, %d, %d }\n", - last_paint_rect.left, last_paint_rect.top, last_paint_rect.right, last_paint_rect.bottom, - client_rect.left, client_rect.top, client_rect.right, client_rect.bottom); + ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n", + wine_dbgstr_rect(&last_paint_rect), wine_dbgstr_rect(&client_rect)); update_window(hProgressWnd); ok(erased, "Progress bar should have erased the background\n"); } diff --git a/rostests/winetests/comctl32/rebar.c b/rostests/winetests/comctl32/rebar.c index bf9085bc88f..16030e3def2 100644 --- a/rostests/winetests/comctl32/rebar.c +++ b/rostests/winetests/comctl32/rebar.c @@ -37,15 +37,14 @@ static HWND hMainWnd; static int system_font_height; -#define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \ - val.left == exp.left && val.right == exp.right, "invalid rect (" name ") (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d)\n", \ - val.left, val.top, val.right, val.bottom, exp.left, exp.top, exp.right, exp.bottom); +#define check_rect(name, val, exp) ok(EqualRect(&val, &exp), \ + "invalid rect (" name ") %s - expected %s\n", wine_dbgstr_rect(&val), wine_dbgstr_rect(&exp)); #define check_rect_no_top(name, val, exp) { \ ok((val.bottom - val.top == exp.bottom - exp.top) && \ - val.left == exp.left && val.right == exp.right, "invalid rect (" name ") (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d), ignoring top\n", \ - val.left, val.top, val.right, val.bottom, exp.left, exp.top, exp.right, exp.bottom); \ - } + val.left == exp.left && val.right == exp.right, \ + "invalid rect (" name ") %s - expected %s, ignoring top\n", \ + wine_dbgstr_rect(&val), wine_dbgstr_rect(&exp)); } #define compare(val, exp, format) ok((val) == (exp), #val " value " format " expected " format "\n", (val), (exp)); diff --git a/rostests/winetests/comctl32/status.c b/rostests/winetests/comctl32/status.c index 2a6bd25682f..13d68f84afe 100644 --- a/rostests/winetests/comctl32/status.c +++ b/rostests/winetests/comctl32/status.c @@ -32,9 +32,8 @@ RECT exp = {abs(got.left - _left), abs(got.top - _top), \ abs(got.right - _right), abs(got.bottom - _bottom)}; \ ok(exp.left <= 2 && exp.top <= 2 && exp.right <= 2 && exp.bottom <= 2, \ - "Expected rect {%d,%d, %d,%d}, got {%d,%d, %d,%d}\n", \ - _left, _top, _right, _bottom, \ - (got).left, (got).top, (got).right, (got).bottom); } while (0) + "Expected rect (%d,%d)-(%d,%d), got %s\n", _left, _top, _right, _bottom, \ + wine_dbgstr_rect(&(got))); } while (0) static HINSTANCE hinst; static WNDPROC g_status_wndproc; diff --git a/rostests/winetests/comctl32/toolbar.c b/rostests/winetests/comctl32/toolbar.c index 5e18126f56b..efad00aef0a 100644 --- a/rostests/winetests/comctl32/toolbar.c +++ b/rostests/winetests/comctl32/toolbar.c @@ -108,9 +108,9 @@ static const struct message restore_parent_seq[] = { #define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT)) -#define check_rect(name, val, exp, ...) ok(val.top == exp.top && val.bottom == exp.bottom && \ - val.left == exp.left && val.right == exp.right, "invalid rect (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d) - (" name ")\n", \ - val.left, val.top, val.right, val.bottom, exp.left, exp.top, exp.right, exp.bottom, __VA_ARGS__); +#define check_rect(name, val, exp, ...) ok(EqualRect(&val, &exp), \ + "invalid rect %s - expected %s - (" name ")\n", \ + wine_dbgstr_rect(&val), wine_dbgstr_rect(&exp), __VA_ARGS__); #define compare(val, exp, format) ok((val) == (exp), #val " value " format " expected " format "\n", (val), (exp)); @@ -1232,7 +1232,7 @@ static DWORD tbsize_alt_numtests = 0; for (i=0; inButtons); i++) { \ ok(SendMessageA(hToolbar, TB_GETITEMRECT, i, (LPARAM)&rc) == 1, "TB_GETITEMRECT\n"); \ if (broken(tbsize_alt_numtests < sizeof(tbsize_alt_results)/sizeof(tbsize_alt_results[0]) && \ - memcmp(&rc, &tbsize_alt_results[tbsize_alt_numtests].rcButton, sizeof(RECT)) == 0)) { \ + EqualRect(&rc, &tbsize_alt_results[tbsize_alt_numtests].rcButton))) { \ win_skip("Alternate rect found\n"); \ tbsize_alt_numtests++; \ } else if (!(mask&1)) { \ diff --git a/rostests/winetests/comctl32/tooltips.c b/rostests/winetests/comctl32/tooltips.c index 4bc1ddd7277..48d0cbd8ebd 100644 --- a/rostests/winetests/comctl32/tooltips.c +++ b/rostests/winetests/comctl32/tooltips.c @@ -1041,6 +1041,43 @@ static void test_setinfo(void) DestroyWindow(parent2); } +static void test_margin(void) +{ + RECT r, r1; + HWND hwnd; + DWORD ret; + + hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, + 10, 10, 300, 100, + NULL, NULL, NULL, 0); + ok(hwnd != NULL, "failed to create tooltip wnd\n"); + + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + SetRect(&r, -1, -1, 1, 1); + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, (LPARAM)&r); + ok(!ret, "got %d\n", ret); + + SetRectEmpty(&r1); + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1); + ok(!ret, "got %d\n", ret); + ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r)); + + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + SetRectEmpty(&r1); + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1); + ok(!ret, "got %d\n", ret); + ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r)); + + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + DestroyWindow(hwnd); +} + START_TEST(tooltips) { InitCommonControls(); @@ -1053,4 +1090,5 @@ START_TEST(tooltips) test_longtextW(); test_track(); test_setinfo(); + test_margin(); } diff --git a/rostests/winetests/comctl32/trackbar.c b/rostests/winetests/comctl32/trackbar.c index 07407274878..1dbd1d5f9c4 100644 --- a/rostests/winetests/comctl32/trackbar.c +++ b/rostests/winetests/comctl32/trackbar.c @@ -658,8 +658,8 @@ static void test_position(void) oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)trackbar_no_wmpaint_proc); SetWindowLongPtrA(hWndTrackbar, GWLP_USERDATA, (LONG_PTR)oldproc); - memset(&rect, 0, sizeof(rect)); - memset(&rect2, 0, sizeof(rect2)); + SetRectEmpty(&rect); + SetRectEmpty(&rect2); SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); @@ -690,6 +690,7 @@ static void test_position(void) static void test_range(void) { HWND hWndTrackbar; + RECT rect1, rect2; int r; hWndTrackbar = create_trackbar(defaultstyle, hWndParent); @@ -755,6 +756,28 @@ static void test_range(void) ok_sequence(sequences, TRACKBAR_SEQ_INDEX, range_test_seq, "range test sequence", TRUE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_range_test_seq, "parent range test sequence", TRUE); + /* TBM_SETRANGE updates thumb visual position (rectangle) if needed */ + r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 0)); + ok(r == 0, "got %d\n", r); + SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 0); + + RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + + r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 10)); + ok(r == 0, "got %d\n", r); + RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW); + + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2); + ok(!EqualRect(&rect1, &rect2), "thumb rectangle not updated\n"); + + /* change range back, don't force repaint */ + r = SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(-10, 0)); + ok(r == 0, "got %d\n", r); + + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + ok(EqualRect(&rect1, &rect2), "thumb rectangle not updated\n"); + DestroyWindow(hWndTrackbar); }