Commit 77337d75 authored by Sergey Guralnik's avatar Sergey Guralnik Committed by Alexandre Julliard

user32/tests: Test standard scrollbar initialization.

parent 6ad54620
......@@ -396,6 +396,101 @@ todo_wine
DestroyWindow( hwnd);
}
static LRESULT CALLBACK scroll_init_proc(HWND hwnd, UINT msg,
WPARAM wparam, LPARAM lparam)
{
SCROLLINFO horz, vert;
CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
BOOL h_ret, v_ret;
switch(msg)
{
case WM_NCCREATE:
return cs->lpCreateParams ? DefWindowProcA(hwnd, msg, wparam, lparam) :
TRUE;
case WM_CREATE:
horz.cbSize = sizeof horz;
horz.fMask = SIF_ALL;
horz.nMin = 0xdeadbeaf;
horz.nMax = 0xbaadc0de;
vert = horz;
h_ret = GetScrollInfo(hwnd, SB_HORZ, &horz);
v_ret = GetScrollInfo(hwnd, SB_VERT, &vert);
if(cs->lpCreateParams)
{
/* WM_NCCREATE was passed to DefWindowProc */
if(cs->style & (WS_VSCROLL | WS_HSCROLL))
{
todo_wine
ok(h_ret && v_ret, "GetScrollInfo() should return NON-zero "
"but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
todo_wine
ok(vert.nMin == 0 && vert.nMax == 100,
"unexpected init values(SB_VERT): min=%d max=%d\n",
vert.nMin, vert.nMax);
todo_wine
ok(horz.nMin == 0 && horz.nMax == 100,
"unexpected init values(SB_HORZ): min=%d max=%d\n",
horz.nMin, horz.nMax);
}
else
{
ok(!h_ret && !v_ret, "GetScrollInfo() should return zeru, "
"but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
ok(vert.nMin == 0xdeadbeaf && vert.nMax == 0xbaadc0de,
"unexpected initialization(SB_VERT): min=%d max=%d\n",
vert.nMin, vert.nMax);
ok(horz.nMin == 0xdeadbeaf && horz.nMax == 0xbaadc0de,
"unexpected initialization(SB_HORZ): min=%d max=%d\n",
horz.nMin, horz.nMax);
}
}
else
{
ok(!h_ret && !v_ret, "GetScrollInfo() should return zeru, "
"but got h_ret=%d v_ret=%d\n", h_ret, v_ret);
ok(horz.nMin == 0xdeadbeaf && horz.nMax == 0xbaadc0de &&
vert.nMin == 0xdeadbeaf && vert.nMax == 0xbaadc0de,
"unexpected initialization\n");
}
return FALSE; /* abort creation */
default:
/* need for WM_GETMINMAXINFO, which precedes WM_NCCREATE */
return 0;
}
}
static void scrollbar_test_init(void)
{
WNDCLASSEXA wc;
CHAR cls_name[] = "scroll_test_class";
LONG style[] = {WS_VSCROLL, WS_HSCROLL, WS_VSCROLL | WS_HSCROLL, 0};
int i;
memset( &wc, 0, sizeof wc );
wc.cbSize = sizeof wc;
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.hInstance = GetModuleHandleA(0);
wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = cls_name;
wc.lpfnWndProc = scroll_init_proc;
RegisterClassExA(&wc);
for(i = 0; i < sizeof style / sizeof style[0]; i++)
{
/* need not to destroy these windows due creation abort */
CreateWindowExA(0, cls_name, NULL, style[i],
100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)TRUE);
CreateWindowExA(0, cls_name, NULL, style[i],
100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)FALSE);
}
UnregisterClassA(cls_name, wc.hInstance);
}
START_TEST ( scroll )
{
WNDCLASSA wc;
......@@ -444,6 +539,8 @@ START_TEST ( scroll )
scrollbar_test_default( WS_VSCROLL);
scrollbar_test_default( WS_HSCROLL | WS_VSCROLL);
scrollbar_test_init();
DestroyWindow(hScroll);
DestroyWindow(hMainWnd);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment