xinput1_3: Added tests for XInputGetKeystroke.
This commit is contained in:
parent
ac3e24c5c9
commit
1b3feb2a5c
|
@ -27,6 +27,7 @@ static DWORD (WINAPI *pXInputGetState)(DWORD, XINPUT_STATE*);
|
|||
static DWORD (WINAPI *pXInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
||||
static DWORD (WINAPI *pXInputSetState)(DWORD, XINPUT_VIBRATION*);
|
||||
static void (WINAPI *pXInputEnable)(BOOL);
|
||||
static DWORD (WINAPI *pXInputGetKeystroke)(DWORD, DWORD, PXINPUT_KEYSTROKE);
|
||||
|
||||
static void test_set_state(void)
|
||||
{
|
||||
|
@ -96,6 +97,30 @@ static void test_get_state(void)
|
|||
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);
|
||||
}
|
||||
|
||||
static void test_get_keystroke(void)
|
||||
{
|
||||
XINPUT_KEYSTROKE keystroke;
|
||||
DWORD controllerNum;
|
||||
DWORD result;
|
||||
|
||||
for(controllerNum=0; controllerNum < XUSER_MAX_COUNT; controllerNum++)
|
||||
{
|
||||
ZeroMemory(&keystroke, sizeof(XINPUT_KEYSTROKE));
|
||||
|
||||
result = pXInputGetKeystroke(controllerNum, XINPUT_FLAG_GAMEPAD, &keystroke);
|
||||
ok(result == ERROR_SUCCESS || result == ERROR_DEVICE_NOT_CONNECTED, "XInputGetKeystroke failed with (%d)\n", result);
|
||||
|
||||
if (ERROR_DEVICE_NOT_CONNECTED == result)
|
||||
{
|
||||
skip("Controller %d is not connected\n", controllerNum);
|
||||
}
|
||||
}
|
||||
|
||||
ZeroMemory(&keystroke, sizeof(XINPUT_KEYSTROKE));
|
||||
result = pXInputGetKeystroke(XUSER_MAX_COUNT+1, XINPUT_FLAG_GAMEPAD, &keystroke);
|
||||
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetKeystroke returned (%d)\n", result);
|
||||
}
|
||||
|
||||
static void test_get_capabilities(void)
|
||||
{
|
||||
XINPUT_CAPABILITIES capabilities;
|
||||
|
@ -134,9 +159,11 @@ START_TEST(xinput)
|
|||
pXInputEnable = (void*)GetProcAddress(hXinput, "XInputEnable");
|
||||
pXInputSetState = (void*)GetProcAddress(hXinput, "XInputSetState");
|
||||
pXInputGetState = (void*)GetProcAddress(hXinput, "XInputGetState");
|
||||
pXInputGetKeystroke = (void*)GetProcAddress(hXinput, "XInputGetKeystroke");
|
||||
pXInputGetCapabilities = (void*)GetProcAddress(hXinput, "XInputGetCapabilities");
|
||||
test_set_state();
|
||||
test_get_state();
|
||||
test_get_keystroke();
|
||||
test_get_capabilities();
|
||||
FreeLibrary(hXinput);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue