Skip to content

Commit 61a8533

Browse files
smcvslouken
authored andcommitted
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 <[email protected]>
1 parent cc236e2 commit 61a8533

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/testanimation.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,15 @@ static int SDLCALL testDecodeThirdPartyMetadata(void *args)
803803
return TEST_SKIPPED;
804804
}
805805

806-
IMG_AnimationDecoder *thirdPartyDecoder = IMG_CreateAnimationDecoder("rgbrgb_thirdpartymetadata.webp");
806+
const char *inputImage = "rgbrgb_thirdpartymetadata.webp";
807+
char *inputImagePath = GetTestFilename(inputImage);
808+
if (!inputImagePath) {
809+
SDLTest_LogError("Failed to convert '%s' to absolute path", inputImage);
810+
return TEST_ABORTED;
811+
}
812+
IMG_AnimationDecoder *thirdPartyDecoder = IMG_CreateAnimationDecoder(inputImagePath);
807813
SDLTest_AssertCheck(thirdPartyDecoder != NULL, "IMG_CreateAnimationDecoder");
814+
SDL_free(inputImagePath);
808815
if (thirdPartyDecoder) {
809816
SDL_PropertiesID thirdPartyMetadata = IMG_GetAnimationDecoderProperties(thirdPartyDecoder);
810817
SDLTest_AssertCheck(thirdPartyMetadata != 0, "IMG_GetAnimationDecoderProperties");

0 commit comments

Comments
 (0)