winmm/tests: Add a basic joystick interactive test.

This commit is contained in:
Bruno Jesus 2015-03-22 11:51:12 -03:00 committed by Alexandre Julliard
parent f70ddf7614
commit 47ab17595b
1 changed files with 29 additions and 0 deletions

View File

@ -195,6 +195,35 @@ static void test_api(void)
ret = joyGetPosEx(joyid, &infoex.ex);
ok(ret == JOYERR_NOERROR, "Expected %d, got %d\n", JOYERR_NOERROR, ret);
}
/* the interactive tests spans for 15 seconds, a 500ms polling is used to get
* changes in the joystick. */
if (winetest_interactive)
{
#define MAX_TIME 15000
DWORD tick = GetTickCount(), spent;
infoex.ex.dwSize = sizeof(infoex.ex);
infoex.ex.dwFlags = JOY_RETURNALL;
do
{
spent = GetTickCount() - tick;
ret = joyGetPosEx(joyid, &infoex.ex);
if (ret == JOYERR_NOERROR)
{
trace("X: %5d, Y: %5d, Z: %5d, POV: %5d\n",
infoex.ex.dwXpos, infoex.ex.dwYpos, infoex.ex.dwZpos, infoex.ex.dwPOV);
trace("R: %5d, U: %5d, V: %5d\n",
infoex.ex.dwRpos, infoex.ex.dwUpos, infoex.ex.dwVpos);
trace("BUTTONS: 0x%04X, BUTTON_COUNT: %2d, REMAINING: %d ms\n\n",
infoex.ex.dwButtons, infoex.ex.dwButtonNumber, MAX_TIME - spent);
}
Sleep(500);
}
while (spent < MAX_TIME);
#undef MAX_TIME
}
else
skip("Skipping interactive tests for the joystick\n");
}
START_TEST(joystick)