Commit e69f27d2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput8/tests: Add some HID joystick IDirectInputDevice8_CreateEffect tests.

parent 6d7e5c71
...@@ -1578,6 +1578,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface ...@@ -1578,6 +1578,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect(LPDIRECTINPUTDEVICE8W iface
{ {
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
FIXME("(%p)->(%s,%p,%p,%p): stub!\n", This, debugstr_guid(rguid), lpeff, ppdef, pUnkOuter); 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"); FIXME("not available in the generic implementation\n");
*ppdef = NULL; *ppdef = NULL;
......
...@@ -3682,6 +3682,7 @@ static void test_simple_joystick(void) ...@@ -3682,6 +3682,7 @@ static void test_simple_joystick(void)
DIEFFECTINFOW effectinfo = {0}; DIEFFECTINFOW effectinfo = {0};
DIDATAFORMAT dataformat = {0}; DIDATAFORMAT dataformat = {0};
IDirectInputDevice8W *device; IDirectInputDevice8W *device;
IDirectInputEffect *effect;
DIEFFESCAPE escape = {0}; DIEFFESCAPE escape = {0};
DIDEVCAPS caps = {0}; DIDEVCAPS caps = {0};
IDirectInput8W *di; IDirectInput8W *di;
...@@ -4673,9 +4674,21 @@ static void test_simple_joystick(void) ...@@ -4673,9 +4674,21 @@ static void test_simple_joystick(void)
todo_wine todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); 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 ); hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); 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 ); hr = IDirectInputDevice8_Escape( device, NULL );
todo_wine todo_wine
ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr ); ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr );
...@@ -5051,6 +5064,30 @@ static BOOL test_device_types(void) ...@@ -5051,6 +5064,30 @@ static BOOL test_device_types(void)
return success; 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 ) static void test_force_feedback_joystick( void )
{ {
#include "psh_hid_macros.h" #include "psh_hid_macros.h"
...@@ -5797,6 +5834,8 @@ static void test_force_feedback_joystick( void ) ...@@ -5797,6 +5834,8 @@ static void test_force_feedback_joystick( void )
todo_wine todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SendDeviceData returned %#x\n", hr ); 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) ); set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) );
hr = IDirectInputDevice8_Unacquire( device ); hr = IDirectInputDevice8_Unacquire( device );
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr ); ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
......
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