[USER32_APITEST] Improve GetMessageTime tests more (#1254)

Compare GetMessageTime and GetTickCount values.
CORE-15565
This commit is contained in:
Katayama Hirofumi MZ 2019-01-18 12:11:53 +09:00 committed by GitHub
parent 0d86ab6a18
commit 4b924a8685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
/* /*
* PROJECT: ReactOS api tests * PROJECT: ReactOS api tests
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: Test for GetMessageTime * PURPOSE: Test for GetMessageTime and GetTickCount
* PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> * PROGRAMMERS: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/ */
#include "precomp.h" #include "precomp.h"
@ -46,7 +46,9 @@ WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (s_nCount != 0) if (s_nCount != 0)
{ {
ok(GetMessageTime() - s_nMsgTime >= TIMER_INTERVAL / 2, ok(GetMessageTime() - s_nMsgTime >= TIMER_INTERVAL / 2,
"message time is wrong\n"); "GetMessageTime() is wrong, compared to previous one\n");
ok(GetTickCount() - (DWORD)GetMessageTime() < TIMER_INTERVAL / 2,
"GetMessageTime() is wrong, compared to GetTickCount()\n");
} }
s_nMsgTime = GetMessageTime(); s_nMsgTime = GetMessageTime();
ok(s_nMsgTime != 0, "message time was zero.\n"); ok(s_nMsgTime != 0, "message time was zero.\n");
@ -65,19 +67,28 @@ WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
trace("WM_MOUSEMOVE\n"); trace("WM_MOUSEMOVE\n");
ok_int(s_nCount, 5); ok_int(s_nCount, 5);
ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL, "message time is wrong.\n"); ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL,
"GetMessageTime() is wrong, compared to previous one\n");
ok(GetTickCount() - (DWORD)GetMessageTime() < TIMER_INTERVAL / 2,
"GetMessageTime() is wrong, compared to GetTickCount()\n");
s_bReach_WM_MOUSEMOVE = TRUE; s_bReach_WM_MOUSEMOVE = TRUE;
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
trace("WM_LBUTTONDOWN\n"); trace("WM_LBUTTONDOWN\n");
ok_int(s_nCount, 5); ok_int(s_nCount, 5);
ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL, "message time is wrong.\n"); ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL,
"GetMessageTime() is wrong, compared to previous one\n");
ok(GetTickCount() - (DWORD)GetMessageTime() < TIMER_INTERVAL / 2,
"GetMessageTime() is wrong, compared to GetTickCount()\n");
s_bReach_WM_LBUTTONDOWN = TRUE; s_bReach_WM_LBUTTONDOWN = TRUE;
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
trace("WM_LBUTTONUP\n"); trace("WM_LBUTTONUP\n");
ok_int(s_nCount, 5); ok_int(s_nCount, 5);
ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL, "message time is wrong.\n"); ok(GetMessageTime() - s_nMsgTime < TIMER_INTERVAL,
"GetMessageTime() is wrong, compared to previous one\n");
ok(GetTickCount() - (DWORD)GetMessageTime() < TIMER_INTERVAL / 2,
"GetMessageTime() is wrong, compared to GetTickCount()\n");
s_bReach_WM_LBUTTONUP = TRUE; s_bReach_WM_LBUTTONUP = TRUE;
break; break;
case WM_DESTROY: case WM_DESTROY: