Module: wine Branch: oldstable Commit: 0bc743ace967e7c08f166d0a9b76271530bf8274 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0bc743ace967e7c08f166d0a9b...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Dec 12 22:03:20 2016 +0300
comctl32/tests: Trackbar test to show that thumb is updated on TBM_SETTICFREQ.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 458ddd59b247a52fc4463a1a8b90d4744f154142) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/comctl32/tests/trackbar.c | 47 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c index 918cf1a..da24595 100644 --- a/dlls/comctl32/tests/trackbar.c +++ b/dlls/comctl32/tests/trackbar.c @@ -890,7 +890,7 @@ static void test_thumb_length(void) static void test_tic_settings(void) { HWND hWndTrackbar; - int r; + int r, i;
hWndTrackbar = create_trackbar(defaultstyle, hWndParent); ok(hWndTrackbar != NULL, "Expected non NULL value\n"); @@ -955,6 +955,51 @@ static void test_tic_settings(void) SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0); expect(3, r); + + DestroyWindow(hWndTrackbar); + + /* Test to show that TBM_SETTICFREQ updates thumb */ + for (i = 0; i < 2; i++) + { + DWORD style = i ? defaultstyle : defaultstyle & ~TBS_AUTOTICKS; + RECT rect, rect1; + WNDPROC oldproc; + + hWndTrackbar = create_trackbar2(style, hWndParent); + ok(hWndTrackbar != NULL, "Expected non NULL value\n"); + + oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)trackbar_no_wmpaint_proc); + SetWindowLongPtrA(hWndTrackbar, GWLP_USERDATA, (LONG_PTR)oldproc); + + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 0); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n", + wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect)); + + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(-100, 100)); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n", + wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect)); + /* Old position is also 0, but thumb position will be different after range change */ + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 0); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n", + wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect)); + /* Previous frequency is also 1, yet thumb is updated */ + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect); + SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0); + SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1); + todo_wine + ok(!EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n", + wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect)); + + SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)oldproc); + + DestroyWindow(hWndTrackbar); + } }
static void test_tic_placement(void)