update SDL3 from 3.2.20 to 3.4.2

This commit is contained in:
Sven Balzer
2026-04-01 18:25:03 +02:00
parent 1daf4d79f1
commit 05b19704f8
1626 changed files with 124218 additions and 191491 deletions
+29 -31
View File
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -25,28 +25,7 @@
*/
#include <SDL3/SDL_test.h>
/* Enable to have color in logs */
#if 1
#define COLOR_RED "\033[0;31m"
#define COLOR_GREEN "\033[0;32m"
#define COLOR_YELLOW "\033[0;93m"
#define COLOR_BLUE "\033[0;94m"
#define COLOR_END "\033[0m"
#else
#define COLOR_RED ""
#define COLOR_GREEN ""
#define COLOR_BLUE ""
#define COLOR_YELLOW ""
#define COLOR_END ""
#endif
/* Assert check message format */
#define SDLTEST_ASSERT_CHECK_FORMAT "Assert '%s': %s"
/* Assert summary message format */
#define SDLTEST_ASSERT_SUMMARY_FORMAT "Assert Summary: Total=%d " COLOR_GREEN "Passed=%d" COLOR_END " " COLOR_RED "Failed=%d" COLOR_END
#define SDLTEST_ASSERT_SUMMARY_FORMAT_OK "Assert Summary: Total=%d " COLOR_GREEN "Passed=%d" COLOR_END " " COLOR_GREEN "Failed=%d" COLOR_END
#include "SDL_test_internal.h"
/* ! counts the failed asserts */
static int SDLTest_AssertsFailed = 0;
@@ -54,6 +33,24 @@ static int SDLTest_AssertsFailed = 0;
/* ! counts the passed asserts */
static int SDLTest_AssertsPassed = 0;
static void SDLTest_LogAssertMessage(bool success, const char *assertion)
{
SDL_LogPriority priority;
const char *color;
const char *message;
if (success) {
priority = SDL_LOG_PRIORITY_INFO;
color = COLOR_GREEN;
message = "Passed";
} else {
priority = SDL_LOG_PRIORITY_ERROR;
color = COLOR_RED;
message = "Failed";
}
SDLTest_LogMessage(priority, "Assert '%s': %s%s%s", assertion, color, message, COLOR_END);
}
/*
* Assert that logs and break execution flow on failures (i.e. for harness errors).
*/
@@ -89,10 +86,10 @@ int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char
/* Log pass or fail message */
if (assertCondition == ASSERT_FAIL) {
SDLTest_AssertsFailed++;
SDLTest_LogError(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, COLOR_RED "Failed" COLOR_END);
SDLTest_LogAssertMessage(false, logMessage);
} else {
SDLTest_AssertsPassed++;
SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, COLOR_GREEN "Passed" COLOR_END);
SDLTest_LogAssertMessage(true, logMessage);
}
return assertCondition;
@@ -114,7 +111,7 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,
/* Log pass message */
SDLTest_AssertsPassed++;
SDLTest_Log(SDLTEST_ASSERT_CHECK_FORMAT, logMessage, COLOR_GREEN "Passed" COLOR_END);
SDLTest_LogAssertMessage(true, logMessage);
}
/*
@@ -133,11 +130,12 @@ void SDLTest_ResetAssertSummary(void)
void SDLTest_LogAssertSummary(void)
{
int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
if (SDLTest_AssertsFailed == 0) {
SDLTest_Log(SDLTEST_ASSERT_SUMMARY_FORMAT_OK, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
} else {
SDLTest_LogError(SDLTEST_ASSERT_SUMMARY_FORMAT, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
}
bool success = SDLTest_AssertsFailed == 0;
SDLTest_LogMessage(success ? SDL_LOG_PRIORITY_INFO : SDL_LOG_PRIORITY_ERROR,
"Assert Summary: Total=%d " "%s" "Passed=%d" "%s" " " "%s" "Failed=%d" "%s",
totalAsserts, COLOR_GREEN, SDLTest_AssertsPassed, COLOR_END,
success ? COLOR_GREEN : COLOR_RED, SDLTest_AssertsFailed, COLOR_END);
}
/*