Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 6bf887e4c7a..cc2f3268e6f 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3422,6 +3422,32 @@ static BOOL CALLBACK check_effect_count( const DIEFFECTINFOW *effect, void *args return DIENUM_CONTINUE; }
+static BOOL CALLBACK check_no_created_effect_objects( IDirectInputEffect *effect, void *context ) +{ + ok( 0, "unexpected effect %p\n", effect ); + return DIENUM_CONTINUE; +} + +struct check_created_effect_params +{ + IDirectInputEffect *expect_effect; + DWORD count; +}; + +static BOOL CALLBACK check_created_effect_objects( IDirectInputEffect *effect, void *context ) +{ + struct check_created_effect_params *params = context; + ULONG ref; + + ok( effect == params->expect_effect, "got effect %p, expected %p\n", effect, params->expect_effect ); + params->count++; + + IDirectInputEffect_AddRef( effect ); + ref = IDirectInputEffect_Release( effect ); + ok( ref == 1, "got ref %u, expected 1\n", ref ); + return DIENUM_CONTINUE; +} + static void test_simple_joystick(void) { #include "psh_hid_macros.h" @@ -4721,6 +4747,15 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL ); ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_CreateEffect returned %#x\n", hr );
+ hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, NULL, effect, 0 ); + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, (void *)0xdeadbeef, 0 ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + hr = IDirectInputDevice8_Escape( device, NULL ); todo_wine ok( hr == E_POINTER, "IDirectInputDevice8_Escape returned: %#x\n", hr ); @@ -5098,6 +5133,7 @@ static BOOL test_device_types(void)
static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) { + struct check_created_effect_params check_params = {0}; IDirectInputEffect *effect; HRESULT hr; ULONG ref; @@ -5117,6 +5153,16 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( hr == DI_OK, "IDirectInputDevice8_CreateEffect returned %#x\n", hr ); if (hr != DI_OK) return;
+ hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + check_params.expect_effect = effect; + hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_created_effect_objects, &check_params, 0 ); + todo_wine + ok( hr == DI_OK, "IDirectInputDevice8_EnumCreatedEffectObjects returned %#x\n", hr ); + todo_wine + ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count ); + ref = IDirectInputEffect_Release( effect ); ok( ref == 0, "IDirectInputDeviceW_Release returned %d\n", ref ); }