# SDL\_image: test: Enable automated test for TGA format

**URL:** <https://discourse.libsdl.org/t/sdl-image-test-enable-automated-test-for-tga-format/36493>\
**Category:** SDL Commits\
**Created:** [May 25, 2022, 3:02pm UTC](https://discourse.libsdl.org/t/sdl-image-test-enable-automated-test-for-tga-format/36493 "2022-05-25T15:02:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [May 25, 2022, 3:02pm UTC](https://discourse.libsdl.org/t/sdl-image-test-enable-automated-test-for-tga-format/36493/1 "2022-05-25T15:02:07Z")

</div>

> <https://github.com/libsdl-org/SDL_image/commit/6491dda8ecfcc5e1d3a470c6e6fb9dc92b5fa323>
>
> SDL\_image currently has no way to recognise this format from content,
> only from …filename. Other than that, it's the same as any other format.
> 
> Signed-off-by: Simon McVittie \<smcv@collabora.com\>

```diff
From 6491dda8ecfcc5e1d3a470c6e6fb9dc92b5fa323 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Wed, 25 May 2022 15:09:06 +0100
Subject: [PATCH] test: Enable automated test for TGA format

SDL_image currently has no way to recognise this format from content,
only from filename. Other than that, it's the same as any other format.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 test/main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/main.c b/test/main.c
index 703f219a..05875ba6 100644
--- a/test/main.c
+++ b/test/main.c
@@ -381,7 +381,6 @@ static const Format formats[] =
         IMG_isSVG,
         IMG_LoadSVG_RW,
     },
-#if 0
     {
         "TGA",
         "sample.tga",
@@ -399,7 +398,6 @@ static const Format formats[] =
         NULL,
         IMG_LoadTGA_RW,
     },
-#endif
     {
         "TIF",
         "sample.tif",
@@ -911,7 +909,13 @@ FormatTest(const Format *format)
             FormatLoadTest(format, LOAD_SIZED);
         } else {
             FormatLoadTest(format, LOAD_CONVENIENCE);
- FormatLoadTest(format, LOAD_RW);
+
+ if (strcmp(format->name, "TGA") == 0) {
+ SDLTest_Log("SKIP: Recognising %s by magic number is not supported", format->name);
+ } else {
+ FormatLoadTest(format, LOAD_RW);
+ }
+
             FormatLoadTest(format, LOAD_TYPED_RW);
 
             if (format->loadFunction != NULL) {

```
