🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

648 lines
20 KiB

  1. /**
  2. * Original code: automated SDL surface test written by Edgar Simo "bobbens"
  3. * Adapted/rewritten for test lib by Andreas Schiffler
  4. */
  5. /* Supress C4996 VS compiler warnings for unlink() */
  6. #define _CRT_SECURE_NO_DEPRECATE
  7. #define _CRT_NONSTDC_NO_DEPRECATE
  8. #include <stdio.h>
  9. #ifndef _MSC_VER
  10. #include <unistd.h>
  11. #endif
  12. #include <sys/stat.h>
  13. #include "SDL.h"
  14. #include "SDL_test.h"
  15. #ifdef __MACOSX__
  16. #include <unistd.h> /* For unlink() */
  17. #endif
  18. /* ================= Test Case Implementation ================== */
  19. /* Shared test surface */
  20. static SDL_Surface *referenceSurface = NULL;
  21. static SDL_Surface *testSurface = NULL;
  22. /* Helper functions for the test cases */
  23. #define TEST_SURFACE_WIDTH testSurface->w
  24. #define TEST_SURFACE_HEIGHT testSurface->h
  25. /* Fixture */
  26. /* Create a 32-bit writable surface for blitting tests */
  27. void
  28. _surfaceSetUp(void *arg)
  29. {
  30. int result;
  31. SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
  32. SDL_BlendMode currentBlendMode;
  33. Uint32 rmask, gmask, bmask, amask;
  34. #if SDL_BYTEORDER == SDL_BIG_ENDIAN
  35. rmask = 0xff000000;
  36. gmask = 0x00ff0000;
  37. bmask = 0x0000ff00;
  38. amask = 0x000000ff;
  39. #else
  40. rmask = 0x000000ff;
  41. gmask = 0x0000ff00;
  42. bmask = 0x00ff0000;
  43. amask = 0xff000000;
  44. #endif
  45. referenceSurface = SDLTest_ImageBlit(); /* For size info */
  46. testSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask);
  47. SDLTest_AssertCheck(testSurface != NULL, "Check that testSurface is not NULL");
  48. if (testSurface != NULL) {
  49. /* Disable blend mode for target surface */
  50. result = SDL_SetSurfaceBlendMode(testSurface, blendMode);
  51. SDLTest_AssertCheck(result == 0, "Validate result from SDL_SetSurfaceBlendMode, expected: 0, got: %i", result);
  52. result = SDL_GetSurfaceBlendMode(testSurface, &currentBlendMode);
  53. SDLTest_AssertCheck(result == 0, "Validate result from SDL_GetSurfaceBlendMode, expected: 0, got: %i", result);
  54. SDLTest_AssertCheck(currentBlendMode == blendMode, "Validate blendMode, expected: %i, got: %i", blendMode, currentBlendMode);
  55. }
  56. }
  57. void
  58. _surfaceTearDown(void *arg)
  59. {
  60. SDL_FreeSurface(referenceSurface);
  61. referenceSurface = NULL;
  62. SDL_FreeSurface(testSurface);
  63. testSurface = NULL;
  64. }
  65. /**
  66. * Helper that clears the test surface
  67. */
  68. void _clearTestSurface()
  69. {
  70. int ret;
  71. Uint32 color;
  72. /* Clear surface. */
  73. color = SDL_MapRGBA( testSurface->format, 0, 0, 0, 0);
  74. SDLTest_AssertPass("Call to SDL_MapRGBA()");
  75. ret = SDL_FillRect( testSurface, NULL, color);
  76. SDLTest_AssertPass("Call to SDL_FillRect()");
  77. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_FillRect, expected: 0, got: %i", ret);
  78. }
  79. /**
  80. * 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.
  81. */
  82. void _testBlitBlendMode(int mode)
  83. {
  84. int ret;
  85. int i, j, ni, nj;
  86. SDL_Surface *face;
  87. SDL_Rect rect;
  88. int nmode;
  89. SDL_BlendMode bmode;
  90. int checkFailCount1;
  91. int checkFailCount2;
  92. int checkFailCount3;
  93. int checkFailCount4;
  94. /* Check test surface */
  95. SDLTest_AssertCheck(testSurface != NULL, "Verify testSurface is not NULL");
  96. if (testSurface == NULL) return;
  97. /* Create sample surface */
  98. face = SDLTest_ImageFace();
  99. SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
  100. if (face == NULL) return;
  101. /* Reset alpha modulation */
  102. ret = SDL_SetSurfaceAlphaMod(face, 255);
  103. SDLTest_AssertPass("Call to SDL_SetSurfaceAlphaMod()");
  104. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceAlphaMod(), expected: 0, got: %i", ret);
  105. /* Reset color modulation */
  106. ret = SDL_SetSurfaceColorMod(face, 255, 255, 255);
  107. SDLTest_AssertPass("Call to SDL_SetSurfaceColorMod()");
  108. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
  109. /* Reset color key */
  110. ret = SDL_SetColorKey(face, SDL_FALSE, 0);
  111. SDLTest_AssertPass("Call to SDL_SetColorKey()");
  112. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
  113. /* Clear the test surface */
  114. _clearTestSurface();
  115. /* Target rect size */
  116. rect.w = face->w;
  117. rect.h = face->h;
  118. /* Steps to take */
  119. ni = testSurface->w - face->w;
  120. nj = testSurface->h - face->h;
  121. /* Optionally set blend mode. */
  122. if (mode >= 0) {
  123. ret = SDL_SetSurfaceBlendMode( face, (SDL_BlendMode)mode );
  124. SDLTest_AssertPass("Call to SDL_SetSurfaceBlendMode()");
  125. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetSurfaceBlendMode(..., %i), expected: 0, got: %i", mode, ret);
  126. }
  127. /* Test blend mode. */
  128. checkFailCount1 = 0;
  129. checkFailCount2 = 0;
  130. checkFailCount3 = 0;
  131. checkFailCount4 = 0;
  132. for (j=0; j <= nj; j+=4) {
  133. for (i=0; i <= ni; i+=4) {
  134. if (mode == -2) {
  135. /* Set color mod. */
  136. ret = SDL_SetSurfaceColorMod( face, (255/nj)*j, (255/ni)*i, (255/nj)*j );
  137. if (ret != 0) checkFailCount2++;
  138. }
  139. else if (mode == -3) {
  140. /* Set alpha mod. */
  141. ret = SDL_SetSurfaceAlphaMod( face, (255/ni)*i );
  142. if (ret != 0) checkFailCount3++;
  143. }
  144. else if (mode == -4) {
  145. /* Crazy blending mode magic. */
  146. nmode = (i/4*j/4) % 4;
  147. if (nmode==0) {
  148. bmode = SDL_BLENDMODE_NONE;
  149. } else if (nmode==1) {
  150. bmode = SDL_BLENDMODE_BLEND;
  151. } else if (nmode==2) {
  152. bmode = SDL_BLENDMODE_ADD;
  153. } else if (nmode==3) {
  154. bmode = SDL_BLENDMODE_MOD;
  155. }
  156. ret = SDL_SetSurfaceBlendMode( face, bmode );
  157. if (ret != 0) checkFailCount4++;
  158. }
  159. /* Blitting. */
  160. rect.x = i;
  161. rect.y = j;
  162. ret = SDL_BlitSurface( face, NULL, testSurface, &rect );
  163. if (ret != 0) checkFailCount1++;
  164. }
  165. }
  166. SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
  167. SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetSurfaceColorMod, expected: 0, got: %i", checkFailCount2);
  168. SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_SetSurfaceAlphaMod, expected: 0, got: %i", checkFailCount3);
  169. SDLTest_AssertCheck(checkFailCount4 == 0, "Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
  170. /* Clean up */
  171. SDL_FreeSurface(face);
  172. face = NULL;
  173. }
  174. /* Helper to check that a file exists */
  175. void
  176. _AssertFileExist(const char *filename)
  177. {
  178. struct stat st;
  179. int ret = stat(filename, &st);
  180. SDLTest_AssertCheck(ret == 0, "Verify file '%s' exists", filename);
  181. }
  182. /* Test case functions */
  183. /**
  184. * @brief Tests sprite saving and loading
  185. */
  186. int
  187. surface_testSaveLoadBitmap(void *arg)
  188. {
  189. int ret;
  190. const char *sampleFilename = "testSaveLoadBitmap.bmp";
  191. SDL_Surface *face;
  192. SDL_Surface *rface;
  193. /* Create sample surface */
  194. face = SDLTest_ImageFace();
  195. SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
  196. if (face == NULL) return TEST_ABORTED;
  197. /* Delete test file; ignore errors */
  198. unlink(sampleFilename);
  199. /* Save a surface */
  200. ret = SDL_SaveBMP(face, sampleFilename);
  201. SDLTest_AssertPass("Call to SDL_SaveBMP()");
  202. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SaveBMP, expected: 0, got: %i", ret);
  203. _AssertFileExist(sampleFilename);
  204. /* Load a surface */
  205. rface = SDL_LoadBMP(sampleFilename);
  206. SDLTest_AssertPass("Call to SDL_LoadBMP()");
  207. SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_LoadBMP is not NULL");
  208. if (rface != NULL) {
  209. SDLTest_AssertCheck(face->w == rface->w, "Verify width of loaded surface, expected: %i, got: %i", face->w, rface->w);
  210. SDLTest_AssertCheck(face->h == rface->h, "Verify height of loaded surface, expected: %i, got: %i", face->h, rface->h);
  211. }
  212. /* Delete test file; ignore errors */
  213. unlink(sampleFilename);
  214. /* Clean up */
  215. SDL_FreeSurface(face);
  216. face = NULL;
  217. SDL_FreeSurface(rface);
  218. rface = NULL;
  219. return TEST_COMPLETED;
  220. }
  221. /* !
  222. * Tests surface conversion.
  223. */
  224. int
  225. surface_testSurfaceConversion(void *arg)
  226. {
  227. SDL_Surface *rface = NULL, *face = NULL;
  228. int ret = 0;
  229. /* Create sample surface */
  230. face = SDLTest_ImageFace();
  231. SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
  232. if (face == NULL)
  233. return TEST_ABORTED;
  234. /* Set transparent pixel as the pixel at (0,0) */
  235. if (face->format->palette) {
  236. ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
  237. SDLTest_AssertPass("Call to SDL_SetColorKey()");
  238. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
  239. }
  240. /* Convert to 32 bit to compare. */
  241. rface = SDL_ConvertSurface( face, testSurface->format, 0 );
  242. SDLTest_AssertPass("Call to SDL_ConvertSurface()");
  243. SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL");
  244. /* Compare surface. */
  245. ret = SDLTest_CompareSurfaces( rface, face, 0 );
  246. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  247. /* Clean up. */
  248. SDL_FreeSurface(face);
  249. face = NULL;
  250. SDL_FreeSurface(rface);
  251. rface = NULL;
  252. return TEST_COMPLETED;
  253. }
  254. /* !
  255. * Tests surface conversion across all pixel formats.
  256. */
  257. int
  258. surface_testCompleteSurfaceConversion(void *arg)
  259. {
  260. Uint32 pixel_formats[] = {
  261. SDL_PIXELFORMAT_INDEX8,
  262. SDL_PIXELFORMAT_RGB332,
  263. SDL_PIXELFORMAT_RGB444,
  264. SDL_PIXELFORMAT_BGR444,
  265. SDL_PIXELFORMAT_RGB555,
  266. SDL_PIXELFORMAT_BGR555,
  267. SDL_PIXELFORMAT_ARGB4444,
  268. SDL_PIXELFORMAT_RGBA4444,
  269. SDL_PIXELFORMAT_ABGR4444,
  270. SDL_PIXELFORMAT_BGRA4444,
  271. SDL_PIXELFORMAT_ARGB1555,
  272. SDL_PIXELFORMAT_RGBA5551,
  273. SDL_PIXELFORMAT_ABGR1555,
  274. SDL_PIXELFORMAT_BGRA5551,
  275. SDL_PIXELFORMAT_RGB565,
  276. SDL_PIXELFORMAT_BGR565,
  277. SDL_PIXELFORMAT_RGB24,
  278. SDL_PIXELFORMAT_BGR24,
  279. SDL_PIXELFORMAT_RGB888,
  280. SDL_PIXELFORMAT_RGBX8888,
  281. SDL_PIXELFORMAT_BGR888,
  282. SDL_PIXELFORMAT_BGRX8888,
  283. SDL_PIXELFORMAT_ARGB8888,
  284. SDL_PIXELFORMAT_RGBA8888,
  285. SDL_PIXELFORMAT_ABGR8888,
  286. SDL_PIXELFORMAT_BGRA8888,
  287. SDL_PIXELFORMAT_ARGB2101010,
  288. };
  289. SDL_Surface *face = NULL, *cvt1, *cvt2, *final;
  290. SDL_PixelFormat *fmt1, *fmt2;
  291. int i, j, ret = 0;
  292. /* Create sample surface */
  293. face = SDLTest_ImageFace();
  294. SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
  295. if (face == NULL)
  296. return TEST_ABORTED;
  297. /* Set transparent pixel as the pixel at (0,0) */
  298. if (face->format->palette) {
  299. ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
  300. SDLTest_AssertPass("Call to SDL_SetColorKey()");
  301. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
  302. }
  303. for ( i = 0; i < SDL_arraysize(pixel_formats); ++i ) {
  304. for ( j = 0; j < SDL_arraysize(pixel_formats); ++j ) {
  305. fmt1 = SDL_AllocFormat(pixel_formats[i]);
  306. SDL_assert(fmt1 != NULL);
  307. cvt1 = SDL_ConvertSurface(face, fmt1, 0);
  308. SDL_assert(cvt1 != NULL);
  309. fmt2 = SDL_AllocFormat(pixel_formats[j]);
  310. SDL_assert(fmt1 != NULL);
  311. cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
  312. SDL_assert(cvt2 != NULL);
  313. if ( fmt1->BytesPerPixel == face->format->BytesPerPixel &&
  314. fmt2->BytesPerPixel == face->format->BytesPerPixel &&
  315. (fmt1->Amask != 0) == (face->format->Amask != 0) &&
  316. (fmt2->Amask != 0) == (face->format->Amask != 0) ) {
  317. final = SDL_ConvertSurface( cvt2, face->format, 0 );
  318. SDL_assert(final != NULL);
  319. /* Compare surface. */
  320. ret = SDLTest_CompareSurfaces( face, final, 0 );
  321. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  322. SDL_FreeSurface(final);
  323. }
  324. SDL_FreeSurface(cvt1);
  325. SDL_FreeFormat(fmt1);
  326. SDL_FreeSurface(cvt2);
  327. SDL_FreeFormat(fmt2);
  328. }
  329. }
  330. /* Clean up. */
  331. SDL_FreeSurface( face );
  332. return TEST_COMPLETED;
  333. }
  334. /**
  335. * @brief Tests sprite loading. A failure case.
  336. */
  337. int
  338. surface_testLoadFailure(void *arg)
  339. {
  340. SDL_Surface *face = SDL_LoadBMP("nonexistant.bmp");
  341. SDLTest_AssertCheck(face == NULL, "SDL_CreateLoadBmp");
  342. return TEST_COMPLETED;
  343. }
  344. /**
  345. * @brief Tests some blitting routines.
  346. */
  347. int
  348. surface_testBlit(void *arg)
  349. {
  350. int ret;
  351. SDL_Surface *compareSurface;
  352. /* Basic blitting */
  353. _testBlitBlendMode(-1);
  354. /* Verify result by comparing surfaces */
  355. compareSurface = SDLTest_ImageBlit();
  356. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  357. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  358. /* Clean up. */
  359. SDL_FreeSurface(compareSurface);
  360. return TEST_COMPLETED;
  361. }
  362. /**
  363. * @brief Tests some blitting routines with color mod
  364. */
  365. int
  366. surface_testBlitColorMod(void *arg)
  367. {
  368. int ret;
  369. SDL_Surface *compareSurface;
  370. /* Basic blitting with color mod */
  371. _testBlitBlendMode(-2);
  372. /* Verify result by comparing surfaces */
  373. compareSurface = SDLTest_ImageBlitColor();
  374. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  375. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  376. /* Clean up. */
  377. SDL_FreeSurface(compareSurface);
  378. return TEST_COMPLETED;
  379. }
  380. /**
  381. * @brief Tests some blitting routines with alpha mod
  382. */
  383. int
  384. surface_testBlitAlphaMod(void *arg)
  385. {
  386. int ret;
  387. SDL_Surface *compareSurface;
  388. /* Basic blitting with alpha mod */
  389. _testBlitBlendMode(-3);
  390. /* Verify result by comparing surfaces */
  391. compareSurface = SDLTest_ImageBlitAlpha();
  392. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  393. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  394. /* Clean up. */
  395. SDL_FreeSurface(compareSurface);
  396. return TEST_COMPLETED;
  397. }
  398. /**
  399. * @brief Tests some more blitting routines.
  400. */
  401. int
  402. surface_testBlitBlendNone(void *arg)
  403. {
  404. int ret;
  405. SDL_Surface *compareSurface;
  406. /* Basic blitting */
  407. _testBlitBlendMode(SDL_BLENDMODE_NONE);
  408. /* Verify result by comparing surfaces */
  409. compareSurface = SDLTest_ImageBlitBlendNone();
  410. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  411. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  412. /* Clean up. */
  413. SDL_FreeSurface(compareSurface);
  414. return TEST_COMPLETED;
  415. }
  416. /**
  417. * @brief Tests some more blitting routines.
  418. */
  419. int
  420. surface_testBlitBlendBlend(void *arg)
  421. {
  422. int ret;
  423. SDL_Surface *compareSurface;
  424. /* Blend blitting */
  425. _testBlitBlendMode(SDL_BLENDMODE_BLEND);
  426. /* Verify result by comparing surfaces */
  427. compareSurface = SDLTest_ImageBlitBlend();
  428. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  429. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  430. /* Clean up. */
  431. SDL_FreeSurface(compareSurface);
  432. return TEST_COMPLETED;
  433. }
  434. /**
  435. * @brief Tests some more blitting routines.
  436. */
  437. int
  438. surface_testBlitBlendAdd(void *arg)
  439. {
  440. int ret;
  441. SDL_Surface *compareSurface;
  442. /* Add blitting */
  443. _testBlitBlendMode(SDL_BLENDMODE_ADD);
  444. /* Verify result by comparing surfaces */
  445. compareSurface = SDLTest_ImageBlitBlendAdd();
  446. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  447. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  448. /* Clean up. */
  449. SDL_FreeSurface(compareSurface);
  450. return TEST_COMPLETED;
  451. }
  452. /**
  453. * @brief Tests some more blitting routines.
  454. */
  455. int
  456. surface_testBlitBlendMod(void *arg)
  457. {
  458. int ret;
  459. SDL_Surface *compareSurface;
  460. /* Mod blitting */
  461. _testBlitBlendMode(SDL_BLENDMODE_MOD);
  462. /* Verify result by comparing surfaces */
  463. compareSurface = SDLTest_ImageBlitBlendMod();
  464. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  465. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  466. /* Clean up. */
  467. SDL_FreeSurface(compareSurface);
  468. return TEST_COMPLETED;
  469. }
  470. /**
  471. * @brief Tests some more blitting routines with loop
  472. */
  473. int
  474. surface_testBlitBlendLoop(void *arg) {
  475. int ret;
  476. SDL_Surface *compareSurface;
  477. /* All blitting modes */
  478. _testBlitBlendMode(-4);
  479. /* Verify result by comparing surfaces */
  480. compareSurface = SDLTest_ImageBlitBlendAll();
  481. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  482. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  483. /* Clean up. */
  484. SDL_FreeSurface(compareSurface);
  485. return TEST_COMPLETED;
  486. }
  487. /* ================= Test References ================== */
  488. /* Surface test cases */
  489. static const SDLTest_TestCaseReference surfaceTest1 =
  490. { (SDLTest_TestCaseFp)surface_testSaveLoadBitmap, "surface_testSaveLoadBitmap", "Tests sprite saving and loading.", TEST_ENABLED};
  491. static const SDLTest_TestCaseReference surfaceTest2 =
  492. { (SDLTest_TestCaseFp)surface_testBlit, "surface_testBlit", "Tests basic blitting.", TEST_ENABLED};
  493. static const SDLTest_TestCaseReference surfaceTest3 =
  494. { (SDLTest_TestCaseFp)surface_testBlitBlendNone, "surface_testBlitBlendNone", "Tests blitting routines with none blending mode.", TEST_ENABLED};
  495. static const SDLTest_TestCaseReference surfaceTest4 =
  496. { (SDLTest_TestCaseFp)surface_testLoadFailure, "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED};
  497. static const SDLTest_TestCaseReference surfaceTest5 =
  498. { (SDLTest_TestCaseFp)surface_testSurfaceConversion, "surface_testSurfaceConversion", "Tests surface conversion.", TEST_ENABLED};
  499. static const SDLTest_TestCaseReference surfaceTest6 =
  500. { (SDLTest_TestCaseFp)surface_testCompleteSurfaceConversion, "surface_testCompleteSurfaceConversion", "Tests surface conversion across all pixel formats", TEST_ENABLED};
  501. static const SDLTest_TestCaseReference surfaceTest7 =
  502. { (SDLTest_TestCaseFp)surface_testBlitColorMod, "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED};
  503. static const SDLTest_TestCaseReference surfaceTest8 =
  504. { (SDLTest_TestCaseFp)surface_testBlitAlphaMod, "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED};
  505. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  506. static const SDLTest_TestCaseReference surfaceTest9 =
  507. { (SDLTest_TestCaseFp)surface_testBlitBlendLoop, "surface_testBlitBlendLoop", "Test blitting routines with various blending modes", TEST_DISABLED};
  508. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  509. static const SDLTest_TestCaseReference surfaceTest10 =
  510. { (SDLTest_TestCaseFp)surface_testBlitBlendBlend, "surface_testBlitBlendBlend", "Tests blitting routines with blend blending mode.", TEST_DISABLED};
  511. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  512. static const SDLTest_TestCaseReference surfaceTest11 =
  513. { (SDLTest_TestCaseFp)surface_testBlitBlendAdd, "surface_testBlitBlendAdd", "Tests blitting routines with add blending mode.", TEST_DISABLED};
  514. static const SDLTest_TestCaseReference surfaceTest12 =
  515. { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
  516. /* Sequence of Surface test cases */
  517. static const SDLTest_TestCaseReference *surfaceTests[] = {
  518. &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5,
  519. &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10,
  520. &surfaceTest11, &surfaceTest12, NULL
  521. };
  522. /* Surface test suite (global) */
  523. SDLTest_TestSuiteReference surfaceTestSuite = {
  524. "Surface",
  525. _surfaceSetUp,
  526. surfaceTests,
  527. _surfaceTearDown
  528. };