mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 18:53:33 +00:00
[user32_apitest]
- Some more tests for GetKeyState svn path=/trunk/; revision=51376
This commit is contained in:
parent
9c44037679
commit
c280a2b6ae
1 changed files with 13 additions and 3 deletions
|
@ -21,12 +21,14 @@ LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam)
|
||||||
if(pressed)
|
if(pressed)
|
||||||
{
|
{
|
||||||
ok(altPressed,"\n");
|
ok(altPressed,"\n");
|
||||||
ok((GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed\n");
|
ok((GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed\n");\
|
||||||
|
ok((GetKeyState(VK_LMENU) & 0x8000), "Left alt should not be pressed\n");\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok(!altPressed,"\n");
|
ok(!altPressed,"\n");
|
||||||
ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed\n");
|
ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed\n");
|
||||||
|
ok(!(GetKeyState(VK_LMENU) & 0x8000), "Left alt should be pressed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallNextHookEx(hKbdHook, code, wParam, lParam);
|
return CallNextHookEx(hKbdHook, code, wParam, lParam);
|
||||||
|
@ -41,12 +43,16 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
ok(pLLHook->flags & LLKHF_ALTDOWN,"Didn't get LLKHF_ALTDOWN flag\n");
|
ok(pLLHook->flags & LLKHF_ALTDOWN,"Didn't get LLKHF_ALTDOWN flag\n");
|
||||||
ok((GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n");
|
ok((GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n");
|
||||||
ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed in queue state\n");
|
ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed in queue state\n");
|
||||||
|
ok(!(GetAsyncKeyState (VK_LMENU) & 0x8000), "Left alt should not be pressed in global kbd status\n");
|
||||||
|
ok(!(GetKeyState(VK_LMENU) & 0x8000), "Left alt should not be pressed in queue state\n");
|
||||||
}
|
}
|
||||||
else if(wParam == WM_SYSKEYUP)
|
else if(wParam == WM_SYSKEYUP)
|
||||||
{
|
{
|
||||||
ok(!(pLLHook->flags & LLKHF_ALTDOWN),"got LLKHF_ALTDOWN flag\n");
|
ok(!(pLLHook->flags & LLKHF_ALTDOWN),"got LLKHF_ALTDOWN flag\n");
|
||||||
ok(!(GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n");
|
ok(!(GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n");
|
||||||
ok((GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed in queue state\n");
|
ok((GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed in queue state\n");
|
||||||
|
ok(!(GetAsyncKeyState (VK_LMENU) & 0x8000), "Left alt should not be pressed in global kbd status\n");
|
||||||
|
ok((GetKeyState(VK_LMENU) & 0x8000), "Left alt should be pressed in queue state\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallNextHookEx(hKbdLLHook, nCode, wParam, lParam);
|
return CallNextHookEx(hKbdLLHook, nCode, wParam, lParam);
|
||||||
|
@ -54,6 +60,10 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
|
if(msg == WM_SYSKEYDOWN)
|
||||||
|
{
|
||||||
|
ok(wParam == VK_MENU, "Got wrong wParam in WM_SYSKEYDOWN (%d instead of %d)\n", wParam, VK_MENU );
|
||||||
|
}
|
||||||
return DefWindowProcA( hWnd, msg, wParam, lParam );
|
return DefWindowProcA( hWnd, msg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,11 +114,11 @@ void Test_GetKeyState()
|
||||||
ok(hKbdHook!=NULL," \n");
|
ok(hKbdHook!=NULL," \n");
|
||||||
ok(hKbdLLHook!=NULL," \n");
|
ok(hKbdLLHook!=NULL," \n");
|
||||||
|
|
||||||
keybd_event(VK_MENU, 0, 0,0);
|
keybd_event(VK_LMENU, 0, 0,0);
|
||||||
|
|
||||||
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
|
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
|
||||||
|
|
||||||
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP,0);
|
keybd_event(VK_LMENU, 0, KEYEVENTF_KEYUP,0);
|
||||||
|
|
||||||
//fixme this hangs the test
|
//fixme this hangs the test
|
||||||
//while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg );
|
//while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue