Rémi Bernon : dinput8/tests: Add some HID joystick IDirectInputDevice8_EnumCreatedEffectObjects tests.
Alexandre Julliard
julliard at winehq.org
Mon Oct 4 15:42:17 CDT 2021
Module: wine
Branch: master
Commit: b8d7d23893b681820224e5b30dda94f7e3d31619
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b8d7d23893b681820224e5b30dda94f7e3d31619
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Oct 4 09:51:28 2021 +0200
dinput8/tests: Add some HID joystick IDirectInputDevice8_EnumCreatedEffectObjects tests.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 aac0da88908..8e21639610a 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -3380,6 +3380,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"
@@ -4679,6 +4705,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 );
@@ -5056,6 +5091,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;
@@ -5075,6 +5111,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 );
}
More information about the wine-cvs
mailing list