Skip to content

Commit 12f4178

Browse files
committed
Add TEST_SKIPPED when SDL_JOYSTICK_VIRTUAL is not defined
[sdl-ci-filter cygwin] [sdl-ci-filter msys2-*] [sdl-ci-filter msvc-*] [sdl-ci-filter ngage]
1 parent d98661f commit 12f4178

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testautomation_joystick.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include <SDL3/SDL_test.h>
77
#include "../src/joystick/usb_ids.h"
88
#include "testautomation_suites.h"
9+
#ifdef HAVE_BUILD_CONFIG
10+
#include "SDL_build_config.h"
11+
#endif
912

1013
/* ================= Test Case Implementation ================== */
1114

@@ -36,6 +39,10 @@ static void SDLCALL joystickTearDown(void *arg)
3639
*/
3740
static int SDLCALL joystick_testVirtual(void *arg)
3841
{
42+
#ifndef SDL_JOYSTICK_VIRTUAL
43+
SDLTest_AssertPass("The joystick_testVirtual test requires SDL_JOYSTICK_VIRTUAL to be defined");
44+
return TEST_SKIPPED;
45+
#else
3946
SDL_VirtualJoystickDesc desc;
4047
SDL_Joystick *joystick = NULL;
4148
SDL_Gamepad *gamepad = NULL;
@@ -207,13 +214,18 @@ static int SDLCALL joystick_testVirtual(void *arg)
207214
SDLTest_AssertCheck(!SDL_IsJoystickVirtual(device_id), "!SDL_IsJoystickVirtual()");
208215

209216
return TEST_COMPLETED;
217+
#endif // SDL_JOYSTICK_VIRTUAL
210218
}
211219

212220
/**
213221
* Check gamepad mappings
214222
*/
215223
static int SDLCALL joystick_testMappings(void *arg)
216224
{
225+
#ifndef SDL_JOYSTICK_VIRTUAL
226+
SDLTest_AssertPass("The joystick_testMappings test requires SDL_JOYSTICK_VIRTUAL to be defined");
227+
return TEST_SKIPPED;
228+
#else
217229
SDL_VirtualJoystickDesc desc;
218230
SDL_Gamepad *gamepad = NULL;
219231
SDL_JoystickID device_id;
@@ -277,6 +289,7 @@ static int SDLCALL joystick_testMappings(void *arg)
277289
SDLTest_AssertCheck(SDL_DetachVirtualJoystick(device_id), "SDL_DetachVirtualJoystick()");
278290

279291
return TEST_COMPLETED;
292+
#endif // SDL_JOYSTICK_VIRTUAL
280293
}
281294

282295
/* ================= Test References ================== */

0 commit comments

Comments
 (0)