SDL: testautomation: Added a test to stdlib_swprintf that previously would fail.

From 6a0405b933358ecabc2f7852bb9b462fcb3befef Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 5 Jan 2025 02:44:35 -0500
Subject: [PATCH] testautomation: Added a test to stdlib_swprintf that
 previously would fail.

---
 test/testautomation_stdlib.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c
index 26317584f19bc..3073510604a04 100644
--- a/test/testautomation_stdlib.c
+++ b/test/testautomation_stdlib.c
@@ -386,6 +386,22 @@ static int SDLCALL stdlib_swprintf(void *arg)
     const wchar_t *expected;
     size_t size;
 
+    result = SDL_swprintf(text, SDL_arraysize(text), L"%s", "hello, world");
+    expected = L"hello, world";
+    SDLTest_AssertPass("Call to SDL_swprintf(\"%%s\", \"hello, world\")");
+    SDLTest_AssertCheck(SDL_wcscmp(text, expected) == 0, "Check text, expected: %S, got: %S", expected, text);
+    SDLTest_AssertCheck(result == SDL_wcslen(text), "Check result value, expected: %d, got: %d", (int)SDL_wcslen(text), result);
+
+    result = SDL_swprintf(text, 2, L"%s", "hello, world");
+    expected = L"h";
+    SDLTest_AssertPass("Call to SDL_swprintf(\"%%s\", \"hello, world\") with buffer size 2");
+    SDLTest_AssertCheck(SDL_wcscmp(text, expected) == 0, "Check text, expected: %S, got: %S", expected, text);
+    SDLTest_AssertCheck(result == 12, "Check result value, expected: 12, got: %d", result);
+
+    result = SDL_swprintf(NULL, 0, L"%s", "hello, world");
+    SDLTest_AssertPass("Call to SDL_swprintf(NULL, 0, \"%%s\", \"hello, world\")");
+    SDLTest_AssertCheck(result == 12, "Check result value, expected: 12, got: %d", result);
+
     result = SDL_swprintf(text, SDL_arraysize(text), L"%s", "foo");
     expected = L"foo";
     SDLTest_AssertPass("Call to SDL_swprintf(\"%%s\", \"foo\")");