1 /* Unit tests for the track bar control.
3 * Copyright 2007 Keith Stevens
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <wine/test.h>
22 //#include <windows.h>
30 #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
31 #define NUM_MSG_SEQUENCE 2
32 #define PARENT_SEQ_INDEX 0
33 #define TRACKBAR_SEQ_INDEX 1
35 static const DWORD defaultstyle
= WS_VISIBLE
| TBS_TOOLTIPS
| TBS_ENABLESELRANGE
| TBS_FIXEDLENGTH
| TBS_AUTOTICKS
;
36 static HWND hWndParent
;
38 static LRESULT WINAPI
trackbar_no_wmpaint_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
40 WNDPROC oldproc
= (WNDPROC
)GetWindowLongPtrA(hwnd
, GWLP_USERDATA
);
42 if (message
== WM_PAINT
)
45 return CallWindowProcA(oldproc
, hwnd
, message
, wParam
, lParam
);
48 static struct msg_sequence
*sequences
[NUM_MSG_SEQUENCE
];
50 static const struct message empty_seq
[] = {
54 static const struct message parent_create_trackbar_wnd_seq
[] = {
55 { WM_NOTIFYFORMAT
, sent
},
56 { WM_QUERYUISTATE
, sent
|optional
},
57 { WM_WINDOWPOSCHANGING
, sent
},
58 { WM_NCACTIVATE
, sent
},
59 { PBT_APMRESUMECRITICAL
, sent
},
60 { WM_WINDOWPOSCHANGING
, sent
},
61 { PBT_APMRESUMESTANDBY
, sent
},
62 { WM_IME_SETCONTEXT
, sent
|optional
},
63 { WM_IME_NOTIFY
, sent
|optional
},
64 { WM_CTLCOLORSTATIC
, sent
},
69 static const struct message parent_new_window_test_seq
[] = {
70 { WM_QUERYNEWPALETTE
, sent
|optional
},
71 { WM_WINDOWPOSCHANGING
, sent
|optional
},
72 { WM_NCACTIVATE
, sent
|optional
},
73 { PBT_APMRESUMECRITICAL
, sent
|optional
},
74 { WM_IME_SETCONTEXT
, sent
|defwinproc
|optional
},
75 { WM_IME_NOTIFY
, sent
|defwinproc
|optional
},
76 { WM_SETFOCUS
, sent
|defwinproc
|optional
},
77 { WM_NOTIFYFORMAT
, sent
},
78 { WM_QUERYUISTATE
, sent
|optional
},
82 static const struct message buddy_window_test_seq
[] = {
83 { TBM_GETBUDDY
, sent
|wparam
, TRUE
},
84 { TBM_SETBUDDY
, sent
|wparam
, FALSE
},
85 { WM_PAINT
, sent
|defwinproc
},
86 { TBM_SETBUDDY
, sent
|wparam
, FALSE
},
87 { WM_PAINT
, sent
|defwinproc
},
88 { TBM_GETBUDDY
, sent
|wparam
, TRUE
},
89 { TBM_SETBUDDY
, sent
|wparam
, TRUE
},
90 { WM_PAINT
, sent
|defwinproc
},
91 { TBM_SETBUDDY
, sent
|wparam
, TRUE
},
92 { WM_PAINT
, sent
|defwinproc
},
93 { TBM_GETBUDDY
, sent
|wparam
, FALSE
},
94 { TBM_GETBUDDY
, sent
|wparam
, TRUE
},
98 static const struct message parent_buddy_window_test_seq
[] = {
99 { WM_CTLCOLORSTATIC
, sent
},
101 { WM_CTLCOLORSTATIC
, sent
},
103 { WM_CTLCOLORSTATIC
, sent
},
105 { WM_CTLCOLORSTATIC
, sent
},
110 static const struct message line_size_test_seq
[] = {
111 { TBM_SETLINESIZE
, sent
|lparam
, 0, 10},
112 { TBM_SETLINESIZE
, sent
|lparam
, 0, 4},
113 { TBM_GETLINESIZE
, sent
},
117 static const struct message page_size_test_seq
[] = {
118 { TBM_SETPAGESIZE
, sent
|lparam
, 0, 10},
119 { TBM_SETPAGESIZE
, sent
|lparam
, 0, -1},
120 { TBM_GETPAGESIZE
, sent
},
124 static const struct message position_test_seq
[] = {
125 { TBM_SETPOS
, sent
|wparam
|lparam
, TRUE
, -1},
126 { WM_PAINT
, sent
|defwinproc
},
128 { TBM_SETPOS
, sent
|wparam
|lparam
, TRUE
, 5},
129 { WM_PAINT
, sent
|defwinproc
},
131 { TBM_SETPOS
, sent
|wparam
|lparam
, TRUE
, 5},
132 { TBM_SETPOS
, sent
|wparam
|lparam
, TRUE
, 1000},
133 { WM_PAINT
, sent
|defwinproc
},
135 { TBM_SETPOS
, sent
|wparam
|lparam
, FALSE
, 20},
137 { TBM_SETPOS
, sent
|wparam
|lparam
, TRUE
, 20},
142 static const struct message parent_position_test_seq
[] = {
143 { WM_CTLCOLORSTATIC
, sent
},
145 { WM_CTLCOLORSTATIC
, sent
},
147 { WM_CTLCOLORSTATIC
, sent
},
152 static const struct message range_test_seq
[] = {
153 { TBM_SETRANGE
, sent
|wparam
|lparam
, TRUE
, MAKELONG(0, 10)},
154 { WM_PAINT
, sent
|defwinproc
},
155 { TBM_GETRANGEMAX
, sent
},
156 { TBM_GETRANGEMIN
, sent
},
157 { TBM_SETRANGE
, sent
|wparam
|lparam
, TRUE
, MAKELONG(-1, 1000)},
158 { WM_PAINT
, sent
|defwinproc
},
159 { TBM_GETRANGEMAX
, sent
},
160 { TBM_GETRANGEMIN
, sent
},
161 { TBM_SETRANGE
, sent
|wparam
|lparam
, TRUE
, MAKELONG(10, 0)},
162 { WM_PAINT
, sent
|defwinproc
},
163 { TBM_GETRANGEMAX
, sent
},
164 { TBM_GETRANGEMIN
, sent
},
165 { TBM_SETRANGE
, sent
|wparam
|lparam
, FALSE
, MAKELONG(0, 10)},
166 { TBM_GETRANGEMAX
, sent
},
167 { TBM_GETRANGEMIN
, sent
},
168 { TBM_SETRANGEMAX
, sent
|wparam
|lparam
, TRUE
, 10},
169 { WM_PAINT
, sent
|defwinproc
},
170 { TBM_GETRANGEMAX
, sent
},
171 { TBM_SETRANGEMAX
, sent
|wparam
|lparam
, TRUE
, -1},
172 { WM_PAINT
, sent
|defwinproc
},
173 { TBM_GETRANGEMAX
, sent
},
174 { TBM_SETRANGEMAX
, sent
|wparam
|lparam
, FALSE
, 10},
175 { TBM_GETRANGEMAX
, sent
},
176 { TBM_SETRANGEMIN
, sent
|wparam
|lparam
, TRUE
, 0},
177 { WM_PAINT
, sent
|defwinproc
},
178 { TBM_GETRANGEMIN
, sent
},
179 { TBM_SETRANGEMIN
, sent
|wparam
|lparam
, TRUE
, 10},
180 { WM_PAINT
, sent
|defwinproc
},
181 { TBM_GETRANGEMIN
, sent
},
182 { TBM_SETRANGEMIN
, sent
|wparam
|lparam
, TRUE
, -10},
183 { WM_PAINT
, sent
|defwinproc
},
184 { TBM_GETRANGEMIN
, sent
},
185 { TBM_SETRANGEMIN
, sent
|wparam
|lparam
, FALSE
, 5},
186 { TBM_GETRANGEMIN
, sent
},
187 { TBM_GETRANGEMAX
, sent
},
188 { TBM_GETRANGEMIN
, sent
},
192 static const struct message parent_range_test_seq
[] = {
193 { WM_CTLCOLORSTATIC
, sent
},
195 { WM_CTLCOLORSTATIC
, sent
},
197 { WM_CTLCOLORSTATIC
, sent
},
199 { WM_CTLCOLORSTATIC
, sent
},
201 { WM_CTLCOLORSTATIC
, sent
},
203 { WM_CTLCOLORSTATIC
, sent
},
205 { WM_CTLCOLORSTATIC
, sent
},
207 { WM_CTLCOLORSTATIC
, sent
},
212 static const struct message selection_test_seq
[] = {
213 { TBM_SETSEL
, sent
|wparam
|lparam
, TRUE
, MAKELONG(0, 10)},
214 { WM_PAINT
, sent
|defwinproc
},
215 { TBM_GETSELEND
, sent
},
216 { TBM_GETSELSTART
, sent
},
217 { TBM_SETSEL
, sent
|wparam
|lparam
, TRUE
, MAKELONG(5, 20)},
218 { WM_PAINT
, sent
|defwinproc
},
219 { TBM_GETSELEND
, sent
},
220 { TBM_GETSELSTART
, sent
},
221 { TBM_SETSEL
, sent
|wparam
|lparam
, FALSE
, MAKELONG(5, 10)},
222 { TBM_GETSELEND
, sent
},
223 { TBM_GETSELSTART
, sent
},
224 { TBM_SETSELEND
, sent
|wparam
|lparam
, TRUE
, 10},
225 { WM_PAINT
, sent
|defwinproc
},
226 { TBM_GETSELEND
, sent
},
227 { TBM_SETSELEND
, sent
|wparam
|lparam
, TRUE
, 20},
228 { WM_PAINT
, sent
|defwinproc
},
229 { TBM_GETSELEND
, sent
},
230 { TBM_SETSELEND
, sent
|wparam
|lparam
, TRUE
, 4},
231 { WM_PAINT
, sent
|defwinproc
},
232 { TBM_GETSELEND
, sent
},
233 { TBM_SETSELEND
, sent
|wparam
|lparam
, FALSE
, 2},
234 { TBM_GETSELEND
, sent
},
235 { TBM_GETSELEND
, sent
},
236 { TBM_SETSELSTART
, sent
|wparam
|lparam
, TRUE
, 5},
237 { WM_PAINT
, sent
|defwinproc
},
238 { TBM_GETSELSTART
, sent
},
239 { TBM_SETSELSTART
, sent
|wparam
|lparam
, TRUE
, 0},
240 { WM_PAINT
, sent
|defwinproc
},
241 { TBM_GETSELSTART
, sent
},
242 { TBM_SETSELSTART
, sent
|wparam
|lparam
, TRUE
, 20},
243 { WM_PAINT
, sent
|defwinproc
},
244 { TBM_GETSELSTART
, sent
},
245 { TBM_SETSELSTART
, sent
|wparam
|lparam
, FALSE
, 8},
246 { TBM_GETSELSTART
, sent
},
247 { TBM_GETSELSTART
, sent
},
251 static const struct message parent_selection_test_seq
[] = {
252 { WM_CTLCOLORSTATIC
, sent
},
254 { WM_CTLCOLORSTATIC
, sent
},
256 { WM_CTLCOLORSTATIC
, sent
},
258 { WM_CTLCOLORSTATIC
, sent
},
260 { WM_CTLCOLORSTATIC
, sent
},
262 { WM_CTLCOLORSTATIC
, sent
},
264 { WM_CTLCOLORSTATIC
, sent
},
266 { WM_CTLCOLORSTATIC
, sent
},
271 static const struct message tic_settings_test_seq
[] = {
272 { TBM_SETTIC
, sent
|lparam
, 0, 0},
273 { TBM_SETTIC
, sent
|lparam
, 0, 5},
274 { TBM_SETTIC
, sent
|lparam
, 0, 10},
275 { TBM_SETTIC
, sent
|lparam
, 0, 20},
276 { TBM_SETRANGE
, sent
|wparam
|lparam
, TRUE
, MAKELONG(0,10)},
277 { WM_PAINT
, sent
|defwinproc
},
278 { TBM_SETTICFREQ
, sent
|wparam
, 2},
279 { WM_PAINT
, sent
|defwinproc
},
280 { TBM_GETNUMTICS
, sent
},
281 { TBM_SETTICFREQ
, sent
|wparam
, 5},
282 { WM_PAINT
, sent
|defwinproc
},
283 { TBM_GETNUMTICS
, sent
},
284 { TBM_SETTICFREQ
, sent
|wparam
, 15},
285 { WM_PAINT
, sent
|defwinproc
},
286 { TBM_GETNUMTICS
, sent
},
287 { TBM_GETNUMTICS
, sent
},
291 static const struct message parent_tic_settings_test_seq
[] = {
292 { WM_CTLCOLORSTATIC
, sent
},
294 { WM_CTLCOLORSTATIC
, sent
},
296 { WM_CTLCOLORSTATIC
, sent
},
298 { WM_CTLCOLORSTATIC
, sent
},
303 static const struct message thumb_length_test_seq
[] = {
304 { TBM_SETTHUMBLENGTH
, sent
|wparam
|lparam
, 15, 0},
305 { WM_PAINT
, sent
|defwinproc
},
306 { TBM_GETTHUMBLENGTH
, sent
},
307 { TBM_SETTHUMBLENGTH
, sent
|wparam
|lparam
, 20, 0},
308 { WM_PAINT
, sent
|defwinproc
},
309 { TBM_GETTHUMBLENGTH
, sent
},
310 { TBM_GETTHUMBLENGTH
, sent
},
312 { WM_PAINT
, sent
|defwinproc
},
313 { TBM_GETTHUMBLENGTH
, sent
},
315 { WM_PAINT
, sent
|defwinproc
},
316 { TBM_GETTHUMBLENGTH
, sent
},
320 static const struct message parent_thumb_length_test_seq
[] = {
321 { WM_CTLCOLORSTATIC
, sent
},
323 { WM_CTLCOLORSTATIC
, sent
},
325 { WM_CTLCOLORSTATIC
, sent
},
327 { WM_CTLCOLORSTATIC
, sent
},
332 static const struct message tic_placement_test_seq
[] = {
333 { TBM_GETPTICS
, sent
},
334 { TBM_GETTIC
, sent
|wparam
, 0},
335 { TBM_GETTIC
, sent
|wparam
, 2},
336 { TBM_GETTIC
, sent
|wparam
, 4},
337 { TBM_GETTICPOS
, sent
|wparam
, 0},
338 { TBM_GETTICPOS
, sent
|wparam
, 2},
342 static const struct message tool_tips_test_seq
[] = {
343 { TBM_SETTIPSIDE
, sent
|wparam
, TBTS_TOP
},
344 { TBM_SETTIPSIDE
, sent
|wparam
, TBTS_LEFT
},
345 { TBM_SETTIPSIDE
, sent
|wparam
, TBTS_BOTTOM
},
346 { TBM_SETTIPSIDE
, sent
|wparam
, TBTS_RIGHT
},
347 { TBM_SETTOOLTIPS
, sent
},
348 { TBM_GETTOOLTIPS
, sent
},
349 { TBM_SETTOOLTIPS
, sent
},
350 { TBM_GETTOOLTIPS
, sent
},
351 { TBM_SETTOOLTIPS
, sent
},
352 { TBM_GETTOOLTIPS
, sent
},
353 { TBM_GETTOOLTIPS
, sent
},
357 static const struct message unicode_test_seq
[] = {
358 { TBM_SETUNICODEFORMAT
, sent
|wparam
, TRUE
},
359 { TBM_SETUNICODEFORMAT
, sent
|wparam
, FALSE
},
360 { TBM_GETUNICODEFORMAT
, sent
},
364 static const struct message ignore_selection_test_seq
[] = {
365 { TBM_SETSEL
, sent
|wparam
|lparam
, TRUE
, MAKELONG(0,10)},
366 { TBM_GETSELEND
, sent
},
367 { TBM_GETSELSTART
, sent
},
368 { TBM_SETSEL
, sent
|wparam
|lparam
, FALSE
, MAKELONG(0,10)},
369 { TBM_GETSELEND
, sent
},
370 { TBM_GETSELSTART
, sent
},
371 { TBM_SETSELEND
, sent
|wparam
|lparam
, TRUE
,0},
372 { TBM_GETSELEND
, sent
},
373 { TBM_SETSELEND
, sent
|wparam
|lparam
, TRUE
, 10},
374 { TBM_GETSELEND
, sent
},
375 { TBM_SETSELEND
, sent
|wparam
|lparam
, FALSE
,0},
376 { TBM_GETSELEND
, sent
},
377 { TBM_SETSELSTART
, sent
|wparam
|lparam
, TRUE
,0},
378 { TBM_GETSELSTART
, sent
},
379 { TBM_SETSELSTART
, sent
|wparam
|lparam
, TRUE
, 10},
380 { TBM_GETSELSTART
, sent
},
381 { TBM_SETSELSTART
, sent
|wparam
|lparam
, FALSE
,0},
382 { TBM_GETSELSTART
, sent
},
386 static LRESULT WINAPI
parent_wnd_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
){
387 static LONG defwndproc_counter
= 0;
391 /* log system messages, except for painting */
392 if (message
< WM_USER
&&
393 message
!= WM_PAINT
&&
394 message
!= WM_ERASEBKGND
&&
395 message
!= WM_NCPAINT
&&
396 message
!= WM_NCHITTEST
&&
397 message
!= WM_GETTEXT
&&
398 message
!= WM_GETICON
&&
399 message
!= WM_DEVICECHANGE
)
401 msg
.message
= message
;
402 msg
.flags
= sent
|wparam
|lparam
;
403 if (defwndproc_counter
) msg
.flags
|= defwinproc
;
407 add_message(sequences
, PARENT_SEQ_INDEX
, &msg
);
410 defwndproc_counter
++;
411 ret
= DefWindowProcA(hwnd
, message
, wParam
, lParam
);
412 defwndproc_counter
--;
417 static BOOL
register_parent_wnd_class(void){
421 cls
.lpfnWndProc
= parent_wnd_proc
;
424 cls
.hInstance
= GetModuleHandleA(NULL
);
426 cls
.hCursor
= LoadCursorA(0, (LPCSTR
)IDC_ARROW
);
427 cls
.hbrBackground
= GetStockObject(WHITE_BRUSH
);
428 cls
.lpszMenuName
= NULL
;
429 cls
.lpszClassName
= "Trackbar test parent class";
430 return RegisterClassA(&cls
);
433 static HWND
create_parent_window(void){
434 if (!register_parent_wnd_class())
437 return CreateWindowA("Trackbar test parent class", "Trackbar test parent window",
438 WS_CAPTION
| WS_SYSMENU
| WS_MINIMIZEBOX
| WS_MAXIMIZEBOX
| WS_VISIBLE
,
439 0, 0, 100, 100, GetDesktopWindow(), NULL
, GetModuleHandleA(NULL
), NULL
);
442 static LRESULT WINAPI
trackbar_subclass_proc(HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
){
443 WNDPROC oldproc
= (WNDPROC
)GetWindowLongPtrA(hwnd
, GWLP_USERDATA
);
444 static LONG defwndproc_counter
= 0;
448 msg
.message
= message
;
449 msg
.flags
= sent
|wparam
|lparam
;
450 if (defwndproc_counter
) msg
.flags
|= defwinproc
;
454 add_message(sequences
, TRACKBAR_SEQ_INDEX
, &msg
);
456 defwndproc_counter
++;
457 ret
= CallWindowProcA(oldproc
, hwnd
, message
, wParam
, lParam
);
458 defwndproc_counter
--;
463 static HWND
create_trackbar(DWORD style
, HWND parent
){
468 GetClientRect(parent
, &rect
);
469 hWndTrack
= CreateWindowA(TRACKBAR_CLASSA
, "Trackbar Control", style
,
470 rect
.right
, rect
.bottom
, 100, 50,
471 parent
, NULL
, GetModuleHandleA(NULL
), NULL
);
473 if (!hWndTrack
) return NULL
;
475 oldproc
= (WNDPROC
)SetWindowLongPtrA(hWndTrack
, GWLP_WNDPROC
, (LONG_PTR
)trackbar_subclass_proc
);
476 SetWindowLongPtrA(hWndTrack
, GWLP_USERDATA
, (LONG_PTR
)oldproc
);
481 static HWND
create_trackbar2(DWORD style
, HWND parent
)
484 GetClientRect(parent
, &rect
);
485 return CreateWindowA(TRACKBAR_CLASSA
, "Trackbar Control", style
,
486 rect
.right
, rect
.bottom
, 100, 50,
487 parent
, NULL
, GetModuleHandleA(NULL
), NULL
);
490 /* test functions for setters, getters, and sequences */
492 static void test_trackbar_buddy(void)
494 HWND hWndLeftBuddy
, hWndTrackbar
;
496 HWND hWndCurrentBuddy
;
499 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
500 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
502 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
504 hWndLeftBuddy
= CreateWindowA(STATUSCLASSNAMEA
, NULL
, 0, 0, 0, 300, 20, NULL
, NULL
, NULL
, NULL
);
505 ok(hWndLeftBuddy
!= NULL
, "Expected non NULL value\n");
507 if (hWndLeftBuddy
!= NULL
){
508 hWndCurrentBuddy
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETBUDDY
, TRUE
, 0);
509 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_SETBUDDY
, FALSE
, (LPARAM
) hWndLeftBuddy
);
510 ok(rTest
== hWndCurrentBuddy
, "Expected hWndCurrentBuddy\n");
511 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_SETBUDDY
, FALSE
, (LPARAM
) hWndLeftBuddy
);
512 ok(rTest
== hWndLeftBuddy
, "Expected hWndLeftBuddy\n");
514 skip ("left buddy control not present?\n");
516 hWndRightBuddy
= CreateWindowA(STATUSCLASSNAMEA
, NULL
, 0, 0, 0, 300, 20, NULL
, NULL
, NULL
, NULL
);
518 ok(hWndRightBuddy
!= NULL
, "expected non NULL value\n");
520 /* test TBM_SETBUDDY */
521 if (hWndRightBuddy
!= NULL
){
522 hWndCurrentBuddy
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETBUDDY
, TRUE
, 0);
523 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_SETBUDDY
, TRUE
, (LPARAM
) hWndRightBuddy
);
524 ok(rTest
== hWndCurrentBuddy
, "Expected hWndCurrentBuddy\n");
525 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_SETBUDDY
, TRUE
, (LPARAM
) hWndRightBuddy
);
526 ok(rTest
== hWndRightBuddy
, "Expected hWndRightbuddy\n");
528 skip("Right buddy control not present?\n");
530 /* test TBM_GETBUDDY */
531 if (hWndLeftBuddy
!= NULL
){
532 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETBUDDY
, FALSE
, 0);
533 ok(rTest
== hWndLeftBuddy
, "Expected hWndLeftBuddy\n");
534 DestroyWindow(hWndLeftBuddy
);
536 if (hWndRightBuddy
!= NULL
){
537 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETBUDDY
, TRUE
,0);
538 ok(rTest
== hWndRightBuddy
, "Expected hWndRightBuddy\n");
539 DestroyWindow(hWndRightBuddy
);
542 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, buddy_window_test_seq
, "buddy test sequence", TRUE
);
543 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_buddy_window_test_seq
, "parent buddy test seq", TRUE
);
545 DestroyWindow(hWndTrackbar
);
548 static void test_line_size(void)
553 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
554 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
556 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
558 /* test TBM_SETLINESIZE */
559 r
= SendMessageA(hWndTrackbar
, TBM_SETLINESIZE
, 0, 10);
561 r
= SendMessageA(hWndTrackbar
, TBM_SETLINESIZE
, 0, 4);
564 /* test TBM_GETLINESIZE */
565 r
= SendMessageA(hWndTrackbar
, TBM_GETLINESIZE
, 0,0);
568 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, line_size_test_seq
, "linesize test sequence", FALSE
);
569 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent line test sequence", FALSE
);
571 DestroyWindow(hWndTrackbar
);
575 static void test_page_size(void)
580 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
581 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
583 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
585 /* test TBM_SETPAGESIZE */
586 r
= SendMessageA(hWndTrackbar
, TBM_SETPAGESIZE
, 0, 10);
588 r
= SendMessageA(hWndTrackbar
, TBM_SETPAGESIZE
, 0, -1);
591 /* test TBM_GETPAGESIZE */
592 r
= SendMessageA(hWndTrackbar
, TBM_GETPAGESIZE
, 0,0);
595 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, page_size_test_seq
, "page size test sequence", FALSE
);
596 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent page size test sequence", FALSE
);
598 /* check for zero page size */
599 r
= SendMessageA(hWndTrackbar
, TBM_SETPAGESIZE
, 0, 0);
601 r
= SendMessageA(hWndTrackbar
, TBM_GETPAGESIZE
, 0, 0);
603 /* revert to default */
604 r
= SendMessageA(hWndTrackbar
, TBM_SETPAGESIZE
, 0, -1);
606 r
= SendMessageA(hWndTrackbar
, TBM_GETPAGESIZE
, 0, 0);
609 r
= SendMessageA(hWndTrackbar
, TBM_SETPAGESIZE
, 0, -2);
611 r
= SendMessageA(hWndTrackbar
, TBM_GETPAGESIZE
, 0, 0);
614 DestroyWindow(hWndTrackbar
);
617 static void test_position(void)
624 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
625 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
627 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
629 /* test TBM_SETPOS */
630 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, -1);
631 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0, 0);
633 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, 5);
634 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0,0);
636 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, 5);
637 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, 1000);
638 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0,0);
640 SendMessageA(hWndTrackbar
, TBM_SETPOS
, FALSE
, 20);
641 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0,0);
643 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, 20);
645 /* test TBM_GETPOS */
646 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0,0);
649 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, position_test_seq
, "position test sequence", TRUE
);
650 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_position_test_seq
, "parent position test sequence", TRUE
);
652 DestroyWindow(hWndTrackbar
);
654 hWndTrackbar
= create_trackbar2(defaultstyle
, hWndParent
);
655 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
657 /* subclassing procedure blocks WM_PAINT */
658 oldproc
= (WNDPROC
)SetWindowLongPtrA(hWndTrackbar
, GWLP_WNDPROC
, (LONG_PTR
)trackbar_no_wmpaint_proc
);
659 SetWindowLongPtrA(hWndTrackbar
, GWLP_USERDATA
, (LONG_PTR
)oldproc
);
661 memset(&rect
, 0, sizeof(rect
));
662 memset(&rect2
, 0, sizeof(rect2
));
664 SendMessageA(hWndTrackbar
, TBM_GETTHUMBRECT
, 0, (LPARAM
)&rect
);
666 /* without repaint */
667 SendMessageA(hWndTrackbar
, TBM_SETPOS
, FALSE
, 25);
668 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0, 0);
669 ok(r
== 25, "got %d\n", r
);
670 SendMessageA(hWndTrackbar
, TBM_GETTHUMBRECT
, 0, (LPARAM
)&rect2
);
671 ok(rect
.left
== rect2
.left
, "got %d\n", rect
.left
);
674 SendMessageA(hWndTrackbar
, TBM_SETPOS
, TRUE
, 30);
675 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0, 0);
676 ok(r
== 30, "got %d\n", r
);
677 SendMessageA(hWndTrackbar
, TBM_GETTHUMBRECT
, 0, (LPARAM
)&rect2
);
678 ok(rect
.left
!= rect2
.left
, "got %d, expected %d\n", rect2
.left
, rect
.left
);
680 /* now move it with keys */
681 SendMessageA(hWndTrackbar
, WM_KEYDOWN
, VK_END
, 0);
682 r
= SendMessageA(hWndTrackbar
, TBM_GETPOS
, 0, 0);
683 ok(r
== 100, "got %d\n", r
);
684 SendMessageA(hWndTrackbar
, TBM_GETTHUMBRECT
, 0, (LPARAM
)&rect
);
685 ok(rect
.left
!= rect2
.left
, "got %d, expected %d\n", rect
.left
, rect2
.left
);
687 DestroyWindow(hWndTrackbar
);
690 static void test_range(void)
695 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
696 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
698 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
700 /* test TBM_SETRANGE */
701 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, TRUE
, MAKELONG(0, 10));
702 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
704 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
706 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, TRUE
, MAKELONG(-1, 1000));
707 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
709 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
711 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, TRUE
, MAKELONG(10, 0));
712 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
714 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
716 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, FALSE
, MAKELONG(0,10));
717 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
719 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
722 /*test TBM_SETRANGEMAX */
723 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, TRUE
, 10);
724 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
726 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, TRUE
, -1);
727 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
729 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, FALSE
, 10);
730 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
733 /* testing TBM_SETRANGEMIN */
734 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, 0);
735 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
737 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, 10);
738 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
740 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, -10);
741 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
743 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, FALSE
, 5);
744 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
747 /* test TBM_GETRANGEMAX */
748 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0,0);
751 /* test TBM_GETRANGEMIN */
752 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0,0);
755 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, range_test_seq
, "range test sequence", TRUE
);
756 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_range_test_seq
, "parent range test sequence", TRUE
);
758 DestroyWindow(hWndTrackbar
);
761 static void test_selection(void)
766 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
767 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
769 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, FALSE
, 5);
770 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, FALSE
, 10);
772 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
774 /* test TBM_SETSEL */
775 SendMessageA(hWndTrackbar
, TBM_SETSEL
, TRUE
, MAKELONG(0,10));
776 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
778 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
780 SendMessageA(hWndTrackbar
, TBM_SETSEL
, TRUE
, MAKELONG(5, 20));
781 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
783 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
785 SendMessageA(hWndTrackbar
, TBM_SETSEL
, FALSE
, MAKELONG(5, 10));
786 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
788 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
791 /* test TBM_SETSELEND */
792 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, TRUE
, 10);
793 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
795 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, TRUE
, 20);
796 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
798 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, TRUE
, 4);
799 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
801 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, FALSE
, 2);
802 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
805 /* test TBM_GETSELEND */
806 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
809 /* testing TBM_SETSELSTART */
810 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, TRUE
, 5);
811 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
813 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, TRUE
, 0);
814 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
816 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, TRUE
, 20);
817 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
819 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, FALSE
, 8);
820 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
823 /* test TBM_GETSELSTART */
824 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
827 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, selection_test_seq
, "selection test sequence", TRUE
);
828 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_selection_test_seq
, "parent selection test sequence", TRUE
);
830 DestroyWindow(hWndTrackbar
);
833 static void test_thumb_length(void)
838 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
839 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
841 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
843 /* testing TBM_SETTHUMBLENGTH */
844 SendMessageA(hWndTrackbar
, TBM_SETTHUMBLENGTH
, 15, 0);
845 r
= SendMessageA(hWndTrackbar
, TBM_GETTHUMBLENGTH
, 0,0);
847 SendMessageA(hWndTrackbar
, TBM_SETTHUMBLENGTH
, 20, 0);
848 r
= SendMessageA(hWndTrackbar
, TBM_GETTHUMBLENGTH
, 0,0);
851 /* test TBM_GETTHUMBLENGTH */
852 r
= SendMessageA(hWndTrackbar
, TBM_GETTHUMBLENGTH
, 0,0);
855 r
= SendMessageA(hWndTrackbar
, WM_SIZE
, 0,0);
857 r
= SendMessageA(hWndTrackbar
, TBM_GETTHUMBLENGTH
, 0,0);
859 r
= SendMessageA(hWndTrackbar
, WM_SIZE
, 0, MAKELPARAM(50, 50) );
861 r
= SendMessageA(hWndTrackbar
, TBM_GETTHUMBLENGTH
, 0,0);
864 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, thumb_length_test_seq
, "thumb length test sequence", TRUE
);
865 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_thumb_length_test_seq
, "parent thumb length test sequence", TRUE
);
867 DestroyWindow(hWndTrackbar
);
870 static void test_tic_settings(void)
875 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
876 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
878 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, FALSE
, 5);
879 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, FALSE
, 10);
881 /* testing TBM_SETTIC */
882 /* Set tics at 5 and 10 */
883 /* 0 and 20 are out of range and should not be set */
884 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMAX
, 0, 0);
886 r
= SendMessageA(hWndTrackbar
, TBM_GETRANGEMIN
, 0, 0);
889 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
890 r
= SendMessageA(hWndTrackbar
, TBM_SETTIC
, 0, 0);
891 ok(r
== FALSE
, "Expected FALSE, got %d\n", r
);
892 r
= SendMessageA(hWndTrackbar
, TBM_SETTIC
, 0, 5);
893 ok(r
== TRUE
, "Expected TRUE, got %d\n", r
);
894 r
= SendMessageA(hWndTrackbar
, TBM_SETTIC
, 0, 10);
895 ok(r
== TRUE
, "Expected TRUE, got %d\n", r
);
897 r
= SendMessageA(hWndTrackbar
, TBM_SETTIC
, 0, 20);
898 ok(r
== FALSE
, "Expected FALSE, got %d\n", r
);
900 /* test TBM_SETTICFREQ */
901 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, TRUE
, MAKELONG(0, 10));
902 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 2, 0);
903 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
905 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 5, 0);
906 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
908 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 15, 0);
909 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
912 /* test TBM_GETNUMTICS */
913 /* since TIC FREQ is 15, there should be only 2 tics now */
914 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
917 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, tic_settings_test_seq
, "tic settings test sequence", TRUE
);
918 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_tic_settings_test_seq
, "parent tic settings test sequence", TRUE
);
920 /* range [0,0], freq = 1 */
921 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, TRUE
, 0);
922 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, 0);
923 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 1, 0);
924 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
926 /* range [0,1], freq = 1 */
927 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, TRUE
, 1);
928 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, 0);
929 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 1, 0);
930 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
932 /* range [0,2], freq = 1 */
933 SendMessageA(hWndTrackbar
, TBM_SETRANGEMAX
, TRUE
, 2);
934 SendMessageA(hWndTrackbar
, TBM_SETRANGEMIN
, TRUE
, 0);
935 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 1, 0);
936 r
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
940 static void test_tic_placement(void)
947 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
948 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
950 SendMessageA(hWndTrackbar
, TBM_SETRANGE
, TRUE
, MAKELONG(1, 6));
951 SendMessageA(hWndTrackbar
, TBM_SETTICFREQ
, 1, 0);
953 numtics
= SendMessageA(hWndTrackbar
, TBM_GETNUMTICS
, 0, 0);
954 ok(numtics
== 6, "Expected 6, got %d\n", numtics
);
956 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
957 /* test TBM_GETPTICS */
958 rPTics
= (DWORD
*) SendMessageA(hWndTrackbar
, TBM_GETPTICS
, 0,0);
959 expect(2, rPTics
[0]);
960 expect(3, rPTics
[1]);
961 expect(4, rPTics
[2]);
962 expect(5, rPTics
[3]);
964 /* test TBM_GETTIC */
965 r
= SendMessageA(hWndTrackbar
, TBM_GETTIC
, 0,0);
967 r
= SendMessageA(hWndTrackbar
, TBM_GETTIC
, 2,0);
969 r
= SendMessageA(hWndTrackbar
, TBM_GETTIC
, 4,0);
972 /* test TBM_GETTICPIC */
973 r
= SendMessageA(hWndTrackbar
, TBM_GETTICPOS
, 0, 0);
974 ok(r
> 0, "Expected r > 0, got %d\n", r
);
975 r
= SendMessageA(hWndTrackbar
, TBM_GETTICPOS
, 2, 0);
976 ok(r
> 0, "Expected r > 0, got %d\n", r
);
978 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, tic_placement_test_seq
, "get tic placement test sequence", FALSE
);
979 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent get tic placement test sequence", FALSE
);
981 DestroyWindow(hWndTrackbar
);
984 static void test_tool_tips(void)
986 HWND hWndTooltip
, hWndTrackbar
;
990 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
991 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
993 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
995 /* testing TBM_SETTIPSIDE */
996 r
= SendMessageA(hWndTrackbar
, TBM_SETTIPSIDE
, TBTS_TOP
, 0);
998 r
= SendMessageA(hWndTrackbar
, TBM_SETTIPSIDE
, TBTS_LEFT
, 0);
1000 r
= SendMessageA(hWndTrackbar
, TBM_SETTIPSIDE
, TBTS_BOTTOM
, 0);
1001 expect(TBTS_LEFT
, r
);
1002 r
= SendMessageA(hWndTrackbar
, TBM_SETTIPSIDE
, TBTS_RIGHT
, 0);
1003 expect(TBTS_BOTTOM
, r
);
1005 /* testing TBM_SETTOOLTIPS */
1006 hWndTooltip
= CreateWindowExA(WS_EX_TOPMOST
, TOOLTIPS_CLASSA
, NULL
, 0,
1007 CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
1008 NULL
, NULL
, NULL
, NULL
);
1010 ok(hWndTooltip
!= NULL
, "Expected non NULL value\n");
1011 if (hWndTooltip
!= NULL
){
1012 SendMessageA(hWndTrackbar
, TBM_SETTOOLTIPS
, (LPARAM
) hWndTooltip
, 0);
1013 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETTOOLTIPS
, 0,0);
1014 ok(rTest
== hWndTooltip
, "Expected hWndToolTip, got\n");
1015 SendMessageA(hWndTrackbar
, TBM_SETTOOLTIPS
, 0, 0);
1016 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETTOOLTIPS
, 0,0);
1017 ok(rTest
== NULL
, "Expected NULL\n");
1018 SendMessageA(hWndTrackbar
, TBM_SETTOOLTIPS
, (LPARAM
) hWndTooltip
, 5);
1019 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETTOOLTIPS
, 0,0);
1020 ok(rTest
== hWndTooltip
, "Expected hWndTooltip, got\n");
1022 skip("tool tip control not present?\n");
1024 /* test TBM_GETTOOLTIPS */
1025 rTest
= (HWND
) SendMessageA(hWndTrackbar
, TBM_GETTOOLTIPS
, 0,0);
1026 ok(rTest
== hWndTooltip
, "Expected hWndTooltip\n");
1028 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, tool_tips_test_seq
, "tool tips test sequence", FALSE
);
1029 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent tool tips test sequence", FALSE
);
1031 DestroyWindow(hWndTrackbar
);
1035 static void test_unicode(void)
1040 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
1041 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
1043 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
1045 /* testing TBM_SETUNICODEFORMAT */
1046 r
= SendMessageA(hWndTrackbar
, TBM_SETUNICODEFORMAT
, TRUE
, 0);
1047 ok(r
== FALSE
, "Expected FALSE, got %d\n",r
);
1048 r
= SendMessageA(hWndTrackbar
, TBM_SETUNICODEFORMAT
, FALSE
, 0);
1049 ok(r
== TRUE
, "Expected TRUE, got %d\n",r
);
1051 /* test TBM_GETUNICODEFORMAT */
1052 r
= SendMessageA(hWndTrackbar
, TBM_GETUNICODEFORMAT
, 0,0);
1053 ok(r
== FALSE
, "Expected FALSE, got %d\n",r
);
1055 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, unicode_test_seq
, "unicode test sequence", FALSE
);
1056 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent unicode test sequence", FALSE
);
1058 DestroyWindow(hWndTrackbar
);
1061 static void test_ignore_selection(void)
1066 hWndTrackbar
= create_trackbar(0, hWndParent
);
1067 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
1069 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
1070 /* test TBM_SETSEL ensure that it is ignored */
1071 SendMessageA(hWndTrackbar
, TBM_SETSEL
, TRUE
, MAKELONG(0,10));
1072 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
1074 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
1076 SendMessageA(hWndTrackbar
, TBM_SETSEL
, FALSE
, MAKELONG(0,10));
1077 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
1079 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
1082 /* test TBM_SETSELEND, ensure that it is ignored */
1083 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, TRUE
, 0);
1084 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
1086 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, TRUE
, 10);
1087 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
1089 SendMessageA(hWndTrackbar
, TBM_SETSELEND
, FALSE
, 0);
1090 r
= SendMessageA(hWndTrackbar
, TBM_GETSELEND
, 0,0);
1093 /* test TBM_SETSELSTART, ensure that it is ignored */
1094 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, TRUE
, 0);
1095 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
1097 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, TRUE
, 10);
1098 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
1100 SendMessageA(hWndTrackbar
, TBM_SETSELSTART
, FALSE
, 0);
1101 r
= SendMessageA(hWndTrackbar
, TBM_GETSELSTART
, 0,0);
1104 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, ignore_selection_test_seq
, "ignore selection setting test sequence", FALSE
);
1105 ok_sequence(sequences
, PARENT_SEQ_INDEX
, empty_seq
, "parent ignore selection setting test sequence", FALSE
);
1107 DestroyWindow(hWndTrackbar
);
1110 static void test_initial_state(void)
1115 hWnd
= create_trackbar(0, hWndParent
);
1117 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1119 ret
= SendMessageA(hWnd
, TBM_GETTIC
, 0, 0);
1121 ret
= SendMessageA(hWnd
, TBM_GETTICPOS
, 0, 0);
1123 ret
= SendMessageA(hWnd
, TBM_GETRANGEMIN
, 0, 0);
1125 ret
= SendMessageA(hWnd
, TBM_GETRANGEMAX
, 0, 0);
1128 ret
= SendMessageA(hWnd
, TBM_SETRANGEMAX
, TRUE
, 200);
1131 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1134 ret
= SendMessageA(hWnd
, TBM_SETRANGEMIN
, TRUE
, 10);
1137 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1140 DestroyWindow(hWnd
);
1143 static void test_TBS_AUTOTICKS(void)
1148 hWnd
= create_trackbar(TBS_AUTOTICKS
, hWndParent
);
1150 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1152 ret
= SendMessageA(hWnd
, TBM_GETTIC
, 0, 0);
1154 ret
= SendMessageA(hWnd
, TBM_GETTICPOS
, 0, 0);
1156 ret
= SendMessageA(hWnd
, TBM_GETRANGEMIN
, 0, 0);
1158 ret
= SendMessageA(hWnd
, TBM_GETRANGEMAX
, 0, 0);
1161 /* TBM_SETRANGEMAX rebuilds tics */
1162 ret
= SendMessageA(hWnd
, TBM_SETRANGEMAX
, TRUE
, 200);
1164 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1167 /* TBM_SETRANGEMIN rebuilds tics */
1168 ret
= SendMessageA(hWnd
, TBM_SETRANGEMAX
, TRUE
, 100);
1170 ret
= SendMessageA(hWnd
, TBM_SETRANGEMIN
, TRUE
, 10);
1172 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1175 ret
= SendMessageA(hWnd
, TBM_SETRANGEMIN
, TRUE
, 0);
1178 /* TBM_SETRANGE rebuilds tics */
1179 ret
= SendMessageA(hWnd
, TBM_SETRANGE
, TRUE
, MAKELONG(10, 200));
1181 ret
= SendMessageA(hWnd
, TBM_GETNUMTICS
, 0, 0);
1184 DestroyWindow(hWnd
);
1187 static void test_create(void)
1191 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
1193 hWndTrackbar
= create_trackbar(defaultstyle
, hWndParent
);
1194 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
1195 ok_sequence(sequences
, TRACKBAR_SEQ_INDEX
, empty_seq
, "create Trackbar Window", FALSE
);
1196 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_create_trackbar_wnd_seq
, "parent trackbar window", TRUE
);
1198 DestroyWindow(hWndTrackbar
);
1201 flush_sequences(sequences
, NUM_MSG_SEQUENCE
);
1202 hWndTrackbar
= create_trackbar(0, hWndParent
);
1203 ok(hWndTrackbar
!= NULL
, "Expected non NULL value\n");
1204 ok_sequence(sequences
, PARENT_SEQ_INDEX
, parent_new_window_test_seq
, "new trackbar window test sequence", TRUE
);
1205 DestroyWindow(hWndTrackbar
);
1208 START_TEST(trackbar
)
1210 init_msg_sequences(sequences
, NUM_MSG_SEQUENCE
);
1211 InitCommonControls();
1213 /* create parent window */
1214 hWndParent
= create_parent_window();
1215 ok(hWndParent
!= NULL
, "Failed to create parent Window!\n");
1218 skip("parent window not present\n");
1223 test_trackbar_buddy();
1229 test_thumb_length();
1230 test_tic_settings();
1231 test_tic_placement();
1234 test_TBS_AUTOTICKS();
1235 test_ignore_selection();
1236 test_initial_state();
1238 DestroyWindow(hWndParent
);