diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index b45628ff2..f58316ec0 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1630,19 +1630,23 @@ static void SDLTest_PrintEvent(SDL_Event *event) } break; case SDL_KEYDOWN: - SDL_Log("SDL EVENT: Keyboard: key pressed in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s", + case SDL_KEYUP: { + char modstr[64]; + if (event->key.keysym.mod) { + modstr[0] = '\0'; + SDLTest_PrintModState(modstr, sizeof (modstr), event->key.keysym.mod); + } else { + SDL_strlcpy(modstr, "NONE", sizeof (modstr)); + } + SDL_Log("SDL EVENT: Keyboard: key %s in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s, mods = %s", + (event->type == SDL_KEYDOWN) ? "pressed" : "released", event->key.windowID, event->key.keysym.scancode, SDL_GetScancodeName(event->key.keysym.scancode), - event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); - break; - case SDL_KEYUP: - SDL_Log("SDL EVENT: Keyboard: key released in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s", - event->key.windowID, - event->key.keysym.scancode, - SDL_GetScancodeName(event->key.keysym.scancode), - event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); + event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym), + modstr); break; + } case SDL_TEXTEDITING: SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %" SDL_PRIu32, event->edit.text, event->edit.windowID);