summaryrefslogtreecommitdiff
path: root/test/testjoystick.c
diff options
context:
space:
mode:
authorRyan C. Gordon <icculus@icculus.org>2015-11-14 12:35:45 -0500
committerRyan C. Gordon <icculus@icculus.org>2015-11-14 12:35:45 -0500
commitdec3cc9a8ccd3630b4384d32277613b3ae70b41e (patch)
treef9681d9a162a85bcfe071408f4216b3cca5a4937 /test/testjoystick.c
parent714c88bde1c2ab0c0104006c2ae43d70c4cef314 (diff)
downloadsdl-dec3cc9a8ccd3630b4384d32277613b3ae70b41e.tar.gz
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
Diffstat (limited to 'test/testjoystick.c')
-rw-r--r--test/testjoystick.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/testjoystick.c b/test/testjoystick.c
index da9d96f99..7355eece3 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -265,6 +265,7 @@ main(int argc, char *argv[])
SDL_GetError());
} else {
char guid[64];
+ SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick),
guid, sizeof (guid));
SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick));
@@ -292,6 +293,9 @@ main(int argc, char *argv[])
device = atoi(argv[1]);
#endif
joystick = SDL_JoystickOpen(device);
+ if (joystick != NULL) {
+ SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
+ }
while ( keepGoing ) {
if (joystick == NULL) {
@@ -317,6 +321,9 @@ main(int argc, char *argv[])
keepGoing = SDL_FALSE;
} else if (event.type == SDL_JOYDEVICEADDED) {
joystick = SDL_JoystickOpen(device);
+ if (joystick != NULL) {
+ SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
+ }
break;
}
}