SDL: Set SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS for the virtual joystick test

From 504bce5187830c082cb8803fe9447b4fb45fcccc Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 9 Jan 2023 09:16:10 -0800
Subject: [PATCH] Set SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS for the virtual
 joystick test

---
 test/testautomation_joystick.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/testautomation_joystick.c b/test/testautomation_joystick.c
index 93a48b8c621f..37f21f79bdcd 100644
--- a/test/testautomation_joystick.c
+++ b/test/testautomation_joystick.c
@@ -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;