🛠️🐜 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.

647 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_RGB555,
  265. SDL_PIXELFORMAT_BGR555,
  266. SDL_PIXELFORMAT_ARGB4444,
  267. SDL_PIXELFORMAT_RGBA4444,
  268. SDL_PIXELFORMAT_ABGR4444,
  269. SDL_PIXELFORMAT_BGRA4444,
  270. SDL_PIXELFORMAT_ARGB1555,
  271. SDL_PIXELFORMAT_RGBA5551,
  272. SDL_PIXELFORMAT_ABGR1555,
  273. SDL_PIXELFORMAT_BGRA5551,
  274. SDL_PIXELFORMAT_RGB565,
  275. SDL_PIXELFORMAT_BGR565,
  276. SDL_PIXELFORMAT_RGB24,
  277. SDL_PIXELFORMAT_BGR24,
  278. SDL_PIXELFORMAT_RGB888,
  279. SDL_PIXELFORMAT_RGBX8888,
  280. SDL_PIXELFORMAT_BGR888,
  281. SDL_PIXELFORMAT_BGRX8888,
  282. SDL_PIXELFORMAT_ARGB8888,
  283. SDL_PIXELFORMAT_RGBA8888,
  284. SDL_PIXELFORMAT_ABGR8888,
  285. SDL_PIXELFORMAT_BGRA8888,
  286. SDL_PIXELFORMAT_ARGB2101010,
  287. };
  288. SDL_Surface *face = NULL, *cvt1, *cvt2, *final;
  289. SDL_PixelFormat *fmt1, *fmt2;
  290. int i, j, ret = 0;
  291. /* Create sample surface */
  292. face = SDLTest_ImageFace();
  293. SDLTest_AssertCheck(face != NULL, "Verify face surface is not NULL");
  294. if (face == NULL)
  295. return TEST_ABORTED;
  296. /* Set transparent pixel as the pixel at (0,0) */
  297. if (face->format->palette) {
  298. ret = SDL_SetColorKey(face, SDL_RLEACCEL, *(Uint8 *) face->pixels);
  299. SDLTest_AssertPass("Call to SDL_SetColorKey()");
  300. SDLTest_AssertCheck(ret == 0, "Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
  301. }
  302. for ( i = 0; i < SDL_arraysize(pixel_formats); ++i ) {
  303. for ( j = 0; j < SDL_arraysize(pixel_formats); ++j ) {
  304. fmt1 = SDL_AllocFormat(pixel_formats[i]);
  305. SDL_assert(fmt1 != NULL);
  306. cvt1 = SDL_ConvertSurface(face, fmt1, 0);
  307. SDL_assert(cvt1 != NULL);
  308. fmt2 = SDL_AllocFormat(pixel_formats[j]);
  309. SDL_assert(fmt1 != NULL);
  310. cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
  311. SDL_assert(cvt2 != NULL);
  312. if ( fmt1->BytesPerPixel == face->format->BytesPerPixel &&
  313. fmt2->BytesPerPixel == face->format->BytesPerPixel &&
  314. (fmt1->Amask != 0) == (face->format->Amask != 0) &&
  315. (fmt2->Amask != 0) == (face->format->Amask != 0) ) {
  316. final = SDL_ConvertSurface( cvt2, face->format, 0 );
  317. SDL_assert(final != NULL);
  318. /* Compare surface. */
  319. ret = SDLTest_CompareSurfaces( face, final, 0 );
  320. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  321. SDL_FreeSurface(final);
  322. }
  323. SDL_FreeSurface(cvt1);
  324. SDL_FreeFormat(fmt1);
  325. SDL_FreeSurface(cvt2);
  326. SDL_FreeFormat(fmt2);
  327. }
  328. }
  329. /* Clean up. */
  330. SDL_FreeSurface( face );
  331. return TEST_COMPLETED;
  332. }
  333. /**
  334. * @brief Tests sprite loading. A failure case.
  335. */
  336. int
  337. surface_testLoadFailure(void *arg)
  338. {
  339. SDL_Surface *face = SDL_LoadBMP("nonexistant.bmp");
  340. SDLTest_AssertCheck(face == NULL, "SDL_CreateLoadBmp");
  341. return TEST_COMPLETED;
  342. }
  343. /**
  344. * @brief Tests some blitting routines.
  345. */
  346. int
  347. surface_testBlit(void *arg)
  348. {
  349. int ret;
  350. SDL_Surface *compareSurface;
  351. /* Basic blitting */
  352. _testBlitBlendMode(-1);
  353. /* Verify result by comparing surfaces */
  354. compareSurface = SDLTest_ImageBlit();
  355. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  356. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  357. /* Clean up. */
  358. SDL_FreeSurface(compareSurface);
  359. return TEST_COMPLETED;
  360. }
  361. /**
  362. * @brief Tests some blitting routines with color mod
  363. */
  364. int
  365. surface_testBlitColorMod(void *arg)
  366. {
  367. int ret;
  368. SDL_Surface *compareSurface;
  369. /* Basic blitting with color mod */
  370. _testBlitBlendMode(-2);
  371. /* Verify result by comparing surfaces */
  372. compareSurface = SDLTest_ImageBlitColor();
  373. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  374. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  375. /* Clean up. */
  376. SDL_FreeSurface(compareSurface);
  377. return TEST_COMPLETED;
  378. }
  379. /**
  380. * @brief Tests some blitting routines with alpha mod
  381. */
  382. int
  383. surface_testBlitAlphaMod(void *arg)
  384. {
  385. int ret;
  386. SDL_Surface *compareSurface;
  387. /* Basic blitting with alpha mod */
  388. _testBlitBlendMode(-3);
  389. /* Verify result by comparing surfaces */
  390. compareSurface = SDLTest_ImageBlitAlpha();
  391. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  392. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  393. /* Clean up. */
  394. SDL_FreeSurface(compareSurface);
  395. return TEST_COMPLETED;
  396. }
  397. /**
  398. * @brief Tests some more blitting routines.
  399. */
  400. int
  401. surface_testBlitBlendNone(void *arg)
  402. {
  403. int ret;
  404. SDL_Surface *compareSurface;
  405. /* Basic blitting */
  406. _testBlitBlendMode(SDL_BLENDMODE_NONE);
  407. /* Verify result by comparing surfaces */
  408. compareSurface = SDLTest_ImageBlitBlendNone();
  409. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  410. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  411. /* Clean up. */
  412. SDL_FreeSurface(compareSurface);
  413. return TEST_COMPLETED;
  414. }
  415. /**
  416. * @brief Tests some more blitting routines.
  417. */
  418. int
  419. surface_testBlitBlendBlend(void *arg)
  420. {
  421. int ret;
  422. SDL_Surface *compareSurface;
  423. /* Blend blitting */
  424. _testBlitBlendMode(SDL_BLENDMODE_BLEND);
  425. /* Verify result by comparing surfaces */
  426. compareSurface = SDLTest_ImageBlitBlend();
  427. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  428. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  429. /* Clean up. */
  430. SDL_FreeSurface(compareSurface);
  431. return TEST_COMPLETED;
  432. }
  433. /**
  434. * @brief Tests some more blitting routines.
  435. */
  436. int
  437. surface_testBlitBlendAdd(void *arg)
  438. {
  439. int ret;
  440. SDL_Surface *compareSurface;
  441. /* Add blitting */
  442. _testBlitBlendMode(SDL_BLENDMODE_ADD);
  443. /* Verify result by comparing surfaces */
  444. compareSurface = SDLTest_ImageBlitBlendAdd();
  445. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  446. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  447. /* Clean up. */
  448. SDL_FreeSurface(compareSurface);
  449. return TEST_COMPLETED;
  450. }
  451. /**
  452. * @brief Tests some more blitting routines.
  453. */
  454. int
  455. surface_testBlitBlendMod(void *arg)
  456. {
  457. int ret;
  458. SDL_Surface *compareSurface;
  459. /* Mod blitting */
  460. _testBlitBlendMode(SDL_BLENDMODE_MOD);
  461. /* Verify result by comparing surfaces */
  462. compareSurface = SDLTest_ImageBlitBlendMod();
  463. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  464. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  465. /* Clean up. */
  466. SDL_FreeSurface(compareSurface);
  467. return TEST_COMPLETED;
  468. }
  469. /**
  470. * @brief Tests some more blitting routines with loop
  471. */
  472. int
  473. surface_testBlitBlendLoop(void *arg) {
  474. int ret;
  475. SDL_Surface *compareSurface;
  476. /* All blitting modes */
  477. _testBlitBlendMode(-4);
  478. /* Verify result by comparing surfaces */
  479. compareSurface = SDLTest_ImageBlitBlendAll();
  480. ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
  481. SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
  482. /* Clean up. */
  483. SDL_FreeSurface(compareSurface);
  484. return TEST_COMPLETED;
  485. }
  486. /* ================= Test References ================== */
  487. /* Surface test cases */
  488. static const SDLTest_TestCaseReference surfaceTest1 =
  489. { (SDLTest_TestCaseFp)surface_testSaveLoadBitmap, "surface_testSaveLoadBitmap", "Tests sprite saving and loading.", TEST_ENABLED};
  490. static const SDLTest_TestCaseReference surfaceTest2 =
  491. { (SDLTest_TestCaseFp)surface_testBlit, "surface_testBlit", "Tests basic blitting.", TEST_ENABLED};
  492. static const SDLTest_TestCaseReference surfaceTest3 =
  493. { (SDLTest_TestCaseFp)surface_testBlitBlendNone, "surface_testBlitBlendNone", "Tests blitting routines with none blending mode.", TEST_ENABLED};
  494. static const SDLTest_TestCaseReference surfaceTest4 =
  495. { (SDLTest_TestCaseFp)surface_testLoadFailure, "surface_testLoadFailure", "Tests sprite loading. A failure case.", TEST_ENABLED};
  496. static const SDLTest_TestCaseReference surfaceTest5 =
  497. { (SDLTest_TestCaseFp)surface_testSurfaceConversion, "surface_testSurfaceConversion", "Tests surface conversion.", TEST_ENABLED};
  498. static const SDLTest_TestCaseReference surfaceTest6 =
  499. { (SDLTest_TestCaseFp)surface_testCompleteSurfaceConversion, "surface_testCompleteSurfaceConversion", "Tests surface conversion across all pixel formats", TEST_ENABLED};
  500. static const SDLTest_TestCaseReference surfaceTest7 =
  501. { (SDLTest_TestCaseFp)surface_testBlitColorMod, "surface_testBlitColorMod", "Tests some blitting routines with color mod.", TEST_ENABLED};
  502. static const SDLTest_TestCaseReference surfaceTest8 =
  503. { (SDLTest_TestCaseFp)surface_testBlitAlphaMod, "surface_testBlitAlphaMod", "Tests some blitting routines with alpha mod.", TEST_ENABLED};
  504. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  505. static const SDLTest_TestCaseReference surfaceTest9 =
  506. { (SDLTest_TestCaseFp)surface_testBlitBlendLoop, "surface_testBlitBlendLoop", "Test blitting routines with various blending modes", TEST_DISABLED};
  507. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  508. static const SDLTest_TestCaseReference surfaceTest10 =
  509. { (SDLTest_TestCaseFp)surface_testBlitBlendBlend, "surface_testBlitBlendBlend", "Tests blitting routines with blend blending mode.", TEST_DISABLED};
  510. /* TODO: rewrite test case, define new test data and re-enable; current implementation fails */
  511. static const SDLTest_TestCaseReference surfaceTest11 =
  512. { (SDLTest_TestCaseFp)surface_testBlitBlendAdd, "surface_testBlitBlendAdd", "Tests blitting routines with add blending mode.", TEST_DISABLED};
  513. static const SDLTest_TestCaseReference surfaceTest12 =
  514. { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
  515. /* Sequence of Surface test cases */
  516. static const SDLTest_TestCaseReference *surfaceTests[] = {
  517. &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5,
  518. &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10,
  519. &surfaceTest11, &surfaceTest12, NULL
  520. };
  521. /* Surface test suite (global) */
  522. SDLTest_TestSuiteReference surfaceTestSuite = {
  523. "Surface",
  524. _surfaceSetUp,
  525. surfaceTests,
  526. _surfaceTearDown
  527. };