mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
user32/tests: Use separate test window for each scrollbar test.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
68d09afc28
commit
f7468386a7
1 changed files with 53 additions and 24 deletions
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "wine/test.h"
|
||||
|
||||
static HWND hScroll, hMainWnd;
|
||||
static HWND hScroll;
|
||||
static BOOL bThemeActive = FALSE;
|
||||
|
||||
static LRESULT CALLBACK MyWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
|
@ -52,20 +52,45 @@ static LRESULT CALLBACK MyWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HWND create_main_test_wnd(void)
|
||||
{
|
||||
HWND hMainWnd;
|
||||
|
||||
hScroll = NULL;
|
||||
hMainWnd = CreateWindowExA( 0, "MyTestWnd", "Scroll",
|
||||
WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
|
||||
ok(hScroll != NULL, "got NULL scroll bar handle\n");
|
||||
|
||||
return hMainWnd;
|
||||
}
|
||||
|
||||
static void scrollbar_test_track(void)
|
||||
{
|
||||
HWND mainwnd;
|
||||
|
||||
mainwnd = create_main_test_wnd();
|
||||
|
||||
/* test that scrollbar tracking is terminated when
|
||||
* the control looses mouse capture */
|
||||
SendMessageA( hScroll, WM_LBUTTONDOWN, 0, MAKELPARAM( 1, 1));
|
||||
/* a normal return from the sendmessage */
|
||||
/* not normal for instance by closing the windws */
|
||||
ok( IsWindow( hScroll), "Scrollbar has gone!\n");
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
}
|
||||
|
||||
static void scrollbar_test1(void)
|
||||
static void test_EnableScrollBar(void)
|
||||
{
|
||||
HWND mainwnd;
|
||||
BOOL ret;
|
||||
|
||||
mainwnd = create_main_test_wnd();
|
||||
|
||||
ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_BOTH );
|
||||
ok( ret, "The scrollbar should be disabled.\n" );
|
||||
ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
|
||||
|
@ -88,13 +113,17 @@ static void scrollbar_test1(void)
|
|||
ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
|
||||
ok( ret, "The scrollbar should be enabled.\n" );
|
||||
ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
}
|
||||
|
||||
static void scrollbar_test2(void)
|
||||
static void test_SetScrollPos(void)
|
||||
{
|
||||
HWND mainwnd;
|
||||
int ret;
|
||||
|
||||
trace("The scrollbar is disabled.\n");
|
||||
mainwnd = create_main_test_wnd();
|
||||
|
||||
EnableWindow( hScroll, FALSE );
|
||||
ok( !IsWindowEnabled( hScroll ), "The scroll should be disabled.\n" );
|
||||
|
@ -114,8 +143,6 @@ static void scrollbar_test2(void)
|
|||
ret = GetScrollPos( hScroll, SB_CTL);
|
||||
ok( ret == 30, "The position should be set!!!\n");
|
||||
|
||||
trace("The scrollbar is enabled.\n");
|
||||
|
||||
EnableWindow( hScroll, TRUE );
|
||||
ok( IsWindowEnabled( hScroll ), "The scroll should be enabled.\n" );
|
||||
|
||||
|
@ -133,12 +160,18 @@ static void scrollbar_test2(void)
|
|||
|
||||
ret = GetScrollPos( hScroll, SB_CTL);
|
||||
ok( ret == 30, "The position should not be equal to zero\n");
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
}
|
||||
|
||||
static void scrollbar_test3(void)
|
||||
static void test_ShowScrollBar(void)
|
||||
{
|
||||
HWND mainwnd;
|
||||
BOOL ret;
|
||||
|
||||
mainwnd = create_main_test_wnd();
|
||||
|
||||
ret = ShowScrollBar( hScroll, SB_CTL, FALSE );
|
||||
ok( ret, "The ShowScrollBar() should not failed.\n" );
|
||||
ok( !IsWindowVisible( hScroll ), "The scrollbar window should not be visible\n" );
|
||||
|
@ -150,10 +183,13 @@ static void scrollbar_test3(void)
|
|||
ret = ShowScrollBar( NULL, SB_CTL, TRUE );
|
||||
ok( !ret, "The ShowScrollBar() should failed.\n" );
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
}
|
||||
|
||||
static void scrollbar_test4(void)
|
||||
static void test_GetScrollBarInfo(void)
|
||||
{
|
||||
HWND hMainWnd;
|
||||
BOOL ret;
|
||||
SCROLLBARINFO sbi;
|
||||
RECT rect;
|
||||
|
@ -166,6 +202,8 @@ static void scrollbar_test4(void)
|
|||
return;
|
||||
}
|
||||
|
||||
hMainWnd = create_main_test_wnd();
|
||||
|
||||
/* Test GetScrollBarInfo to make sure it returns rcScrollBar in screen
|
||||
* coordinates. */
|
||||
sbi.cbSize = sizeof(sbi);
|
||||
|
@ -218,6 +256,9 @@ static void scrollbar_test4(void)
|
|||
rect.top, rect.left, rect.bottom, rect.right,
|
||||
sbi.rcScrollBar.top, sbi.rcScrollBar.left,
|
||||
sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(hMainWnd);
|
||||
}
|
||||
|
||||
/* some tests designed to show that Horizontal and Vertical
|
||||
|
@ -502,19 +543,10 @@ START_TEST ( scroll )
|
|||
wc.lpfnWndProc = MyWndProc;
|
||||
RegisterClassA(&wc);
|
||||
|
||||
hMainWnd = CreateWindowExA( 0, "MyTestWnd", "Scroll",
|
||||
WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
|
||||
ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
|
||||
if (!hMainWnd) return;
|
||||
|
||||
assert( hScroll );
|
||||
|
||||
scrollbar_test1();
|
||||
scrollbar_test2();
|
||||
scrollbar_test3();
|
||||
scrollbar_test4();
|
||||
test_EnableScrollBar();
|
||||
test_SetScrollPos();
|
||||
test_ShowScrollBar();
|
||||
test_GetScrollBarInfo();
|
||||
scrollbar_test_track();
|
||||
|
||||
/* Some test results vary depending of theming being active or not */
|
||||
|
@ -533,7 +565,4 @@ START_TEST ( scroll )
|
|||
scrollbar_test_default( WS_HSCROLL | WS_VSCROLL);
|
||||
|
||||
scrollbar_test_init();
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(hMainWnd);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue