Commit 4989d872 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

xinput1_3/tests: Improve vibration tests.

Specially the part to disable the vibration after the test. Manually tested on Windows 8. Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 24dbd9de
...@@ -54,22 +54,35 @@ static void test_set_state(void) ...@@ -54,22 +54,35 @@ static void test_set_state(void)
{ {
ZeroMemory(&vibrator, sizeof(XINPUT_VIBRATION)); 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.wLeftMotorSpeed = 0;
vibrator.wRightMotorSpeed = 0; vibrator.wRightMotorSpeed = 0;
result = pXInputSetState(controllerNum, &vibrator); 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 /* Disabling XInput here, queueing a vibration and then re-enabling XInput
* is used to prove that vibrations are auto enabled when resuming 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); if (pXInputEnable) pXInputEnable(0);
Sleep(250);
vibrator.wLeftMotorSpeed = 65535; vibrator.wLeftMotorSpeed = 65535;
vibrator.wRightMotorSpeed = 65535; vibrator.wRightMotorSpeed = 65535;
result = pXInputSetState(controllerNum, &vibrator); 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); 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); result = pXInputSetState(XUSER_MAX_COUNT+1, &vibrator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment