xinput1_3/tests: Improve vibration tests
Bruno Jesus
00cpxxx at gmail.com
Fri Dec 9 01:26:08 CST 2016
Specially the part to disable the vibration after the test. Manually
tested on Windows 8.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
-------------- next part --------------
diff --git a/dlls/xinput1_3/tests/xinput.c b/dlls/xinput1_3/tests/xinput.c
index eb0bab3..0deab26 100644
--- a/dlls/xinput1_3/tests/xinput.c
+++ b/dlls/xinput1_3/tests/xinput.c
@@ -54,22 +54,35 @@ static void test_set_state(void)
{
ZeroMemory(&vibrator, sizeof(XINPUT_VIBRATION));
+ vibrator.wLeftMotorSpeed = 32767;
+ vibrator.wRightMotorSpeed = 32767;
+ result = pXInputSetState(controllerNum, &vibrator);
+ if (result == ERROR_DEVICE_NOT_CONNECTED) continue;
+
+ Sleep(250);
vibrator.wLeftMotorSpeed = 0;
vibrator.wRightMotorSpeed = 0;
result = pXInputSetState(controllerNum, &vibrator);
- ok(result == ERROR_SUCCESS || result == ERROR_DEVICE_NOT_CONNECTED, "XInputSetState failed with (%d)\n", result);
+ ok(result == ERROR_SUCCESS, "XInputSetState failed with (%d)\n", result);
/* Disabling XInput here, queueing a vibration and then re-enabling XInput
* is used to prove that vibrations are auto enabled when resuming XInput.
- * If XInputEnable is removed the vibration will never play. */
+ * If XInputEnable(1) is removed below the vibration will never play. */
if (pXInputEnable) pXInputEnable(0);
+ Sleep(250);
vibrator.wLeftMotorSpeed = 65535;
vibrator.wRightMotorSpeed = 65535;
result = pXInputSetState(controllerNum, &vibrator);
- ok(result == ERROR_SUCCESS || result == ERROR_DEVICE_NOT_CONNECTED, "XInputSetState failed with (%d)\n", result);
+ ok(result == ERROR_SUCCESS, "XInputSetState failed with (%d)\n", result);
if (pXInputEnable) pXInputEnable(1);
+ Sleep(250);
+
+ vibrator.wLeftMotorSpeed = 0;
+ vibrator.wRightMotorSpeed = 0;
+ result = pXInputSetState(controllerNum, &vibrator);
+ ok(result == ERROR_SUCCESS, "XInputSetState failed with (%d)\n", result);
}
result = pXInputSetState(XUSER_MAX_COUNT+1, &vibrator);
More information about the wine-patches
mailing list