Merge commit '504bce5187830c082cb8803fe9447b4fb45fcccc' into main

main
Sam Lantinga 2023-01-10 10:18:19 -08:00
commit f393f65104
1 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,8 @@ TestVirtualJoystick(void *arg)
SDLTest_AssertCheck(SDL_InitSubSystem(SDL_INIT_GAMEPAD) == 0, "SDL_InitSubSystem(SDL_INIT_GAMEPAD)");
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
SDL_zero(desc);
desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION;
desc.type = SDL_JOYSTICK_TYPE_GAMEPAD;
@ -54,6 +56,7 @@ TestVirtualJoystick(void *arg)
SDL_UpdateJoysticks();
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_GAMEPAD_BUTTON_A) == SDL_PRESSED, "SDL_GetJoystickButton(SDL_GAMEPAD_BUTTON_A) == SDL_PRESSED");
SDLTest_AssertCheck(SDL_SetJoystickVirtualButton(joystick, SDL_GAMEPAD_BUTTON_A, SDL_RELEASED) == 0, "SDL_SetJoystickVirtualButton(SDL_GAMEPAD_BUTTON_A, SDL_RELEASED)");
SDL_UpdateJoysticks();
SDLTest_AssertCheck(SDL_GetJoystickButton(joystick, SDL_GAMEPAD_BUTTON_A) == SDL_RELEASED, "SDL_GetJoystickButton(SDL_GAMEPAD_BUTTON_A) == SDL_RELEASED");
@ -63,6 +66,8 @@ TestVirtualJoystick(void *arg)
}
SDLTest_AssertCheck(!SDL_IsJoystickVirtual(device_id), "!SDL_IsJoystickVirtual()");
SDL_ResetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS);
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
return TEST_COMPLETED;