test/testjoystick.c
changeset 9916 9429bc102632
parent 9876 1496e502e51d
child 9922 b066d5fd5fa7
     1.1 --- a/test/testjoystick.c	Sat Nov 14 04:24:39 2015 -0400
     1.2 +++ b/test/testjoystick.c	Sat Nov 14 12:35:45 2015 -0500
     1.3 @@ -265,6 +265,7 @@
     1.4                      SDL_GetError());
     1.5          } else {
     1.6              char guid[64];
     1.7 +            SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
     1.8              SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick),
     1.9                                        guid, sizeof (guid));
    1.10              SDL_Log("       axes: %d\n", SDL_JoystickNumAxes(joystick));
    1.11 @@ -292,6 +293,9 @@
    1.12          device = atoi(argv[1]);
    1.13  #endif
    1.14          joystick = SDL_JoystickOpen(device);
    1.15 +        if (joystick != NULL) {
    1.16 +            SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
    1.17 +        }
    1.18  
    1.19          while ( keepGoing ) {
    1.20              if (joystick == NULL) {
    1.21 @@ -317,6 +321,9 @@
    1.22                      keepGoing = SDL_FALSE;
    1.23                  } else if (event.type == SDL_JOYDEVICEADDED) {
    1.24                      joystick = SDL_JoystickOpen(device);
    1.25 +                    if (joystick != NULL) {
    1.26 +                        SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
    1.27 +                    }
    1.28                      break;
    1.29                  }
    1.30              }