update SDL3 to latest commit

This commit is contained in:
Sasha Szpakowski
2024-10-06 20:30:44 -03:00
parent 1b0fdc338b
commit 9e5eb1b018
1426 changed files with 242456 additions and 103496 deletions
+36 -16
View File
@@ -13,14 +13,14 @@
/**
* Call to SDL_GetRealtimeClock
*/
static int time_getRealtimeClock(void *arg)
static int SDLCALL time_getRealtimeClock(void *arg)
{
int result;
SDL_Time ticks;
result = SDL_GetCurrentTime(&ticks);
SDLTest_AssertPass("Call to SDL_GetRealtimeClockTicks()");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
return TEST_COMPLETED;
}
@@ -28,7 +28,7 @@ static int time_getRealtimeClock(void *arg)
/**
* Test bidirectional SDL_DateTime conversions.
*/
static int time_dateTimeConversion(void *arg)
static int SDLCALL time_dateTimeConversion(void *arg)
{
int result;
SDL_Time ticks[2];
@@ -36,9 +36,9 @@ static int time_dateTimeConversion(void *arg)
ticks[0] = JAN_1_2000_NS;
result = SDL_TimeToDateTime(ticks[0], &dt, SDL_FALSE);
result = SDL_TimeToDateTime(ticks[0], &dt, false);
SDLTest_AssertPass("Call to SDL_TimeToUTCDateTime()");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
SDLTest_AssertCheck(dt.year == 2000, "Check year value, expected 2000, got: %i", dt.year);
SDLTest_AssertCheck(dt.month == 1, "Check month value, expected 1, got: %i", dt.month);
SDLTest_AssertCheck(dt.day == 1, "Check day value, expected 1, got: %i", dt.day);
@@ -48,20 +48,20 @@ static int time_dateTimeConversion(void *arg)
result = SDL_DateTimeToTime(&dt, &ticks[1]);
SDLTest_AssertPass("Call to SDL_DateTimeToTime()");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = ticks[0] == ticks[1];
SDLTest_AssertCheck(result, "Check that original and converted SDL_Time values match: ticks0 = %" SDL_PRIs64 ", ticks1 = %" SDL_PRIs64, ticks[0], ticks[1]);
/* Local time unknown, so just verify success. */
result = SDL_TimeToDateTime(ticks[0], &dt, SDL_TRUE);
result = SDL_TimeToDateTime(ticks[0], &dt, true);
SDLTest_AssertPass("Call to SDL_TimeToLocalDateTime()");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
/* Convert back and verify result. */
result = SDL_DateTimeToTime(&dt, &ticks[1]);
SDLTest_AssertPass("Call to SDL_DateTimeToTime()");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = ticks[0] == ticks[1];
SDLTest_AssertCheck(result, "Check that original and converted SDL_Time values match: ticks0 = %" SDL_PRIs64 ", ticks1 = %" SDL_PRIs64, ticks[0], ticks[1]);
@@ -79,7 +79,7 @@ static int time_dateTimeConversion(void *arg)
result = SDL_DateTimeToTime(&dt, &ticks[1]);
SDLTest_AssertPass("Call to SDL_DateTimeToTime() (one day advanced)");
SDLTest_AssertCheck(result == 0, "Check result value, expected 0, got: %i", result);
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = (ticks[0] + (Sint64)SDL_SECONDS_TO_NS(86400)) == ticks[1];
SDLTest_AssertCheck(result, "Check that the difference is exactly 86400 seconds, got: %" SDL_PRIs64, (Sint64)SDL_NS_TO_SECONDS(ticks[1] - ticks[0]));
@@ -90,12 +90,12 @@ static int time_dateTimeConversion(void *arg)
dt.day = 1;
result = SDL_DateTimeToTime(&dt, &ticks[0]);
SDLTest_AssertPass("Call to SDL_DateTimeToTime() (year overflows an SDL_Time)");
SDLTest_AssertCheck(result == -1, "Check result value, expected -1, got: %i", result);
SDLTest_AssertCheck(result == false, "Check result value, expected false, got: %i", result);
dt.year = 1601;
result = SDL_DateTimeToTime(&dt, &ticks[0]);
SDLTest_AssertPass("Call to SDL_DateTimeToTime() (year underflows an SDL_Time)");
SDLTest_AssertCheck(result == -1, "Check result value, expected -1, got: %i", result);
SDLTest_AssertCheck(result == false, "Check result value, expected false, got: %i", result);
return TEST_COMPLETED;
}
@@ -103,7 +103,7 @@ static int time_dateTimeConversion(void *arg)
/**
* Test time utility functions.
*/
static int time_dateTimeUtilities(void *arg)
static int SDLCALL time_dateTimeUtilities(void *arg)
{
int result;
@@ -169,6 +169,26 @@ static int time_dateTimeUtilities(void *arg)
SDLTest_AssertPass("Call to SDL_TimeFromWindows()");
SDLTest_AssertCheck(ticks > 0 && ticks <= SDL_MAX_TIME, "Check result value, expected >0 && <=%" SDL_PRIs64 ", got: %" SDL_PRIs64, SDL_MAX_TIME, ticks);
/* Test time locale functions */
SDL_DateFormat dateFormat;
SDL_TimeFormat timeFormat;
result = SDL_GetDateTimeLocalePreferences(&dateFormat, &timeFormat);
SDLTest_AssertPass("Call to SDL_GetDateTimeLocalePreferences(&dateFormat, &timeFormat)");
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = SDL_GetDateTimeLocalePreferences(&dateFormat, NULL);
SDLTest_AssertPass("Call to SDL_GetDateTimeLocalePreferences(&dateFormat, NULL)");
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = SDL_GetDateTimeLocalePreferences(NULL, &timeFormat);
SDLTest_AssertPass("Call to SDL_GetDateTimeLocalePreferences(NULL, &timeFormat)");
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
result = SDL_GetDateTimeLocalePreferences(NULL, NULL);
SDLTest_AssertPass("Call to SDL_GetDateTimeLocalePreferences(NULL, NULL)");
SDLTest_AssertCheck(result == true, "Check result value, expected true, got: %i", result);
return TEST_COMPLETED;
}
@@ -176,15 +196,15 @@ static int time_dateTimeUtilities(void *arg)
/* Time test cases */
static const SDLTest_TestCaseReference timeTest1 = {
(SDLTest_TestCaseFp)time_getRealtimeClock, "time_getRealtimeClock", "Call to SDL_GetRealtimeClockTicks", TEST_ENABLED
time_getRealtimeClock, "time_getRealtimeClock", "Call to SDL_GetRealtimeClockTicks", TEST_ENABLED
};
static const SDLTest_TestCaseReference timeTest2 = {
(SDLTest_TestCaseFp)time_dateTimeConversion, "time_dateTimeConversion", "Call to SDL_TimeToDateTime/SDL_DateTimeToTime", TEST_ENABLED
time_dateTimeConversion, "time_dateTimeConversion", "Call to SDL_TimeToDateTime/SDL_DateTimeToTime", TEST_ENABLED
};
static const SDLTest_TestCaseReference timeTest3 = {
(SDLTest_TestCaseFp)time_dateTimeUtilities, "time_dateTimeUtilities", "Call to SDL_TimeToDateTime/SDL_DateTimeToTime", TEST_ENABLED
time_dateTimeUtilities, "time_dateTimeUtilities", "Call to SDL_TimeToDateTime/SDL_DateTimeToTime", TEST_ENABLED
};
/* Sequence of Timer test cases */