SDL  2.0
testautomation_surface.c
Go to the documentation of this file.
1 /**
2  * Original code: automated SDL surface test written by Edgar Simo "bobbens"
3  * Adapted/rewritten for test lib by Andreas Schiffler
4  */
5 
6 /* Supress C4996 VS compiler warnings for unlink() */
7 #define _CRT_SECURE_NO_DEPRECATE
8 #define _CRT_NONSTDC_NO_DEPRECATE
9 
10 #include <stdio.h>
11 #ifndef _MSC_VER
12 #include <unistd.h>
13 #endif
14 #include <sys/stat.h>
15 
16 #include "SDL.h"
17 #include "SDL_test.h"
18 
19 #ifdef __MACOSX__
20 #include <unistd.h> /* For unlink() */
21 #endif
22 
23 /* ================= Test Case Implementation ================== */
24 
25 /* Shared test surface */
26 
29 
30 /* Helper functions for the test cases */
31 
32 #define TEST_SURFACE_WIDTH testSurface->w
33 #define TEST_SURFACE_HEIGHT testSurface->h
34 
35 /* Fixture */
36 
37 /* Create a 32-bit writable surface for blitting tests */
38 void
39 _surfaceSetUp(void *arg)
40 {
41  int result;
43  SDL_BlendMode currentBlendMode;
44  Uint32 rmask, gmask, bmask, amask;
45 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
46  rmask = 0xff000000;
47  gmask = 0x00ff0000;
48  bmask = 0x0000ff00;
49  amask = 0x000000ff;
50 #else
51  rmask = 0x000000ff;
52  gmask = 0x0000ff00;
53  bmask = 0x00ff0000;
54  amask = 0xff000000;
55 #endif
56 
57  referenceSurface = SDLTest_ImageBlit(); /* For size info */
58  testSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask);
59  SDLTest_AssertCheck(testSurface != NULL, "Check that testSurface is not NULL");
60  if (testSurface != NULL) {
61  /* Disable blend mode for target surface */
62  result = SDL_SetSurfaceBlendMode(testSurface, blendMode);
63  SDLTest_AssertCheck(result == 0, "Validate result from SDL_SetSurfaceBlendMode, expected: 0, got: %i", result);
64  result = SDL_GetSurfaceBlendMode(testSurface, &currentBlendMode);
65  SDLTest_AssertCheck(result == 0, "Validate result from SDL_GetSurfaceBlendMode, expected: 0, got: %i", result);
66  SDLTest_AssertCheck(currentBlendMode == blendMode, "Validate blendMode, expected: %i, got: %i", blendMode, currentBlendMode);
67  }
68 }
69 
70 void
71 _surfaceTearDown(void *arg)
72 {
73  SDL_FreeSurface(referenceSurface);
74  referenceSurface = NULL;
75  SDL_FreeSurface(testSurface);
76  testSurface = NULL;
77 }
78 
79 /**
80  * Helper that clears the test surface
81  */
83 {
84  int ret;
85  Uint32 color;
86 
87  /* Clear surface. */
88  color = SDL_MapRGBA( testSurface->format, 0, 0, 0, 0);
89  SDLTest_AssertPass("Call to SDL_MapRGBA()");
90  ret = SDL_FillRect( testSurface, NULL, color);
91  SDLTest_AssertPass("Call to SDL_FillRect()");
92  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
93 }
94 
95 /**
96  * Helper that blits in a specific blend mode, -1 for basic blitting, -2 for color mod, -3 for alpha mod, -4 for mixed blend modes.
97  */
99 {
100  int ret;
101  int i, j, ni, nj;
102  SDL_Surface *face;
103  SDL_Rect rect;
104  int nmode;
105  SDL_BlendMode bmode;
106  int checkFailCount1;
107  int checkFailCount2;
108  int checkFailCount3;
109  int checkFailCount4;
110 
111  /* Check test surface */
112  SDLTest_AssertCheck(testSurface != NULL, "Verify testSurface is not NULL");
113  if (testSurface == NULL) return;
114 
115  /* Create sample surface */
116  face = SDLTest_ImageFace();
117  SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
118  if (face == NULL) return;
119 
120  /* Reset alpha modulation */
121  ret = SDL_SetSurfaceAlphaMod(face, 255);
122  SDLTest_AssertPass("Call to SDL_SetSurfaceAlphaMod()");
123  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceAlphaMod(), expected: 0, got: %i", ret);
124 
125  /* Reset color modulation */
126  ret = SDL_SetSurfaceColorMod(face, 255, 255, 255);
127  SDLTest_AssertPass("Call to SDL_SetSurfaceColorMod()");
128  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
129 
130  /* Reset color key */
131  ret = SDL_SetColorKey(face, SDL_FALSE, 0);
132  SDLTest_AssertPass("Call to SDL_SetColorKey()");
133  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
134 
135  /* Clear the test surface */
137 
138  /* Target rect size */
139  rect.w = face->w;
140  rect.h = face->h;
141 
142  /* Steps to take */
143  ni = testSurface->w - face->w;
144  nj = testSurface->h - face->h;
145 
146  /* Optionally set blend mode. */
147  if (mode >= 0) {
148  ret = SDL_SetSurfaceBlendMode( face, (SDL_BlendMode)mode );
149  SDLTest_AssertPass("Call to SDL_SetSurfaceBlendMode()");
150  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceBlendMode(..., %i), expected: 0, got: %i", mode, ret);
151  }
152 
153  /* Test blend mode. */
154  checkFailCount1 = 0;
155  checkFailCount2 = 0;
156  checkFailCount3 = 0;
157  checkFailCount4 = 0;
158  for (j=0; j <= nj; j+=4) {
159  for (i=0; i <= ni; i+=4) {
160  if (mode == -2) {
161  /* Set color mod. */
162  ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
163  if (ret != 0) checkFailCount2++;
164  }
165  else if (mode == -3) {
166  /* Set alpha mod. */
167  ret = SDL_SetSurfaceAlphaMod( face, (255/ni)*i );
168  if (ret != 0) checkFailCount3++;
169  }
170  else if (mode == -4) {
171  /* Crazy blending mode magic. */
172  nmode = (i/4*j/4) % 4;
173  if (nmode==0) {
174  bmode = SDL_BLENDMODE_NONE;
175  } else if (nmode==1) {
176  bmode = SDL_BLENDMODE_BLEND;
177  } else if (nmode==2) {
178  bmode = SDL_BLENDMODE_ADD;
179  } else if (nmode==3) {
180  bmode = SDL_BLENDMODE_MOD;
181  }
182  ret = SDL_SetSurfaceBlendMode( face, bmode );
183  if (ret != 0) checkFailCount4++;
184  }
185 
186  /* Blitting. */
187  rect.x = i;
188  rect.y = j;
189  ret = SDL_BlitSurface( face, NULL, testSurface, &rect );
190  if (ret != 0) checkFailCount1++;
191  }
192  }
193  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
194  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetSurfaceColorMod, expected: 0, got: %i", checkFailCount2);
195  SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetSurfaceAlphaMod, expected: 0, got: %i", checkFailCount3);
196  SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
197 
198  /* Clean up */
199  SDL_FreeSurface(face);
200  face = NULL;
201 }
202 
203 /* Helper to check that a file exists */
204 void
206 {
207  struct stat st;
208  int ret = stat(filename, &st);
209 
210  SDLTest_AssertCheck(ret == 0, "Verify file '%s' exists", filename);
211 }
212 
213 
214 /* Test case functions */
215 
216 /**
217  * @brief Tests sprite saving and loading
218  */
219 int
221 {
222  int ret;
223  const char *sampleFilename = "testSaveLoadBitmap.bmp";
224  SDL_Surface *face;
225  SDL_Surface *rface;
226 
227  /* Create sample surface */
228  face = SDLTest_ImageFace();
229  SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
230  if (face == NULL) return TEST_ABORTED;
231 
232  /* Delete test file; ignore errors */
233  unlink(sampleFilename);
234 
235  /* Save a surface */
236  ret = SDL_SaveBMP(face, sampleFilename);
237  SDLTest_AssertPass("Call to SDL_SaveBMP()");
238  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SaveBMP, expected: 0, got: %i", ret);
239  _AssertFileExist(sampleFilename);
240 
241  /* Load a surface */
242  rface = SDL_LoadBMP(sampleFilename);
243  SDLTest_AssertPass("Call to SDL_LoadBMP()");
244  SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_LoadBMP is not NULL");
245  if (rface != NULL) {
246  SDLTest_AssertCheck(face->w == rface->w, "Verify width of loaded surface, expected: %i, got: %i", face->w, rface->w);
247  SDLTest_AssertCheck(face->h == rface->h, "Verify height of loaded surface, expected: %i, got: %i", face->h, rface->h);
248  }
249 
250  /* Delete test file; ignore errors */
251  unlink(sampleFilename);
252 
253  /* Clean up */
254  SDL_FreeSurface(face);
255  face = NULL;
256  SDL_FreeSurface(rface);
257  rface = NULL;
258 
259  return TEST_COMPLETED;
260 }
261 
262 /* !
263  * Tests surface conversion.
264  */
265 int
267 {
268  SDL_Surface *rface = NULL, *face = NULL;
269  int ret = 0;
270 
271  /* Create sample surface */
272  face = SDLTest_ImageFace();
273  SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
274  if (face == NULL)
275  return TEST_ABORTED;
276 
277  /* Set transparent pixel as the pixel at (0,0) */
278  if (face->format->palette) {
279  ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
280  SDLTest_AssertPass("Call to SDL_SetColorKey()");
281  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
282  }
283 
284  /* Convert to 32 bit to compare. */
285  rface = SDL_ConvertSurface( face, testSurface->format, 0 );
286  SDLTest_AssertPass("Call to SDL_ConvertSurface()");
287  SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL");
288 
289  /* Compare surface. */
290  ret = SDLTest_CompareSurfaces( rface, face, 0 );
291  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
292 
293  /* Clean up. */
294  SDL_FreeSurface(face);
295  face = NULL;
296  SDL_FreeSurface(rface);
297  rface = NULL;
298 
299  return TEST_COMPLETED;
300 }
301 
302 
303 /* !
304  * Tests surface conversion across all pixel formats.
305  */
306 int
308 {
309  Uint32 pixel_formats[] = {
336  };
337  SDL_Surface *face = NULL, *cvt1, *cvt2, *final;
338  SDL_PixelFormat *fmt1, *fmt2;
339  int i, j, ret = 0;
340 
341  /* Create sample surface */
342  face = SDLTest_ImageFace();
343  SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
344  if (face == NULL)
345  return TEST_ABORTED;
346 
347  /* Set transparent pixel as the pixel at (0,0) */
348  if (face->format->palette) {
349  ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
350  SDLTest_AssertPass("Call to SDL_SetColorKey()");
351  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
352  }
353 
354  for ( i = 0; i < SDL_arraysize(pixel_formats); ++i ) {
355  for ( j = 0; j < SDL_arraysize(pixel_formats); ++j ) {
356  fmt1 = SDL_AllocFormat(pixel_formats[i]);
357  SDL_assert(fmt1 != NULL);
358  cvt1 = SDL_ConvertSurface(face, fmt1, 0);
359  SDL_assert(cvt1 != NULL);
360 
361  fmt2 = SDL_AllocFormat(pixel_formats[j]);
362  SDL_assert(fmt1 != NULL);
363  cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
364  SDL_assert(cvt2 != NULL);
365 
366  if ( fmt1->BytesPerPixel == face->format->BytesPerPixel &&
367  fmt2->BytesPerPixel == face->format->BytesPerPixel &&
368  (fmt1->Amask != 0) == (face->format->Amask != 0) &&
369  (fmt2->Amask != 0) == (face->format->Amask != 0) ) {
370  final = SDL_ConvertSurface( cvt2, face->format, 0 );
371  SDL_assert(final != NULL);
372 
373  /* Compare surface. */
374  ret = SDLTest_CompareSurfaces( face, final, 0 );
375  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
376  SDL_FreeSurface(final);
377  }
378 
379  SDL_FreeSurface(cvt1);
380  SDL_FreeFormat(fmt1);
381  SDL_FreeSurface(cvt2);
382  SDL_FreeFormat(fmt2);
383  }
384  }
385 
386  /* Clean up. */
387  SDL_FreeSurface( face );
388 
389  return TEST_COMPLETED;
390 }
391 
392 
393 /**
394  * @brief Tests sprite loading. A failure case.
395  */
396 int
398 {
399  SDL_Surface *face = SDL_LoadBMP("nonexistant.bmp");
400  SDLTest_AssertCheck(face == NULL, "SDL_CreateLoadBmp");
401 
402  return TEST_COMPLETED;
403 }
404 
405 /**
406  * @brief Tests some blitting routines.
407  */
408 int
410 {
411  int ret;
412  SDL_Surface *compareSurface;
413 
414  /* Basic blitting */
415  _testBlitBlendMode(-1);
416 
417  /* Verify result by comparing surfaces */
418  compareSurface = SDLTest_ImageBlit();
419  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
420  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
421 
422  /* Clean up. */
423  SDL_FreeSurface(compareSurface);
424 
425  return TEST_COMPLETED;
426 }
427 
428 /**
429  * @brief Tests some blitting routines with color mod
430  */
431 int
433 {
434  int ret;
435  SDL_Surface *compareSurface;
436 
437  /* Basic blitting with color mod */
438  _testBlitBlendMode(-2);
439 
440  /* Verify result by comparing surfaces */
441  compareSurface = SDLTest_ImageBlitColor();
442  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
443  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
444 
445  /* Clean up. */
446  SDL_FreeSurface(compareSurface);
447 
448  return TEST_COMPLETED;
449 }
450 
451 /**
452  * @brief Tests some blitting routines with alpha mod
453  */
454 int
456 {
457  int ret;
458  SDL_Surface *compareSurface;
459 
460  /* Basic blitting with alpha mod */
461  _testBlitBlendMode(-3);
462 
463  /* Verify result by comparing surfaces */
464  compareSurface = SDLTest_ImageBlitAlpha();
465  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
466  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
467 
468  /* Clean up. */
469  SDL_FreeSurface(compareSurface);
470 
471  return TEST_COMPLETED;
472 }
473 
474 
475 /**
476  * @brief Tests some more blitting routines.
477  */
478 int
480 {
481  int ret;
482  SDL_Surface *compareSurface;
483 
484  /* Basic blitting */
486 
487  /* Verify result by comparing surfaces */
488  compareSurface = SDLTest_ImageBlitBlendNone();
489  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
490  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
491 
492  /* Clean up. */
493  SDL_FreeSurface(compareSurface);
494 
495  return TEST_COMPLETED;
496 }
497 
498 /**
499  * @brief Tests some more blitting routines.
500  */
501 int
503 {
504  int ret;
505  SDL_Surface *compareSurface;
506 
507  /* Blend blitting */
509 
510  /* Verify result by comparing surfaces */
511  compareSurface = SDLTest_ImageBlitBlend();
512  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
513  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
514 
515  /* Clean up. */
516  SDL_FreeSurface(compareSurface);
517 
518  return TEST_COMPLETED;
519 }
520 
521 /**
522  * @brief Tests some more blitting routines.
523  */
524 int
526 {
527  int ret;
528  SDL_Surface *compareSurface;
529 
530  /* Add blitting */
532 
533  /* Verify result by comparing surfaces */
534  compareSurface = SDLTest_ImageBlitBlendAdd();
535  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
536  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
537 
538  /* Clean up. */
539  SDL_FreeSurface(compareSurface);
540 
541  return TEST_COMPLETED;
542 }
543 
544 /**
545  * @brief Tests some more blitting routines.
546  */
547 int
549 {
550  int ret;
551  SDL_Surface *compareSurface;
552 
553  /* Mod blitting */
555 
556  /* Verify result by comparing surfaces */
557  compareSurface = SDLTest_ImageBlitBlendMod();
558  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
559  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
560 
561  /* Clean up. */
562  SDL_FreeSurface(compareSurface);
563 
564  return TEST_COMPLETED;
565 }
566 
567 /**
568  * @brief Tests some more blitting routines with loop
569  */
570 int
572 
573  int ret;
574  SDL_Surface *compareSurface;
575 
576  /* All blitting modes */
577  _testBlitBlendMode(-4);
578 
579  /* Verify result by comparing surfaces */
580  compareSurface = SDLTest_ImageBlitBlendAll();
581  ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
582  SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
583 
584  /* Clean up. */
585  SDL_FreeSurface(compareSurface);
586 
587  return TEST_COMPLETED;
588 
589 }
590 
591 /* ================= Test References ================== */
592 
593 /* Surface test cases */
595  { (SDLTest_TestCaseFp)surface_testSaveLoadBitmap, "surface_testSaveLoadBitmap", "Tests sprite saving and loading.", TEST_ENABLED};
596 
598  { (SDLTest_TestCaseFp)surface_testBlit, "surface_testBlit", "Tests basic blitting.", TEST_ENABLED};
599 
601  { (SDLTest_TestCaseFp)surface_testBlitBlendNone, "surface_testBlitBlendNone", "Tests blitting routines with none blending mode.", TEST_ENABLED};
602 
604  { (SDLTest_TestCaseFp)surface_testLoadFailure, "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED};
605 
607  { (SDLTest_TestCaseFp)surface_testSurfaceConversion, "surface_testSurfaceConversion", "Tests surface conversion.", TEST_ENABLED};
608 
610  { (SDLTest_TestCaseFp)surface_testCompleteSurfaceConversion, "surface_testCompleteSurfaceConversion", "Tests surface conversion across all pixel formats", TEST_ENABLED};
611 
613  { (SDLTest_TestCaseFp)surface_testBlitColorMod, "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED};
614 
616  { (SDLTest_TestCaseFp)surface_testBlitAlphaMod, "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED};
617 
618 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
620  { (SDLTest_TestCaseFp)surface_testBlitBlendLoop, "surface_testBlitBlendLoop", "Test blitting routines with various blending modes", TEST_DISABLED};
621 
622 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
624  { (SDLTest_TestCaseFp)surface_testBlitBlendBlend, "surface_testBlitBlendBlend", "Tests blitting routines with blend blending mode.", TEST_DISABLED};
625 
626 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
628  { (SDLTest_TestCaseFp)surface_testBlitBlendAdd, "surface_testBlitBlendAdd", "Tests blitting routines with add blending mode.", TEST_DISABLED};
629 
631  { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
632 
633 /* Sequence of Surface test cases */
638 };
639 
640 /* Surface test suite (global) */
642  "Surface",
644  surfaceTests,
646 
647 };
void _clearTestSurface()
int surface_testBlitBlendNone(void *arg)
Tests some more blitting routines.
static const SDLTest_TestCaseReference surfaceTest10
static const SDLTest_TestCaseReference surfaceTest8
#define TEST_ABORTED
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
GLuint64EXT * result
static const SDLTest_TestCaseReference surfaceTest6
static const SDLTest_TestCaseReference surfaceTest4
#define SDL_LoadBMP(file)
Definition: SDL_surface.h:200
#define SDL_MapRGBA
#define SDL_SWSURFACE
Definition: SDL_surface.h:52
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
#define SDL_ConvertSurface
SDL_Rect rect
Definition: testrelative.c:27
int surface_testSaveLoadBitmap(void *arg)
Tests sprite saving and loading.
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.
int surface_testBlitBlendMod(void *arg)
Tests some more blitting routines.
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_Surface * SDLTest_ImageBlitAlpha(void)
Returns the BlitAlpha test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitBlendAdd(void)
Returns the BlitBlendAdd test image as SDL_Surface.
#define SDL_BlitSurface
Definition: SDL_surface.h:476
#define SDL_SaveBMP(surface, file)
Definition: SDL_surface.h:223
#define SDL_AllocFormat
uint32_t Uint32
Definition: SDL_stdinc.h:181
int surface_testCompleteSurfaceConversion(void *arg)
static const SDLTest_TestCaseReference * surfaceTests[]
#define SDL_GetSurfaceBlendMode
static SDL_BlendMode blendMode
Definition: testdraw2.c:34
SDL_Surface * SDLTest_ImageFace(void)
Returns the Face test image as SDL_Surface.
int(* SDLTest_TestCaseFp)(void *arg)
void _surfaceTearDown(void *arg)
#define TEST_DISABLED
GLenum GLuint GLint GLenum face
SDL_Surface * SDLTest_ImageBlitBlendAll(void)
Returns the BlitBlendAll test image as SDL_Surface.
static const SDLTest_TestCaseReference surfaceTest9
static const SDLTest_TestCaseReference surfaceTest2
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...
SDLTest_TestSuiteReference surfaceTestSuite
void * pixels
Definition: SDL_surface.h:75
#define SDL_FreeSurface
int surface_testSurfaceConversion(void *arg)
#define SDL_SetSurfaceColorMod
uint8_t Uint8
Definition: SDL_stdinc.h:157
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 int in j)
Definition: SDL_x11sym.h:50
#define SDL_FreeFormat
GLenum mode
#define SDL_SetColorKey
int x
Definition: SDL_rect.h:66
static const SDLTest_TestCaseReference surfaceTest7
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
int surface_testBlit(void *arg)
Tests some blitting routines.
#define TEST_ENABLED
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 SDL_assert(condition)
Definition: SDL_assert.h:169
#define NULL
Definition: begin_code.h:164
static const SDLTest_TestCaseReference surfaceTest11
SDL_PixelFormat * format
Definition: SDL_surface.h:72
static const SDLTest_TestCaseReference surfaceTest12
int surface_testBlitAlphaMod(void *arg)
Tests some blitting routines with alpha mod.
int surface_testBlitBlendAdd(void *arg)
Tests some more blitting routines.
SDL_Surface * SDLTest_ImageBlit(void)
Returns the Blit test image as SDL_Surface.
#define SDL_CreateRGBSurface
int surface_testLoadFailure(void *arg)
Tests sprite loading. A failure case.
static const SDLTest_TestCaseReference surfaceTest1
int h
Definition: SDL_rect.h:67
#define SDL_SetSurfaceBlendMode
void _testBlitBlendMode(int mode)
static SDL_Surface * testSurface
#define SDL_FillRect
GLuint color
SDL_Surface * SDLTest_ImageBlitBlend(void)
Returns the BlitBlend test image as SDL_Surface.
int surface_testBlitBlendBlend(void *arg)
Tests some more blitting routines.
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
SDL_Palette * palette
Definition: SDL_pixels.h:318
int surface_testBlitColorMod(void *arg)
Tests some blitting routines with color mod.
static const SDLTest_TestCaseReference surfaceTest3
static SDL_Surface * referenceSurface
SDL_Surface * SDLTest_ImageBlitBlendMod(void)
Returns the BlitBlendMod test image as SDL_Surface.
int surface_testBlitBlendLoop(void *arg)
Tests some more blitting routines with loop.
int y
Definition: SDL_rect.h:66
SDL_Surface * SDLTest_ImageBlitBlendNone(void)
Returns the BlitBlendNone test image as SDL_Surface.
#define SDL_SetSurfaceAlphaMod
static const SDLTest_TestCaseReference surfaceTest5
SDL_Surface * SDLTest_ImageBlitColor(void)
Returns the BlitColor test image as SDL_Surface.
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RLEACCEL
Definition: SDL_surface.h:54
void _surfaceSetUp(void *arg)
void _AssertFileExist(const char *filename)