Module: wine Branch: master Commit: 5e59d093a2442b37ce0571b1e6a99614ecd4b60c URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e59d093a2442b37ce0571b1e6...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Thu Jan 26 17:07:05 2017 -0200
dinput/tests: Add tests for DISFFC_STOPALL, DISFFC_RESET and GetEffectStatus.
Requires a FF-enabled joystick to test.
Signed-off-by: Bruno Jesus 00cpxxx@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput/tests/joystick.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index fc267a5..b4ffba5 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -739,6 +739,46 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr); ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+ /* Test SendForceFeedbackCommand + * DISFFC_STOPALL - Should stop effects only + * DISFFC_RESET - Should stop effects and unload them (NOT release them) + * Tests for game Odallus (bug 41623) */ + hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, 0); + ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr); + hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, 0xFF); + ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr); + + hr = IDirectInputEffect_Download(effect); + ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %08x\n", hr); + + /* Send STOPALL and prove that the effect can still be started */ + hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, DISFFC_STOPALL); + ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr); + hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); + ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr); + ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n"); + hr = IDirectInputEffect_Start(effect, 1, 0); + ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %08x\n", hr); + hr = IDirectInputEffect_GetEffectGuid(effect, &guid); + ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %08x\n", hr); + ok(IsEqualGUID(&effect_data.guid, &guid), "Wrong guid returned\n"); + + /* Send RESET and prove that we can still manipulate the effect, thus not released */ + hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, DISFFC_RESET); + ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr); + hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); + ok(hr==DIERR_NOTDOWNLOADED,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr); + hr = IDirectInputEffect_Download(effect); + ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %08x\n", hr); + hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status); + ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr); + ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n"); + hr = IDirectInputEffect_Start(effect, 1, 0); + ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %08x\n", hr); + hr = IDirectInputEffect_GetEffectGuid(effect, &guid); + ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %08x\n", hr); + ok(IsEqualGUID(&effect_data.guid, &guid), "Wrong guid returned\n"); + ref = IUnknown_Release(effect); ok(ref == 0, "IDirectInputDevice_Release() reference count = %d\n", ref); }