Module: wine Branch: master Commit: 4989d8727f91c6b730c8be94fc5341d198c179cf URL: http://source.winehq.org/git/wine.git/?a=commit;h=4989d8727f91c6b730c8be94fc...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Fri Dec 9 05:26:08 2016 -0200
xinput1_3/tests: Improve vibration tests.
Specially the part to disable the vibration after the test. Manually tested on Windows 8.
Signed-off-by: Bruno Jesus 00cpxxx@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/xinput1_3/tests/xinput.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
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);