From: James Tabor Date: Wed, 26 Feb 2014 22:54:03 +0000 (+0000) Subject: [User32Test] X-Git-Tag: ReactOS-0.3.16-CLT2014~59 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=bcc1390a3611772beb8f57cdd258629989e7a351;hp=38758f72ac0b6a277a9c3f98826ae0b694d264ca [User32Test] - Update listbox and msg test to wine 1.7.13. svn path=/trunk/; revision=62338 --- diff --git a/rostests/winetests/user32/listbox.c b/rostests/winetests/user32/listbox.c index fdc190d8e6d..8e3fbcd34a1 100644 --- a/rostests/winetests/user32/listbox.c +++ b/rostests/winetests/user32/listbox.c @@ -234,6 +234,8 @@ static void check_item_height(void) DestroyWindow (hLB); } +static int got_selchange; + static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) @@ -267,6 +269,10 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA break; } + case WM_COMMAND: + if (HIWORD( wparam ) == LBN_SELCHANGE) got_selchange++; + break; + default: break; } @@ -1588,6 +1594,29 @@ todo_wine DestroyWindow(parent); } +static void test_missing_lbuttonup( void ) +{ + HWND listbox, parent, capture; + + parent = create_parent(); + listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent); + + /* Send button down without a corresponding button up */ + SendMessageA(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(10,10)); + capture = GetCapture(); + ok(capture == listbox, "got %p expected %p\n", capture, listbox); + + /* Capture is released and LBN_SELCHANGE sent during WM_KILLFOCUS */ + got_selchange = 0; + SetFocus(NULL); + capture = GetCapture(); + ok(capture == NULL, "got %p\n", capture); + ok(got_selchange, "got %d\n", got_selchange); + + DestroyWindow(listbox); + DestroyWindow(parent); +} + START_TEST(listbox) { const struct listbox_test SS = @@ -1668,4 +1697,5 @@ START_TEST(listbox) test_listbox_dlgdir(); test_set_count(); test_GetListBoxInfo(); + test_missing_lbuttonup(); } diff --git a/rostests/winetests/user32/msg.c b/rostests/winetests/user32/msg.c index 530df4d9df6..a0c610b8c3f 100755 --- a/rostests/winetests/user32/msg.c +++ b/rostests/winetests/user32/msg.c @@ -1719,11 +1719,11 @@ static const struct message WmSHOWNATopInvisible[] = { { 0 } }; -static int after_end_dialog, test_def_id; +static BOOL after_end_dialog, test_def_id, paint_loop_done; static int sequence_cnt, sequence_size; static struct recvd_message* sequence; static int log_all_parent_messages; -static int paint_loop_done; +static CRITICAL_SECTION sequence_cs; /* user32 functions */ static HWND (WINAPI *pGetAncestor)(HWND,UINT); @@ -1814,7 +1814,8 @@ static void add_message_(int line, const struct recvd_message *msg) { struct recvd_message *seq; - if (!sequence) + EnterCriticalSection( &sequence_cs ); + if (!sequence) { sequence_size = 10; sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) ); @@ -1826,7 +1827,7 @@ static void add_message_(int line, const struct recvd_message *msg) } assert(sequence); - seq = &sequence[sequence_cnt]; + seq = &sequence[sequence_cnt++]; seq->hwnd = msg->hwnd; seq->message = msg->message; seq->flags = msg->flags; @@ -1835,6 +1836,7 @@ static void add_message_(int line, const struct recvd_message *msg) seq->line = line; seq->descr = msg->descr; seq->output[0] = 0; + LeaveCriticalSection( &sequence_cs ); if (msg->descr) { @@ -1919,8 +1921,6 @@ static void add_message_(int line, const struct recvd_message *msg) sprintf( seq->output + strlen(seq->output), " (flags %x)", msg->flags ); } } - - sequence_cnt++; } /* try to make sure pending X events have been processed before continuing */ @@ -1941,9 +1941,11 @@ static void flush_events(void) static void flush_sequence(void) { + EnterCriticalSection( &sequence_cs ); HeapFree(GetProcessHeap(), 0, sequence); sequence = 0; sequence_cnt = sequence_size = 0; + LeaveCriticalSection( &sequence_cs ); } static void dump_sequence(const struct message *expected, const char *context, const char *file, int line) @@ -2030,7 +2032,7 @@ static void dump_sequence(const struct message *expected, const char *context, c ok_sequence_( (exp), (contx), (todo), __FILE__, __LINE__) -static void ok_sequence_(const struct message *expected_list, const char *context, int todo, +static void ok_sequence_(const struct message *expected_list, const char *context, BOOL todo, const char *file, int line) { static const struct recvd_message end_of_sequence; @@ -4762,17 +4764,17 @@ static void test_messages(void) flush_sequence(); - test_def_id = 1; + test_def_id = TRUE; SendMessageA(hwnd, WM_NULL, 0, 0); flush_sequence(); - after_end_dialog = 1; + after_end_dialog = TRUE; EndDialog( hwnd, 0 ); ok_sequence(WmEndCustomDialogSeq, "EndCustomDialog", FALSE); DestroyWindow(hwnd); - after_end_dialog = 0; - test_def_id = 0; + after_end_dialog = FALSE; + test_def_id = FALSE; hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL); @@ -7886,7 +7888,7 @@ static LRESULT WINAPI PaintLoopProcA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM } else ok(broken(1), "infinite loop\n"); if ( i == 0) - paint_loop_done = 1; + paint_loop_done = TRUE; return DefWindowProcA(hWnd,msg,wParam,lParam); } } @@ -9040,22 +9042,22 @@ static void test_scrollwindowex(void) trace("start scroll\n"); ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL, SW_ERASE|SW_INVALIDATE); - ok_sequence(WmEmptySeq, "ScrollWindowEx", 0); + ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE); trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); /* Now without the SW_ERASE flag */ trace("start scroll\n"); ScrollWindowEx( hwnd, 10, 10, &rect, NULL, NULL, NULL, SW_INVALIDATE); - ok_sequence(WmEmptySeq, "ScrollWindowEx", 0); + ok_sequence(WmEmptySeq, "ScrollWindowEx", FALSE); trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint2, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); @@ -9069,7 +9071,7 @@ static void test_scrollwindowex(void) trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindowEx", FALSE); flush_events(); flush_sequence(); @@ -9079,7 +9081,7 @@ static void test_scrollwindowex(void) trace("end scroll\n"); flush_sequence(); flush_events(); - ok_sequence(ScrollWindowPaint1, "ScrollWindow", 0); + ok_sequence(ScrollWindowPaint1, "ScrollWindow", FALSE); ok(DestroyWindow(hchild), "failed to destroy window\n"); ok(DestroyWindow(hwnd), "failed to destroy window\n"); @@ -9212,7 +9214,7 @@ static void test_DestroyWindow(void) ret = DestroyWindow(parent); ok( ret, "DestroyWindow() error %d\n", GetLastError()); test_DestroyWindow_flag = FALSE; - ok_sequence(destroy_window_with_children, "destroy window with children", 0); + ok_sequence(destroy_window_with_children, "destroy window with children", FALSE); ok(!IsWindow(parent), "parent still exists\n"); ok(!IsWindow(child1), "child1 still exists\n"); @@ -10229,8 +10231,7 @@ static void wait_move_event(HWND hwnd, int x, int y) { MSG msg; DWORD time; - BOOL ret; - int go = 0; + BOOL ret, go = FALSE; time = GetTickCount(); while (GetTickCount() - time < 200 && !go) { @@ -12590,6 +12591,7 @@ static void test_menu_messages(void) SetMenu(hwnd, hmenu); SetForegroundWindow( hwnd ); + flush_events(); set_menu_style(hmenu, MNS_NOTIFYBYPOS); style = get_menu_style(hmenu); @@ -12708,7 +12710,7 @@ static void test_paintingloop(void) { HWND hwnd; - paint_loop_done = 0; + paint_loop_done = FALSE; hwnd = CreateWindowExA(0x0,"PaintLoopWindowClass", "PaintLoopWindowClass",WS_OVERLAPPEDWINDOW, 100, 100, 100, 100, 0, 0, 0, NULL ); @@ -12732,7 +12734,7 @@ static void test_defwinproc(void) { HWND hwnd; MSG msg; - int gotwmquit = FALSE; + BOOL gotwmquit = FALSE; hwnd = CreateWindowExA(0, "static", "test_defwndproc", WS_POPUP, 0,0,0,0,0,0,0, NULL); assert(hwnd); DefWindowProcA( hwnd, WM_ENDSESSION, 1, 0); @@ -12740,7 +12742,7 @@ static void test_defwinproc(void) if( msg.message == WM_QUIT) gotwmquit = TRUE; DispatchMessageA( &msg ); } - ok( gotwmquit == FALSE, "Unexpected WM_QUIT message!\n"); + ok(!gotwmquit, "Unexpected WM_QUIT message!\n"); DestroyWindow( hwnd); } @@ -14292,6 +14294,7 @@ START_TEST(msg) return; } + InitializeCriticalSection( &sequence_cs ); init_procs(); hModuleImm32 = LoadLibraryA("imm32.dll"); @@ -14327,7 +14330,6 @@ START_TEST(msg) test_winevents(); /* Fix message sequences before removing 4 lines below */ -#if 1 if (pUnhookWinEvent && hEvent_hook) { ret = pUnhookWinEvent(hEvent_hook); @@ -14335,7 +14337,6 @@ START_TEST(msg) pUnhookWinEvent = 0; } hEvent_hook = 0; -#endif test_SetFocus(); test_SetParent(); @@ -14358,7 +14359,7 @@ START_TEST(msg) test_paint_messages(); if(!winetest_interactive) skip("ReactOS ActivateActCtx seems to be broken.\n"); - else + else test_interthread_messages(); test_message_conversion(); test_accelerators(); @@ -14407,4 +14408,5 @@ START_TEST(msg) GetLastError() == 0xdeadbeef, /* Win9x */ "unexpected error %d\n", GetLastError()); } + DeleteCriticalSection( &sequence_cs ); }