testautomation_render.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  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. #include <stdio.h>
  6. #include "SDL.h"
  7. #include "SDL_test.h"
  8. /* ================= Test Case Implementation ================== */
  9. #define TESTRENDER_SCREEN_W 80
  10. #define TESTRENDER_SCREEN_H 60
  11. #define RENDER_COMPARE_FORMAT SDL_PIXELFORMAT_ARGB8888
  12. #define RENDER_COMPARE_AMASK 0xff000000 /**< Alpha bit mask. */
  13. #define RENDER_COMPARE_RMASK 0x00ff0000 /**< Red bit mask. */
  14. #define RENDER_COMPARE_GMASK 0x0000ff00 /**< Green bit mask. */
  15. #define RENDER_COMPARE_BMASK 0x000000ff /**< Blue bit mask. */
  16. #define ALLOWABLE_ERROR_OPAQUE 0
  17. #define ALLOWABLE_ERROR_BLENDED 64
  18. /* Test window and renderer */
  19. SDL_Window *window = NULL;
  20. SDL_Renderer *renderer = NULL;
  21. /* Prototypes for helper functions */
  22. static int _clearScreen (void);
  23. static void _compare(SDL_Surface *reference, int allowable_error);
  24. static int _hasTexAlpha(void);
  25. static int _hasTexColor(void);
  26. static SDL_Texture *_loadTestFace(void);
  27. static int _hasBlendModes(void);
  28. static int _hasDrawColor(void);
  29. static int _isSupported(int code);
  30. /**
  31. * Create software renderer for tests
  32. */
  33. void InitCreateRenderer(void *arg)
  34. {
  35. int posX = 100, posY = 100, width = 320, height = 240;
  36. renderer = NULL;
  37. window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
  38. SDLTest_AssertPass("SDL_CreateWindow()");
  39. SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
  40. if (window == NULL) {
  41. return;
  42. }
  43. renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
  44. SDLTest_AssertPass("SDL_CreateRenderer()");
  45. SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
  46. if (renderer == NULL) {
  47. SDL_DestroyWindow(window);
  48. return;
  49. }
  50. }
  51. /*
  52. * Destroy renderer for tests
  53. */
  54. void CleanupDestroyRenderer(void *arg)
  55. {
  56. if (renderer != NULL) {
  57. SDL_DestroyRenderer(renderer);
  58. renderer = NULL;
  59. SDLTest_AssertPass("SDL_DestroyRenderer()");
  60. }
  61. if (window != NULL) {
  62. SDL_DestroyWindow(window);
  63. window = NULL;
  64. SDLTest_AssertPass("SDL_DestroyWindow");
  65. }
  66. }
  67. /**
  68. * @brief Tests call to SDL_GetNumRenderDrivers
  69. *
  70. * \sa
  71. * http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers
  72. */
  73. int
  74. render_testGetNumRenderDrivers(void *arg)
  75. {
  76. int n;
  77. n = SDL_GetNumRenderDrivers();
  78. SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
  79. return TEST_COMPLETED;
  80. }
  81. /**
  82. * @brief Tests the SDL primitives for rendering.
  83. *
  84. * \sa
  85. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  86. * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  87. * http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine
  88. *
  89. */
  90. int render_testPrimitives (void *arg)
  91. {
  92. int ret;
  93. int x, y;
  94. SDL_Rect rect;
  95. SDL_Surface *referenceSurface = NULL;
  96. int checkFailCount1;
  97. int checkFailCount2;
  98. /* Need drawcolor or just skip test. */
  99. SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
  100. /* Draw a rectangle. */
  101. rect.x = 40;
  102. rect.y = 0;
  103. rect.w = 40;
  104. rect.h = 80;
  105. ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
  106. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  107. ret = SDL_RenderFillRect(renderer, &rect );
  108. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  109. /* Draw a rectangle. */
  110. rect.x = 10;
  111. rect.y = 10;
  112. rect.w = 60;
  113. rect.h = 40;
  114. ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
  115. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  116. ret = SDL_RenderFillRect(renderer, &rect );
  117. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  118. /* Draw some points like so:
  119. * X.X.X.X..
  120. * .X.X.X.X.
  121. * X.X.X.X.. */
  122. checkFailCount1 = 0;
  123. checkFailCount2 = 0;
  124. for (y=0; y<3; y++) {
  125. for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
  126. ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
  127. if (ret != 0) checkFailCount1++;
  128. ret = SDL_RenderDrawPoint(renderer, x, y );
  129. if (ret != 0) checkFailCount2++;
  130. }
  131. }
  132. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  133. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
  134. /* Draw some lines. */
  135. ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE );
  136. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
  137. ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
  138. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  139. ret = SDL_SetRenderDrawColor(renderer, 55, 55, 5, SDL_ALPHA_OPAQUE );
  140. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  141. ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
  142. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  143. ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
  144. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  145. ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
  146. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  147. ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
  148. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  149. ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
  150. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  151. ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
  152. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
  153. /* See if it's the same. */
  154. referenceSurface = SDLTest_ImagePrimitives();
  155. _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
  156. /* Clean up. */
  157. SDL_FreeSurface(referenceSurface);
  158. referenceSurface = NULL;
  159. return TEST_COMPLETED;
  160. }
  161. /**
  162. * @brief Tests the SDL primitives with alpha for rendering.
  163. *
  164. * \sa
  165. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  166. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  167. * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  168. */
  169. int render_testPrimitivesBlend (void *arg)
  170. {
  171. int ret;
  172. int i, j;
  173. SDL_Rect rect;
  174. SDL_Surface *referenceSurface = NULL;
  175. int checkFailCount1;
  176. int checkFailCount2;
  177. int checkFailCount3;
  178. /* Need drawcolor and blendmode or just skip test. */
  179. SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
  180. SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
  181. /* Create some rectangles for each blend mode. */
  182. ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
  183. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  184. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  185. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  186. ret = SDL_RenderFillRect(renderer, NULL );
  187. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  188. rect.x = 10;
  189. rect.y = 25;
  190. rect.w = 40;
  191. rect.h = 25;
  192. ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
  193. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  194. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
  195. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  196. ret = SDL_RenderFillRect(renderer, &rect );
  197. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  198. rect.x = 30;
  199. rect.y = 40;
  200. rect.w = 45;
  201. rect.h = 15;
  202. ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
  203. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  204. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
  205. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  206. ret = SDL_RenderFillRect(renderer, &rect );
  207. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  208. rect.x = 25;
  209. rect.y = 25;
  210. rect.w = 25;
  211. rect.h = 25;
  212. ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
  213. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  214. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  215. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  216. ret = SDL_RenderFillRect(renderer, &rect );
  217. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  218. /* Draw blended lines, lines for everyone. */
  219. checkFailCount1 = 0;
  220. checkFailCount2 = 0;
  221. checkFailCount3 = 0;
  222. for (i=0; i<TESTRENDER_SCREEN_W; i+=2) {
  223. ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
  224. if (ret != 0) checkFailCount1++;
  225. ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
  226. (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  227. if (ret != 0) checkFailCount2++;
  228. ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
  229. if (ret != 0) checkFailCount3++;
  230. }
  231. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  232. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  233. SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
  234. checkFailCount1 = 0;
  235. checkFailCount2 = 0;
  236. checkFailCount3 = 0;
  237. for (i=0; i<TESTRENDER_SCREEN_H; i+=2) {
  238. ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
  239. if (ret != 0) checkFailCount1++;
  240. ret = SDL_SetRenderDrawBlendMode(renderer,(((i/2)%3)==0) ? SDL_BLENDMODE_BLEND :
  241. (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  242. if (ret != 0) checkFailCount2++;
  243. ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
  244. if (ret != 0) checkFailCount3++;
  245. }
  246. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  247. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  248. SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
  249. /* Draw points. */
  250. checkFailCount1 = 0;
  251. checkFailCount2 = 0;
  252. checkFailCount3 = 0;
  253. for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
  254. for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
  255. ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
  256. if (ret != 0) checkFailCount1++;
  257. ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
  258. ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
  259. if (ret != 0) checkFailCount2++;
  260. ret = SDL_RenderDrawPoint(renderer, i, j );
  261. if (ret != 0) checkFailCount3++;
  262. }
  263. }
  264. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
  265. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
  266. SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
  267. /* See if it's the same. */
  268. referenceSurface = SDLTest_ImagePrimitivesBlend();
  269. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
  270. /* Clean up. */
  271. SDL_FreeSurface(referenceSurface);
  272. referenceSurface = NULL;
  273. return TEST_COMPLETED;
  274. }
  275. /**
  276. * @brief Tests some blitting routines.
  277. *
  278. * \sa
  279. * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  280. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  281. */
  282. int
  283. render_testBlit(void *arg)
  284. {
  285. int ret;
  286. SDL_Rect rect;
  287. SDL_Texture *tface;
  288. SDL_Surface *referenceSurface = NULL;
  289. Uint32 tformat;
  290. int taccess, tw, th;
  291. int i, j, ni, nj;
  292. int checkFailCount1;
  293. /* Need drawcolor or just skip test. */
  294. SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
  295. /* Create face surface. */
  296. tface = _loadTestFace();
  297. SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  298. if (tface == NULL) {
  299. return TEST_ABORTED;
  300. }
  301. /* Constant values. */
  302. ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  303. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  304. rect.w = tw;
  305. rect.h = th;
  306. ni = TESTRENDER_SCREEN_W - tw;
  307. nj = TESTRENDER_SCREEN_H - th;
  308. /* Loop blit. */
  309. checkFailCount1 = 0;
  310. for (j=0; j <= nj; j+=4) {
  311. for (i=0; i <= ni; i+=4) {
  312. /* Blitting. */
  313. rect.x = i;
  314. rect.y = j;
  315. ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  316. if (ret != 0) checkFailCount1++;
  317. }
  318. }
  319. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
  320. /* See if it's the same */
  321. referenceSurface = SDLTest_ImageBlit();
  322. _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
  323. /* Clean up. */
  324. SDL_DestroyTexture( tface );
  325. SDL_FreeSurface(referenceSurface);
  326. referenceSurface = NULL;
  327. return TEST_COMPLETED;
  328. }
  329. /**
  330. * @brief Blits doing color tests.
  331. *
  332. * \sa
  333. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  334. * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  335. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  336. */
  337. int
  338. render_testBlitColor (void *arg)
  339. {
  340. int ret;
  341. SDL_Rect rect;
  342. SDL_Texture *tface;
  343. SDL_Surface *referenceSurface = NULL;
  344. Uint32 tformat;
  345. int taccess, tw, th;
  346. int i, j, ni, nj;
  347. int checkFailCount1;
  348. int checkFailCount2;
  349. /* Create face surface. */
  350. tface = _loadTestFace();
  351. SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  352. if (tface == NULL) {
  353. return TEST_ABORTED;
  354. }
  355. /* Constant values. */
  356. ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  357. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  358. rect.w = tw;
  359. rect.h = th;
  360. ni = TESTRENDER_SCREEN_W - tw;
  361. nj = TESTRENDER_SCREEN_H - th;
  362. /* Test blitting with color mod. */
  363. checkFailCount1 = 0;
  364. checkFailCount2 = 0;
  365. for (j=0; j <= nj; j+=4) {
  366. for (i=0; i <= ni; i+=4) {
  367. /* Set color mod. */
  368. ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
  369. if (ret != 0) checkFailCount1++;
  370. /* Blitting. */
  371. rect.x = i;
  372. rect.y = j;
  373. ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  374. if (ret != 0) checkFailCount2++;
  375. }
  376. }
  377. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
  378. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  379. /* See if it's the same. */
  380. referenceSurface = SDLTest_ImageBlitColor();
  381. _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
  382. /* Clean up. */
  383. SDL_DestroyTexture( tface );
  384. SDL_FreeSurface(referenceSurface);
  385. referenceSurface = NULL;
  386. return TEST_COMPLETED;
  387. }
  388. /**
  389. * @brief Tests blitting with alpha.
  390. *
  391. * \sa
  392. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  393. * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  394. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  395. */
  396. int
  397. render_testBlitAlpha (void *arg)
  398. {
  399. int ret;
  400. SDL_Rect rect;
  401. SDL_Texture *tface;
  402. SDL_Surface *referenceSurface = NULL;
  403. Uint32 tformat;
  404. int taccess, tw, th;
  405. int i, j, ni, nj;
  406. int checkFailCount1;
  407. int checkFailCount2;
  408. /* Need alpha or just skip test. */
  409. SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
  410. /* Create face surface. */
  411. tface = _loadTestFace();
  412. SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  413. if (tface == NULL) {
  414. return TEST_ABORTED;
  415. }
  416. /* Constant values. */
  417. ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  418. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  419. rect.w = tw;
  420. rect.h = th;
  421. ni = TESTRENDER_SCREEN_W - tw;
  422. nj = TESTRENDER_SCREEN_H - th;
  423. /* Test blitting with alpha mod. */
  424. checkFailCount1 = 0;
  425. checkFailCount2 = 0;
  426. for (j=0; j <= nj; j+=4) {
  427. for (i=0; i <= ni; i+=4) {
  428. /* Set alpha mod. */
  429. ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
  430. if (ret != 0) checkFailCount1++;
  431. /* Blitting. */
  432. rect.x = i;
  433. rect.y = j;
  434. ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  435. if (ret != 0) checkFailCount2++;
  436. }
  437. }
  438. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
  439. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  440. /* See if it's the same. */
  441. referenceSurface = SDLTest_ImageBlitAlpha();
  442. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
  443. /* Clean up. */
  444. SDL_DestroyTexture( tface );
  445. SDL_FreeSurface(referenceSurface);
  446. referenceSurface = NULL;
  447. return TEST_COMPLETED;
  448. }
  449. /* Helper functions */
  450. /**
  451. * @brief Tests a blend mode.
  452. *
  453. * \sa
  454. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
  455. * http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy
  456. */
  457. static void
  458. _testBlitBlendMode( SDL_Texture * tface, int mode )
  459. {
  460. int ret;
  461. Uint32 tformat;
  462. int taccess, tw, th;
  463. int i, j, ni, nj;
  464. SDL_Rect rect;
  465. int checkFailCount1;
  466. int checkFailCount2;
  467. /* Clear surface. */
  468. _clearScreen();
  469. /* Constant values. */
  470. ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  471. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  472. rect.w = tw;
  473. rect.h = th;
  474. ni = TESTRENDER_SCREEN_W - tw;
  475. nj = TESTRENDER_SCREEN_H - th;
  476. /* Test blend mode. */
  477. checkFailCount1 = 0;
  478. checkFailCount2 = 0;
  479. for (j=0; j <= nj; j+=4) {
  480. for (i=0; i <= ni; i+=4) {
  481. /* Set blend mode. */
  482. ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
  483. if (ret != 0) checkFailCount1++;
  484. /* Blitting. */
  485. rect.x = i;
  486. rect.y = j;
  487. ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  488. if (ret != 0) checkFailCount2++;
  489. }
  490. }
  491. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
  492. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
  493. }
  494. /**
  495. * @brief Tests some more blitting routines.
  496. *
  497. * \sa
  498. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  499. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  500. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode
  501. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  502. */
  503. int
  504. render_testBlitBlend (void *arg)
  505. {
  506. int ret;
  507. SDL_Rect rect;
  508. SDL_Texture *tface;
  509. SDL_Surface *referenceSurface = NULL;
  510. Uint32 tformat;
  511. int taccess, tw, th;
  512. int i, j, ni, nj;
  513. int mode;
  514. int checkFailCount1;
  515. int checkFailCount2;
  516. int checkFailCount3;
  517. int checkFailCount4;
  518. SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
  519. SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
  520. SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
  521. /* Create face surface. */
  522. tface = _loadTestFace();
  523. SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
  524. if (tface == NULL) {
  525. return TEST_ABORTED;
  526. }
  527. /* Constant values. */
  528. ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
  529. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
  530. rect.w = tw;
  531. rect.h = th;
  532. ni = TESTRENDER_SCREEN_W - tw;
  533. nj = TESTRENDER_SCREEN_H - th;
  534. /* Set alpha mod. */
  535. ret = SDL_SetTextureAlphaMod( tface, 100 );
  536. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
  537. /* Test None. */
  538. _testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
  539. referenceSurface = SDLTest_ImageBlitBlendNone();
  540. _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
  541. SDL_FreeSurface(referenceSurface);
  542. referenceSurface = NULL;
  543. /* Test Blend. */
  544. _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
  545. referenceSurface = SDLTest_ImageBlitBlend();
  546. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
  547. SDL_FreeSurface(referenceSurface);
  548. referenceSurface = NULL;
  549. /* Test Add. */
  550. _testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
  551. referenceSurface = SDLTest_ImageBlitBlendAdd();
  552. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
  553. SDL_FreeSurface(referenceSurface);
  554. referenceSurface = NULL;
  555. /* Test Mod. */
  556. _testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
  557. referenceSurface = SDLTest_ImageBlitBlendMod();
  558. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
  559. SDL_FreeSurface(referenceSurface);
  560. referenceSurface = NULL;
  561. /* Clear surface. */
  562. _clearScreen();
  563. /* Loop blit. */
  564. checkFailCount1 = 0;
  565. checkFailCount2 = 0;
  566. checkFailCount3 = 0;
  567. checkFailCount4 = 0;
  568. for (j=0; j <= nj; j+=4) {
  569. for (i=0; i <= ni; i+=4) {
  570. /* Set color mod. */
  571. ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
  572. if (ret != 0) checkFailCount1++;
  573. /* Set alpha mod. */
  574. ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
  575. if (ret != 0) checkFailCount2++;
  576. /* Crazy blending mode magic. */
  577. mode = (i/4*j/4) % 4;
  578. if (mode==0) mode = SDL_BLENDMODE_NONE;
  579. else if (mode==1) mode = SDL_BLENDMODE_BLEND;
  580. else if (mode==2) mode = SDL_BLENDMODE_ADD;
  581. else if (mode==3) mode = SDL_BLENDMODE_MOD;
  582. ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
  583. if (ret != 0) checkFailCount3++;
  584. /* Blitting. */
  585. rect.x = i;
  586. rect.y = j;
  587. ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
  588. if (ret != 0) checkFailCount4++;
  589. }
  590. }
  591. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
  592. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
  593. SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
  594. SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
  595. /* Clean up. */
  596. SDL_DestroyTexture( tface );
  597. /* Check to see if final image matches. */
  598. referenceSurface = SDLTest_ImageBlitBlendAll();
  599. _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
  600. SDL_FreeSurface(referenceSurface);
  601. referenceSurface = NULL;
  602. return TEST_COMPLETED;
  603. }
  604. /**
  605. * @brief Checks to see if functionality is supported. Helper function.
  606. */
  607. static int
  608. _isSupported( int code )
  609. {
  610. return (code == 0);
  611. }
  612. /**
  613. * @brief Test to see if we can vary the draw color. Helper function.
  614. *
  615. * \sa
  616. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  617. * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor
  618. */
  619. static int
  620. _hasDrawColor (void)
  621. {
  622. int ret, fail;
  623. Uint8 r, g, b, a;
  624. fail = 0;
  625. /* Set color. */
  626. ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
  627. if (!_isSupported(ret))
  628. fail = 1;
  629. ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
  630. if (!_isSupported(ret))
  631. fail = 1;
  632. /* Restore natural. */
  633. ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
  634. if (!_isSupported(ret))
  635. fail = 1;
  636. /* Something failed, consider not available. */
  637. if (fail)
  638. return 0;
  639. /* Not set properly, consider failed. */
  640. else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
  641. return 0;
  642. return 1;
  643. }
  644. /**
  645. * @brief Test to see if we can vary the blend mode. Helper function.
  646. *
  647. * \sa
  648. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  649. * http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode
  650. */
  651. static int
  652. _hasBlendModes (void)
  653. {
  654. int fail;
  655. int ret;
  656. SDL_BlendMode mode;
  657. fail = 0;
  658. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND );
  659. if (!_isSupported(ret))
  660. fail = 1;
  661. ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  662. if (!_isSupported(ret))
  663. fail = 1;
  664. ret = (mode != SDL_BLENDMODE_BLEND);
  665. if (!_isSupported(ret))
  666. fail = 1;
  667. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD );
  668. if (!_isSupported(ret))
  669. fail = 1;
  670. ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  671. if (!_isSupported(ret))
  672. fail = 1;
  673. ret = (mode != SDL_BLENDMODE_ADD);
  674. if (!_isSupported(ret))
  675. fail = 1;
  676. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_MOD );
  677. if (!_isSupported(ret))
  678. fail = 1;
  679. ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  680. if (!_isSupported(ret))
  681. fail = 1;
  682. ret = (mode != SDL_BLENDMODE_MOD);
  683. if (!_isSupported(ret))
  684. fail = 1;
  685. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  686. if (!_isSupported(ret))
  687. fail = 1;
  688. ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
  689. if (!_isSupported(ret))
  690. fail = 1;
  691. ret = (mode != SDL_BLENDMODE_NONE);
  692. if (!_isSupported(ret))
  693. fail = 1;
  694. return !fail;
  695. }
  696. /**
  697. * @brief Loads the test image 'Face' as texture. Helper function.
  698. *
  699. * \sa
  700. * http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface
  701. */
  702. static SDL_Texture *
  703. _loadTestFace(void)
  704. {
  705. SDL_Surface *face;
  706. SDL_Texture *tface;
  707. face = SDLTest_ImageFace();
  708. if (face == NULL) {
  709. return NULL;
  710. }
  711. tface = SDL_CreateTextureFromSurface(renderer, face);
  712. if (tface == NULL) {
  713. SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
  714. }
  715. SDL_FreeSurface(face);
  716. return tface;
  717. }
  718. /**
  719. * @brief Test to see if can set texture color mode. Helper function.
  720. *
  721. * \sa
  722. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod
  723. * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod
  724. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  725. */
  726. static int
  727. _hasTexColor (void)
  728. {
  729. int fail;
  730. int ret;
  731. SDL_Texture *tface;
  732. Uint8 r, g, b;
  733. /* Get test face. */
  734. tface = _loadTestFace();
  735. if (tface == NULL)
  736. return 0;
  737. /* See if supported. */
  738. fail = 0;
  739. ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
  740. if (!_isSupported(ret))
  741. fail = 1;
  742. ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
  743. if (!_isSupported(ret))
  744. fail = 1;
  745. /* Clean up. */
  746. SDL_DestroyTexture( tface );
  747. if (fail)
  748. return 0;
  749. else if ((r != 100) || (g != 100) || (b != 100))
  750. return 0;
  751. return 1;
  752. }
  753. /**
  754. * @brief Test to see if we can vary the alpha of the texture. Helper function.
  755. *
  756. * \sa
  757. * http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod
  758. * http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod
  759. * http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture
  760. */
  761. static int
  762. _hasTexAlpha(void)
  763. {
  764. int fail;
  765. int ret;
  766. SDL_Texture *tface;
  767. Uint8 a;
  768. /* Get test face. */
  769. tface = _loadTestFace();
  770. if (tface == NULL)
  771. return 0;
  772. /* See if supported. */
  773. fail = 0;
  774. ret = SDL_SetTextureAlphaMod( tface, 100 );
  775. if (!_isSupported(ret))
  776. fail = 1;
  777. ret = SDL_GetTextureAlphaMod( tface, &a );
  778. if (!_isSupported(ret))
  779. fail = 1;
  780. /* Clean up. */
  781. SDL_DestroyTexture( tface );
  782. if (fail)
  783. return 0;
  784. else if (a != 100)
  785. return 0;
  786. return 1;
  787. }
  788. /**
  789. * @brief Compares screen pixels with image pixels. Helper function.
  790. *
  791. * @param s Image to compare against.
  792. *
  793. * \sa
  794. * http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels
  795. * http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom
  796. * http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface
  797. */
  798. static void
  799. _compare(SDL_Surface *referenceSurface, int allowable_error)
  800. {
  801. int result;
  802. SDL_Rect rect;
  803. Uint8 *pixels;
  804. SDL_Surface *testSurface;
  805. /* Read pixels. */
  806. pixels = (Uint8 *)SDL_malloc(4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H);
  807. SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
  808. if (pixels == NULL) return;
  809. /* Explicitly specify the rect in case the window isn't the expected size... */
  810. rect.x = 0;
  811. rect.y = 0;
  812. rect.w = TESTRENDER_SCREEN_W;
  813. rect.h = TESTRENDER_SCREEN_H;
  814. result = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pixels, 80*4 );
  815. SDLTest_AssertCheck(result == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", result);
  816. /* Create surface. */
  817. testSurface = SDL_CreateRGBSurfaceFrom(pixels, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
  818. RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
  819. SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom is not NULL");
  820. /* Compare surface. */
  821. result = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
  822. SDLTest_AssertCheck(result == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", result);
  823. /* Clean up. */
  824. SDL_free(pixels);
  825. SDL_FreeSurface(testSurface);
  826. }
  827. /**
  828. * @brief Clears the screen. Helper function.
  829. *
  830. * \sa
  831. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor
  832. * http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect
  833. * http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode
  834. */
  835. static int
  836. _clearScreen(void)
  837. {
  838. int ret;
  839. /* Set color. */
  840. ret = SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE );
  841. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  842. /* Clear screen. */
  843. ret = SDL_RenderFillRect(renderer, NULL );
  844. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
  845. /* Set defaults. */
  846. ret = SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE );
  847. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
  848. ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
  849. SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
  850. return 0;
  851. }
  852. /* ================= Test References ================== */
  853. /* Render test cases */
  854. static const SDLTest_TestCaseReference renderTest1 =
  855. { (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
  856. static const SDLTest_TestCaseReference renderTest2 =
  857. { (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED };
  858. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  859. static const SDLTest_TestCaseReference renderTest3 =
  860. { (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED };
  861. static const SDLTest_TestCaseReference renderTest4 =
  862. { (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED };
  863. static const SDLTest_TestCaseReference renderTest5 =
  864. { (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED };
  865. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  866. static const SDLTest_TestCaseReference renderTest6 =
  867. { (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED };
  868. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  869. static const SDLTest_TestCaseReference renderTest7 =
  870. { (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED };
  871. /* Sequence of Render test cases */
  872. static const SDLTest_TestCaseReference *renderTests[] = {
  873. &renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
  874. };
  875. /* Render test suite (global) */
  876. SDLTest_TestSuiteReference renderTestSuite = {
  877. "Render",
  878. InitCreateRenderer,
  879. renderTests,
  880. CleanupDestroyRenderer
  881. };