SDL: test: Fix resource paths in testtray (ad57c)

From ad57c6ea37f23a011e9d2feae73d561b6eb14325 Mon Sep 17 00:00:00 2001
From: Marcin Serwin <[EMAIL REDACTED]>
Date: Sun, 22 Jun 2025 12:42:55 +0200
Subject: [PATCH] test: Fix resource paths in testtray

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
(cherry picked from commit bbc674b9e78c3b6f71c7f5d6f94f06dc7bccc2c2)
---
 test/CMakeLists.txt |  2 +-
 test/testtray.c     | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3be04e215e5ee..8bf5c25a46079 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -411,7 +411,7 @@ add_sdl_test_executable(testdialog SOURCES testdialog.c)
 add_sdl_test_executable(testtime SOURCES testtime.c)
 add_sdl_test_executable(testmanymouse SOURCES testmanymouse.c)
 add_sdl_test_executable(testmodal SOURCES testmodal.c)
-add_sdl_test_executable(testtray SOURCES testtray.c)
+add_sdl_test_executable(testtray NEEDS_RESOURCES TESTUTILS SOURCES testtray.c)
 
 
 add_sdl_test_executable(testprocess
diff --git a/test/testtray.c b/test/testtray.c
index fdb12daf28d72..8046d60c39acd 100644
--- a/test/testtray.c
+++ b/test/testtray.c
@@ -1,3 +1,4 @@
+#include "testutils.h"
 #include <SDL3/SDL.h>
 #include <SDL3/SDL_main.h>
 #include <SDL3/SDL_test.h>
@@ -520,14 +521,17 @@ int main(int argc, char **argv)
         goto quit;
     }
 
-    /* TODO: Resource paths? */
-    SDL_Surface *icon = SDL_LoadBMP("../test/sdl-test_round.bmp");
+    char *icon1filename = GetResourceFilename(NULL, "sdl-test_round.bmp");
+    SDL_Surface *icon = SDL_LoadBMP(icon1filename);
+    SDL_free(icon1filename);
 
     if (!icon) {
         SDL_Log("Couldn't load icon 1, proceeding without: %s", SDL_GetError());
     }
 
-    SDL_Surface *icon2 = SDL_LoadBMP("../test/speaker.bmp");
+    char *icon2filename = GetResourceFilename(NULL, "speaker.bmp");
+    SDL_Surface *icon2 = SDL_LoadBMP(icon2filename);
+    SDL_free(icon2filename);
 
     if (!icon2) {
         SDL_Log("Couldn't load icon 2, proceeding without: %s", SDL_GetError());