test/testgamecontroller.c
changeset 9916 9429bc102632
parent 9876 1496e502e51d
child 9922 b066d5fd5fa7
     1.1 --- a/test/testgamecontroller.c	Sat Nov 14 04:24:39 2015 -0400
     1.2 +++ b/test/testgamecontroller.c	Sat Nov 14 12:35:45 2015 -0500
     1.3 @@ -291,6 +291,11 @@
     1.4                                        guid, sizeof (guid));
     1.5              SDL_Log("Attempting to open device %i, guid %s\n", device, guid);
     1.6              gamecontroller = SDL_GameControllerOpen(device);
     1.7 +
     1.8 +            if (gamecontroller != NULL) {
     1.9 +                SDL_assert(SDL_GameControllerFromInstanceID(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller))) == gamecontroller);
    1.10 +            }
    1.11 +
    1.12              while (keepGoing) {
    1.13                  if (gamecontroller == NULL) {
    1.14                      if (!reportederror) {
    1.15 @@ -316,6 +321,9 @@
    1.16                          keepGoing = SDL_FALSE;
    1.17                      } else if (event.type == SDL_CONTROLLERDEVICEADDED) {
    1.18                          gamecontroller = SDL_GameControllerOpen(event.cdevice.which);
    1.19 +                        if (gamecontroller != NULL) {
    1.20 +                            SDL_assert(SDL_GameControllerFromInstanceID(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller))) == gamecontroller);
    1.21 +                        }
    1.22                          break;
    1.23                      }
    1.24                  }