Bruno Jesus : winmm/tests: Add a basic joystick interactive test.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 23 10:03:19 CDT 2015


Module: wine
Branch: master
Commit: 47ab17595b3b3fc2058ec1c033ccde9b765a2780
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=47ab17595b3b3fc2058ec1c033ccde9b765a2780

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Sun Mar 22 11:51:12 2015 -0300

winmm/tests: Add a basic joystick interactive test.

---

 dlls/winmm/tests/joystick.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/dlls/winmm/tests/joystick.c b/dlls/winmm/tests/joystick.c
index 21e90e3..2f235fa 100644
--- a/dlls/winmm/tests/joystick.c
+++ b/dlls/winmm/tests/joystick.c
@@ -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)




More information about the wine-cvs mailing list