comctl32/updown: Make tests independent, drop unrelated tests.

This commit is contained in:
Nikolay Sivov 2009-09-20 01:26:10 +04:00 committed by Alexandre Julliard
parent 0209b02f47
commit 6be1bade1a
1 changed files with 44 additions and 60 deletions

View File

@ -59,38 +59,10 @@
#define EDIT_SEQ_INDEX 1 #define EDIT_SEQ_INDEX 1
#define UPDOWN_SEQ_INDEX 2 #define UPDOWN_SEQ_INDEX 2
static HWND parent_wnd, edit, updown; static HWND parent_wnd, edit;
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static const struct message create_parent_wnd_seq[] = {
{ WM_GETMINMAXINFO, sent },
{ WM_NCCREATE, sent },
{ WM_NCCALCSIZE, sent|wparam, 0 },
{ WM_CREATE, sent },
{ WM_SHOWWINDOW, sent|wparam, 1 },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_QUERYNEWPALETTE, sent|optional },
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent },
{ WM_ACTIVATE, sent|wparam, 1 },
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
{ WM_IME_NOTIFY, sent|defwinproc|optional },
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
/* Win9x adds SWP_NOZORDER below */
{ WM_WINDOWPOSCHANGED, sent, /*|wparam, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE*/ },
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
{ WM_SIZE, sent },
{ WM_MOVE, sent },
{ 0 }
};
static const struct message add_edit_to_parent_seq[] = {
{ WM_PARENTNOTIFY, sent|wparam, WM_CREATE },
{ 0 }
};
static const struct message add_updown_with_edit_seq[] = { static const struct message add_updown_with_edit_seq[] = {
{ WM_WINDOWPOSCHANGING, sent }, { WM_WINDOWPOSCHANGING, sent },
{ WM_NCCALCSIZE, sent|wparam, TRUE }, { WM_NCCALCSIZE, sent|wparam, TRUE },
@ -182,15 +154,6 @@ static const struct message test_updown_unicode_seq[] = {
{ 0 } { 0 }
}; };
static const struct message test_updown_destroy_seq[] = {
{ WM_SHOWWINDOW, sent|wparam|lparam, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent},
{ WM_WINDOWPOSCHANGED, sent},
{ WM_DESTROY, sent},
{ WM_NCDESTROY, sent},
{ 0 }
};
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static LONG defwndproc_counter = 0; static LONG defwndproc_counter = 0;
@ -359,8 +322,11 @@ static HWND create_updown_control(void)
static void test_updown_pos(void) static void test_updown_pos(void)
{ {
HWND updown;
int r; int r;
updown = create_updown_control();
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set Range from 0 to 100 */ /* Set Range from 0 to 100 */
@ -410,13 +376,18 @@ static void test_updown_pos(void)
expect(1,HIWORD(r)); expect(1,HIWORD(r));
ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos_seq , "test updown pos", FALSE); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos_seq , "test updown pos", FALSE);
DestroyWindow(updown);
} }
static void test_updown_pos32(void) static void test_updown_pos32(void)
{ {
HWND updown;
int r; int r;
int low, high; int low, high;
updown = create_updown_control();
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set the position to 0 to 1000 */ /* Set the position to 0 to 1000 */
@ -433,7 +404,7 @@ static void test_updown_pos32(void)
win_skip("UDM_SETPOS32 and UDM_GETPOS32 need 5.80\n"); win_skip("UDM_SETPOS32 and UDM_GETPOS32 need 5.80\n");
return; return;
} }
expect(100,r); /* As set by test_updown_pos() */ expect(50,r);
/* Since UDM_SETBUDDYINT was not set at creation bRet will always be true as a return from UDM_GETPOS32 */ /* Since UDM_SETBUDDYINT was not set at creation bRet will always be true as a return from UDM_GETPOS32 */
@ -470,11 +441,15 @@ static void test_updown_pos32(void)
expect(1,high); expect(1,high);
ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos32_seq, "test updown pos32", FALSE); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_pos32_seq, "test updown pos32", FALSE);
DestroyWindow(updown);
} }
static void test_updown_buddy(void) static void test_updown_buddy(void)
{ {
HWND buddyReturn; HWND updown, buddyReturn;
updown = create_updown_control();
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
@ -489,12 +464,17 @@ static void test_updown_buddy(void)
ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_buddy_seq, "test updown buddy", TRUE); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_buddy_seq, "test updown buddy", TRUE);
ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "test updown buddy_edit", FALSE); ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "test updown buddy_edit", FALSE);
DestroyWindow(updown);
} }
static void test_updown_base(void) static void test_updown_base(void)
{ {
HWND updown;
int r; int r;
updown = create_updown_control();
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
SendMessage(updown, UDM_SETBASE, 10 , 0); SendMessage(updown, UDM_SETBASE, 10 , 0);
@ -526,12 +506,17 @@ static void test_updown_base(void)
expect(10,r); expect(10,r);
ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_base_seq, "test updown base", FALSE); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_base_seq, "test updown base", FALSE);
DestroyWindow(updown);
} }
static void test_updown_unicode(void) static void test_updown_unicode(void)
{ {
HWND updown;
int r; int r;
updown = create_updown_control();
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
/* Set it to ANSI, don't check return as we don't know previous state */ /* Set it to ANSI, don't check return as we don't know previous state */
@ -552,22 +537,14 @@ static void test_updown_unicode(void)
expect(0,r); expect(0,r);
ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_unicode_seq, "test updown unicode", FALSE); ok_sequence(sequences, UPDOWN_SEQ_INDEX, test_updown_unicode_seq, "test updown unicode", FALSE);
DestroyWindow(updown);
} }
static void test_updown_create(void)
static void test_create_updown_control(void)
{ {
CHAR text[MAX_PATH]; CHAR text[MAX_PATH];
HWND updown;
parent_wnd = create_parent_window();
ok(parent_wnd != NULL, "Failed to create parent window!\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent window", TRUE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
edit = create_edit_control();
ok(edit != NULL, "Failed to create edit control\n");
ok_sequence(sequences, PARENT_SEQ_INDEX, add_edit_to_parent_seq, "add edit control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES); flush_sequences(sequences, NUM_MSG_SEQUENCES);
@ -582,13 +559,7 @@ static void test_create_updown_control(void)
ok(lstrlenA(text) == 0, "Expected empty string\n"); ok(lstrlenA(text) == 0, "Expected empty string\n");
ok_sequence(sequences, EDIT_SEQ_INDEX, get_edit_text_seq, "get edit text", FALSE); ok_sequence(sequences, EDIT_SEQ_INDEX, get_edit_text_seq, "get edit text", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES); DestroyWindow(updown);
test_updown_pos();
test_updown_pos32();
test_updown_buddy();
test_updown_base();
test_updown_unicode();
} }
START_TEST(updown) START_TEST(updown)
@ -596,5 +567,18 @@ START_TEST(updown)
InitCommonControls(); InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES); init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_create_updown_control(); parent_wnd = create_parent_window();
ok(parent_wnd != NULL, "Failed to create parent window!\n");
edit = create_edit_control();
ok(edit != NULL, "Failed to create edit control\n");
test_updown_create();
test_updown_pos();
test_updown_pos32();
test_updown_buddy();
test_updown_base();
test_updown_unicode();
DestroyWindow(edit);
DestroyWindow(parent_wnd);
} }