From 3fc4c48d1acd059ff4b403cd516d8c53decda650 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 5 Aug 2024 11:56:10 +0300
Subject: [PATCH] sync tests with latest SDL2.
---
test/testautomation_stdlib.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/test/testautomation_stdlib.c b/test/testautomation_stdlib.c
index ed9f13ea..969dd39b 100644
--- a/test/testautomation_stdlib.c
+++ b/test/testautomation_stdlib.c
@@ -62,6 +62,18 @@ int stdlib_snprintf(void *arg)
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
+ result = SDL_snprintf(text, sizeof(text), "%10sA", "foo");
+ expected = " fooA";
+ SDLTest_AssertPass("Call to SDL_snprintf(\"%%10sA\", \"foo\")");
+ SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
+ SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
+
+ result = SDL_snprintf(text, sizeof(text), "%-10sA", "foo");
+ expected = "foo A";
+ SDLTest_AssertPass("Call to SDL_snprintf(\"%%-10sA\", \"foo\")");
+ SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text);
+ SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result);
+
result = SDL_snprintf(text, sizeof(text), "%S", L"foo");
expected = "foo";
SDLTest_AssertPass("Call to SDL_snprintf(\"%%S\", \"foo\")");