SDL  2.0
testautomation_render.c
Go to the documentation of this file.
1 /**
2  * Original code: automated SDL platform test written by Edgar Simo "bobbens"
3  * Extended and extensively updated by aschiffler at ferzkopp dot net
4  */
5 
6 #include <stdio.h>
7 
8 #include "SDL.h"
9 #include "SDL_test.h"
10 
11 /* ================= Test Case Implementation ================== */
12 
13 #define TESTRENDER_SCREEN_W 80
14 #define TESTRENDER_SCREEN_H 60
15 
16 #define RENDER_COMPARE_FORMAT SDL_PIXELFORMAT_ARGB8888
17 #define RENDER_COMPARE_AMASK 0xff000000 /**< Alpha bit mask. */
18 #define RENDER_COMPARE_RMASK 0x00ff0000 /**< Red bit mask. */
19 #define RENDER_COMPARE_GMASK 0x0000ff00 /**< Green bit mask. */
20 #define RENDER_COMPARE_BMASK 0x000000ff /**< Blue bit mask. */
21 
22 #define ALLOWABLE_ERROR_OPAQUE 0
23 #define ALLOWABLE_ERROR_BLENDED 64
24 
25 /* Test window and renderer */
28 
29 /* Prototypes for helper functions */
30 
31 static int _clearScreen (void);
32 static void _compare(SDL_Surface *reference, int allowable_error);
33 static int _hasTexAlpha(void);
34 static int _hasTexColor(void);
35 static SDL_Texture *_loadTestFace(void);
36 static int _hasBlendModes(void);
37 static int _hasDrawColor(void);
38 static int _isSupported(int code);
39 
40 /**
41  * Create software renderer for tests
42  */
43 void InitCreateRenderer(void *arg)
44 {
45  int posX = 100, posY = 100, width = 320, height = 240;
46  renderer = NULL;
47  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
48  SDLTest_AssertPass("SDL_CreateWindow()");
49  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
50  if (window == NULL) {
51  return;
52  }
53 
55  SDLTest_AssertPass("SDL_CreateRenderer()");
56  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
57  if (renderer == NULL) {
59  return;
60  }
61 }
62 
63 /*
64  * Destroy renderer for tests
65  */
66 void CleanupDestroyRenderer(void *arg)
67 {
68  if (renderer != NULL) {
70  renderer = NULL;
71  SDLTest_AssertPass("SDL_DestroyRenderer()");
72  }
73 
74  if (window != NULL) {
76  window = NULL;
77  SDLTest_AssertPass("SDL_DestroyWindow");
78  }
79 }
80 
81 
82 /**
83  * @brief Tests call to SDL_GetNumRenderDrivers
84  *
85  * \sa
86  * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
87  */
88 int
90 {
91  int n;
93  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
94  return TEST_COMPLETED;
95 }
96 
97 
98 /**
99  * @brief Tests the SDL primitives for rendering.
100  *
101  * \sa
102  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
103  * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
104  * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
105  *
106  */
107 int render_testPrimitives (void *arg)
108 {
109  int ret;
110  int x, y;
111  SDL_Rect rect;
113  int checkFailCount1;
114  int checkFailCount2;
115 
116  /* Clear surface. */
117  _clearScreen();
118 
119  /* Need drawcolor or just skip test. */
120  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
121 
122  /* Draw a rectangle. */
123  rect.x = 40;
124  rect.y = 0;
125  rect.w = 40;
126  rect.h = 80;
127 
128  ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
129  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
130 
131  ret = SDL_RenderFillRect(renderer, &rect );
132  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
133 
134  /* Draw a rectangle. */
135  rect.x = 10;
136  rect.y = 10;
137  rect.w = 60;
138  rect.h = 40;
139  ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
140  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
141 
142  ret = SDL_RenderFillRect(renderer, &rect );
143  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
144 
145  /* Draw some points like so:
146  * X.X.X.X..
147  * .X.X.X.X.
148  * X.X.X.X.. */
149  checkFailCount1 = 0;
150  checkFailCount2 = 0;
151  for (y=0; y<3; y++) {
152  for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
154  if (ret != 0) checkFailCount1++;
155 
156  ret = SDL_RenderDrawPoint(renderer, x, y );
157  if (ret != 0) checkFailCount2++;
158  }
159  }
160  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
161  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
162 
163  /* Draw some lines. */
165  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
166 
167  ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
168  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
169 
171  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
172 
173  ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
174  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
175 
176  ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
177  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
178 
179  ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
180  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
181 
182  ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
183  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
184 
185  ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
186  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
187 
188  ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
189  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
190 
191  /* Make current */
193 
194  /* See if it's the same. */
197 
198  /* Clean up. */
201 
202  return TEST_COMPLETED;
203 }
204 
205 /**
206  * @brief Tests the SDL primitives with alpha for rendering.
207  *
208  * \sa
209  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
210  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
211  * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
212  */
214 {
215  int ret;
216  int i, j;
217  SDL_Rect rect;
219  int checkFailCount1;
220  int checkFailCount2;
221  int checkFailCount3;
222 
223  /* Clear surface. */
224  _clearScreen();
225 
226  /* Need drawcolor and blendmode or just skip test. */
227  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
228  SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
229 
230  /* Create some rectangles for each blend mode. */
231  ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
232  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
233 
235  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
236 
238  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
239 
240  rect.x = 10;
241  rect.y = 25;
242  rect.w = 40;
243  rect.h = 25;
244  ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
245  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
246 
248  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
249 
250  ret = SDL_RenderFillRect(renderer, &rect );
251  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
252 
253  rect.x = 30;
254  rect.y = 40;
255  rect.w = 45;
256  rect.h = 15;
257  ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
258  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
259 
261  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
262 
263  ret = SDL_RenderFillRect(renderer, &rect );
264  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
265 
266  rect.x = 25;
267  rect.y = 25;
268  rect.w = 25;
269  rect.h = 25;
270  ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
271  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
272 
274  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
275 
276  ret = SDL_RenderFillRect(renderer, &rect );
277  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
278 
279 
280  /* Draw blended lines, lines for everyone. */
281  checkFailCount1 = 0;
282  checkFailCount2 = 0;
283  checkFailCount3 = 0;
284  for (i=0; i<TESTRENDER_SCREEN_W; i+=2) {
285  ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
286  if (ret != 0) checkFailCount1++;
287 
289  (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
290  if (ret != 0) checkFailCount2++;
291 
292  ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
293  if (ret != 0) checkFailCount3++;
294  }
295  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
296  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
297  SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
298 
299  checkFailCount1 = 0;
300  checkFailCount2 = 0;
301  checkFailCount3 = 0;
302  for (i=0; i<TESTRENDER_SCREEN_H; i+=2) {
303  ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
304  if (ret != 0) checkFailCount1++;
305 
307  (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
308  if (ret != 0) checkFailCount2++;
309 
310  ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
311  if (ret != 0) checkFailCount3++;
312  }
313  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
314  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
315  SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
316 
317  /* Draw points. */
318  checkFailCount1 = 0;
319  checkFailCount2 = 0;
320  checkFailCount3 = 0;
321  for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
322  for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
323  ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
324  if (ret != 0) checkFailCount1++;
325 
326  ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
327  ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
328  if (ret != 0) checkFailCount2++;
329 
330  ret = SDL_RenderDrawPoint(renderer, i, j );
331  if (ret != 0) checkFailCount3++;
332  }
333  }
334  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
335  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
336  SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
337 
338  /* Make current */
340 
341  /* See if it's the same. */
344 
345  /* Clean up. */
348 
349  return TEST_COMPLETED;
350 }
351 
352 
353 
354 /**
355  * @brief Tests some blitting routines.
356  *
357  * \sa
358  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
359  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
360  */
361 int
362 render_testBlit(void *arg)
363 {
364  int ret;
365  SDL_Rect rect;
366  SDL_Texture *tface;
368  Uint32 tformat;
369  int taccess, tw, th;
370  int i, j, ni, nj;
371  int checkFailCount1;
372 
373  /* Clear surface. */
374  _clearScreen();
375 
376  /* Need drawcolor or just skip test. */
377  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
378 
379  /* Create face surface. */
380  tface = _loadTestFace();
381  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
382  if (tface == NULL) {
383  return TEST_ABORTED;
384  }
385 
386  /* Constant values. */
387  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
388  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
389  rect.w = tw;
390  rect.h = th;
391  ni = TESTRENDER_SCREEN_W - tw;
392  nj = TESTRENDER_SCREEN_H - th;
393 
394  /* Loop blit. */
395  checkFailCount1 = 0;
396  for (j=0; j <= nj; j+=4) {
397  for (i=0; i <= ni; i+=4) {
398  /* Blitting. */
399  rect.x = i;
400  rect.y = j;
401  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
402  if (ret != 0) checkFailCount1++;
403  }
404  }
405  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
406 
407  /* Make current */
409 
410  /* See if it's the same */
413 
414  /* Clean up. */
415  SDL_DestroyTexture( tface );
418 
419  return TEST_COMPLETED;
420 }
421 
422 
423 /**
424  * @brief Blits doing color tests.
425  *
426  * \sa
427  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
428  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
429  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
430  */
431 int
433 {
434  int ret;
435  SDL_Rect rect;
436  SDL_Texture *tface;
438  Uint32 tformat;
439  int taccess, tw, th;
440  int i, j, ni, nj;
441  int checkFailCount1;
442  int checkFailCount2;
443 
444  /* Clear surface. */
445  _clearScreen();
446 
447  /* Create face surface. */
448  tface = _loadTestFace();
449  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
450  if (tface == NULL) {
451  return TEST_ABORTED;
452  }
453 
454  /* Constant values. */
455  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
456  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
457  rect.w = tw;
458  rect.h = th;
459  ni = TESTRENDER_SCREEN_W - tw;
460  nj = TESTRENDER_SCREEN_H - th;
461 
462  /* Test blitting with color mod. */
463  checkFailCount1 = 0;
464  checkFailCount2 = 0;
465  for (j=0; j <= nj; j+=4) {
466  for (i=0; i <= ni; i+=4) {
467  /* Set color mod. */
468  ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
469  if (ret != 0) checkFailCount1++;
470 
471  /* Blitting. */
472  rect.x = i;
473  rect.y = j;
474  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
475  if (ret != 0) checkFailCount2++;
476  }
477  }
478  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
479  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
480 
481  /* Make current */
483 
484  /* See if it's the same. */
487 
488  /* Clean up. */
489  SDL_DestroyTexture( tface );
492 
493  return TEST_COMPLETED;
494 }
495 
496 
497 /**
498  * @brief Tests blitting with alpha.
499  *
500  * \sa
501  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
502  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
503  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
504  */
505 int
507 {
508  int ret;
509  SDL_Rect rect;
510  SDL_Texture *tface;
512  Uint32 tformat;
513  int taccess, tw, th;
514  int i, j, ni, nj;
515  int checkFailCount1;
516  int checkFailCount2;
517 
518  /* Clear surface. */
519  _clearScreen();
520 
521  /* Need alpha or just skip test. */
522  SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
523 
524  /* Create face surface. */
525  tface = _loadTestFace();
526  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
527  if (tface == NULL) {
528  return TEST_ABORTED;
529  }
530 
531  /* Constant values. */
532  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
533  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
534  rect.w = tw;
535  rect.h = th;
536  ni = TESTRENDER_SCREEN_W - tw;
537  nj = TESTRENDER_SCREEN_H - th;
538 
539  /* Test blitting with alpha mod. */
540  checkFailCount1 = 0;
541  checkFailCount2 = 0;
542  for (j=0; j <= nj; j+=4) {
543  for (i=0; i <= ni; i+=4) {
544  /* Set alpha mod. */
545  ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
546  if (ret != 0) checkFailCount1++;
547 
548  /* Blitting. */
549  rect.x = i;
550  rect.y = j;
551  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
552  if (ret != 0) checkFailCount2++;
553  }
554  }
555  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
556  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
557 
558  /* Make current */
560 
561  /* See if it's the same. */
564 
565  /* Clean up. */
566  SDL_DestroyTexture( tface );
569 
570  return TEST_COMPLETED;
571 }
572 
573 /* Helper functions */
574 
575 /**
576  * @brief Tests a blend mode.
577  *
578  * \sa
579  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
580  * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
581  */
582 static void
584 {
585  int ret;
586  Uint32 tformat;
587  int taccess, tw, th;
588  int i, j, ni, nj;
589  SDL_Rect rect;
590  int checkFailCount1;
591  int checkFailCount2;
592 
593  /* Clear surface. */
594  _clearScreen();
595 
596  /* Constant values. */
597  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
598  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
599  rect.w = tw;
600  rect.h = th;
601  ni = TESTRENDER_SCREEN_W - tw;
602  nj = TESTRENDER_SCREEN_H - th;
603 
604  /* Test blend mode. */
605  checkFailCount1 = 0;
606  checkFailCount2 = 0;
607  for (j=0; j <= nj; j+=4) {
608  for (i=0; i <= ni; i+=4) {
609  /* Set blend mode. */
610  ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
611  if (ret != 0) checkFailCount1++;
612 
613  /* Blitting. */
614  rect.x = i;
615  rect.y = j;
616  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
617  if (ret != 0) checkFailCount2++;
618  }
619  }
620  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
621  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
622 }
623 
624 
625 /**
626  * @brief Tests some more blitting routines.
627  *
628  * \sa
629  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
630  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
631  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
632  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
633  */
634 int
636 {
637  int ret;
638  SDL_Rect rect;
639  SDL_Texture *tface;
641  Uint32 tformat;
642  int taccess, tw, th;
643  int i, j, ni, nj;
644  int mode;
645  int checkFailCount1;
646  int checkFailCount2;
647  int checkFailCount3;
648  int checkFailCount4;
649 
650  SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
651  SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
652  SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
653 
654  /* Create face surface. */
655  tface = _loadTestFace();
656  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
657  if (tface == NULL) {
658  return TEST_ABORTED;
659  }
660 
661  /* Constant values. */
662  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
663  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
664  rect.w = tw;
665  rect.h = th;
666  ni = TESTRENDER_SCREEN_W - tw;
667  nj = TESTRENDER_SCREEN_H - th;
668 
669  /* Set alpha mod. */
670  ret = SDL_SetTextureAlphaMod( tface, 100 );
671  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
672 
673  /* Test None. */
676 
677  /* Make current and compare */
682 
683  /* Test Blend. */
686 
687  /* Make current and compare */
692 
693  /* Test Add. */
696 
697  /* Make current and compare */
702 
703  /* Test Mod. */
706 
707  /* Make current and compare */
712 
713  /* Clear surface. */
714  _clearScreen();
715 
716  /* Loop blit. */
717  checkFailCount1 = 0;
718  checkFailCount2 = 0;
719  checkFailCount3 = 0;
720  checkFailCount4 = 0;
721  for (j=0; j <= nj; j+=4) {
722  for (i=0; i <= ni; i+=4) {
723 
724  /* Set color mod. */
725  ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
726  if (ret != 0) checkFailCount1++;
727 
728  /* Set alpha mod. */
729  ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
730  if (ret != 0) checkFailCount2++;
731 
732  /* Crazy blending mode magic. */
733  mode = (i/4*j/4) % 4;
734  if (mode==0) mode = SDL_BLENDMODE_NONE;
735  else if (mode==1) mode = SDL_BLENDMODE_BLEND;
736  else if (mode==2) mode = SDL_BLENDMODE_ADD;
737  else if (mode==3) mode = SDL_BLENDMODE_MOD;
738  ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
739  if (ret != 0) checkFailCount3++;
740 
741  /* Blitting. */
742  rect.x = i;
743  rect.y = j;
744  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
745  if (ret != 0) checkFailCount4++;
746  }
747  }
748  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
749  SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
750  SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
751  SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
752 
753  /* Clean up. */
754  SDL_DestroyTexture( tface );
755 
756  /* Make current */
758 
759  /* Check to see if final image matches. */
764 
765  return TEST_COMPLETED;
766 }
767 
768 
769 /**
770  * @brief Checks to see if functionality is supported. Helper function.
771  */
772 static int
773 _isSupported( int code )
774 {
775  return (code == 0);
776 }
777 
778 /**
779  * @brief Test to see if we can vary the draw color. Helper function.
780  *
781  * \sa
782  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
783  * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
784  */
785 static int
787 {
788  int ret, fail;
789  Uint8 r, g, b, a;
790 
791  fail = 0;
792 
793  /* Set color. */
794  ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
795  if (!_isSupported(ret))
796  fail = 1;
797  ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
798  if (!_isSupported(ret))
799  fail = 1;
800 
801  /* Restore natural. */
803  if (!_isSupported(ret))
804  fail = 1;
805 
806  /* Something failed, consider not available. */
807  if (fail)
808  return 0;
809 
810  /* Not set properly, consider failed. */
811  else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
812  return 0;
813  return 1;
814 }
815 
816 /**
817  * @brief Test to see if we can vary the blend mode. Helper function.
818  *
819  * \sa
820  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
821  * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
822  */
823 static int
825 {
826  int fail;
827  int ret;
829 
830  fail = 0;
831 
833  if (!_isSupported(ret))
834  fail = 1;
836  if (!_isSupported(ret))
837  fail = 1;
838  ret = (mode != SDL_BLENDMODE_BLEND);
839  if (!_isSupported(ret))
840  fail = 1;
842  if (!_isSupported(ret))
843  fail = 1;
845  if (!_isSupported(ret))
846  fail = 1;
847  ret = (mode != SDL_BLENDMODE_ADD);
848  if (!_isSupported(ret))
849  fail = 1;
851  if (!_isSupported(ret))
852  fail = 1;
854  if (!_isSupported(ret))
855  fail = 1;
856  ret = (mode != SDL_BLENDMODE_MOD);
857  if (!_isSupported(ret))
858  fail = 1;
860  if (!_isSupported(ret))
861  fail = 1;
863  if (!_isSupported(ret))
864  fail = 1;
865  ret = (mode != SDL_BLENDMODE_NONE);
866  if (!_isSupported(ret))
867  fail = 1;
868 
869  return !fail;
870 }
871 
872 
873 /**
874  * @brief Loads the test image 'Face' as texture. Helper function.
875  *
876  * \sa
877  * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
878  */
879 static SDL_Texture *
881 {
882  SDL_Surface *face;
883  SDL_Texture *tface;
884 
886  if (face == NULL) {
887  return NULL;
888  }
889 
891  if (tface == NULL) {
892  SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
893  }
894 
896 
897  return tface;
898 }
899 
900 
901 /**
902  * @brief Test to see if can set texture color mode. Helper function.
903  *
904  * \sa
905  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
906  * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
907  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
908  */
909 static int
911 {
912  int fail;
913  int ret;
914  SDL_Texture *tface;
915  Uint8 r, g, b;
916 
917  /* Get test face. */
918  tface = _loadTestFace();
919  if (tface == NULL)
920  return 0;
921 
922  /* See if supported. */
923  fail = 0;
924  ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
925  if (!_isSupported(ret))
926  fail = 1;
927  ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
928  if (!_isSupported(ret))
929  fail = 1;
930 
931  /* Clean up. */
932  SDL_DestroyTexture( tface );
933 
934  if (fail)
935  return 0;
936  else if ((r != 100) || (g != 100) || (b != 100))
937  return 0;
938  return 1;
939 }
940 
941 /**
942  * @brief Test to see if we can vary the alpha of the texture. Helper function.
943  *
944  * \sa
945  * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
946  * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
947  * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
948  */
949 static int
951 {
952  int fail;
953  int ret;
954  SDL_Texture *tface;
955  Uint8 a;
956 
957  /* Get test face. */
958  tface = _loadTestFace();
959  if (tface == NULL)
960  return 0;
961 
962  /* See if supported. */
963  fail = 0;
964  ret = SDL_SetTextureAlphaMod( tface, 100 );
965  if (!_isSupported(ret))
966  fail = 1;
967  ret = SDL_GetTextureAlphaMod( tface, &a );
968  if (!_isSupported(ret))
969  fail = 1;
970 
971  /* Clean up. */
972  SDL_DestroyTexture( tface );
973 
974  if (fail)
975  return 0;
976  else if (a != 100)
977  return 0;
978  return 1;
979 }
980 
981 /**
982  * @brief Compares screen pixels with image pixels. Helper function.
983  *
984  * @param s Image to compare against.
985  *
986  * \sa
987  * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
988  * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
989  * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
990  */
991 static void
992 _compare(SDL_Surface *referenceSurface, int allowable_error)
993 {
994  int result;
995  SDL_Rect rect;
996  Uint8 *pixels;
998 
999  /* Read pixels. */
1001  SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
1002  if (pixels == NULL) return;
1003 
1004  /* Explicitly specify the rect in case the window isn't the expected size... */
1005  rect.x = 0;
1006  rect.y = 0;
1010  SDLTest_AssertCheck(result == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", result);
1011 
1012  /* Create surface. */
1015  SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom is not NULL");
1016 
1017  /* Compare surface. */
1019  SDLTest_AssertCheck(result == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", result);
1020 
1021  /* Clean up. */
1022  SDL_free(pixels);
1024 }
1025 
1026 /**
1027  * @brief Clears the screen. Helper function.
1028  *
1029  * \sa
1030  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
1031  * http://wiki.libsdl.org/moin.cgi/SDL_RenderClear
1032  * http://wiki.libsdl.org/moin.cgi/SDL_RenderPresent
1033  * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
1034  */
1035 static int
1037 {
1038  int ret;
1039 
1040  /* Set color. */
1042  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
1043 
1044  /* Clear screen. */
1045  ret = SDL_RenderClear(renderer);
1046  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderClear, expected: 0, got: %i", ret);
1047 
1048  /* Make current */
1050 
1051  /* Set defaults. */
1053  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
1054 
1055  ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
1056  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
1057 
1058  return 0;
1059 }
1060 
1061 /* ================= Test References ================== */
1062 
1063 /* Render test cases */
1065  { (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
1066 
1068  { (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
1069 
1070 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
1072  { (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED };
1073 
1075  { (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
1076 
1078  { (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
1079 
1080 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
1082  { (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED };
1083 
1084 /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
1086  { (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED };
1087 
1088 /* Sequence of Render test cases */
1091 };
1092 
1093 /* Render test suite (global) */
1095  "Render",
1097  renderTests,
1099 };
SDL.h
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_GetError
#define SDL_GetError
Definition: SDL_dynapi_overrides.h:113
renderer
SDL_Renderer * renderer
Definition: testautomation_render.c:27
SDL_RenderPresent
#define SDL_RenderPresent
Definition: SDL_dynapi_overrides.h:346
renderTestSuite
SDLTest_TestSuiteReference renderTestSuite
Definition: testautomation_render.c:1094
SDLTest_ImageBlitBlendAdd
SDL_Surface * SDLTest_ImageBlitBlendAdd(void)
Returns the BlitBlendAdd test image as SDL_Surface.
Definition: SDL_test_imageBlitBlend.c:581
SDL_Surface
A collection of pixels used in software blitting.
Definition: SDL_surface.h:70
SDL_RenderDrawPoint
#define SDL_RenderDrawPoint
Definition: SDL_dynapi_overrides.h:335
ALLOWABLE_ERROR_OPAQUE
#define ALLOWABLE_ERROR_OPAQUE
Definition: testautomation_render.c:22
SDL_test.h
_hasTexColor
static int _hasTexColor(void)
Test to see if can set texture color mode. Helper function.
Definition: testautomation_render.c:910
NULL
#define NULL
Definition: begin_code.h:164
SDL_ALPHA_OPAQUE
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:46
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109
referenceSurface
static SDL_Surface * referenceSurface
Definition: testautomation_surface.c:27
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_GetNumRenderDrivers
#define SDL_GetNumRenderDrivers
Definition: SDL_dynapi_overrides.h:298
g
GLboolean GLboolean g
Definition: SDL_opengl_glext.h:1109
SDL_SetRenderDrawBlendMode
#define SDL_SetRenderDrawBlendMode
Definition: SDL_dynapi_overrides.h:332
mode
GLenum mode
Definition: SDL_opengl_glext.h:1122
SDL_GetRenderDrawBlendMode
#define SDL_GetRenderDrawBlendMode
Definition: SDL_dynapi_overrides.h:333
_isSupported
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.
Definition: testautomation_render.c:773
_hasBlendModes
static int _hasBlendModes(void)
Test to see if we can vary the blend mode. Helper function.
Definition: testautomation_render.c:824
SDLTest_ImagePrimitives
SDL_Surface * SDLTest_ImagePrimitives(void)
Returns the Primitives test image as SDL_Surface.
Definition: SDL_test_imagePrimitives.c:491
render_testBlitColor
int render_testBlitColor(void *arg)
Blits doing color tests.
Definition: testautomation_render.c:432
SDL_BLENDMODE_BLEND
@ SDL_BLENDMODE_BLEND
Definition: SDL_blendmode.h:44
renderTest6
static const SDLTest_TestCaseReference renderTest6
Definition: testautomation_render.c:1081
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
ALLOWABLE_ERROR_BLENDED
#define ALLOWABLE_ERROR_BLENDED
Definition: testautomation_render.c:23
SDLTest_ImageBlitColor
SDL_Surface * SDLTest_ImageBlitColor(void)
Returns the BlitColor test image as SDL_Surface.
Definition: SDL_test_imageBlit.c:1024
SDL_RenderFillRect
#define SDL_RenderFillRect
Definition: SDL_dynapi_overrides.h:341
render_testBlitBlend
int render_testBlitBlend(void *arg)
Tests some more blitting routines.
Definition: testautomation_render.c:635
render_testBlit
int render_testBlit(void *arg)
Tests some blitting routines.
Definition: testautomation_render.c:362
render_testBlitAlpha
int render_testBlitAlpha(void *arg)
Tests blitting with alpha.
Definition: testautomation_render.c:506
renderTest4
static const SDLTest_TestCaseReference renderTest4
Definition: testautomation_render.c:1074
TEST_ENABLED
#define TEST_ENABLED
Definition: SDL_test_harness.h:47
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
render_testPrimitivesBlend
int render_testPrimitivesBlend(void *arg)
Tests the SDL primitives with alpha for rendering.
Definition: testautomation_render.c:213
InitCreateRenderer
void InitCreateRenderer(void *arg)
Definition: testautomation_render.c:43
SDL_SetTextureBlendMode
#define SDL_SetTextureBlendMode
Definition: SDL_dynapi_overrides.h:313
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
SDL_CreateWindow
#define SDL_CreateWindow
Definition: SDL_dynapi_overrides.h:514
SDL_Rect::x
int x
Definition: SDL_rect.h:66
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
_hasTexAlpha
static int _hasTexAlpha(void)
Test to see if we can vary the alpha of the texture. Helper function.
Definition: testautomation_render.c:950
SDL_Rect::w
int w
Definition: SDL_rect.h:67
SDLTest_ImagePrimitivesBlend
SDL_Surface * SDLTest_ImagePrimitivesBlend(void)
Returns the PrimitivesBlend test image as SDL_Surface.
Definition: SDL_test_imagePrimitivesBlend.c:673
RENDER_COMPARE_RMASK
#define RENDER_COMPARE_RMASK
Definition: testautomation_render.c:18
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:74
SDLTest_ImageFace
SDL_Surface * SDLTest_ImageFace(void)
Returns the Face test image as SDL_Surface.
Definition: SDL_test_imageFace.c:224
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
RENDER_COMPARE_GMASK
#define RENDER_COMPARE_GMASK
Definition: testautomation_render.c:19
reference
GLint reference
Definition: SDL_opengl_glext.h:9174
SDL_CreateTextureFromSurface
#define SDL_CreateTextureFromSurface
Definition: SDL_dynapi_overrides.h:307
SDL_CreateRGBSurfaceFrom
#define SDL_CreateRGBSurfaceFrom
Definition: SDL_dynapi_overrides.h:445
TESTRENDER_SCREEN_H
#define TESTRENDER_SCREEN_H
Definition: testautomation_render.c:14
TESTRENDER_SCREEN_W
#define TESTRENDER_SCREEN_W
Definition: testautomation_render.c:13
SDL_Renderer
Definition: SDL_sysrender.h:86
SDL_GetTextureAlphaMod
#define SDL_GetTextureAlphaMod
Definition: SDL_dynapi_overrides.h:312
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_RenderCopy
#define SDL_RenderCopy
Definition: SDL_dynapi_overrides.h:343
window
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
_hasDrawColor
static int _hasDrawColor(void)
Test to see if we can vary the draw color. Helper function.
Definition: testautomation_render.c:786
SDL_Rect::y
int y
Definition: SDL_rect.h:66
SDLTest_TestCaseFp
int(* SDLTest_TestCaseFp)(void *arg)
Definition: SDL_test_harness.h:67
SDLTest_AssertPass
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.
Definition: SDL_test_assert.c:94
SDL_Rect::h
int h
Definition: SDL_rect.h:67
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
TEST_ABORTED
#define TEST_ABORTED
Definition: SDL_test_harness.h:51
renderTests
static const SDLTest_TestCaseReference * renderTests[]
Definition: testautomation_render.c:1089
SDL_BLENDMODE_NONE
@ SDL_BLENDMODE_NONE
Definition: SDL_blendmode.h:42
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_QueryTexture
#define SDL_QueryTexture
Definition: SDL_dynapi_overrides.h:308
SDL_SetTextureColorMod
#define SDL_SetTextureColorMod
Definition: SDL_dynapi_overrides.h:309
SDL_GetRenderDrawColor
#define SDL_GetRenderDrawColor
Definition: SDL_dynapi_overrides.h:331
rect
SDL_Rect rect
Definition: testrelative.c:27
SDL_FreeSurface
#define SDL_FreeSurface
Definition: SDL_dynapi_overrides.h:446
_clearScreen
static int _clearScreen(void)
Clears the screen. Helper function.
Definition: testautomation_render.c:1036
renderTest5
static const SDLTest_TestCaseReference renderTest5
Definition: testautomation_render.c:1077
render_testGetNumRenderDrivers
int render_testGetNumRenderDrivers(void *arg)
Tests call to SDL_GetNumRenderDrivers.
Definition: testautomation_render.c:89
SDL_GetTextureColorMod
#define SDL_GetTextureColorMod
Definition: SDL_dynapi_overrides.h:310
SDLTest_AssertCheck
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...
Definition: SDL_test_assert.c:65
SDLTest_TestCaseReference
Definition: SDL_test_harness.h:75
TEST_COMPLETED
#define TEST_COMPLETED
Definition: SDL_test_harness.h:53
testSurface
static SDL_Surface * testSurface
Definition: testautomation_surface.c:28
SDLTest_ImageBlitBlendAll
SDL_Surface * SDLTest_ImageBlitBlendAll(void)
Returns the BlitBlendAll test image as SDL_Surface.
Definition: SDL_test_imageBlitBlend.c:2822
pixels
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: SDL_opengl.h:1572
SDLTest_ImageBlitBlendNone
SDL_Surface * SDLTest_ImageBlitBlendNone(void)
Returns the BlitBlendNone test image as SDL_Surface.
Definition: SDL_test_imageBlitBlend.c:2354
RENDER_COMPARE_FORMAT
#define RENDER_COMPARE_FORMAT
Definition: testautomation_render.c:16
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDLTest_CompareSurfaces
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
Definition: SDL_test_compare.c:39
SDL_DestroyTexture
#define SDL_DestroyTexture
Definition: SDL_dynapi_overrides.h:347
renderTest2
static const SDLTest_TestCaseReference renderTest2
Definition: testautomation_render.c:1067
_testBlitBlendMode
static void _testBlitBlendMode(SDL_Texture *tface, int mode)
Tests a blend mode.
Definition: testautomation_render.c:583
RENDER_COMPARE_AMASK
#define RENDER_COMPARE_AMASK
Definition: testautomation_render.c:17
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:65
SDLTest_ImageBlitAlpha
SDL_Surface * SDLTest_ImageBlitAlpha(void)
Returns the BlitAlpha test image as SDL_Surface.
Definition: SDL_test_imageBlit.c:1536
j
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
renderTest1
static const SDLTest_TestCaseReference renderTest1
Definition: testautomation_render.c:1064
SDL_Texture
Definition: SDL_sysrender.h:58
SDLTest_LogError
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
Definition: SDL_test_log.c:103
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:334
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:330
CleanupDestroyRenderer
void CleanupDestroyRenderer(void *arg)
Definition: testautomation_render.c:66
renderTest7
static const SDLTest_TestCaseReference renderTest7
Definition: testautomation_render.c:1085
_compare
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
Definition: testautomation_render.c:992
TEST_DISABLED
#define TEST_DISABLED
Definition: SDL_test_harness.h:48
render_testPrimitives
int render_testPrimitives(void *arg)
Tests the SDL primitives for rendering.
Definition: testautomation_render.c:107
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_RENDERER_ACCELERATED
@ SDL_RENDERER_ACCELERATED
Definition: SDL_render.h:67
SDL_RenderDrawLine
#define SDL_RenderDrawLine
Definition: SDL_dynapi_overrides.h:337
SDL_CreateRenderer
#define SDL_CreateRenderer
Definition: SDL_dynapi_overrides.h:301
face
GLenum GLuint GLint GLenum face
Definition: SDL_opengl_glext.h:3019
SDL_DestroyRenderer
#define SDL_DestroyRenderer
Definition: SDL_dynapi_overrides.h:348
SDL_SetTextureAlphaMod
#define SDL_SetTextureAlphaMod
Definition: SDL_dynapi_overrides.h:311
renderTest3
static const SDLTest_TestCaseReference renderTest3
Definition: testautomation_render.c:1071
SDL_RenderReadPixels
#define SDL_RenderReadPixels
Definition: SDL_dynapi_overrides.h:345
SDLTest_TestSuiteReference
Definition: SDL_test_harness.h:89
i
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
SDLTest_ImageBlitBlend
SDL_Surface * SDLTest_ImageBlitBlend(void)
Returns the BlitBlend test image as SDL_Surface.
Definition: SDL_test_imageBlitBlend.c:1111
SDL_DestroyWindow
#define SDL_DestroyWindow
Definition: SDL_dynapi_overrides.h:549
SDL_BLENDMODE_MOD
@ SDL_BLENDMODE_MOD
Definition: SDL_blendmode.h:50
SDL_BLENDMODE_ADD
@ SDL_BLENDMODE_ADD
Definition: SDL_blendmode.h:47
SDL_BlendMode
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:41
SDLTest_ImageBlitBlendMod
SDL_Surface * SDLTest_ImageBlitBlendMod(void)
Returns the BlitBlendMod test image as SDL_Surface.
Definition: SDL_test_imageBlitBlend.c:1541
SDLTest_ImageBlit
SDL_Surface * SDLTest_ImageBlit(void)
Returns the Blit test image as SDL_Surface.
Definition: SDL_test_imageBlit.c:541
RENDER_COMPARE_BMASK
#define RENDER_COMPARE_BMASK
Definition: testautomation_render.c:20
_loadTestFace
static SDL_Texture * _loadTestFace(void)
Loads the test image 'Face' as texture. Helper function.
Definition: testautomation_render.c:880