void Test_msg_simple() { SetCursorPos(0,0); create_test_windows(); set_default_zorder(); SetActiveWindow(hWnd1); FlushMessages(); COMPARE_CACHE(activate2to1_chain); SetActiveWindow(hWnd2); FlushMessages(); COMPARE_CACHE(activate1to2_chain); destroy_test_window(); }
void Test_TrackMouseEvent() { MOVE_CURSOR(0,0); create_test_windows(); FlushMessages(); EMPTY_CACHE(); /* the mouse moves over hwnd2 */ MOVE_CURSOR(220,220); FlushMessages(); COMPARE_CACHE(mousemove2_chain); EXPECT_TME_FLAGS(hWnd2, 0); /* Begin tracking mouse events for hWnd2 */ TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse hovers hwnd2 */ MOVE_CURSOR(221, 221); Sleep(100); EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(QS_TIMER|QS_MOUSEMOVE, 0); EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); COMPARE_CACHE(mousehover2_chain); /* the mouse leaves hwnd2 and moves to hwnd1 */ MOVE_CURSOR(150, 150); EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); FLUSH_MESSAGES(QS_MOUSEMOVE,QS_TIMER ); EXPECT_TME_FLAGS(hWnd2, 0); COMPARE_CACHE(mouseleave2to1_chain); FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse moves over hwnd2 */ MOVE_CURSOR(220,220); FLUSH_MESSAGES(QS_MOUSEMOVE, QS_TIMER); COMPARE_CACHE(mousemove2_chain); EXPECT_TME_FLAGS(hWnd2, 0); FlushMessages(); COMPARE_CACHE(empty_chain); /* Begin tracking mouse events for hWnd2 */ TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(0, QS_TIMER|QS_MOUSEMOVE); COMPARE_CACHE(empty_chain); EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); /* the mouse moves from hwnd2 to the intersection of hwnd2 and hwnd3 */ MOVE_CURSOR(300,300); FLUSH_MESSAGES(QS_MOUSEMOVE, QS_TIMER); EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); COMPARE_CACHE(mousemove2_chain); FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse moves from hwnd2 to hwnd3 */ MOVE_CURSOR(400,400); FLUSH_MESSAGES(QS_MOUSEMOVE, QS_TIMER); EXPECT_TME_FLAGS(hWnd2, 0); COMPARE_CACHE(mouseleave2to3_chain); FlushMessages(); COMPARE_CACHE(empty_chain); /* Begin tracking mouse events for hWnd3 */ TmeStartTracking(hWnd3, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(0, QS_TIMER|QS_MOUSEMOVE); COMPARE_CACHE(empty_chain); EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); /* the mouse hovers hwnd3 */ MOVE_CURSOR(401,401); Sleep(100); EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(QS_TIMER|QS_MOUSEMOVE, 0); EXPECT_TME_FLAGS(hWnd3, TME_LEAVE); COMPARE_CACHE(mousehover3_chain); FlushMessages(); COMPARE_CACHE(empty_chain); /* Begin tracking mouse events for hWnd3 */ TmeStartTracking(hWnd3, TME_HOVER ); FLUSH_MESSAGES(0, QS_TIMER|QS_MOUSEMOVE); COMPARE_CACHE(empty_chain); EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); /* make sure that the timer will fire before the mouse moves */ Sleep(100); FlushMessages(); COMPARE_CACHE(mousehover3_nomove_chain); EXPECT_TME_FLAGS(hWnd3, TME_LEAVE); Sleep(100); FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse hovers hwnd3 and the timer is not dispatched*/ TmeStartTracking(hWnd3, TME_HOVER ); ignore_timer = TRUE; MOVE_CURSOR(400,400); Sleep(100); EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(QS_TIMER|QS_MOUSEMOVE, 0); /* the loop drops WM_SYSTIMER */ EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); /* TME_HOVER is still active */ COMPARE_CACHE(mousehover3_droptimer_chain); /* we get no WM_MOUSEHOVER */ ignore_timer = FALSE; /* the mouse hovers hwnd3 and mouse message is dropped by WH_MOUSE_LL */ ignore_mousell = TRUE; MOVE_CURSOR(402,402); Sleep(100); EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(QS_TIMER, QS_MOUSEMOVE); /* WH_MOUSE_LL drops WM_MOUSEMOVE */ EXPECT_TME_FLAGS(hWnd3, TME_LEAVE); COMPARE_CACHE(mousehover3_dropmousell_chain); /* we get WM_MOUSEHOVER normaly */ ignore_mousell = FALSE; FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse hovers hwnd3 and mouse message is dropped by WH_MOUSE */ ignore_mouse = TRUE; TmeStartTracking(hWnd3, TME_HOVER ); MOVE_CURSOR(401,401); Sleep(100); EXPECT_TME_FLAGS(hWnd3, TME_HOVER|TME_LEAVE); FLUSH_MESSAGES(QS_TIMER|QS_MOUSEMOVE, 0); /* WH_MOUSE drops WM_MOUSEMOVE */ EXPECT_TME_FLAGS(hWnd3, TME_LEAVE); COMPARE_CACHE(mousehover3_dropmouse_chain); /* we get WM_MOUSEHOVER normaly */ ignore_mouse = FALSE; FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse leaves hwnd3 and moves to hwnd2 and mouse message is dropped by WH_MOUSE_LL */ ignore_mousell = TRUE; TmeStartTracking(hWnd3, TME_LEAVE ); MOVE_CURSOR(220,220); FLUSH_MESSAGES(0, QS_MOUSEMOVE|QS_TIMER); /* WH_MOUSE drops WM_MOUSEMOVE */ EXPECT_TME_FLAGS(hWnd3, TME_LEAVE); /* all flags are removed */ COMPARE_CACHE(mouseleave3to2_dropmousell_chain); /* we get no WM_MOUSELEAVE */ ignore_mousell = FALSE; FlushMessages(); COMPARE_CACHE(empty_chain); /* the mouse leaves hwnd3 and moves to hwnd2 and mouse message is dropped by WH_MOUSE */ ignore_mouse = TRUE; MOVE_CURSOR(220,220); FLUSH_MESSAGES(QS_MOUSEMOVE, QS_TIMER); /* WH_MOUSE drops WM_MOUSEMOVE */ EXPECT_TME_FLAGS(hWnd3, 0); /* all flags are removed */ COMPARE_CACHE(mouseleave3to2_dropmouse_chain); /* we get no WM_MOUSELEAVE */ ignore_mouse = FALSE; /* after WH_MOUSE drops WM_MOUSEMOVE, WM_MOUSELEAVE is still in the queue */ FLUSH_MESSAGES(QS_POSTMESSAGE, QS_TIMER|QS_MOUSEMOVE); COMPARE_CACHE(mouseleave3_remainging_chain); FlushMessages(); COMPARE_CACHE(empty_chain); destroy_test_window(); }