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

dinput/tests: Test SaveActionMap effect on DIPROP_APPDATA property.

parent 2656e418
...@@ -734,6 +734,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ...@@ -734,6 +734,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
.dwHow = DIPH_DEVICE, .dwHow = DIPH_DEVICE,
} }
}; };
DIPROPPOINTER prop_pointer =
{
.diph =
{
.dwHeaderSize = sizeof(DIPROPHEADER),
.dwSize = sizeof(DIPROPPOINTER),
}
};
DIACTIONW actions[ARRAY_SIZE(expect_actions)]; DIACTIONW actions[ARRAY_SIZE(expect_actions)];
DIACTIONFORMATW action_format; DIACTIONFORMATW action_format;
WCHAR username[256]; WCHAR username[256];
...@@ -885,6 +893,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ...@@ -885,6 +893,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr ); ok( hr == DI_OK, "SetActionMap returned %#lx\n", hr );
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC);
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
ok( prop_pointer.uData == 0, "got uData %#Ix\n", prop_pointer.uData );
/* saving action map actually does nothing */ /* saving action map actually does nothing */
action_format = action_format_2_filled; action_format = action_format_2_filled;
...@@ -903,6 +919,34 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ...@@ -903,6 +919,34 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled ); check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2_filled, actions_todos_2_filled );
prop_pointer.diph.dwHow = DIPH_DEVICE;
prop_pointer.diph.dwObj = 0;
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
ok( hr == DIERR_UNSUPPORTED, "GetProperty returned %#lx\n", hr );
prop_pointer.diph.dwHow = DIPH_BYID;
prop_pointer.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 3 );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DIERR_NOTFOUND, "GetProperty returned %#lx\n", hr );
prop_pointer.diph.dwHow = DIPH_BYID;
prop_pointer.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( prop_pointer.uData == 6, "got uData %#Ix\n", prop_pointer.uData );
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC);
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData );
action_format = action_format_2; action_format = action_format_2;
action_format.rgoAction = actions; action_format.rgoAction = actions;
memcpy( actions, default_actions, sizeof(default_actions) ); memcpy( actions, default_actions, sizeof(default_actions) );
...@@ -925,6 +969,28 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e ...@@ -925,6 +969,28 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e
check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 ); check_diactionformatw_( __LINE__, &action_format, &expect_action_format_2, actions_todos_2 );
/* setting the data format resets action map */
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC);
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( prop_pointer.uData == 8, "got uData %#Ix\n", prop_pointer.uData );
hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr );
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC);
hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
todo_wine
ok( hr == DI_OK, "GetProperty returned %#lx\n", hr );
todo_wine
ok( prop_pointer.uData == -1, "got uData %#Ix\n", prop_pointer.uData );
/* DIDSAM_NOUSER flag clears the device user property */ /* DIDSAM_NOUSER flag clears the device user property */
memset( prop_username.wsz, 0, sizeof(prop_username.wsz) ); memset( prop_username.wsz, 0, sizeof(prop_username.wsz) );
......
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