testautomation_pixels.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. /**
  2. * Pixels test suite
  3. */
  4. #include <stdio.h>
  5. #include "SDL.h"
  6. #include "SDL_test.h"
  7. /* Test case functions */
  8. /* Definition of all RGB formats used to test pixel conversions */
  9. const int _numRGBPixelFormats = 30;
  10. Uint32 _RGBPixelFormats[] =
  11. {
  12. SDL_PIXELFORMAT_INDEX1LSB,
  13. SDL_PIXELFORMAT_INDEX1MSB,
  14. SDL_PIXELFORMAT_INDEX4LSB,
  15. SDL_PIXELFORMAT_INDEX4MSB,
  16. SDL_PIXELFORMAT_INDEX8,
  17. SDL_PIXELFORMAT_RGB332,
  18. SDL_PIXELFORMAT_RGB444,
  19. SDL_PIXELFORMAT_RGB555,
  20. SDL_PIXELFORMAT_BGR555,
  21. SDL_PIXELFORMAT_ARGB4444,
  22. SDL_PIXELFORMAT_RGBA4444,
  23. SDL_PIXELFORMAT_ABGR4444,
  24. SDL_PIXELFORMAT_BGRA4444,
  25. SDL_PIXELFORMAT_ARGB1555,
  26. SDL_PIXELFORMAT_RGBA5551,
  27. SDL_PIXELFORMAT_ABGR1555,
  28. SDL_PIXELFORMAT_BGRA5551,
  29. SDL_PIXELFORMAT_RGB565,
  30. SDL_PIXELFORMAT_BGR565,
  31. SDL_PIXELFORMAT_RGB24,
  32. SDL_PIXELFORMAT_BGR24,
  33. SDL_PIXELFORMAT_RGB888,
  34. SDL_PIXELFORMAT_RGBX8888,
  35. SDL_PIXELFORMAT_BGR888,
  36. SDL_PIXELFORMAT_BGRX8888,
  37. SDL_PIXELFORMAT_ARGB8888,
  38. SDL_PIXELFORMAT_RGBA8888,
  39. SDL_PIXELFORMAT_ABGR8888,
  40. SDL_PIXELFORMAT_BGRA8888,
  41. SDL_PIXELFORMAT_ARGB2101010
  42. };
  43. char* _RGBPixelFormatsVerbose[] =
  44. {
  45. "SDL_PIXELFORMAT_INDEX1LSB",
  46. "SDL_PIXELFORMAT_INDEX1MSB",
  47. "SDL_PIXELFORMAT_INDEX4LSB",
  48. "SDL_PIXELFORMAT_INDEX4MSB",
  49. "SDL_PIXELFORMAT_INDEX8",
  50. "SDL_PIXELFORMAT_RGB332",
  51. "SDL_PIXELFORMAT_RGB444",
  52. "SDL_PIXELFORMAT_RGB555",
  53. "SDL_PIXELFORMAT_BGR555",
  54. "SDL_PIXELFORMAT_ARGB4444",
  55. "SDL_PIXELFORMAT_RGBA4444",
  56. "SDL_PIXELFORMAT_ABGR4444",
  57. "SDL_PIXELFORMAT_BGRA4444",
  58. "SDL_PIXELFORMAT_ARGB1555",
  59. "SDL_PIXELFORMAT_RGBA5551",
  60. "SDL_PIXELFORMAT_ABGR1555",
  61. "SDL_PIXELFORMAT_BGRA5551",
  62. "SDL_PIXELFORMAT_RGB565",
  63. "SDL_PIXELFORMAT_BGR565",
  64. "SDL_PIXELFORMAT_RGB24",
  65. "SDL_PIXELFORMAT_BGR24",
  66. "SDL_PIXELFORMAT_RGB888",
  67. "SDL_PIXELFORMAT_RGBX8888",
  68. "SDL_PIXELFORMAT_BGR888",
  69. "SDL_PIXELFORMAT_BGRX8888",
  70. "SDL_PIXELFORMAT_ARGB8888",
  71. "SDL_PIXELFORMAT_RGBA8888",
  72. "SDL_PIXELFORMAT_ABGR8888",
  73. "SDL_PIXELFORMAT_BGRA8888",
  74. "SDL_PIXELFORMAT_ARGB2101010"
  75. };
  76. /* Definition of all Non-RGB formats used to test pixel conversions */
  77. const int _numNonRGBPixelFormats = 5;
  78. Uint32 _nonRGBPixelFormats[] =
  79. {
  80. SDL_PIXELFORMAT_YV12,
  81. SDL_PIXELFORMAT_IYUV,
  82. SDL_PIXELFORMAT_YUY2,
  83. SDL_PIXELFORMAT_UYVY,
  84. SDL_PIXELFORMAT_YVYU
  85. };
  86. char* _nonRGBPixelFormatsVerbose[] =
  87. {
  88. "SDL_PIXELFORMAT_YV12",
  89. "SDL_PIXELFORMAT_IYUV",
  90. "SDL_PIXELFORMAT_YUY2",
  91. "SDL_PIXELFORMAT_UYVY",
  92. "SDL_PIXELFORMAT_YVYU"
  93. };
  94. /* Definition of some invalid formats for negative tests */
  95. const int _numInvalidPixelFormats = 2;
  96. Uint32 _invalidPixelFormats[] =
  97. {
  98. 0xfffffffe,
  99. 0xffffffff
  100. };
  101. char* _invalidPixelFormatsVerbose[] =
  102. {
  103. "SDL_PIXELFORMAT_UNKNOWN",
  104. "SDL_PIXELFORMAT_UNKNOWN"
  105. };
  106. /* Test case functions */
  107. /**
  108. * @brief Call to SDL_AllocFormat and SDL_FreeFormat
  109. *
  110. * @sa http://wiki.libsdl.org/moin.fcg/SDL_AllocFormat
  111. * @sa http://wiki.libsdl.org/moin.fcg/SDL_FreeFormat
  112. */
  113. int
  114. pixels_allocFreeFormat(void *arg)
  115. {
  116. const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
  117. const char *expectedError = "Parameter 'format' is invalid";
  118. const char *error;
  119. int i;
  120. Uint32 format;
  121. Uint32 masks;
  122. SDL_PixelFormat* result;
  123. /* Blank/unknown format */
  124. format = 0;
  125. SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format);
  126. /* Allocate format */
  127. result = SDL_AllocFormat(format);
  128. SDLTest_AssertPass("Call to SDL_AllocFormat()");
  129. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  130. if (result != NULL) {
  131. SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format);
  132. SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel);
  133. SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel);
  134. masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
  135. SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %u", masks);
  136. /* Deallocate again */
  137. SDL_FreeFormat(result);
  138. SDLTest_AssertPass("Call to SDL_FreeFormat()");
  139. }
  140. /* RGB formats */
  141. for (i = 0; i < _numRGBPixelFormats; i++) {
  142. format = _RGBPixelFormats[i];
  143. SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
  144. /* Allocate format */
  145. result = SDL_AllocFormat(format);
  146. SDLTest_AssertPass("Call to SDL_AllocFormat()");
  147. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  148. if (result != NULL) {
  149. SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %u, got %u", format, result->format);
  150. SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
  151. SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
  152. if (result->palette != NULL) {
  153. masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
  154. SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %u", masks);
  155. }
  156. /* Deallocate again */
  157. SDL_FreeFormat(result);
  158. SDLTest_AssertPass("Call to SDL_FreeFormat()");
  159. }
  160. }
  161. /* Non-RGB formats */
  162. for (i = 0; i < _numNonRGBPixelFormats; i++) {
  163. format = _nonRGBPixelFormats[i];
  164. SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
  165. /* Try to allocate format */
  166. result = SDL_AllocFormat(format);
  167. SDLTest_AssertPass("Call to SDL_AllocFormat()");
  168. SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
  169. }
  170. /* Negative cases */
  171. /* Invalid Formats */
  172. for (i = 0; i < _numInvalidPixelFormats; i++) {
  173. SDL_ClearError();
  174. SDLTest_AssertPass("Call to SDL_ClearError()");
  175. format = _invalidPixelFormats[i];
  176. result = SDL_AllocFormat(format);
  177. SDLTest_AssertPass("Call to SDL_AllocFormat(%u)", format);
  178. SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
  179. error = SDL_GetError();
  180. SDLTest_AssertPass("Call to SDL_GetError()");
  181. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  182. if (error != NULL) {
  183. SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
  184. "Validate error message, expected: '%s', got: '%s'", expectedError, error);
  185. }
  186. }
  187. /* Invalid free pointer */
  188. SDL_ClearError();
  189. SDLTest_AssertPass("Call to SDL_ClearError()");
  190. SDL_FreeFormat(NULL);
  191. SDLTest_AssertPass("Call to SDL_FreeFormat(NULL)");
  192. error = SDL_GetError();
  193. SDLTest_AssertPass("Call to SDL_GetError()");
  194. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  195. if (error != NULL) {
  196. SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
  197. "Validate error message, expected: '%s', got: '%s'", expectedError, error);
  198. }
  199. return TEST_COMPLETED;
  200. }
  201. /**
  202. * @brief Call to SDL_GetPixelFormatName
  203. *
  204. * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetPixelFormatName
  205. */
  206. int
  207. pixels_getPixelFormatName(void *arg)
  208. {
  209. const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
  210. const char *error;
  211. int i;
  212. Uint32 format;
  213. char* result;
  214. /* Blank/undefined format */
  215. format = 0;
  216. SDLTest_Log("RGB Format: %s (%u)", unknownFormat, format);
  217. /* Get name of format */
  218. result = (char *)SDL_GetPixelFormatName(format);
  219. SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
  220. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  221. if (result != NULL) {
  222. SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
  223. SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
  224. "Verify result text; expected: %s, got %s", unknownFormat, result);
  225. }
  226. /* RGB formats */
  227. for (i = 0; i < _numRGBPixelFormats; i++) {
  228. format = _RGBPixelFormats[i];
  229. SDLTest_Log("RGB Format: %s (%u)", _RGBPixelFormatsVerbose[i], format);
  230. /* Get name of format */
  231. result = (char *)SDL_GetPixelFormatName(format);
  232. SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
  233. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  234. if (result != NULL) {
  235. SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
  236. SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
  237. "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
  238. }
  239. }
  240. /* Non-RGB formats */
  241. for (i = 0; i < _numNonRGBPixelFormats; i++) {
  242. format = _nonRGBPixelFormats[i];
  243. SDLTest_Log("non-RGB Format: %s (%u)", _nonRGBPixelFormatsVerbose[i], format);
  244. /* Get name of format */
  245. result = (char *)SDL_GetPixelFormatName(format);
  246. SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
  247. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  248. if (result != NULL) {
  249. SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
  250. SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
  251. "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
  252. }
  253. }
  254. /* Negative cases */
  255. /* Invalid Formats */
  256. SDL_ClearError();
  257. SDLTest_AssertPass("Call to SDL_ClearError()");
  258. for (i = 0; i < _numInvalidPixelFormats; i++) {
  259. format = _invalidPixelFormats[i];
  260. result = (char *)SDL_GetPixelFormatName(format);
  261. SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
  262. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  263. if (result != NULL) {
  264. SDLTest_AssertCheck(result[0] != '\0',
  265. "Verify result is non-empty; got: %s", result);
  266. SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
  267. "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
  268. }
  269. error = SDL_GetError();
  270. SDLTest_AssertPass("Call to SDL_GetError()");
  271. SDLTest_AssertCheck(error == NULL || error[0] == '\0', "Validate that error message is empty");
  272. }
  273. return TEST_COMPLETED;
  274. }
  275. /**
  276. * @brief Call to SDL_AllocPalette and SDL_FreePalette
  277. *
  278. * @sa http://wiki.libsdl.org/moin.fcg/SDL_AllocPalette
  279. * @sa http://wiki.libsdl.org/moin.fcg/SDL_FreePalette
  280. */
  281. int
  282. pixels_allocFreePalette(void *arg)
  283. {
  284. const char *expectedError1 = "Parameter 'ncolors' is invalid";
  285. const char *expectedError2 = "Parameter 'palette' is invalid";
  286. const char *error;
  287. int variation;
  288. int i;
  289. int ncolors;
  290. SDL_Palette* result;
  291. /* Allocate palette */
  292. for (variation = 1; variation <= 3; variation++) {
  293. switch (variation) {
  294. /* Just one color */
  295. case 1:
  296. ncolors = 1;
  297. break;
  298. /* Two colors */
  299. case 2:
  300. ncolors = 2;
  301. break;
  302. /* More than two colors */
  303. case 3:
  304. ncolors = SDLTest_RandomIntegerInRange(8, 16);
  305. break;
  306. }
  307. result = SDL_AllocPalette(ncolors);
  308. SDLTest_AssertPass("Call to SDL_AllocPalette(%d)", ncolors);
  309. SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
  310. if (result != NULL) {
  311. SDLTest_AssertCheck(result->ncolors == ncolors, "Verify value of result.ncolors; expected: %u, got %u", ncolors, result->ncolors);
  312. if (result->ncolors > 0) {
  313. SDLTest_AssertCheck(result->colors != NULL, "Verify value of result.colors is not NULL");
  314. if (result->colors != NULL) {
  315. for(i = 0; i < result->ncolors; i++) {
  316. SDLTest_AssertCheck(result->colors[i].r == 255, "Verify value of result.colors[%d].r; expected: 255, got %u", i, result->colors[i].r);
  317. SDLTest_AssertCheck(result->colors[i].g == 255, "Verify value of result.colors[%d].g; expected: 255, got %u", i, result->colors[i].g);
  318. SDLTest_AssertCheck(result->colors[i].b == 255, "Verify value of result.colors[%d].b; expected: 255, got %u", i, result->colors[i].b);
  319. }
  320. }
  321. }
  322. /* Deallocate again */
  323. SDL_FreePalette(result);
  324. SDLTest_AssertPass("Call to SDL_FreePalette()");
  325. }
  326. }
  327. /* Negative cases */
  328. /* Invalid number of colors */
  329. for (ncolors = 0; ncolors > -3; ncolors--) {
  330. SDL_ClearError();
  331. SDLTest_AssertPass("Call to SDL_ClearError()");
  332. result = SDL_AllocPalette(ncolors);
  333. SDLTest_AssertPass("Call to SDL_AllocPalette(%d)", ncolors);
  334. SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
  335. error = SDL_GetError();
  336. SDLTest_AssertPass("Call to SDL_GetError()");
  337. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  338. if (error != NULL) {
  339. SDLTest_AssertCheck(SDL_strcmp(error, expectedError1) == 0,
  340. "Validate error message, expected: '%s', got: '%s'", expectedError1, error);
  341. }
  342. }
  343. /* Invalid free pointer */
  344. SDL_ClearError();
  345. SDLTest_AssertPass("Call to SDL_ClearError()");
  346. SDL_FreePalette(NULL);
  347. SDLTest_AssertPass("Call to SDL_FreePalette(NULL)");
  348. error = SDL_GetError();
  349. SDLTest_AssertPass("Call to SDL_GetError()");
  350. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  351. if (error != NULL) {
  352. SDLTest_AssertCheck(SDL_strcmp(error, expectedError2) == 0,
  353. "Validate error message, expected: '%s', got: '%s'", expectedError2, error);
  354. }
  355. return TEST_COMPLETED;
  356. }
  357. /**
  358. * @brief Call to SDL_CalculateGammaRamp
  359. *
  360. * @sa http://wiki.libsdl.org/moin.fcg/SDL_CalculateGammaRamp
  361. */
  362. int
  363. pixels_calcGammaRamp(void *arg)
  364. {
  365. const char *expectedError1 = "Parameter 'gamma' is invalid";
  366. const char *expectedError2 = "Parameter 'ramp' is invalid";
  367. const char *error;
  368. float gamma;
  369. Uint16 *ramp;
  370. int variation;
  371. int i;
  372. int changed;
  373. Uint16 magic = 0xbeef;
  374. /* Allocate temp ramp array and fill with some value */
  375. ramp = (Uint16 *)SDL_malloc(256 * sizeof(Uint16));
  376. SDLTest_AssertCheck(ramp != NULL, "Validate temp ramp array could be allocated");
  377. if (ramp == NULL) return TEST_ABORTED;
  378. /* Make call with different gamma values */
  379. for (variation = 0; variation < 4; variation++) {
  380. switch (variation) {
  381. /* gamma = 0 all black */
  382. case 0:
  383. gamma = 0.0f;
  384. break;
  385. /* gamma = 1 identity */
  386. case 1:
  387. gamma = 1.0f;
  388. break;
  389. /* gamma = [0.2,0.8] normal range */
  390. case 2:
  391. gamma = 0.2f + 0.8f * SDLTest_RandomUnitFloat();
  392. break;
  393. /* gamma = >1.1 non-standard range */
  394. case 3:
  395. gamma = 1.1f + SDLTest_RandomUnitFloat();
  396. break;
  397. }
  398. /* Make call and check that values were updated */
  399. for (i = 0; i < 256; i++) ramp[i] = magic;
  400. SDL_CalculateGammaRamp(gamma, ramp);
  401. SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(%f)", gamma);
  402. changed = 0;
  403. for (i = 0; i < 256; i++) if (ramp[i] != magic) changed++;
  404. SDLTest_AssertCheck(changed > 250, "Validate that ramp was calculated; expected: >250 values changed, got: %d values changed", changed);
  405. /* Additional value checks for some cases */
  406. i = SDLTest_RandomIntegerInRange(64,192);
  407. switch (variation) {
  408. case 0:
  409. SDLTest_AssertCheck(ramp[i] == 0, "Validate value at position %d; expected: 0, got: %d", i, ramp[i]);
  410. break;
  411. case 1:
  412. SDLTest_AssertCheck(ramp[i] == ((i << 8) | i), "Validate value at position %d; expected: %d, got: %d", i, (i << 8) | i, ramp[i]);
  413. break;
  414. case 2:
  415. case 3:
  416. SDLTest_AssertCheck(ramp[i] > 0, "Validate value at position %d; expected: >0, got: %d", i, ramp[i]);
  417. break;
  418. }
  419. }
  420. /* Negative cases */
  421. SDL_ClearError();
  422. SDLTest_AssertPass("Call to SDL_ClearError()");
  423. gamma = -1;
  424. for (i=0; i<256; i++) ramp[i] = magic;
  425. SDL_CalculateGammaRamp(gamma, ramp);
  426. SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(%f)", gamma);
  427. error = SDL_GetError();
  428. SDLTest_AssertPass("Call to SDL_GetError()");
  429. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  430. if (error != NULL) {
  431. SDLTest_AssertCheck(SDL_strcmp(error, expectedError1) == 0,
  432. "Validate error message, expected: '%s', got: '%s'", expectedError1, error);
  433. }
  434. changed = 0;
  435. for (i = 0; i < 256; i++) if (ramp[i] != magic) changed++;
  436. SDLTest_AssertCheck(changed ==0, "Validate that ramp unchanged; expected: 0 values changed got: %d values changed", changed);
  437. SDL_CalculateGammaRamp(0.5f, NULL);
  438. SDLTest_AssertPass("Call to SDL_CalculateGammaRamp(0.5,NULL)");
  439. error = SDL_GetError();
  440. SDLTest_AssertPass("Call to SDL_GetError()");
  441. SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
  442. if (error != NULL) {
  443. SDLTest_AssertCheck(SDL_strcmp(error, expectedError2) == 0,
  444. "Validate error message, expected: '%s', got: '%s'", expectedError2, error);
  445. }
  446. /* Cleanup */
  447. SDL_free(ramp);
  448. return TEST_COMPLETED;
  449. }
  450. /* ================= Test References ================== */
  451. /* Pixels test cases */
  452. static const SDLTest_TestCaseReference pixelsTest1 =
  453. { (SDLTest_TestCaseFp)pixels_allocFreeFormat, "pixels_allocFreeFormat", "Call to SDL_AllocFormat and SDL_FreeFormat", TEST_ENABLED };
  454. static const SDLTest_TestCaseReference pixelsTest2 =
  455. { (SDLTest_TestCaseFp)pixels_allocFreePalette, "pixels_allocFreePalette", "Call to SDL_AllocPalette and SDL_FreePalette", TEST_ENABLED };
  456. static const SDLTest_TestCaseReference pixelsTest3 =
  457. { (SDLTest_TestCaseFp)pixels_calcGammaRamp, "pixels_calcGammaRamp", "Call to SDL_CalculateGammaRamp", TEST_ENABLED };
  458. static const SDLTest_TestCaseReference pixelsTest4 =
  459. { (SDLTest_TestCaseFp)pixels_getPixelFormatName, "pixels_getPixelFormatName", "Call to SDL_GetPixelFormatName", TEST_ENABLED };
  460. /* Sequence of Pixels test cases */
  461. static const SDLTest_TestCaseReference *pixelsTests[] = {
  462. &pixelsTest1, &pixelsTest2, &pixelsTest3, &pixelsTest4, NULL
  463. };
  464. /* Pixels test suite (global) */
  465. SDLTest_TestSuiteReference pixelsTestSuite = {
  466. "Pixels",
  467. NULL,
  468. pixelsTests,
  469. NULL
  470. };