Author: jimtabor Date: Wed Feb 26 22:54:03 2014 New Revision: 62338
URL: http://svn.reactos.org/svn/reactos?rev=62338&view=rev Log: [User32Test] - Update listbox and msg test to wine 1.7.13.
Modified: trunk/rostests/winetests/user32/listbox.c trunk/rostests/winetests/user32/msg.c
Modified: trunk/rostests/winetests/user32/listbox.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/listbox.c... ============================================================================== --- trunk/rostests/winetests/user32/listbox.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/listbox.c [iso-8859-1] Wed Feb 26 22:54:03 2014 @@ -234,6 +234,8 @@ DestroyWindow (hLB); }
+static int got_selchange; + static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) @@ -266,6 +268,10 @@
break; } + + case WM_COMMAND: + if (HIWORD( wparam ) == LBN_SELCHANGE) got_selchange++; + break;
default: break; @@ -1583,6 +1589,29 @@ ok(ret > 0, "got %d\n", ret); todo_wine ok(lb_getlistboxinfo == 0, "got %d\n", lb_getlistboxinfo); + + DestroyWindow(listbox); + 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); @@ -1668,4 +1697,5 @@ test_listbox_dlgdir(); test_set_count(); test_GetListBoxInfo(); -} + test_missing_lbuttonup(); +}
Modified: trunk/rostests/winetests/user32/msg.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?rev... ============================================================================== --- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Wed Feb 26 22:54:03 2014 @@ -1719,11 +1719,11 @@ { 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 @@ { 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 @@ } 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 @@ seq->line = line; seq->descr = msg->descr; seq->output[0] = 0; + LeaveCriticalSection( &sequence_cs );
if (msg->descr) { @@ -1919,8 +1921,6 @@ 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_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 @@ 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 @@
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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { MSG msg; DWORD time; - BOOL ret; - int go = 0; + BOOL ret, go = FALSE;
time = GetTickCount(); while (GetTickCount() - time < 200 && !go) { @@ -12590,6 +12591,7 @@
SetMenu(hwnd, hmenu); SetForegroundWindow( hwnd ); + flush_events();
set_menu_style(hmenu, MNS_NOTIFYBYPOS); style = get_menu_style(hmenu); @@ -12708,7 +12710,7 @@ { 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 @@ { 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 @@ 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 @@ return; }
+ InitializeCriticalSection( &sequence_cs ); init_procs();
hModuleImm32 = LoadLibraryA("imm32.dll"); @@ -14327,7 +14330,6 @@ test_winevents();
/* Fix message sequences before removing 4 lines below */ -#if 1 if (pUnhookWinEvent && hEvent_hook) { ret = pUnhookWinEvent(hEvent_hook); @@ -14335,7 +14337,6 @@ pUnhookWinEvent = 0; } hEvent_hook = 0; -#endif
test_SetFocus(); test_SetParent(); @@ -14358,7 +14359,7 @@ 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 @@ GetLastError() == 0xdeadbeef, /* Win9x */ "unexpected error %d\n", GetLastError()); } + DeleteCriticalSection( &sequence_cs ); }