Author: gadamopoulos Date: Fri Sep 23 11:45:44 2011 New Revision: 53811 URL: http://svn.reactos.org/svn/reactos?rev=53811&view=rev Log: [user32_apitest] - Fix white spaces
Modified: trunk/rostests/apitests/user32/SetCursorPos.c trunk/rostests/apitests/user32/TrackMouseEvent.c Modified: trunk/rostests/apitests/user32/SetCursorPos.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/SetCursorPos.c?rev=53811&r1=53810&r2=53811&view=diff ============================================================================== --- trunk/rostests/apitests/user32/SetCursorPos.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/SetCursorPos.c [iso-8859-1] Fri Sep 23 11:45:44 2011 @@ -59,7 +59,7 @@ WNDCLASSA wclass; HANDLE hInstance = GetModuleHandleA( NULL ); HWND hWndTest; - + wclass.lpszClassName = "MouseInputTestClass"; wclass.style = CS_HREDRAW | CS_VREDRAW; wclass.lpfnWndProc = WndProc; @@ -154,8 +154,8 @@ SetCapture(NULL); DestroyWindow(hwnd); - UnhookWindowsHookEx (hMouseHook); - UnhookWindowsHookEx (hMouseHookLL); + UnhookWindowsHookEx (hMouseHook); + UnhookWindowsHookEx (hMouseHookLL); } Modified: trunk/rostests/apitests/user32/TrackMouseEvent.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/TrackMouseEvent.c?rev=53811&r1=53810&r2=53811&view=diff ============================================================================== --- trunk/rostests/apitests/user32/TrackMouseEvent.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/TrackMouseEvent.c [iso-8859-1] Fri Sep 23 11:45:44 2011 @@ -40,13 +40,13 @@ case WM_MOVE: return "WM_MOVE"; case WM_SHOWWINDOW: return "WM_SHOWWINDOW"; case WM_QUERYNEWPALETTE: return "WM_QUERYNEWPALETTE"; - case WM_MOUSELEAVE: return "WM_MOUSELEAVE"; - case WM_MOUSEHOVER: return "WM_MOUSEHOVER"; - case WM_NCMOUSELEAVE: return "WM_NCMOUSELEAVE"; - case WM_NCMOUSEHOVER: return "WM_NCMOUSEHOVER"; - case WM_NCHITTEST: return "WM_NCHITTEST"; - case WM_SETCURSOR: return "WM_SETCURSOR"; - case WM_MOUSEMOVE: return "WM_MOUSEMOVE"; + case WM_MOUSELEAVE: return "WM_MOUSELEAVE"; + case WM_MOUSEHOVER: return "WM_MOUSEHOVER"; + case WM_NCMOUSELEAVE: return "WM_NCMOUSELEAVE"; + case WM_NCMOUSEHOVER: return "WM_NCMOUSEHOVER"; + case WM_NCHITTEST: return "WM_NCHITTEST"; + case WM_SETCURSOR: return "WM_SETCURSOR"; + case WM_MOUSEMOVE: return "WM_MOUSEMOVE"; default: return NULL; } } @@ -73,7 +73,7 @@ trace("hwnd%d, msg:%d\n",message_cache[i].iwnd, message_cache[i].msg ); } } - trace("\n"); + trace("\n"); } #endif @@ -114,8 +114,8 @@ } i++; } - - empty_message_cache(); + + empty_message_cache(); } static void record_message(int iwnd, UINT message) @@ -147,18 +147,18 @@ else return DefWindowProc(hWnd, message, wParam, lParam); - record_message(iwnd, message); - } - } - - if(message == WM_PAINT) - { - PAINTSTRUCT ps; - BeginPaint(hWnd, &ps); + record_message(iwnd, message); + } + } + + if(message == WM_PAINT) + { + PAINTSTRUCT ps; + BeginPaint(hWnd, &ps); Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); - EndPaint(hWnd, &ps); - } - + EndPaint(hWnd, &ps); + } + return DefWindowProc(hWnd, message, wParam, lParam); } @@ -194,159 +194,155 @@ UpdateWindow(hWnd2); ShowWindow(hWnd3, SW_SHOWNORMAL); UpdateWindow(hWnd3); - //SetWindowPos (hWnd3, HWND_TOP, 0,0,0,0, SWP_NOMOVE|SWP_NOREDRAW); -} - + //SetWindowPos (hWnd3, HWND_TOP, 0,0,0,0, SWP_NOMOVE|SWP_NOREDRAW); +} + static void TmeStartTracking(HWND hwnd, DWORD Flags) { TRACKMOUSEEVENT tme; - tme.cbSize = sizeof(tme); + tme.cbSize = sizeof(tme); tme.dwFlags = Flags; - tme.hwndTrack = hwnd; - tme.dwHoverTime = 1; - if(!TrackMouseEvent(&tme)) - { - trace("failed!\n"); - } + tme.hwndTrack = hwnd; + tme.dwHoverTime = 1; + if(!TrackMouseEvent(&tme)) + { + trace("failed!\n"); + } } DWORD TmeQuery(HWND hwnd) { TRACKMOUSEEVENT tme; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_QUERY|TME_HOVER|TME_LEAVE; - tme.hwndTrack = hwnd; - TrackMouseEvent(&tme); - return tme.dwFlags; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_QUERY|TME_HOVER|TME_LEAVE; + tme.hwndTrack = hwnd; + TrackMouseEvent(&tme); + return tme.dwFlags; } #define FLUSH_MESSAGES(msg) while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); #define EXPECT_TME_FLAGS(hWnd, expected) \ { DWORD flags = TmeQuery(hWnd); \ - ok(flags == (expected),"wrong tme flags. expected %li, and got %li\n", (DWORD)(expected), flags); \ - } - -#define EXPECT_QUEUE_STATUS(expected, notexpected) \ - { \ - DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS)); \ - ok(((status) & (expected))== (expected),"wrong queue status. expected %li, and got %li\n", (DWORD)(expected), status); \ - if(notexpected) \ - ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \ - } - + ok(flags == (expected),"wrong tme flags. expected %li, and got %li\n", (DWORD)(expected), flags); \ + } + +#define EXPECT_QUEUE_STATUS(expected, notexpected) \ + { \ + DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS)); \ + ok(((status) & (expected))== (expected),"wrong queue status. expected %li, and got %li\n", (DWORD)(expected), status); \ + if(notexpected) \ + ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \ + } + MSG_ENTRY empty_chain[]= {{0,0}}; /* the mouse moves over hwnd2 */ MSG_ENTRY mousemove2_chain[]={{2, WM_NCHITTEST}, {2, WM_SETCURSOR}, - {1, WM_SETCURSOR}, - {2, WM_MOUSEMOVE}, - {0,0}}; + {1, WM_SETCURSOR}, + {2, WM_MOUSEMOVE}, + {0,0}}; /* the mouse hovers hwnd2 */ MSG_ENTRY mousehover2_chain[]={{2, WM_NCHITTEST}, {2, WM_SETCURSOR}, - {1, WM_SETCURSOR}, - {2, WM_MOUSEMOVE}, - {2, WM_MOUSEHOVER}, - {0,0}}; + {1, WM_SETCURSOR}, + {2, WM_MOUSEMOVE}, + {2, WM_MOUSEHOVER}, + {0,0}}; /* the mouse leaves hwnd2 and moves to hwnd1 */ MSG_ENTRY mouseleave2to1_chain[]={{1, WM_NCHITTEST}, {1, WM_SETCURSOR}, - {1, WM_MOUSEMOVE}, - {2, WM_MOUSELEAVE}, - {0,0}}; + {1, WM_MOUSEMOVE}, + {2, WM_MOUSELEAVE}, + {0,0}}; /* the mouse leaves hwnd2 and moves to hwnd3 */ MSG_ENTRY mouseleave2to3_chain[]={{3, WM_NCHITTEST}, {3, WM_SETCURSOR}, {1, WM_SETCURSOR}, - {3, WM_MOUSEMOVE}, - {2, WM_MOUSELEAVE}, - {0,0}}; + {3, WM_MOUSEMOVE}, + {2, WM_MOUSELEAVE}, + {0,0}}; void Test_TrackMouseEvent() { MSG msg; - - SetCursorPos(0,0); + + SetCursorPos(0,0); create_test_windows(); - FLUSH_MESSAGES(msg); - empty_message_cache(); + FLUSH_MESSAGES(msg); + empty_message_cache(); /* the mouse moves over hwnd2 */ - SetCursorPos(220,220); - FLUSH_MESSAGES(msg); - compare_cache("mousemove2", mousemove2_chain); - EXPECT_TME_FLAGS(hWnd2, 0); - TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); - EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); - FLUSH_MESSAGES(msg); - compare_cache("empty1", empty_chain); - + SetCursorPos(220,220); + FLUSH_MESSAGES(msg); + compare_cache("mousemove2", mousemove2_chain); + EXPECT_TME_FLAGS(hWnd2, 0); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + FLUSH_MESSAGES(msg); + compare_cache("empty1", empty_chain); + /* the mouse hovers hwnd2 */ - SetCursorPos(221,221); - Sleep(100); - EXPECT_QUEUE_STATUS(QS_TIMER|QS_MOUSEMOVE, QS_POSTMESSAGE); - EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); - FLUSH_MESSAGES(msg); - EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); - compare_cache("mousehover2", mousehover2_chain); - - /* the mouse leaves hwnd2 and moves to hwnd1 */ - SetCursorPos(150,150); - EXPECT_QUEUE_STATUS(QS_MOUSEMOVE,QS_TIMER|QS_POSTMESSAGE ); - EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); - FLUSH_MESSAGES(msg); - EXPECT_TME_FLAGS(hWnd2, 0); - compare_cache("mouseleave2to1", mouseleave2to1_chain); - - FLUSH_MESSAGES(msg); - compare_cache("empty2", empty_chain); - + SetCursorPos(221,221); + Sleep(100); + EXPECT_QUEUE_STATUS(QS_TIMER|QS_MOUSEMOVE, QS_POSTMESSAGE); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); + compare_cache("mousehover2", mousehover2_chain); + + /* the mouse leaves hwnd2 and moves to hwnd1 */ + SetCursorPos(150,150); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE,QS_TIMER|QS_POSTMESSAGE ); + EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("mouseleave2to1", mouseleave2to1_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty2", empty_chain); + /* the mouse moves over hwnd2 */ - SetCursorPos(220,220); - EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); - FLUSH_MESSAGES(msg); - compare_cache("mousemove2", mousemove2_chain); - EXPECT_TME_FLAGS(hWnd2, 0); - compare_cache("empty3", empty_chain); - TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); - TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); - TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); - TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); - EXPECT_QUEUE_STATUS(0, QS_TIMER|QS_MOUSEMOVE|QS_POSTMESSAGE); - FLUSH_MESSAGES(msg); - compare_cache("empty4", empty_chain); - EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); - - FLUSH_MESSAGES(msg); - compare_cache("empty5", empty_chain); - + SetCursorPos(220,220); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + compare_cache("mousemove2", mousemove2_chain); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("empty3", empty_chain); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + EXPECT_QUEUE_STATUS(0, QS_TIMER|QS_MOUSEMOVE|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + compare_cache("empty4", empty_chain); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + + FLUSH_MESSAGES(msg); + compare_cache("empty5", empty_chain); + /* the mouse moves from hwnd2 to the intersection of hwnd2 and hwnd3 */ - SetCursorPos(300,300); - EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); - FLUSH_MESSAGES(msg); - EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); - compare_cache("mousemove2", mousemove2_chain); - - FLUSH_MESSAGES(msg); - compare_cache("empty6", empty_chain); - - /* the mouse moves from hwnd2 to hwnd3 */ - SetCursorPos(400,400); - EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); - FLUSH_MESSAGES(msg); - EXPECT_TME_FLAGS(hWnd2, 0); - compare_cache("mousemove2to3", mouseleave2to3_chain); - - FLUSH_MESSAGES(msg); - compare_cache("empty7", empty_chain); - - //trace_cache(); - - //Sleep(2000); + SetCursorPos(300,300); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + compare_cache("mousemove2", mousemove2_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty6", empty_chain); + + /* the mouse moves from hwnd2 to hwnd3 */ + SetCursorPos(400,400); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("mousemove2to3", mouseleave2to3_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty7", empty_chain); } START_TEST(TrackMouseEvent)