winmm/tests: Add a basic joystick interactive test
Bruno Jesus
00cpxxx at gmail.com
Sat Mar 21 14:55:56 CDT 2015
Sample output:
X: 32767, Y: 32767, Z: 32767, BUTTONS: 0x0080, REMAINING: 8492 ms
X: 0, Y: 32767, Z: 32767, BUTTONS: 0x0001, REMAINING: 5990 ms
X: 32767, Y: 0, Z: 32767, BUTTONS: 0x0000, REMAINING: 5489 ms
X: 32767, Y: 32767, Z: 32767, BUTTONS: 0x0003, REMAINING: 4989 ms
X: 65534, Y: 65534, Z: 32767, BUTTONS: 0x0020, REMAINING: 4488 ms
X: 32767, Y: 0, Z: 32767, BUTTONS: 0x0000, REMAINING: 3987 ms
-------------- next part --------------
diff --git a/dlls/winmm/tests/joystick.c b/dlls/winmm/tests/joystick.c
index 21e90e3..27aae43 100644
--- a/dlls/winmm/tests/joystick.c
+++ b/dlls/winmm/tests/joystick.c
@@ -195,6 +195,28 @@ 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, there is no way to tell the
+ * amount of buttons in winmm so there is no way to ask the user to press
+ * all buttons, that is why the test is time limited. */
+ if (winetest_interactive)
+ {
+ #define MAX_TIME 15000
+ DWORD tick = GetTickCount(), spent;
+ do
+ {
+ spent = GetTickCount() - tick;
+ ret = joyGetPos(joyid, &info);
+ if (ret == JOYERR_NOERROR)
+ trace("X: %5d, Y: %5d, Z: %5d, BUTTONS: 0x%04X, REMAINING: %d ms\n",
+ info.wXpos, info.wYpos, info.wZpos, info.wButtons, MAX_TIME - spent);
+ Sleep(500);
+ }
+ while (spent < MAX_TIME);
+ #undef MAX_TIME
+ }
+ else
+ skip("Skipping interactive tests for the joystick\n");
}
START_TEST(joystick)
More information about the wine-patches
mailing list