mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 13:39:11 +00:00
Implemented left-justification in SDL_PrintString()
Fixes https://github.com/libsdl-org/SDL/issues/10310
This commit is contained in:
parent
6212497ea3
commit
f59d66f4b1
2 changed files with 29 additions and 9 deletions
|
@ -150,6 +150,18 @@ static 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\")");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue