Skip to content

Commit bbc674b

Browse files
marcin-serwinslouken
authored andcommitted
test: Fix resource paths in testtray
Signed-off-by: Marcin Serwin <[email protected]>
1 parent 796961a commit bbc674b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ add_sdl_test_executable(testdialog SOURCES testdialog.c)
420420
add_sdl_test_executable(testtime SOURCES testtime.c)
421421
add_sdl_test_executable(testmanymouse SOURCES testmanymouse.c)
422422
add_sdl_test_executable(testmodal SOURCES testmodal.c)
423-
add_sdl_test_executable(testtray SOURCES testtray.c)
423+
add_sdl_test_executable(testtray NEEDS_RESOURCES TESTUTILS SOURCES testtray.c)
424424

425425

426426
add_sdl_test_executable(testprocess

test/testtray.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "testutils.h"
12
#include <SDL3/SDL.h>
23
#include <SDL3/SDL_main.h>
34
#include <SDL3/SDL_test.h>
@@ -520,14 +521,17 @@ int main(int argc, char **argv)
520521
goto quit;
521522
}
522523

523-
/* TODO: Resource paths? */
524-
SDL_Surface *icon = SDL_LoadBMP("../test/sdl-test_round.bmp");
524+
char *icon1filename = GetResourceFilename(NULL, "sdl-test_round.bmp");
525+
SDL_Surface *icon = SDL_LoadBMP(icon1filename);
526+
SDL_free(icon1filename);
525527

526528
if (!icon) {
527529
SDL_Log("Couldn't load icon 1, proceeding without: %s", SDL_GetError());
528530
}
529531

530-
SDL_Surface *icon2 = SDL_LoadBMP("../test/speaker.bmp");
532+
char *icon2filename = GetResourceFilename(NULL, "speaker.bmp");
533+
SDL_Surface *icon2 = SDL_LoadBMP(icon2filename);
534+
SDL_free(icon2filename);
531535

532536
if (!icon2) {
533537
SDL_Log("Couldn't load icon 2, proceeding without: %s", SDL_GetError());

0 commit comments

Comments
 (0)