tests: start memory tracking first + clean up cached text textures

This commit is contained in:
Anonymous Maarten 2024-07-27 13:44:04 +02:00
parent 6f1136c6ce
commit 3bfc103e76
6 changed files with 17 additions and 12 deletions

View File

@ -342,14 +342,15 @@ int main(int argc, char *argv[])
const char *color_cursor = NULL; const char *color_cursor = NULL;
SDL_Cursor *cursor; SDL_Cursor *cursor;
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize test framework */ /* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) { if (!state) {
return 1; return 1;
} }
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
for (i = 1; i < argc;) { for (i = 1; i < argc;) {
int consumed; int consumed;

View File

@ -14,7 +14,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_main.h> #include <SDL3/SDL_main.h>
#include <SDL3/SDL_test_common.h> #include <SDL3/SDL_test.h>
#ifdef SDL_PLATFORM_EMSCRIPTEN #ifdef SDL_PLATFORM_EMSCRIPTEN
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
@ -217,10 +217,6 @@ static void loop(void)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int i; int i;
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize parameters */ /* Initialize parameters */
num_objects = NUM_OBJECTS; num_objects = NUM_OBJECTS;
@ -229,6 +225,10 @@ int main(int argc, char *argv[])
if (!state) { if (!state) {
return 1; return 1;
} }
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
for (i = 1; i < argc;) { for (i = 1; i < argc;) {
int consumed; int consumed;
@ -309,6 +309,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
SDLTest_CleanupTextDrawing();
SDLTest_CommonQuit(state); SDLTest_CommonQuit(state);
return 0; return 0;

View File

@ -55,6 +55,7 @@ static void quit(int rc)
SDL_free(menus); SDL_free(menus);
menus = NULL; menus = NULL;
SDLTest_CleanupTextDrawing();
SDLTest_CommonQuit(state); SDLTest_CommonQuit(state);
/* Let 'main()' return normally */ /* Let 'main()' return normally */
if (rc != 0) { if (rc != 0) {

View File

@ -218,14 +218,15 @@ int main(int argc, char *argv[])
int frames; int frames;
Uint64 then, now; Uint64 then, now;
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize test framework */ /* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) { if (!state) {
return 1; return 1;
} }
/* Enable standard application logging */
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
for (i = 1; i < argc;) { for (i = 1; i < argc;) {
int consumed; int consumed;

View File

@ -221,6 +221,7 @@ int main(int argc, char *argv[])
} }
quit: quit:
SDLTest_CleanupTextDrawing();
SDLTest_CommonQuit(state); SDLTest_CommonQuit(state);
return 0; return 0;
} }

View File

@ -261,7 +261,7 @@ int main(int argc, char *argv[])
return_code = test_sdl_delay_within_bounds(); return_code = test_sdl_delay_within_bounds();
} }
SDLTest_CommonDestroyState(state);
SDL_Quit(); SDL_Quit();
SDLTest_CommonDestroyState(state);
return return_code; return return_code;
} }