SDL: Added test code to validate SDL_WaitEventTimeout()

From 5ddd97062e7be666f793750e155afc12b2dd8ded Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 25 Jan 2024 06:29:15 -0800
Subject: [PATCH] Added test code to validate SDL_WaitEventTimeout()

You can enable this by defining TEST_WAITEVENTTIMEOUT
---
 test/testwm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/test/testwm.c b/test/testwm.c
index 24b5a0f05021..3e1a75978efe 100644
--- a/test/testwm.c
+++ b/test/testwm.c
@@ -154,7 +154,17 @@ static void loop(void)
 {
     int i;
     SDL_Event event;
-    /* Check for events */
+
+#ifdef TEST_WAITEVENTTIMEOUT
+    /* Wait up to 20 ms for input, as a test */
+    Uint64 then = SDL_GetTicks();
+    if (SDL_WaitEventTimeout(NULL, 20)) {
+        SDL_Log("Got an event!\n");
+    }
+    Uint64 now = SDL_GetTicks();
+    SDL_Log("Waited %d ms for events\n", (int)(now - then));
+#endif
+
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);