dinput8/tests: Add some HID joystick IDirectInputDevice8_CreateEffect tests.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-30 10:37:41 +02:00 committed by Alexandre Julliard
parent 6d7e5c714b
commit e69f27d2ee
2 changed files with 40 additions and 0 deletions

View File

@ -1578,6 +1578,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface
{
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
FIXME("(%p)->(%s,%p,%p,%p): stub!\n", This, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter);
if (!ppdef) return E_POINTER;
FIXME("not available in the generic implementation\n");
*ppdef = NULL;

View File

@ -3682,6 +3682,7 @@ static void test_simple_joystick(void)
DIEFFECTINFOW effectinfo = {0};
DIDATAFORMAT dataformat = {0};
IDirectInputDevice8W *device;
IDirectInputEffect *effect;
DIEFFESCAPE escape = {0};
DIDEVCAPS caps = {0};
IDirectInput8W *di;
@ -4673,9 +4674,21 @@ static void test_simple_joystick(void)
todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL );
ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_Escape( device, NULL );
todo_wine
ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr );
@ -5051,6 +5064,30 @@ static BOOL test_device_types(void)
return success;
}
static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file )
{
IDirectInputEffect *effect;
HRESULT hr;
ULONG ref;
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL );
ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL );
todo_wine
ok( hr == E_POINTER, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL );
todo_wine
ok( hr == DIERR_DEVICENOTREG, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
todo_wine
ok( hr == DI_OK, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
if (hr != DI_OK) return;
ref = IDirectInputEffect_Release( effect );
ok( ref == 0, "IDirectInputDeviceW_Release returned %d\n", ref );
}
static void test_force_feedback_joystick( void )
{
#include "psh_hid_macros.h"
@ -5797,6 +5834,8 @@ static void test_force_feedback_joystick( void )
todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr );
test_periodic_effect( device, file );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) );
hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );