comctl32/tests: Use BOOL type where appropriate.
[wine.git] / dlls / user32 / tests / scroll.c
blobdf37534806edc5ba5c57751ace1dcc265d7febc2
1 /*
2 * Unit tests for scrollbar
4 * Copyright 2008 Lyutin Anatoly (Etersoft)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <assert.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <windows.h>
26 #include "wine/test.h"
28 static HWND hScroll, hMainWnd;
29 static BOOL bThemeActive = FALSE;
31 static LRESULT CALLBACK MyWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
33 switch(msg)
36 case WM_CREATE:
38 hScroll = CreateWindowA( "SCROLLBAR", "", WS_CHILD | WS_VISIBLE, 0, 0, 120, 100, hWnd, (HMENU)100, GetModuleHandleA(0), 0 );
40 return 0;
42 case WM_DESTROY:
43 PostQuitMessage(0);
44 break;
45 case WM_HSCROLL:
46 case WM_VSCROLL:
47 /* stop tracking */
48 ReleaseCapture();
49 return 0;
50 default:
51 return DefWindowProcA(hWnd, msg, wParam, lParam);
53 return 0;
55 static void scrollbar_test_track(void)
57 /* test that scrollbar tracking is terminated when
58 * the control looses mouse capture */
59 SendMessageA( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
60 /* a normal return from the sendmessage */
61 /* not normal for instance by closing the windws */
62 ok( IsWindow( hScroll), "Scrollbar has gone!\n");
65 static void scrollbar_test1(void)
67 BOOL ret;
69 ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_BOTH );
70 ok( ret, "The scrollbar should be disabled.\n" );
71 ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
73 ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
74 ok( ret, "The scrollbar should be enabled.\n" );
75 ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
77 /* test buttons separately */
78 ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_LTUP );
79 ok( ret, "The scrollbar LTUP button should be disabled.\n" );
80 ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
81 ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
82 ok( ret, "The scrollbar should be enabled.\n" );
83 ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
85 ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_RTDN );
86 ok( ret, "The scrollbar RTDN button should be disabled.\n" );
87 ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
88 ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
89 ok( ret, "The scrollbar should be enabled.\n" );
90 ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
93 static void scrollbar_test2(void)
95 int ret;
97 trace("The scrollbar is disabled.\n");
99 EnableWindow( hScroll, FALSE );
100 ok( !IsWindowEnabled( hScroll ), "The scroll should be disabled.\n" );
102 ret = SetScrollPos( hScroll, SB_CTL, 30, TRUE);
103 ok( !ret, "The position should not be set.\n" );
105 ret = GetScrollPos( hScroll, SB_CTL);
106 ok( !ret, "The position should be equal to zero\n");
108 ret = SetScrollRange( hScroll, SB_CTL, 0, 100, TRUE );
109 ok( ret, "The range should be set.\n" );
111 ret = SetScrollPos( hScroll, SB_CTL, 30, TRUE);
112 ok( !ret , "The position should not be set.\n" );
114 ret = GetScrollPos( hScroll, SB_CTL);
115 ok( ret == 30, "The position should be set!!!\n");
117 trace("The scrollbar is enabled.\n");
119 EnableWindow( hScroll, TRUE );
120 ok( IsWindowEnabled( hScroll ), "The scroll should be enabled.\n" );
122 ret = SetScrollPos( hScroll, SB_CTL, 30, TRUE);
123 ok( ret == 30, "The position should be set.\n" );
125 ret = GetScrollPos( hScroll, SB_CTL);
126 ok( ret == 30, "The position should not be equal to zero\n");
128 ret = SetScrollRange( hScroll, SB_CTL, 0, 100, TRUE );
129 ok( ret, "The range should be set.\n" );
131 ret = SetScrollPos( hScroll, SB_CTL, 30, TRUE);
132 ok( ret == 30, "The position should be set.\n" );
134 ret = GetScrollPos( hScroll, SB_CTL);
135 ok( ret == 30, "The position should not be equal to zero\n");
138 static void scrollbar_test3(void)
140 BOOL ret;
142 ret = ShowScrollBar( hScroll, SB_CTL, FALSE );
143 ok( ret, "The ShowScrollBar() should not failed.\n" );
144 ok( !IsWindowVisible( hScroll ), "The scrollbar window should not be visible\n" );
146 ret = ShowScrollBar( hScroll, SB_CTL, TRUE );
147 ok( ret, "The ShowScrollBar() should not failed.\n" );
148 ok( !IsWindowVisible( hScroll ), "The scrollbar window should be visible\n" );
150 ret = ShowScrollBar( NULL, SB_CTL, TRUE );
151 ok( !ret, "The ShowScrollBar() should failed.\n" );
155 static void scrollbar_test4(void)
157 BOOL ret;
158 SCROLLBARINFO sbi;
159 RECT rect;
160 BOOL (WINAPI *pGetScrollBarInfo)(HWND, LONG, LPSCROLLBARINFO);
162 pGetScrollBarInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetScrollBarInfo");
163 if (!pGetScrollBarInfo)
165 win_skip("GetScrollBarInfo is not available\n");
166 return;
169 /* Test GetScrollBarInfo to make sure it returns rcScrollBar in screen
170 * coordinates. */
171 sbi.cbSize = sizeof(sbi);
172 ret = pGetScrollBarInfo( hScroll, OBJID_CLIENT, &sbi);
173 ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
174 GetWindowRect( hScroll, &rect );
175 ok( ret, "The GetWindowRect() call should not fail.\n" );
176 ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)),
177 "unexpected rgstate(0x%x)\n", sbi.rgstate[0]);
178 ok( EqualRect(&rect, &sbi.rcScrollBar),
179 "WindowRect(%d, %d, %d, %d) != rcScrollBar(%d, %d, %d, %d)\n",
180 rect.top, rect.left, rect.bottom, rect.right,
181 sbi.rcScrollBar.top, sbi.rcScrollBar.left,
182 sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
184 /* Test windows horizontal and vertical scrollbar to make sure rcScrollBar
185 * is still returned in screen coordinates by moving the window, and
186 * making sure that it shifts the rcScrollBar value. */
187 ShowWindow( hMainWnd, SW_SHOW );
188 sbi.cbSize = sizeof(sbi);
189 ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi);
190 ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
191 GetWindowRect( hMainWnd, &rect );
192 ok( ret, "The GetWindowRect() call should not fail.\n" );
193 MoveWindow( hMainWnd, rect.left+5, rect.top+5,
194 rect.right-rect.left, rect.bottom-rect.top, TRUE );
195 rect = sbi.rcScrollBar;
196 OffsetRect(&rect, 5, 5);
197 ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi);
198 ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
199 ok( EqualRect(&rect, &sbi.rcScrollBar),
200 "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n",
201 rect.top, rect.left, rect.bottom, rect.right,
202 sbi.rcScrollBar.top, sbi.rcScrollBar.left,
203 sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
205 sbi.cbSize = sizeof(sbi);
206 ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi);
207 ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
208 GetWindowRect( hMainWnd, &rect );
209 ok( ret, "The GetWindowRect() call should not fail.\n" );
210 MoveWindow( hMainWnd, rect.left+5, rect.top+5,
211 rect.right-rect.left, rect.bottom-rect.top, TRUE );
212 rect = sbi.rcScrollBar;
213 OffsetRect(&rect, 5, 5);
214 ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi);
215 ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
216 ok( EqualRect(&rect, &sbi.rcScrollBar),
217 "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n",
218 rect.top, rect.left, rect.bottom, rect.right,
219 sbi.rcScrollBar.top, sbi.rcScrollBar.left,
220 sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
223 /* some tests designed to show that Horizontal and Vertical
224 * window scroll bar info are not created independently */
225 static void scrollbar_test_default( DWORD style)
227 INT min, max, ret;
228 DWORD winstyle;
229 HWND hwnd;
230 SCROLLINFO si = { sizeof( SCROLLINFO), SIF_TRACKPOS };
232 hwnd = CreateWindowExA( 0, "static", "", WS_POPUP | style,
233 0, 0, 10, 10, 0, 0, 0, NULL);
234 assert( hwnd != 0);
236 ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
237 ok( ret ||
238 broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
239 /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
240 if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
241 ok( min == 0 && max == 0,
242 "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
243 else
244 ok(( min == 0 && max == 100) ||
245 broken( min == 0 && max == 0), /* Win 9x/ME */
246 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
247 ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
248 ok( ret ||
249 broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
250 /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
251 if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
252 ok( min == 0 && max == 0,
253 "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
254 else
255 ok(( min == 0 && max == 100) ||
256 broken( min == 0 && max == 0), /* Win 9x/ME */
257 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
258 /* test GetScrollInfo, vist for vertical SB */
259 ret = GetScrollInfo( hwnd, SB_VERT, &si);
260 /* should fail if no H or V scroll bar styles are present. Succeed otherwise */
261 if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
262 ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
263 else
264 ok( ret ||
265 broken( !ret), /* Win 9x/ME */
266 "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
267 /* Same for Horizontal SB */
268 ret = GetScrollInfo( hwnd, SB_HORZ, &si);
269 /* should fail if no H or V scroll bar styles are present. Succeed otherwise */
270 if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
271 ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
272 else
273 ok( ret ||
274 broken( !ret), /* Win 9x/ME */
275 "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
276 /* now set the Vertical Scroll range to something that could be the default value it
277 * already has */;
278 ret = SetScrollRange( hwnd, SB_VERT, 0, 100, FALSE);
279 ok( ret, "SetScrollRange failed.\n");
280 /* and request the Horizontal range */
281 ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
282 ok( ret, "GetScrollRange failed.\n");
283 /* now the range should be 0,100 in ALL cases */
284 ok( min == 0 && max == 100,
285 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
286 /* See what is different now for GetScrollRange */
287 ret = GetScrollInfo( hwnd, SB_HORZ, &si);
288 /* should succeed in ALL cases */
289 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
290 ret = GetScrollInfo( hwnd, SB_VERT, &si);
291 /* should succeed in ALL cases */
292 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
293 /* report the windows style */
294 winstyle = GetWindowLongA( hwnd, GWL_STYLE );
295 /* WS_VSCROLL added to the window style */
296 if( !(style & WS_VSCROLL))
298 if (bThemeActive || style != WS_HSCROLL)
299 todo_wine
300 ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_VSCROLL),
301 "unexpected style change %08x/%08x\n", winstyle, style);
302 else
303 ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
304 "unexpected style change %08x/%08x\n", winstyle, style);
306 /* do the test again with H and V reversed.
307 * Start with a clean window */
308 DestroyWindow( hwnd);
309 hwnd = CreateWindowExA( 0, "static", "", WS_POPUP | style,
310 0, 0, 10, 10, 0, 0, 0, NULL);
311 assert( hwnd != 0);
312 /* Set Horizontal Scroll range to something that could be the default value it
313 * already has */;
314 ret = SetScrollRange( hwnd, SB_HORZ, 0, 100, FALSE);
315 ok( ret, "SetScrollRange failed.\n");
316 /* and request the Vertical range */
317 ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
318 ok( ret, "GetScrollRange failed.\n");
319 /* now the range should be 0,100 in ALL cases */
320 ok( min == 0 && max == 100,
321 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
322 /* See what is different now for GetScrollRange */
323 ret = GetScrollInfo( hwnd, SB_HORZ, &si);
324 /* should succeed in ALL cases */
325 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
326 ret = GetScrollInfo( hwnd, SB_VERT, &si);
327 /* should succeed in ALL cases */
328 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
329 /* report the windows style */
330 winstyle = GetWindowLongA( hwnd, GWL_STYLE );
331 /* WS_HSCROLL added to the window style */
332 if( !(style & WS_HSCROLL))
334 if (bThemeActive || style != WS_VSCROLL)
335 todo_wine
336 ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_HSCROLL),
337 "unexpected style change %08x/%08x\n", winstyle, style);
338 else
339 ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
340 "unexpected style change %08x/%08x\n", winstyle, style);
342 /* Slightly change the test to use SetScrollInfo
343 * Start with a clean window */
344 DestroyWindow( hwnd);
345 hwnd = CreateWindowExA( 0, "static", "", WS_POPUP | style,
346 0, 0, 10, 10, 0, 0, 0, NULL);
347 assert( hwnd != 0);
348 /* set Horizontal position with SetScrollInfo */
349 si.nPos = 0;
350 si.nMin = 11;
351 si.nMax = 22;
352 si.fMask |= SIF_RANGE;
353 ret = SetScrollInfo( hwnd, SB_HORZ, &si, FALSE);
354 ok( ret, "SetScrollInfo failed. Style is %08x\n", style);
355 /* and request the Vertical range */
356 ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
357 ok( ret, "GetScrollRange failed.\n");
358 /* now the range should be 0,100 in ALL cases */
359 ok( min == 0 && max == 100,
360 "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
361 /* See what is different now for GetScrollRange */
362 ret = GetScrollInfo( hwnd, SB_HORZ, &si);
363 /* should succeed in ALL cases */
364 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
365 ret = GetScrollInfo( hwnd, SB_VERT, &si);
366 /* should succeed in ALL cases */
367 ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
368 /* also test if the window scroll bars are enabled */
369 ret = EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH);
370 ok( !ret, "Vertical window scroll bar was not enabled\n");
371 ret = EnableScrollBar( hwnd, SB_HORZ, ESB_ENABLE_BOTH);
372 ok( !ret, "Horizontal window scroll bar was not enabled\n");
373 DestroyWindow( hwnd);
374 /* finally, check if adding a WS_[HV]SCROLL style of a window makes the scroll info
375 * available */
376 if( style & (WS_HSCROLL | WS_VSCROLL)) return;/* only test if not yet set */
377 /* Start with a clean window */
378 DestroyWindow( hwnd);
379 hwnd = CreateWindowExA( 0, "static", "", WS_POPUP ,
380 0, 0, 10, 10, 0, 0, 0, NULL);
381 assert( hwnd != 0);
382 ret = GetScrollInfo( hwnd, SB_VERT, &si);
383 /* should fail */
384 ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
385 /* add scroll styles */
386 winstyle = GetWindowLongA( hwnd, GWL_STYLE );
387 SetWindowLongW( hwnd, GWL_STYLE, winstyle | WS_VSCROLL | WS_HSCROLL);
388 ret = GetScrollInfo( hwnd, SB_VERT, &si);
389 /* should still fail */
390 ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
391 /* clean up */
392 DestroyWindow( hwnd);
395 static LRESULT CALLBACK scroll_init_proc(HWND hwnd, UINT msg,
396 WPARAM wparam, LPARAM lparam)
398 SCROLLINFO horz, vert;
399 CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
400 BOOL h_ret, v_ret;
402 switch(msg)
404 case WM_NCCREATE:
405 return cs->lpCreateParams ? DefWindowProcA(hwnd, msg, wparam, lparam) :
406 TRUE;
408 case WM_CREATE:
409 horz.cbSize = sizeof horz;
410 horz.fMask = SIF_ALL;
411 horz.nMin = 0xdeadbeaf;
412 horz.nMax = 0xbaadc0de;
413 vert = horz;
414 h_ret = GetScrollInfo(hwnd, SB_HORZ, &horz);
415 v_ret = GetScrollInfo(hwnd, SB_VERT, &vert);
417 if(cs->lpCreateParams)
419 /* WM_NCCREATE was passed to DefWindowProc */
420 if(cs->style & (WS_VSCROLL | WS_HSCROLL))
422 ok(h_ret && v_ret, "GetScrollInfo() should return NON-zero "
423 "but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
424 ok(vert.nMin == 0 && vert.nMax == 100,
425 "unexpected init values(SB_VERT): min=%d max=%d\n",
426 vert.nMin, vert.nMax);
427 ok(horz.nMin == 0 && horz.nMax == 100,
428 "unexpected init values(SB_HORZ): min=%d max=%d\n",
429 horz.nMin, horz.nMax);
431 else
433 ok(!h_ret && !v_ret, "GetScrollInfo() should return zeru, "
434 "but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
435 ok(vert.nMin == 0xdeadbeaf && vert.nMax == 0xbaadc0de,
436 "unexpected initialization(SB_VERT): min=%d max=%d\n",
437 vert.nMin, vert.nMax);
438 ok(horz.nMin == 0xdeadbeaf && horz.nMax == 0xbaadc0de,
439 "unexpected initialization(SB_HORZ): min=%d max=%d\n",
440 horz.nMin, horz.nMax);
443 else
445 ok(!h_ret && !v_ret, "GetScrollInfo() should return zeru, "
446 "but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
447 ok(horz.nMin == 0xdeadbeaf && horz.nMax == 0xbaadc0de &&
448 vert.nMin == 0xdeadbeaf && vert.nMax == 0xbaadc0de,
449 "unexpected initialization\n");
451 return FALSE; /* abort creation */
453 default:
454 /* need for WM_GETMINMAXINFO, which precedes WM_NCCREATE */
455 return 0;
459 static void scrollbar_test_init(void)
461 WNDCLASSEXA wc;
462 CHAR cls_name[] = "scroll_test_class";
463 LONG style[] = {WS_VSCROLL, WS_HSCROLL, WS_VSCROLL | WS_HSCROLL, 0};
464 int i;
466 memset( &wc, 0, sizeof wc );
467 wc.cbSize = sizeof wc;
468 wc.style = CS_VREDRAW | CS_HREDRAW;
469 wc.hInstance = GetModuleHandleA(0);
470 wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
471 wc.hbrBackground = GetStockObject(WHITE_BRUSH);
472 wc.lpszClassName = cls_name;
473 wc.lpfnWndProc = scroll_init_proc;
474 RegisterClassExA(&wc);
476 for(i = 0; i < sizeof style / sizeof style[0]; i++)
478 /* need not to destroy these windows due creation abort */
479 CreateWindowExA(0, cls_name, NULL, style[i],
480 100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)TRUE);
481 CreateWindowExA(0, cls_name, NULL, style[i],
482 100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)FALSE);
484 UnregisterClassA(cls_name, wc.hInstance);
487 START_TEST ( scroll )
489 WNDCLASSA wc;
490 HMODULE hUxtheme;
491 BOOL (WINAPI * pIsThemeActive)(VOID);
493 wc.style = CS_HREDRAW | CS_VREDRAW;
494 wc.cbClsExtra = 0;
495 wc.cbWndExtra = 0;
496 wc.hInstance = GetModuleHandleA(NULL);
497 wc.hIcon = NULL;
498 wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_IBEAM);
499 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
500 wc.lpszMenuName = NULL;
501 wc.lpszClassName = "MyTestWnd";
502 wc.lpfnWndProc = MyWndProc;
503 RegisterClassA(&wc);
505 hMainWnd = CreateWindowExA( 0, "MyTestWnd", "Scroll",
506 WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL,
507 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
509 ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
510 if (!hMainWnd) return;
512 assert( hScroll );
514 scrollbar_test1();
515 scrollbar_test2();
516 scrollbar_test3();
517 scrollbar_test4();
518 scrollbar_test_track();
520 /* Some test results vary depending of theming being active or not */
521 hUxtheme = LoadLibraryA("uxtheme.dll");
522 if (hUxtheme)
524 pIsThemeActive = (void*)GetProcAddress(hUxtheme, "IsThemeActive");
525 if (pIsThemeActive)
526 bThemeActive = pIsThemeActive();
527 FreeLibrary(hUxtheme);
530 scrollbar_test_default( 0);
531 scrollbar_test_default( WS_HSCROLL);
532 scrollbar_test_default( WS_VSCROLL);
533 scrollbar_test_default( WS_HSCROLL | WS_VSCROLL);
535 scrollbar_test_init();
537 DestroyWindow(hScroll);
538 DestroyWindow(hMainWnd);