SDL_image: testanimation: Load webp data from test directory if necessary

From 61a85332a1f2adf26e8ac33632c42ece0b68026c Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Sat, 17 Jan 2026 00:58:35 +0000
Subject: [PATCH] testanimation: Load webp data from test directory if
 necessary

When running "as-installed" tests from /usr/libexec/installed-tests, the
resource files are not necessarily in the current working directory.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 test/testanimation.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/testanimation.c b/test/testanimation.c
index 4dee20d9..89185bdc 100644
--- a/test/testanimation.c
+++ b/test/testanimation.c
@@ -803,8 +803,15 @@ static int SDLCALL testDecodeThirdPartyMetadata(void *args)
         return TEST_SKIPPED;
     }
 
-    IMG_AnimationDecoder *thirdPartyDecoder = IMG_CreateAnimationDecoder("rgbrgb_thirdpartymetadata.webp");
+    const char *inputImage = "rgbrgb_thirdpartymetadata.webp";
+    char *inputImagePath = GetTestFilename(inputImage);
+    if (!inputImagePath) {
+        SDLTest_LogError("Failed to convert '%s' to absolute path", inputImage);
+        return TEST_ABORTED;
+    }
+    IMG_AnimationDecoder *thirdPartyDecoder = IMG_CreateAnimationDecoder(inputImagePath);
     SDLTest_AssertCheck(thirdPartyDecoder != NULL, "IMG_CreateAnimationDecoder");
+    SDL_free(inputImagePath);
     if (thirdPartyDecoder) {
         SDL_PropertiesID thirdPartyMetadata = IMG_GetAnimationDecoderProperties(thirdPartyDecoder);
         SDLTest_AssertCheck(thirdPartyMetadata != 0, "IMG_GetAnimationDecoderProperties");