xinput1_3/tests: Add interactive tests.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
101edb1f6d
commit
6b88529b3c
|
@ -96,8 +96,7 @@ static void test_get_state(void)
|
||||||
XINPUT_STATE state;
|
XINPUT_STATE state;
|
||||||
XINPUT_STATE_EX state_ex;
|
XINPUT_STATE_EX state_ex;
|
||||||
} xinput;
|
} xinput;
|
||||||
DWORD controllerNum, i;
|
DWORD controllerNum, i, result, good = XUSER_MAX_COUNT;
|
||||||
DWORD result;
|
|
||||||
|
|
||||||
for (i = 0; i < (pXInputGetStateEx ? 2 : 1); i++)
|
for (i = 0; i < (pXInputGetStateEx ? 2 : 1); i++)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +119,10 @@ static void test_get_state(void)
|
||||||
|
|
||||||
trace("-- Results for controller %d --\n", controllerNum);
|
trace("-- Results for controller %d --\n", controllerNum);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
{
|
||||||
|
good = controllerNum;
|
||||||
trace("XInputGetState: %d\n", result);
|
trace("XInputGetState: %d\n", result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
trace("XInputGetStateEx: %d\n", result);
|
trace("XInputGetStateEx: %d\n", result);
|
||||||
trace("State->dwPacketNumber: %d\n", xinput.state.dwPacketNumber);
|
trace("State->dwPacketNumber: %d\n", xinput.state.dwPacketNumber);
|
||||||
|
@ -141,6 +143,28 @@ static void test_get_state(void)
|
||||||
result = pXInputGetStateEx(XUSER_MAX_COUNT+1, &xinput.state_ex);
|
result = pXInputGetStateEx(XUSER_MAX_COUNT+1, &xinput.state_ex);
|
||||||
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);
|
ok(result == ERROR_BAD_ARGUMENTS, "XInputGetState returned (%d)\n", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (winetest_interactive && good < XUSER_MAX_COUNT)
|
||||||
|
{
|
||||||
|
DWORD now = GetTickCount(), packet = 0;
|
||||||
|
XINPUT_GAMEPAD *game = &xinput.state.Gamepad;
|
||||||
|
|
||||||
|
trace("You have 20 seconds to test the joystick freely\n");
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Sleep(100);
|
||||||
|
pXInputGetState(good, &xinput.state);
|
||||||
|
if (xinput.state.dwPacketNumber == packet)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
packet = xinput.state.dwPacketNumber;
|
||||||
|
trace("Buttons 0x%04X Triggers %3d/%3d LT %6d/%6d RT %6d/%6d\n",
|
||||||
|
game->wButtons, game->bLeftTrigger, game->bRightTrigger,
|
||||||
|
game->sThumbLX, game->sThumbLY, game->sThumbRX, game->sThumbRY);
|
||||||
|
}
|
||||||
|
while(GetTickCount() - now < 20000);
|
||||||
|
trace("Test over...\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_keystroke(void)
|
static void test_get_keystroke(void)
|
||||||
|
|
Loading…
Reference in New Issue