shdocvw: Support URLs passed by reference in WebBrowser_Navigate2.
[wine] / dlls / comctl32 / tests / trackbar.c
1 /* Unit tests for the track bar control.
2  *
3  * Copyright 2007 Keith Stevens
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <assert.h>
21 #include <windows.h>
22 #include <commctrl.h>
23 #include <stdio.h>
24
25 #include "wine/test.h"
26 #include "msg.h"
27
28 #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
29 #define NUM_MSG_SEQUENCE 2
30 #define PARENT_SEQ_INDEX 0
31 #define TRACKBAR_SEQ_INDEX 1
32
33
34 static struct msg_sequence *sequences[NUM_MSG_SEQUENCE];
35
36 static const struct message create_parent_wnd_seq[] = {
37     { WM_GETMINMAXINFO, sent },
38     { WM_NCCREATE, sent },
39     { WM_NCCALCSIZE, sent|wparam, 0 },
40     { WM_CREATE, sent },
41     { WM_SHOWWINDOW, sent|wparam, 1 },
42     { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
43     { WM_QUERYNEWPALETTE, sent|optional },
44     { WM_WINDOWPOSCHANGING, sent|wparam, 0 },
45     { WM_ACTIVATEAPP, sent|wparam, 1 },
46     { WM_NCACTIVATE, sent|wparam, 1 },
47     { WM_ACTIVATE, sent|wparam, 1 },
48     { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
49     { WM_IME_NOTIFY, sent|defwinproc|optional },
50     { WM_SETFOCUS, sent|wparam|defwinproc, 0 },
51     /* Win9x adds SWP_NOZORDER below */
52     { WM_WINDOWPOSCHANGED, sent, /*|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ },
53     { WM_NCCALCSIZE, sent|wparam|optional, 1 },
54     { WM_SIZE, sent },
55     { WM_MOVE, sent },
56     { 0 }
57 };
58
59 static const struct message create_trackbar_wnd_seq[] = {
60     {0}
61 };
62
63 static const struct message parent_empty_test_seq[] = {
64     {0}
65 };
66
67 static const struct message parent_create_trackbar_wnd_seq[] = {
68     { WM_NOTIFYFORMAT, sent},
69     { WM_QUERYUISTATE, sent|optional},
70     { WM_WINDOWPOSCHANGING, sent},
71     { WM_NCACTIVATE, sent},
72     { PBT_APMRESUMECRITICAL, sent},
73     { WM_WINDOWPOSCHANGING, sent},
74     { PBT_APMRESUMESTANDBY, sent},
75     { WM_IME_SETCONTEXT, sent|optional},
76     { WM_IME_NOTIFY, sent|optional},
77     { WM_CTLCOLORSTATIC, sent},
78     { WM_NOTIFY, sent},
79     {0}
80 };
81
82 static const struct message parent_new_window_test_seq[] = {
83     { WM_QUERYNEWPALETTE, sent|optional },
84     { WM_WINDOWPOSCHANGING, sent},
85     { WM_NCACTIVATE, sent},
86     { PBT_APMRESUMECRITICAL, sent},
87     { WM_IME_SETCONTEXT, sent|defwinproc|optional},
88     { WM_IME_NOTIFY, sent|defwinproc|optional},
89     { WM_SETFOCUS, sent|defwinproc},
90     { WM_NOTIFYFORMAT, sent},
91     { WM_QUERYUISTATE, sent|optional},
92     {0}
93 };
94
95 static const struct message buddy_window_test_seq[] = {
96     { TBM_GETBUDDY, sent|wparam, TRUE},
97     { TBM_SETBUDDY, sent|wparam, FALSE},
98     { WM_PAINT, sent|defwinproc},
99     { TBM_SETBUDDY, sent|wparam, FALSE},
100     { WM_PAINT, sent|defwinproc},
101     { TBM_GETBUDDY, sent|wparam, TRUE},
102     { TBM_SETBUDDY, sent|wparam, TRUE},
103     { WM_PAINT, sent|defwinproc},
104     { TBM_SETBUDDY, sent|wparam, TRUE},
105     { WM_PAINT, sent|defwinproc},
106     { TBM_GETBUDDY, sent|wparam, FALSE},
107     { TBM_GETBUDDY, sent|wparam, TRUE},
108     {0}
109 };
110
111 static const struct message parent_buddy_window_test_seq[] = {
112     { WM_CTLCOLORSTATIC, sent},
113     { WM_NOTIFY, sent},
114     { WM_CTLCOLORSTATIC, sent},
115     { WM_NOTIFY, sent},
116     { WM_CTLCOLORSTATIC, sent},
117     { WM_NOTIFY, sent},
118     { WM_CTLCOLORSTATIC, sent},
119     { WM_NOTIFY, sent},
120     {0}
121 };
122
123 static const struct message line_size_test_seq[] = {
124     { TBM_SETLINESIZE, sent|lparam, 0, 10},
125     { TBM_SETLINESIZE, sent|lparam, 0, 4},
126     { TBM_GETLINESIZE, sent},
127     {0}
128 };
129
130 static const struct message page_size_test_seq[] = {
131     { TBM_SETPAGESIZE, sent|lparam, 0, 10},
132     { TBM_SETPAGESIZE, sent|lparam, 0, -1},
133     { TBM_GETPAGESIZE, sent},
134     {0}
135 };
136
137 static const struct message position_test_seq[] = {
138     { TBM_SETPOS, sent|wparam|lparam, TRUE, -1},
139     { WM_PAINT, sent|defwinproc},
140     { TBM_GETPOS, sent},
141     { TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
142     { WM_PAINT, sent|defwinproc},
143     { TBM_GETPOS, sent},
144     { TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
145     { TBM_SETPOS, sent|wparam|lparam, TRUE, 1000},
146     { WM_PAINT, sent|defwinproc},
147     { TBM_GETPOS, sent},
148     { TBM_SETPOS, sent|wparam|lparam, FALSE, 20},
149     { TBM_GETPOS, sent},
150     { TBM_SETPOS, sent|wparam|lparam, TRUE, 20},
151     { TBM_GETPOS, sent},
152     {0}
153 };
154
155 static const struct message parent_position_test_seq[] = {
156     { WM_CTLCOLORSTATIC, sent},
157     { WM_NOTIFY, sent},
158     { WM_CTLCOLORSTATIC, sent},
159     { WM_NOTIFY, sent},
160     { WM_CTLCOLORSTATIC, sent},
161     { WM_NOTIFY, sent},
162     {0}
163 };
164
165 static const struct message range_test_seq[] = {
166     { TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(0, 10)},
167     { WM_PAINT, sent|defwinproc},
168     { TBM_GETRANGEMAX, sent},
169     { TBM_GETRANGEMIN, sent},
170     { TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(-1, 1000)},
171     { WM_PAINT, sent|defwinproc},
172     { TBM_GETRANGEMAX, sent},
173     { TBM_GETRANGEMIN, sent},
174     { TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(10, 0)},
175     { WM_PAINT, sent|defwinproc},
176     { TBM_GETRANGEMAX, sent},
177     { TBM_GETRANGEMIN, sent},
178     { TBM_SETRANGE, sent|wparam|lparam, FALSE, MAKELONG(0, 10)},
179     { TBM_GETRANGEMAX, sent},
180     { TBM_GETRANGEMIN, sent},
181     { TBM_SETRANGEMAX, sent|wparam|lparam, TRUE, 10},
182     { WM_PAINT, sent|defwinproc},
183     { TBM_GETRANGEMAX, sent},
184     { TBM_SETRANGEMAX, sent|wparam|lparam, TRUE, -1},
185     { WM_PAINT, sent|defwinproc},
186     { TBM_GETRANGEMAX, sent},
187     { TBM_SETRANGEMAX, sent|wparam|lparam, FALSE, 10},
188     { TBM_GETRANGEMAX, sent},
189     { TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, 0},
190     { WM_PAINT, sent|defwinproc},
191     { TBM_GETRANGEMIN, sent},
192     { TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, 10},
193     { WM_PAINT, sent|defwinproc},
194     { TBM_GETRANGEMIN, sent},
195     { TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, -10},
196     { WM_PAINT, sent|defwinproc},
197     { TBM_GETRANGEMIN, sent},
198     { TBM_SETRANGEMIN, sent|wparam|lparam, FALSE, 5},
199     { TBM_GETRANGEMIN, sent},
200     { TBM_GETRANGEMAX, sent},
201     { TBM_GETRANGEMIN, sent},
202     {0}
203 };
204
205 static const struct message parent_range_test_seq[] = {
206     { WM_CTLCOLORSTATIC, sent},
207     { WM_NOTIFY, sent},
208     { WM_CTLCOLORSTATIC, sent},
209     { WM_NOTIFY, sent},
210     { WM_CTLCOLORSTATIC, sent},
211     { WM_NOTIFY, sent},
212     { WM_CTLCOLORSTATIC, sent},
213     { WM_NOTIFY, sent},
214     { WM_CTLCOLORSTATIC, sent},
215     { WM_NOTIFY, sent},
216     { WM_CTLCOLORSTATIC, sent},
217     { WM_NOTIFY, sent},
218     { WM_CTLCOLORSTATIC, sent},
219     { WM_NOTIFY, sent},
220     { WM_CTLCOLORSTATIC, sent},
221     { WM_NOTIFY, sent},
222     {0}
223 };
224
225 static const struct message selection_test_seq[] = {
226     { TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(0, 10)},
227     { WM_PAINT, sent|defwinproc},
228     { TBM_GETSELEND, sent},
229     { TBM_GETSELSTART, sent},
230     { TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(5, 20)},
231     { WM_PAINT, sent|defwinproc},
232     { TBM_GETSELEND, sent},
233     { TBM_GETSELSTART, sent},
234     { TBM_SETSEL, sent|wparam|lparam, FALSE, MAKELONG(5, 10)},
235     { TBM_GETSELEND, sent},
236     { TBM_GETSELSTART, sent},
237     { TBM_SETSELEND, sent|wparam|lparam, TRUE, 10},
238     { WM_PAINT, sent|defwinproc},
239     { TBM_GETSELEND, sent},
240     { TBM_SETSELEND, sent|wparam|lparam, TRUE, 20},
241     { WM_PAINT, sent|defwinproc},
242     { TBM_GETSELEND, sent},
243     { TBM_SETSELEND, sent|wparam|lparam, TRUE, 4},
244     { WM_PAINT, sent|defwinproc},
245     { TBM_GETSELEND, sent},
246     { TBM_SETSELEND, sent|wparam|lparam, FALSE, 2},
247     { TBM_GETSELEND, sent},
248     { TBM_GETSELEND, sent},
249     { TBM_SETSELSTART, sent|wparam|lparam, TRUE, 5},
250     { WM_PAINT, sent|defwinproc},
251     { TBM_GETSELSTART, sent},
252     { TBM_SETSELSTART, sent|wparam|lparam, TRUE, 0},
253     { WM_PAINT, sent|defwinproc},
254     { TBM_GETSELSTART, sent},
255     { TBM_SETSELSTART, sent|wparam|lparam, TRUE, 20},
256     { WM_PAINT, sent|defwinproc},
257     { TBM_GETSELSTART, sent},
258     { TBM_SETSELSTART, sent|wparam|lparam, FALSE, 8},
259     { TBM_GETSELSTART, sent},
260     { TBM_GETSELSTART, sent},
261     {0}
262 };
263
264 static const struct message parent_selection_test_seq[] = {
265     { WM_CTLCOLORSTATIC, sent},
266     { WM_NOTIFY, sent},
267     { WM_CTLCOLORSTATIC, sent},
268     { WM_NOTIFY, sent},
269     { WM_CTLCOLORSTATIC, sent},
270     { WM_NOTIFY, sent},
271     { WM_CTLCOLORSTATIC, sent},
272     { WM_NOTIFY, sent},
273     { WM_CTLCOLORSTATIC, sent},
274     { WM_NOTIFY, sent},
275     { WM_CTLCOLORSTATIC, sent},
276     { WM_NOTIFY, sent},
277     { WM_CTLCOLORSTATIC, sent},
278     { WM_NOTIFY, sent},
279     { WM_CTLCOLORSTATIC, sent},
280     { WM_NOTIFY, sent},
281     {0}
282 };
283
284 static const struct message tic_settings_test_seq[] = {
285     { TBM_SETTIC, sent|lparam, 0, 0},
286     { TBM_SETTIC, sent|lparam, 0, 5},
287     { TBM_SETTIC, sent|lparam, 0, 10},
288     { TBM_SETTIC, sent|lparam, 0, 20},
289     { TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(0,10)},
290     { WM_PAINT, sent|defwinproc},
291     { TBM_SETTICFREQ, sent|wparam, 2},
292     { WM_PAINT, sent|defwinproc},
293     { TBM_GETNUMTICS, sent},
294     { TBM_SETTICFREQ, sent|wparam, 5},
295     { WM_PAINT, sent|defwinproc},
296     { TBM_GETNUMTICS, sent},
297     { TBM_SETTICFREQ, sent|wparam, 15},
298     { WM_PAINT, sent|defwinproc},
299     { TBM_GETNUMTICS, sent},
300     { TBM_GETNUMTICS, sent},
301     {0}
302 };
303
304 static const struct message parent_tic_settings_test_seq[] = {
305     { WM_CTLCOLORSTATIC, sent},
306     { WM_NOTIFY, sent},
307     { WM_CTLCOLORSTATIC, sent},
308     { WM_NOTIFY, sent},
309     { WM_CTLCOLORSTATIC, sent},
310     { WM_NOTIFY, sent},
311     { WM_CTLCOLORSTATIC, sent},
312     { WM_NOTIFY, sent},
313     {0}
314 };
315
316 static const struct message thumb_length_test_seq[] = {
317     { TBM_SETTHUMBLENGTH, sent|wparam|lparam, 15, 0},
318     { WM_PAINT, sent|defwinproc},
319     { TBM_GETTHUMBLENGTH, sent},
320     { TBM_SETTHUMBLENGTH, sent|wparam|lparam, 20, 0},
321     { WM_PAINT, sent|defwinproc},
322     { TBM_GETTHUMBLENGTH, sent},
323     { TBM_GETTHUMBLENGTH, sent},
324     {0}
325 };
326
327 static const struct message parent_thumb_length_test_seq[] = {
328     { WM_CTLCOLORSTATIC, sent},
329     { WM_NOTIFY, sent},
330     { WM_CTLCOLORSTATIC, sent},
331     { WM_NOTIFY, sent},
332     {0}
333 };
334
335 static const struct message tic_placement_test_seq[] = {
336     { TBM_GETPTICS, sent},
337     { TBM_GETTIC, sent|wparam, 0},
338     { TBM_GETTIC, sent|wparam, 2},
339     { TBM_GETTIC, sent|wparam, 4},
340     { TBM_GETTICPOS, sent|wparam, 0},
341     { TBM_GETTICPOS, sent|wparam, 2},
342     {0}
343 };
344
345 static const struct message tool_tips_test_seq[] = {
346     { TBM_SETTIPSIDE, sent|wparam, TBTS_TOP},
347     { TBM_SETTIPSIDE, sent|wparam, TBTS_LEFT},
348     { TBM_SETTIPSIDE, sent|wparam, TBTS_BOTTOM},
349     { TBM_SETTIPSIDE, sent|wparam, TBTS_RIGHT},
350     { TBM_SETTOOLTIPS, sent},
351     { TBM_GETTOOLTIPS, sent},
352     { TBM_SETTOOLTIPS, sent},
353     { TBM_GETTOOLTIPS, sent},
354     { TBM_SETTOOLTIPS, sent},
355     { TBM_GETTOOLTIPS, sent},
356     { TBM_GETTOOLTIPS, sent},
357     {0}
358 };
359
360 static const struct message unicode_test_seq[] = {
361     { TBM_SETUNICODEFORMAT, sent|wparam, TRUE},
362     { TBM_SETUNICODEFORMAT, sent|wparam, FALSE},
363     { TBM_GETUNICODEFORMAT, sent},
364     {0}
365 };
366
367 static const struct message ignore_selection_test_seq[] = {
368     { TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(0,10)},
369     { TBM_GETSELEND, sent},
370     { TBM_GETSELSTART, sent},
371     { TBM_SETSEL, sent|wparam|lparam, FALSE, MAKELONG(0,10)},
372     { TBM_GETSELEND, sent},
373     { TBM_GETSELSTART, sent},
374     { TBM_SETSELEND, sent|wparam|lparam, TRUE,0},
375     { TBM_GETSELEND, sent},
376     { TBM_SETSELEND, sent|wparam|lparam, TRUE, 10},
377     { TBM_GETSELEND, sent},
378     { TBM_SETSELEND, sent|wparam|lparam, FALSE,0},
379     { TBM_GETSELEND, sent},
380     { TBM_SETSELSTART, sent|wparam|lparam, TRUE,0},
381     { TBM_GETSELSTART, sent},
382     { TBM_SETSELSTART, sent|wparam|lparam, TRUE, 10},
383     { TBM_GETSELSTART, sent},
384     { TBM_SETSELSTART, sent|wparam|lparam, FALSE,0},
385     { TBM_GETSELSTART, sent},
386     {0}
387 };
388
389 struct subclass_info
390 {
391     WNDPROC oldproc;
392 };
393
394 static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
395     static LONG defwndproc_counter = 0;
396     LRESULT ret;
397     struct message msg;
398
399     /* log system messages, except for painting */
400     if (message < WM_USER &&
401         message != WM_PAINT &&
402         message != WM_ERASEBKGND &&
403         message != WM_NCPAINT &&
404         message != WM_NCHITTEST &&
405         message != WM_GETTEXT &&
406         message != WM_GETICON &&
407         message != WM_DEVICECHANGE)
408     {
409         trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
410
411         msg.message = message;
412         msg.flags = sent|wparam|lparam;
413         if (defwndproc_counter) msg.flags |= defwinproc;
414         msg.wParam = wParam;
415         msg.lParam = lParam;
416         add_message(sequences, PARENT_SEQ_INDEX, &msg);
417     }
418
419     defwndproc_counter++;
420     ret = DefWindowProcA(hwnd, message, wParam, lParam);
421     defwndproc_counter--;
422
423     return ret;
424 }
425
426 static BOOL register_parent_wnd_class(void){
427     WNDCLASSA cls;
428
429     cls.style = 0;
430     cls.lpfnWndProc = parent_wnd_proc;
431     cls.cbClsExtra = 0;
432     cls.cbWndExtra = 0;
433     cls.hInstance = GetModuleHandleA(NULL);
434     cls.hIcon = 0;
435     cls.hCursor = LoadCursorA(0, IDC_ARROW);
436     cls.hbrBackground = GetStockObject(WHITE_BRUSH);
437     cls.lpszMenuName = NULL;
438     cls.lpszClassName = "Trackbar test parent class";
439     return RegisterClassA(&cls);
440 }
441
442 static HWND create_parent_window(void){
443     if (!register_parent_wnd_class())
444         return NULL;
445
446     return CreateWindowEx(0, "Trackbar test parent class",
447         "Trackbar test parent window",
448         WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
449         WS_MAXIMIZEBOX | WS_VISIBLE,
450         0, 0, 100, 100,
451         GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
452 }
453
454 static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
455     struct subclass_info *info = (struct subclass_info *) GetWindowLongPtrA(hwnd, GWLP_USERDATA);
456     static LONG defwndproc_counter = 0;
457     LRESULT ret;
458     struct message msg;
459
460     trace("trackbar: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
461
462     msg.message = message;
463     msg.flags = sent|wparam|lparam;
464     if (defwndproc_counter) msg.flags |= defwinproc;
465     msg.wParam = wParam;
466     msg.lParam = lParam;
467     add_message(sequences, TRACKBAR_SEQ_INDEX, &msg);
468
469     defwndproc_counter++;
470     ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam);
471     defwndproc_counter--;
472
473     return ret;
474 }
475
476 static HWND create_trackbar(DWORD style, HWND parent){
477     struct subclass_info *info;
478     HWND hWndTrack;
479     RECT rect;
480
481     info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
482     if (!info)
483         return NULL;
484
485     GetClientRect(parent, &rect);
486     hWndTrack = CreateWindowEx(
487       0, TRACKBAR_CLASS,"Trackbar Control", style,
488       rect.right,rect.bottom, 100, 50,
489       parent, NULL,GetModuleHandleA(NULL) ,NULL);
490
491     if (!hWndTrack)
492     {
493         HeapFree(GetProcessHeap(), 0, info);
494         return NULL;
495     }
496
497     info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
498
499     SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)info);
500
501     return hWndTrack;
502 }
503
504 /* test functions for setters, getters, and sequences */
505
506 static void test_trackbar_buddy(HWND hWndTrackbar){
507     HWND hWndLeftBuddy;
508     HWND hWndRightBuddy;
509     HWND hWndCurrentBuddy;
510     HWND rTest;
511
512     flush_sequences(sequences, NUM_MSG_SEQUENCE);
513
514     hWndLeftBuddy = CreateWindowEx(0, STATUSCLASSNAME, NULL, 0,
515         0,0,300,20, NULL, NULL, NULL, NULL);
516     ok(hWndLeftBuddy != NULL, "Expected non NULL value\n");
517
518     if (hWndLeftBuddy != NULL){
519         hWndCurrentBuddy = (HWND) SendMessage(hWndTrackbar, TBM_GETBUDDY, TRUE, 0);
520         rTest = (HWND) SendMessage(hWndTrackbar, TBM_SETBUDDY, FALSE, (LPARAM) hWndLeftBuddy);
521         ok(rTest == hWndCurrentBuddy, "Expected hWndCurrentBuddy\n");
522         rTest = (HWND) SendMessage(hWndTrackbar, TBM_SETBUDDY, FALSE, (LPARAM) hWndLeftBuddy);
523         ok(rTest == hWndLeftBuddy, "Expected hWndLeftBuddy\n");
524     } else
525         skip ("left buddy control not present?\n");
526
527     hWndRightBuddy = CreateWindowEx(0, STATUSCLASSNAME, NULL, 0,
528         0,0,300,20,NULL,NULL, NULL, NULL);
529
530     ok(hWndRightBuddy != NULL, "expected non NULL value\n");
531
532     /* test TBM_SETBUDDY */
533     if (hWndRightBuddy != NULL){
534         hWndCurrentBuddy = (HWND) SendMessage(hWndTrackbar, TBM_GETBUDDY, TRUE, 0);
535         rTest = (HWND) SendMessage(hWndTrackbar, TBM_SETBUDDY, TRUE, (LPARAM) hWndRightBuddy);
536         ok(rTest == hWndCurrentBuddy, "Expected hWndCurrentBuddy\n");
537         rTest = (HWND) SendMessage(hWndTrackbar, TBM_SETBUDDY, TRUE, (LPARAM) hWndRightBuddy);
538         ok(rTest == hWndRightBuddy, "Expected hWndRightbuddy\n");
539      } else
540        skip("Right buddy control not present?\n");
541
542     /* test TBM_GETBUDDY */
543     if (hWndLeftBuddy != NULL){
544         rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETBUDDY, FALSE, 0);
545         ok(rTest == hWndLeftBuddy, "Expected hWndLeftBuddy\n");
546         DestroyWindow(hWndLeftBuddy);
547     }
548     if (hWndRightBuddy != NULL){
549         rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETBUDDY, TRUE,0);
550         ok(rTest == hWndRightBuddy, "Expected hWndRightBuddy\n");
551         DestroyWindow(hWndRightBuddy);
552     }
553
554     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, buddy_window_test_seq, "buddy test sequence", TRUE);
555     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_buddy_window_test_seq, "parent buddy test seq", TRUE);
556
557 }
558
559 static void test_line_size(HWND hWndTrackbar){
560     int r;
561
562     flush_sequences(sequences, NUM_MSG_SEQUENCE);
563
564     /* test TBM_SETLINESIZE */
565     r = SendMessage(hWndTrackbar, TBM_SETLINESIZE, 0, 10);
566     r = SendMessage(hWndTrackbar, TBM_SETLINESIZE, 0, 4);
567     expect(10, r);
568
569     /* test TBM_GETLINESIZE */
570     r = SendMessage(hWndTrackbar, TBM_GETLINESIZE, 0,0);
571     expect(4, r);
572
573     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, line_size_test_seq, "linesize test sequence", FALSE);
574     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent line test sequence", FALSE);
575 }
576
577
578 static void test_page_size(HWND hWndTrackbar){
579     int r;
580
581     flush_sequences(sequences, NUM_MSG_SEQUENCE);
582
583     /* test TBM_SETPAGESIZE */
584     r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, 10);
585     expect(20, r);
586     r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, -1);
587     expect(10, r);
588
589     /* test TBM_GETPAGESIZE */
590     r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0,0);
591     expect(20, r);
592
593     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, page_size_test_seq, "page size test sequence", FALSE);
594     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent page size test sequence", FALSE);
595
596     /* check for zero page size */
597     r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, 0);
598     expect(20, r);
599     r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
600     expect(0, r);
601     /* revert to default */
602     r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, -1);
603     expect(0, r);
604     r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
605     expect(20, r);
606     /* < -1 */
607     r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, -2);
608     expect(20, r);
609     r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
610     expect(-2, r);
611 }
612
613 static void test_position(HWND hWndTrackbar){
614     int r;
615
616     flush_sequences(sequences, NUM_MSG_SEQUENCE);
617     /* test TBM_SETPOS */
618     SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, -1);
619     r = SendMessage(hWndTrackbar, TBM_GETPOS, 0, 0);
620     expect(0, r);
621     SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 5);
622     r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
623     expect(5, r);
624     SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 5);
625     SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 1000);
626     r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
627     expect(100, r);
628     SendMessage(hWndTrackbar, TBM_SETPOS, FALSE, 20);
629     r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
630     expect(20, r);
631     SendMessage(hWndTrackbar, TBM_SETPOS, TRUE, 20);
632
633     /* test TBM_GETPOS */
634     r = SendMessage(hWndTrackbar, TBM_GETPOS, 0,0);
635     expect(20, r);
636
637     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, position_test_seq, "position test sequence", TRUE);
638     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_position_test_seq, "parent position test sequence", TRUE);
639 }
640
641 static void test_range(HWND hWndTrackbar){
642     int r;
643
644     flush_sequences(sequences, NUM_MSG_SEQUENCE);
645     /* test TBM_SETRANGE */
646     SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10));
647     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
648     expect(10, r);
649     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
650     expect(0, r);
651     SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-1, 1000));
652     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
653     expect(1000, r);
654     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
655     expect(-1, r);
656     SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(10, 0));
657     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
658     expect(0, r);
659     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
660     expect(10, r);
661     SendMessage(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(0,10));
662     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
663     expect(10, r);
664     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
665     expect(0, r);
666
667     /*test TBM_SETRANGEMAX */
668     SendMessage(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 10);
669     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
670     expect(10, r);
671     SendMessage(hWndTrackbar, TBM_SETRANGEMAX, TRUE, -1);
672     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
673     expect(-1, r);
674     SendMessage(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
675     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
676     expect(10, r);
677
678     /* testing TBM_SETRANGEMIN */
679     SendMessage(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0);
680     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
681     expect(0, r);
682     SendMessage(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 10);
683     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
684     expect(10, r);
685     SendMessage(hWndTrackbar, TBM_SETRANGEMIN, TRUE, -10);
686     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
687     expect(-10, r);
688     SendMessage(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5);
689     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
690     expect(5, r);
691
692     /* test TBM_GETRANGEMAX */
693     r = SendMessage(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
694     expect(10, r);
695
696     /* test TBM_GETRANGEMIN */
697     r = SendMessage(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
698     expect(5, r);
699
700     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, range_test_seq, "range test sequence", TRUE);
701     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_range_test_seq, "parent range test sequence", TRUE);
702 }
703
704 static void test_selection(HWND hWndTrackbar){
705     int r;
706
707     flush_sequences(sequences, NUM_MSG_SEQUENCE);
708     /* test TBM_SETSEL */
709     SendMessage(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
710     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
711     expect(10, r);
712     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
713     expect(5, r);
714     SendMessage(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(5, 20));
715     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
716     expect(10, r);
717     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
718     expect(5, r);
719     SendMessage(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(5, 10));
720     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
721     expect(10, r);
722     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
723     expect(5, r);
724
725     /* test TBM_SETSELEND */
726     SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
727     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
728     expect(10, r);
729     SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 20);
730     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
731     expect(10, r);
732     SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 4);
733     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
734     expect(4, r);
735     SendMessage(hWndTrackbar, TBM_SETSELEND, FALSE, 2);
736     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
737     expect(2, r);
738
739     /* test TBM_GETSELEND */
740     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
741     expect(2, r);
742
743     /* testing TBM_SETSELSTART */
744     SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 5);
745     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
746     expect(5, r);
747     SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 0);
748     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
749     expect(5, r);
750     SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 20);
751     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
752     expect(20, r);
753     SendMessage(hWndTrackbar, TBM_SETSELSTART, FALSE, 8);
754     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
755     expect(8, r);
756
757     /* test TBM_GETSELSTART */
758     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
759     expect(8, r);
760
761     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, selection_test_seq, "selection test sequence", TRUE);
762     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_selection_test_seq, "parent selection test seqence", TRUE);
763 }
764
765 static void test_thumb_length(HWND hWndTrackbar){
766     int r;
767
768     flush_sequences(sequences, NUM_MSG_SEQUENCE);
769     /* testing TBM_SETTHUMBLENGTH */
770     SendMessage(hWndTrackbar, TBM_SETTHUMBLENGTH, 15, 0);
771     r = SendMessage(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
772     expect(15, r);
773     SendMessage(hWndTrackbar, TBM_SETTHUMBLENGTH, 20, 0);
774     r = SendMessage(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
775     expect(20, r);
776
777     /* test TBM_GETTHUMBLENGTH */
778     r = SendMessage(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
779     expect(20, r);
780
781     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, thumb_length_test_seq, "thumb length test sequence", TRUE);
782     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_thumb_length_test_seq, "parent thumb lenth test sequence", TRUE);
783 }
784
785 static void test_tic_settings(HWND hWndTrackbar){
786     int r;
787
788     flush_sequences(sequences, NUM_MSG_SEQUENCE);
789     /* testing TBM_SETTIC */
790     /* Set tics at 5 and 10 */
791     /* 0 and 20 are out of range and should not be set */
792     r = SendMessage(hWndTrackbar, TBM_SETTIC, 0, 0);
793     ok(r == FALSE, "Expected FALSE, got %d\n", r);
794     r = SendMessage(hWndTrackbar, TBM_SETTIC, 0, 5);
795     todo_wine{
796         ok(r == TRUE, "Expected TRUE, got %d\n", r);
797         r = SendMessage(hWndTrackbar, TBM_SETTIC, 0, 10);
798         ok(r == TRUE, "Expected TRUE, got %d\n", r);
799     }
800     r = SendMessage(hWndTrackbar, TBM_SETTIC, 0, 20);
801     ok(r == FALSE, "Expected False, got %d\n", r);
802
803     /* test TBM_SETTICFREQ */
804     SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10));
805     SendMessage(hWndTrackbar, TBM_SETTICFREQ, 2, 0);
806     r = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0,0);
807     expect(6, r);
808     SendMessage(hWndTrackbar, TBM_SETTICFREQ, 5, 0);
809     r = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0,0);
810     expect(3, r);
811     SendMessage(hWndTrackbar, TBM_SETTICFREQ, 15, 0);
812     r = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0,0);
813     expect(2, r);
814
815     /* test TBM_GETNUMTICS */
816     /* since TIC FREQ is 15, there should be only 2 tics now */
817     r = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0,0);
818     expect(2, r);
819
820     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_settings_test_seq, "tic settings test sequence", TRUE);
821     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_tic_settings_test_seq, "parent tic settings test sequence", TRUE);
822 }
823
824 static void test_tic_placement(HWND hWndTrackbar){
825     int r;
826     DWORD *rPTics;
827     DWORD numtics;
828
829     SendMessage(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(1, 6));
830     SendMessage(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
831
832     numtics = SendMessage(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
833     ok(numtics == 6, "Expected 6, got %d\n", numtics);
834
835     flush_sequences(sequences, NUM_MSG_SEQUENCE);
836     /* test TBM_GETPTICS */
837     rPTics = (DWORD *) SendMessage(hWndTrackbar, TBM_GETPTICS, 0,0);
838     expect(2, rPTics[0]);
839     expect(3, rPTics[1]);
840     expect(4, rPTics[2]);
841     expect(5, rPTics[3]);
842
843     /* test TBM_GETTIC */
844     r = SendMessage(hWndTrackbar, TBM_GETTIC, 0,0);
845     expect(2, r);
846     r = SendMessage(hWndTrackbar, TBM_GETTIC, 2,0);
847     expect(4, r);
848     r = SendMessage(hWndTrackbar, TBM_GETTIC, 4,0);
849     todo_wine{
850         expect(-1, r);
851     }
852
853     /* test TBM_GETTICPIC */
854     r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 0, 0);
855     ok(r > 0, "Expected r > 0, got %d\n", r);
856     r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 2, 0);
857     ok(r > 0, "Expected r > 0, got %d\n", r);
858
859     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_placement_test_seq, "get tic placement test sequence", FALSE);
860     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent get tic placement test sequence", FALSE);
861 }
862
863
864 static void test_tool_tips(HWND hWndTrackbar){
865     int r;
866     HWND hWndTooltip;
867     HWND rTest;
868
869     flush_sequences(sequences, NUM_MSG_SEQUENCE);
870     /* testing TBM_SETTIPSIDE */
871     r = SendMessage(hWndTrackbar, TBM_SETTIPSIDE, TBTS_TOP, 0);
872     todo_wine{
873         expect(0, r);
874     }
875     r = SendMessage(hWndTrackbar, TBM_SETTIPSIDE, TBTS_LEFT, 0);
876     expect(0, r);
877     r = SendMessage(hWndTrackbar, TBM_SETTIPSIDE, TBTS_BOTTOM, 0);
878     expect(1, r);
879     r = SendMessage(hWndTrackbar, TBM_SETTIPSIDE, TBTS_RIGHT, 0);
880     expect(2, r);
881
882     /* testing TBM_SETTOOLTIPS */
883     hWndTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, 0,
884       CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
885       NULL, NULL, NULL, NULL);
886
887     ok(hWndTooltip != NULL, "Expected non NULL value\n");
888     if (hWndTooltip != NULL){
889         SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 0);
890         rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
891         ok(rTest == hWndTooltip, "Expected hWndToolTip, got\n");
892         SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, 0, 0);
893         rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
894         ok(rTest == NULL, "Expected NULL\n");
895         SendMessage(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 5);
896         rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
897         ok(rTest == hWndTooltip, "Expected hWndTooltip, got\n");
898     } else
899         skip("tool tip control not present?\n");
900
901     /* test TBM_GETTOOLTIPS */
902     rTest = (HWND) SendMessage(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
903     ok(rTest == hWndTooltip, "Expected hWndTooltip\n");
904
905     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tool_tips_test_seq, "tool tips test sequence", FALSE);
906     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent tool tips test sequence", FALSE);
907 }
908
909
910 static void test_unicode(HWND hWndTrackbar){
911     int r;
912
913     flush_sequences(sequences, NUM_MSG_SEQUENCE);
914     /* testing TBM_SETUNICODEFORMAT */
915     r = SendMessage(hWndTrackbar, TBM_SETUNICODEFORMAT, TRUE, 0);
916     ok(r == FALSE, "Expected FALSE, got %d\n",r);
917     r = SendMessage(hWndTrackbar, TBM_SETUNICODEFORMAT, FALSE, 0);
918     ok(r == TRUE, "Expected TRUE, got %d\n",r);
919
920     /* test TBM_GETUNICODEFORMAT */
921     r = SendMessage(hWndTrackbar, TBM_GETUNICODEFORMAT, 0,0);
922     ok(r == FALSE, "Expected FALSE, got %d\n",r);
923
924     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, unicode_test_seq, "unicode test sequence", FALSE);
925     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent unicode test sequence", FALSE);
926 }
927
928 static void test_ignore_selection(HWND hWndTrackbar){
929     int r;
930
931     flush_sequences(sequences, NUM_MSG_SEQUENCE);
932     /* test TBM_SETSEL  ensure that it is ignored */
933     SendMessage(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
934     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
935     expect(0, r);
936     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
937     expect(0, r);
938     SendMessage(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(0,10));
939     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
940     expect(0, r);
941     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
942     expect(0, r);
943
944     /* test TBM_SETSELEND, ensure that it is ignored */
945     SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 0);
946     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
947     expect(0, r);
948     SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
949     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
950     expect(0,r);
951     SendMessage(hWndTrackbar, TBM_SETSELEND, FALSE, 0);
952     r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
953     expect(0, r);
954
955     /* test TBM_SETSELSTART, ensure that it is ignored */
956     SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 0);
957     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
958     expect(0, r);
959     SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 10);
960     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
961     expect(0,r);
962     SendMessage(hWndTrackbar, TBM_SETSELSTART, FALSE, 0);
963     r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
964     expect(0, r);
965
966     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, ignore_selection_test_seq, "ignore selection setting test sequence", FALSE);
967     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent ignore selection setting test sequence", FALSE);
968 }
969
970 START_TEST(trackbar)
971 {
972     DWORD style = WS_VISIBLE | TBS_TOOLTIPS | TBS_ENABLESELRANGE | TBS_FIXEDLENGTH | TBS_AUTOTICKS;
973     HWND hWndTrackbar;
974     HWND hWndParent;
975
976     init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
977     InitCommonControls();
978
979     flush_sequences(sequences, NUM_MSG_SEQUENCE);
980
981     /* create parent window */
982     hWndParent = create_parent_window();
983     ok(hWndParent != NULL, "Failed to create parent Window!\n");
984
985     if(!hWndParent){
986         skip("parent window not present\n");
987         return;
988     }
989
990     ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create Parent Window", TRUE);
991     flush_sequences(sequences, NUM_MSG_SEQUENCE);
992
993     /* create trackbar with set styles */
994     hWndTrackbar = create_trackbar(style, hWndParent);
995
996     ok(hWndTrackbar != NULL, "Expected non NULL value\n");
997
998     if (!hWndTrackbar){
999         skip("trackbar control not present?\n");
1000         return;
1001     }
1002
1003     ok_sequence(sequences, TRACKBAR_SEQ_INDEX, create_trackbar_wnd_seq, "create Trackbar Window", FALSE);
1004     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_trackbar_wnd_seq, "parent trackbar window", TRUE);
1005     flush_sequences(sequences, NUM_MSG_SEQUENCE);
1006
1007     /* TEST OF ALL SETTER and GETTER MESSAGES with required styles turned on*/
1008     test_trackbar_buddy(hWndTrackbar);
1009     test_line_size(hWndTrackbar);
1010     test_page_size(hWndTrackbar);
1011     test_position(hWndTrackbar);
1012     test_range(hWndTrackbar);
1013     test_selection(hWndTrackbar);
1014     test_thumb_length(hWndTrackbar);
1015     test_tic_settings(hWndTrackbar);
1016     test_tic_placement(hWndTrackbar);
1017     test_tool_tips(hWndTrackbar);
1018     test_unicode(hWndTrackbar);
1019
1020     flush_sequences(sequences, NUM_MSG_SEQUENCE);
1021     DestroyWindow(hWndTrackbar);
1022
1023     /* test getters and setters without styles set */
1024     hWndTrackbar = create_trackbar(0, hWndParent);
1025
1026     ok(hWndTrackbar != NULL, "Expected non NULL value\n");
1027
1028     if (!hWndTrackbar){
1029         skip("trackbar control not present?\n");
1030         return;
1031     }
1032
1033     ok_sequence(sequences, PARENT_SEQ_INDEX, parent_new_window_test_seq, "new trackbar window test sequence", TRUE);
1034
1035     test_ignore_selection(hWndTrackbar);
1036
1037     DestroyWindow(hWndTrackbar);
1038
1039     DestroyWindow(hWndParent);
1040 }