SDL  2.0
testautomation_pixels.c File Reference
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for testautomation_pixels.c:

Go to the source code of this file.

Functions

int pixels_allocFreeFormat (void *arg)
 Call to SDL_AllocFormat and SDL_FreeFormat. More...
 
int pixels_getPixelFormatName (void *arg)
 Call to SDL_GetPixelFormatName. More...
 
int pixels_allocFreePalette (void *arg)
 Call to SDL_AllocPalette and SDL_FreePalette. More...
 
int pixels_calcGammaRamp (void *arg)
 Call to SDL_CalculateGammaRamp. More...
 

Variables

const int _numRGBPixelFormats = 30
 
Uint32 _RGBPixelFormats []
 
char * _RGBPixelFormatsVerbose []
 
const int _numNonRGBPixelFormats = 7
 
Uint32 _nonRGBPixelFormats []
 
char * _nonRGBPixelFormatsVerbose []
 
const int _numInvalidPixelFormats = 2
 
Uint32 _invalidPixelFormats []
 
char * _invalidPixelFormatsVerbose []
 
static const SDLTest_TestCaseReference pixelsTest1
 
static const SDLTest_TestCaseReference pixelsTest2
 
static const SDLTest_TestCaseReference pixelsTest3
 
static const SDLTest_TestCaseReference pixelsTest4
 
static const SDLTest_TestCaseReferencepixelsTests []
 
SDLTest_TestSuiteReference pixelsTestSuite
 

Function Documentation

◆ pixels_allocFreeFormat()

int pixels_allocFreeFormat ( void arg)

Call to SDL_AllocFormat and SDL_FreeFormat.

See also
http://wiki.libsdl.org/moin.fcg/SDL_AllocFormat
http://wiki.libsdl.org/moin.fcg/SDL_FreeFormat

Definition at line 126 of file testautomation_pixels.c.

References _invalidPixelFormats, _nonRGBPixelFormats, _nonRGBPixelFormatsVerbose, _numInvalidPixelFormats, _numNonRGBPixelFormats, _numRGBPixelFormats, _RGBPixelFormats, _RGBPixelFormatsVerbose, SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, SDL_PixelFormat::format, SDL_PixelFormat::Gmask, i, NULL, SDL_PixelFormat::palette, SDL_PixelFormat::Rmask, SDL_AllocFormat, SDL_ClearError, SDL_FreeFormat, SDL_GetError, SDL_strcmp, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_Log(), and TEST_COMPLETED.

127 {
128  const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
129  const char *expectedError = "Parameter 'format' is invalid";
130  const char *error;
131  int i;
132  Uint32 format;
133  Uint32 masks;
135 
136  /* Blank/unknown format */
137  format = 0;
138  SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format);
139 
140  /* Allocate format */
141  result = SDL_AllocFormat(format);
142  SDLTest_AssertPass("Call to SDL_AllocFormat()");
143  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
144  if (result != NULL) {
145  SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format);
146  SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel);
147  SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel);
148  masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
149  SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %u", masks);
150 
151  /* Deallocate again */
152  SDL_FreeFormat(result);
153  SDLTest_AssertPass("Call to SDL_FreeFormat()");
154  }
155 
156  /* RGB formats */
157  for (i = 0; i < _numRGBPixelFormats; i++) {
158  format = _RGBPixelFormats[i];
159  SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
160 
161  /* Allocate format */
162  result = SDL_AllocFormat(format);
163  SDLTest_AssertPass("Call to SDL_AllocFormat()");
164  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
165  if (result != NULL) {
166  SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format);
167  SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
168  SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
169  if (result->palette != NULL) {
170  masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
171  SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %u", masks);
172  }
173 
174  /* Deallocate again */
175  SDL_FreeFormat(result);
176  SDLTest_AssertPass("Call to SDL_FreeFormat()");
177  }
178  }
179 
180  /* Non-RGB formats */
181  for (i = 0; i < _numNonRGBPixelFormats; i++) {
182  format = _nonRGBPixelFormats[i];
183  SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
184 
185  /* Try to allocate format */
186  result = SDL_AllocFormat(format);
187  SDLTest_AssertPass("Call to SDL_AllocFormat()");
188  SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
189  }
190 
191  /* Negative cases */
192 
193  /* Invalid Formats */
194  for (i = 0; i < _numInvalidPixelFormats; i++) {
195  SDL_ClearError();
196  SDLTest_AssertPass("Call to SDL_ClearError()");
197  format = _invalidPixelFormats[i];
198  result = SDL_AllocFormat(format);
199  SDLTest_AssertPass("Call to SDL_AllocFormat(%u)", format);
200  SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
201  error = SDL_GetError();
202  SDLTest_AssertPass("Call to SDL_GetError()");
203  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
204  if (error != NULL) {
205  SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
206  "Validate error message, expected: '%s', got: '%s'", expectedError, error);
207  }
208  }
209 
210  /* Invalid free pointer */
211  SDL_ClearError();
212  SDLTest_AssertPass("Call to SDL_ClearError()");
214  SDLTest_AssertPass("Call to SDL_FreeFormat(NULL)");
215  error = SDL_GetError();
216  SDLTest_AssertPass("Call to SDL_GetError()");
217  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
218  if (error != NULL) {
219  SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
220  "Validate error message, expected: '%s', got: '%s'", expectedError, error);
221  }
222 
223  return TEST_COMPLETED;
224 }
#define SDL_ClearError
#define SDL_GetError
GLuint64EXT * result
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
Uint32 _nonRGBPixelFormats[]
#define SDL_AllocFormat
uint32_t Uint32
Definition: SDL_stdinc.h:181
const int _numRGBPixelFormats
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
const int _numInvalidPixelFormats
Uint32 _RGBPixelFormats[]
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
Uint8 BitsPerPixel
Definition: SDL_pixels.h:319
#define SDL_FreeFormat
Uint32 _invalidPixelFormats[]
#define TEST_COMPLETED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and INFO priority.
Definition: SDL_test_log.c:85
SDL_Palette * palette
Definition: SDL_pixels.h:318
const int _numNonRGBPixelFormats
#define SDL_strcmp
char * _nonRGBPixelFormatsVerbose[]
char * _RGBPixelFormatsVerbose[]

◆ pixels_allocFreePalette()

int pixels_allocFreePalette ( void arg)

Call to SDL_AllocPalette and SDL_FreePalette.

See also
http://wiki.libsdl.org/moin.fcg/SDL_AllocPalette
http://wiki.libsdl.org/moin.fcg/SDL_FreePalette

Definition at line 317 of file testautomation_pixels.c.

References SDL_Color::b, SDL_Palette::colors, SDL_Color::g, i, SDL_Palette::ncolors, NULL, SDL_Color::r, SDL_AllocPalette, SDL_ClearError, SDL_FreePalette, SDL_GetError, SDL_strcmp, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomIntegerInRange(), and TEST_COMPLETED.

318 {
319  const char *expectedError1 = "Parameter 'ncolors' is invalid";
320  const char *expectedError2 = "Parameter 'palette' is invalid";
321  const char *error;
322  int variation;
323  int i;
324  int ncolors;
326 
327  /* Allocate palette */
328  for (variation = 1; variation <= 3; variation++) {
329  switch (variation) {
330  /* Just one color */
331  case 1:
332  ncolors = 1;
333  break;
334  /* Two colors */
335  case 2:
336  ncolors = 2;
337  break;
338  /* More than two colors */
339  case 3:
340  ncolors = SDLTest_RandomIntegerInRange(8, 16);
341  break;
342  }
343 
344  result = SDL_AllocPalette(ncolors);
345  SDLTest_AssertPass("Call to SDL_AllocPalette(%d)", ncolors);
346  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
347  if (result != NULL) {
348  SDLTest_AssertCheck(result->ncolors == ncolors, "Verify value of result.ncolors; expected: %u, got %u", ncolors, result->ncolors);
349  if (result->ncolors > 0) {
350  SDLTest_AssertCheck(result->colors != NULL, "Verify value of result.colors is not NULL");
351  if (result->colors != NULL) {
352  for(i = 0; i < result->ncolors; i++) {
353  SDLTest_AssertCheck(result->colors[i].r == 255, "Verify value of result.colors[%d].r; expected: 255, got %u", i, result->colors[i].r);
354  SDLTest_AssertCheck(result->colors[i].g == 255, "Verify value of result.colors[%d].g; expected: 255, got %u", i, result->colors[i].g);
355  SDLTest_AssertCheck(result->colors[i].b == 255, "Verify value of result.colors[%d].b; expected: 255, got %u", i, result->colors[i].b);
356  }
357  }
358  }
359 
360  /* Deallocate again */
361  SDL_FreePalette(result);
362  SDLTest_AssertPass("Call to SDL_FreePalette()");
363  }
364  }
365 
366  /* Negative cases */
367 
368  /* Invalid number of colors */
369  for (ncolors = 0; ncolors > -3; ncolors--) {
370  SDL_ClearError();
371  SDLTest_AssertPass("Call to SDL_ClearError()");
372  result = SDL_AllocPalette(ncolors);
373  SDLTest_AssertPass("Call to SDL_AllocPalette(%d)", ncolors);
374  SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
375  error = SDL_GetError();
376  SDLTest_AssertPass("Call to SDL_GetError()");
377  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
378  if (error != NULL) {
379  SDLTest_AssertCheck(SDL_strcmp(error, expectedError1) == 0,
380  "Validate error message, expected: '%s', got: '%s'", expectedError1, error);
381  }
382  }
383 
384  /* Invalid free pointer */
385  SDL_ClearError();
386  SDLTest_AssertPass("Call to SDL_ClearError()");
388  SDLTest_AssertPass("Call to SDL_FreePalette(NULL)");
389  error = SDL_GetError();
390  SDLTest_AssertPass("Call to SDL_GetError()");
391  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
392  if (error != NULL) {
393  SDLTest_AssertCheck(SDL_strcmp(error, expectedError2) == 0,
394  "Validate error message, expected: '%s', got: '%s'", expectedError2, error);
395  }
396 
397  return TEST_COMPLETED;
398 }
#define SDL_ClearError
#define SDL_GetError
GLuint64EXT * result
Uint8 g
Definition: SDL_pixels.h:298
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
Uint8 b
Definition: SDL_pixels.h:299
Uint8 r
Definition: SDL_pixels.h:297
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
#define TEST_COMPLETED
#define SDL_AllocPalette
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
SDL_Color * colors
Definition: SDL_pixels.h:307
#define SDL_FreePalette
#define SDL_strcmp

◆ pixels_calcGammaRamp()

int pixels_calcGammaRamp ( void arg)

Call to SDL_CalculateGammaRamp.

See also
http://wiki.libsdl.org/moin.fcg/SDL_CalculateGammaRamp

Definition at line 406 of file testautomation_pixels.c.

References i, NULL, SDL_CalculateGammaRamp, SDL_ClearError, SDL_free, SDL_GetError, SDL_malloc, SDL_strcmp, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomIntegerInRange(), SDLTest_RandomUnitFloat(), TEST_ABORTED, and TEST_COMPLETED.

407 {
408  const char *expectedError1 = "Parameter 'gamma' is invalid";
409  const char *expectedError2 = "Parameter 'ramp' is invalid";
410  const char *error;
411  float gamma;
412  Uint16 *ramp;
413  int variation;
414  int i;
415  int changed;
416  Uint16 magic = 0xbeef;
417 
418  /* Allocate temp ramp array and fill with some value */
419  ramp = (Uint16 *)SDL_malloc(256 * sizeof(Uint16));
420  SDLTest_AssertCheck(ramp != NULL, "Validate temp ramp array could be allocated");
421  if (ramp == NULL) return TEST_ABORTED;
422 
423  /* Make call with different gamma values */
424  for (variation = 0; variation < 4; variation++) {
425  switch (variation) {
426  /* gamma = 0 all black */
427  case 0:
428  gamma = 0.0f;
429  break;
430  /* gamma = 1 identity */
431  case 1:
432  gamma = 1.0f;
433  break;
434  /* gamma = [0.2,0.8] normal range */
435  case 2:
436  gamma = 0.2f + 0.8f * SDLTest_RandomUnitFloat();
437  break;
438  /* gamma = >1.1 non-standard range */
439  case 3:
440  gamma = 1.1f + SDLTest_RandomUnitFloat();
441  break;
442  }
443 
444  /* Make call and check that values were updated */
445  for (i = 0; i < 256; i++) ramp[i] = magic;
446  SDL_CalculateGammaRamp(gamma, ramp);
447  SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(%f)", gamma);
448  changed = 0;
449  for (i = 0; i < 256; i++) if (ramp[i] != magic) changed++;
450  SDLTest_AssertCheck(changed > 250, "Validate that ramp was calculated; expected: >250 values changed, got: %d values changed", changed);
451 
452  /* Additional value checks for some cases */
453  i = SDLTest_RandomIntegerInRange(64,192);
454  switch (variation) {
455  case 0:
456  SDLTest_AssertCheck(ramp[i] == 0, "Validate value at position %d; expected: 0, got: %d", i, ramp[i]);
457  break;
458  case 1:
459  SDLTest_AssertCheck(ramp[i] == ((i << 8) | i), "Validate value at position %d; expected: %d, got: %d", i, (i << 8) | i, ramp[i]);
460  break;
461  case 2:
462  case 3:
463  SDLTest_AssertCheck(ramp[i] > 0, "Validate value at position %d; expected: >0, got: %d", i, ramp[i]);
464  break;
465  }
466  }
467 
468  /* Negative cases */
469  SDL_ClearError();
470  SDLTest_AssertPass("Call to SDL_ClearError()");
471  gamma = -1;
472  for (i=0; i<256; i++) ramp[i] = magic;
473  SDL_CalculateGammaRamp(gamma, ramp);
474  SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(%f)", gamma);
475  error = SDL_GetError();
476  SDLTest_AssertPass("Call to SDL_GetError()");
477  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
478  if (error != NULL) {
479  SDLTest_AssertCheck(SDL_strcmp(error, expectedError1) == 0,
480  "Validate error message, expected: '%s', got: '%s'", expectedError1, error);
481  }
482  changed = 0;
483  for (i = 0; i < 256; i++) if (ramp[i] != magic) changed++;
484  SDLTest_AssertCheck(changed ==0, "Validate that ramp unchanged; expected: 0 values changed got: %d values changed", changed);
485 
487  SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(0.5,NULL)");
488  error = SDL_GetError();
489  SDLTest_AssertPass("Call to SDL_GetError()");
490  SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
491  if (error != NULL) {
492  SDLTest_AssertCheck(SDL_strcmp(error, expectedError2) == 0,
493  "Validate error message, expected: '%s', got: '%s'", expectedError2, error);
494  }
495 
496  /* Cleanup */
497  SDL_free(ramp);
498 
499 
500  return TEST_COMPLETED;
501 }
#define SDL_ClearError
#define SDL_GetError
#define TEST_ABORTED
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
GLfloat f
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
#define SDL_free
#define TEST_COMPLETED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
uint16_t Uint16
Definition: SDL_stdinc.h:169
#define SDL_CalculateGammaRamp
#define SDL_malloc
float SDLTest_RandomUnitFloat(void)
#define SDL_strcmp

◆ pixels_getPixelFormatName()

int pixels_getPixelFormatName ( void arg)

Call to SDL_GetPixelFormatName.

See also
http://wiki.libsdl.org/moin.fcg/SDL_GetPixelFormatName

Definition at line 232 of file testautomation_pixels.c.

References _invalidPixelFormats, _invalidPixelFormatsVerbose, _nonRGBPixelFormats, _nonRGBPixelFormatsVerbose, _numInvalidPixelFormats, _numNonRGBPixelFormats, _numRGBPixelFormats, _RGBPixelFormats, _RGBPixelFormatsVerbose, i, NULL, SDL_ClearError, SDL_GetError, SDL_GetPixelFormatName, SDL_strcmp, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_Log(), and TEST_COMPLETED.

233 {
234  const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
235  const char *error;
236  int i;
237  Uint32 format;
238  char* result;
239 
240  /* Blank/undefined format */
241  format = 0;
242  SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format);
243 
244  /* Get name of format */
245  result = (char *)SDL_GetPixelFormatName(format);
246  SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
247  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
248  if (result != NULL) {
249  SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
250  SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
251  "Verify result text; expected: %s, got %s", unknownFormat, result);
252  }
253 
254  /* RGB formats */
255  for (i = 0; i < _numRGBPixelFormats; i++) {
256  format = _RGBPixelFormats[i];
257  SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
258 
259  /* Get name of format */
260  result = (char *)SDL_GetPixelFormatName(format);
261  SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
262  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
263  if (result != NULL) {
264  SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
266  "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
267  }
268  }
269 
270  /* Non-RGB formats */
271  for (i = 0; i < _numNonRGBPixelFormats; i++) {
272  format = _nonRGBPixelFormats[i];
273  SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
274 
275  /* Get name of format */
276  result = (char *)SDL_GetPixelFormatName(format);
277  SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
278  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
279  if (result != NULL) {
280  SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
282  "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
283  }
284  }
285 
286  /* Negative cases */
287 
288  /* Invalid Formats */
289  SDL_ClearError();
290  SDLTest_AssertPass("Call to SDL_ClearError()");
291  for (i = 0; i < _numInvalidPixelFormats; i++) {
292  format = _invalidPixelFormats[i];
293  result = (char *)SDL_GetPixelFormatName(format);
294  SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
295  SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
296  if (result != NULL) {
297  SDLTest_AssertCheck(result[0] != '\0',
298  "Verify result is non-empty; got: %s", result);
300  "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
301  }
302  error = SDL_GetError();
303  SDLTest_AssertPass("Call to SDL_GetError()");
304  SDLTest_AssertCheck(error == NULL || error[0] == '\0', "Validate that error message is empty");
305  }
306 
307  return TEST_COMPLETED;
308 }
#define SDL_ClearError
#define SDL_GetError
GLuint64EXT * result
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
char * _invalidPixelFormatsVerbose[]
Uint32 _nonRGBPixelFormats[]
uint32_t Uint32
Definition: SDL_stdinc.h:181
const int _numRGBPixelFormats
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: SDL_opengl.h:1572
const int _numInvalidPixelFormats
Uint32 _RGBPixelFormats[]
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
Uint32 _invalidPixelFormats[]
#define TEST_COMPLETED
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and INFO priority.
Definition: SDL_test_log.c:85
const int _numNonRGBPixelFormats
#define SDL_strcmp
char * _nonRGBPixelFormatsVerbose[]
char * _RGBPixelFormatsVerbose[]
#define SDL_GetPixelFormatName

Variable Documentation

◆ _invalidPixelFormats

Uint32 _invalidPixelFormats[]
Initial value:
=
{
0xfffffffe,
0xffffffff
}

Definition at line 106 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _invalidPixelFormatsVerbose

char* _invalidPixelFormatsVerbose[]
Initial value:
=
{
"SDL_PIXELFORMAT_UNKNOWN",
"SDL_PIXELFORMAT_UNKNOWN"
}

Definition at line 111 of file testautomation_pixels.c.

Referenced by pixels_getPixelFormatName().

◆ _nonRGBPixelFormats

◆ _nonRGBPixelFormatsVerbose

char* _nonRGBPixelFormatsVerbose[]
Initial value:
=
{
"SDL_PIXELFORMAT_YV12",
"SDL_PIXELFORMAT_IYUV",
"SDL_PIXELFORMAT_YUY2",
"SDL_PIXELFORMAT_UYVY",
"SDL_PIXELFORMAT_YVYU",
"SDL_PIXELFORMAT_NV12",
"SDL_PIXELFORMAT_NV21"
}

Definition at line 93 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _numInvalidPixelFormats

const int _numInvalidPixelFormats = 2

Definition at line 105 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _numNonRGBPixelFormats

const int _numNonRGBPixelFormats = 7

Definition at line 82 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _numRGBPixelFormats

const int _numRGBPixelFormats = 30

Pixels test suite

Definition at line 13 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _RGBPixelFormats

Uint32 _RGBPixelFormats[]

Definition at line 14 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ _RGBPixelFormatsVerbose

char* _RGBPixelFormatsVerbose[]

Definition at line 47 of file testautomation_pixels.c.

Referenced by pixels_allocFreeFormat(), and pixels_getPixelFormatName().

◆ pixelsTest1

const SDLTest_TestCaseReference pixelsTest1
static
Initial value:
=
{ (SDLTest_TestCaseFp)pixels_allocFreeFormat, "pixels_allocFreeFormat", "Call to SDL_AllocFormat and SDL_FreeFormat", TEST_ENABLED }
int pixels_allocFreeFormat(void *arg)
Call to SDL_AllocFormat and SDL_FreeFormat.
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED

Definition at line 506 of file testautomation_pixels.c.

◆ pixelsTest2

const SDLTest_TestCaseReference pixelsTest2
static
Initial value:
=
{ (SDLTest_TestCaseFp)pixels_allocFreePalette, "pixels_allocFreePalette", "Call to SDL_AllocPalette and SDL_FreePalette", TEST_ENABLED }
int pixels_allocFreePalette(void *arg)
Call to SDL_AllocPalette and SDL_FreePalette.
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED

Definition at line 509 of file testautomation_pixels.c.

◆ pixelsTest3

const SDLTest_TestCaseReference pixelsTest3
static
Initial value:
=
{ (SDLTest_TestCaseFp)pixels_calcGammaRamp, "pixels_calcGammaRamp", "Call to SDL_CalculateGammaRamp", TEST_ENABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED
int pixels_calcGammaRamp(void *arg)
Call to SDL_CalculateGammaRamp.

Definition at line 512 of file testautomation_pixels.c.

◆ pixelsTest4

const SDLTest_TestCaseReference pixelsTest4
static
Initial value:
=
{ (SDLTest_TestCaseFp)pixels_getPixelFormatName, "pixels_getPixelFormatName", "Call to SDL_GetPixelFormatName", TEST_ENABLED }
int(* SDLTest_TestCaseFp)(void *arg)
int pixels_getPixelFormatName(void *arg)
Call to SDL_GetPixelFormatName.
#define TEST_ENABLED

Definition at line 515 of file testautomation_pixels.c.

◆ pixelsTests

const SDLTest_TestCaseReference* pixelsTests[]
static
Initial value:
= {
}
static const SDLTest_TestCaseReference pixelsTest1
static const SDLTest_TestCaseReference pixelsTest2
#define NULL
Definition: begin_code.h:164
static const SDLTest_TestCaseReference pixelsTest4
static const SDLTest_TestCaseReference pixelsTest3

Definition at line 519 of file testautomation_pixels.c.

◆ pixelsTestSuite

SDLTest_TestSuiteReference pixelsTestSuite
Initial value:
= {
"Pixels",
}
static const SDLTest_TestCaseReference * pixelsTests[]
#define NULL
Definition: begin_code.h:164

Definition at line 524 of file testautomation_pixels.c.