testautomation_video.c 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931
  1. /**
  2. * Video test suite
  3. */
  4. #include <SDL3/SDL.h>
  5. #include <SDL3/SDL_test.h>
  6. /* Private helpers */
  7. /*
  8. * Create a test window
  9. */
  10. SDL_Window *_createVideoSuiteTestWindow(const char *title)
  11. {
  12. SDL_Window* window;
  13. int x, y, w, h;
  14. SDL_WindowFlags flags;
  15. /* Standard window */
  16. x = SDLTest_RandomIntegerInRange(1, 100);
  17. y = SDLTest_RandomIntegerInRange(1, 100);
  18. w = SDLTest_RandomIntegerInRange(320, 1024);
  19. h = SDLTest_RandomIntegerInRange(320, 768);
  20. flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
  21. window = SDL_CreateWindow(title, x, y, w, h, flags);
  22. SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
  23. SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  24. return window;
  25. }
  26. /*
  27. * Destroy test window
  28. */
  29. void _destroyVideoSuiteTestWindow(SDL_Window *window)
  30. {
  31. if (window != NULL) {
  32. SDL_DestroyWindow(window);
  33. window = NULL;
  34. SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  35. }
  36. }
  37. /* Test case functions */
  38. /**
  39. * @brief Enable and disable screensaver while checking state
  40. */
  41. int
  42. video_enableDisableScreensaver(void *arg)
  43. {
  44. SDL_bool initialResult;
  45. SDL_bool result;
  46. /* Get current state and proceed according to current state */
  47. initialResult = SDL_IsScreenSaverEnabled();
  48. SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
  49. if (initialResult == SDL_TRUE) {
  50. /* Currently enabled: disable first, then enable again */
  51. /* Disable screensaver and check */
  52. SDL_DisableScreenSaver();
  53. SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
  54. result = SDL_IsScreenSaverEnabled();
  55. SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
  56. SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
  57. /* Enable screensaver and check */
  58. SDL_EnableScreenSaver();
  59. SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
  60. result = SDL_IsScreenSaverEnabled();
  61. SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
  62. SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
  63. } else {
  64. /* Currently disabled: enable first, then disable again */
  65. /* Enable screensaver and check */
  66. SDL_EnableScreenSaver();
  67. SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
  68. result = SDL_IsScreenSaverEnabled();
  69. SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
  70. SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
  71. /* Disable screensaver and check */
  72. SDL_DisableScreenSaver();
  73. SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");
  74. result = SDL_IsScreenSaverEnabled();
  75. SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
  76. SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
  77. }
  78. return TEST_COMPLETED;
  79. }
  80. /**
  81. * @brief Tests the functionality of the SDL_CreateWindow function using different positions
  82. */
  83. int
  84. video_createWindowVariousPositions(void *arg)
  85. {
  86. SDL_Window* window;
  87. const char* title = "video_createWindowVariousPositions Test Window";
  88. int x, y, w, h;
  89. int xVariation, yVariation;
  90. for (xVariation = 0; xVariation < 6; xVariation++) {
  91. for (yVariation = 0; yVariation < 6; yVariation++) {
  92. switch(xVariation) {
  93. default:
  94. case 0:
  95. /* Zero X Position */
  96. x = 0;
  97. break;
  98. case 1:
  99. /* Random X position inside screen */
  100. x = SDLTest_RandomIntegerInRange(1, 100);
  101. break;
  102. case 2:
  103. /* Random X position outside screen (positive) */
  104. x = SDLTest_RandomIntegerInRange(10000, 11000);
  105. break;
  106. case 3:
  107. /* Random X position outside screen (negative) */
  108. x = SDLTest_RandomIntegerInRange(-1000, -100);
  109. break;
  110. case 4:
  111. /* Centered X position */
  112. x = SDL_WINDOWPOS_CENTERED;
  113. break;
  114. case 5:
  115. /* Undefined X position */
  116. x = SDL_WINDOWPOS_UNDEFINED;
  117. break;
  118. }
  119. switch(yVariation) {
  120. default:
  121. case 0:
  122. /* Zero X Position */
  123. y = 0;
  124. break;
  125. case 1:
  126. /* Random X position inside screen */
  127. y = SDLTest_RandomIntegerInRange(1, 100);
  128. break;
  129. case 2:
  130. /* Random X position outside screen (positive) */
  131. y = SDLTest_RandomIntegerInRange(10000, 11000);
  132. break;
  133. case 3:
  134. /* Random Y position outside screen (negative) */
  135. y = SDLTest_RandomIntegerInRange(-1000, -100);
  136. break;
  137. case 4:
  138. /* Centered Y position */
  139. y = SDL_WINDOWPOS_CENTERED;
  140. break;
  141. case 5:
  142. /* Undefined Y position */
  143. y = SDL_WINDOWPOS_UNDEFINED;
  144. break;
  145. }
  146. w = SDLTest_RandomIntegerInRange(32, 96);
  147. h = SDLTest_RandomIntegerInRange(32, 96);
  148. window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
  149. SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
  150. SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  151. /* Clean up */
  152. _destroyVideoSuiteTestWindow(window);
  153. }
  154. }
  155. return TEST_COMPLETED;
  156. }
  157. /**
  158. * @brief Tests the functionality of the SDL_CreateWindow function using different sizes
  159. */
  160. int
  161. video_createWindowVariousSizes(void *arg)
  162. {
  163. SDL_Window* window;
  164. const char* title = "video_createWindowVariousSizes Test Window";
  165. int x, y, w, h;
  166. int wVariation, hVariation;
  167. x = SDLTest_RandomIntegerInRange(1, 100);
  168. y = SDLTest_RandomIntegerInRange(1, 100);
  169. for (wVariation = 0; wVariation < 3; wVariation++) {
  170. for (hVariation = 0; hVariation < 3; hVariation++) {
  171. switch(wVariation) {
  172. case 0:
  173. /* Width of 1 */
  174. w = 1;
  175. break;
  176. case 1:
  177. /* Random "normal" width */
  178. w = SDLTest_RandomIntegerInRange(320, 1920);
  179. break;
  180. case 2:
  181. /* Random "large" width */
  182. w = SDLTest_RandomIntegerInRange(2048, 4095);
  183. break;
  184. }
  185. switch(hVariation) {
  186. case 0:
  187. /* Height of 1 */
  188. h = 1;
  189. break;
  190. case 1:
  191. /* Random "normal" height */
  192. h = SDLTest_RandomIntegerInRange(320, 1080);
  193. break;
  194. case 2:
  195. /* Random "large" height */
  196. h = SDLTest_RandomIntegerInRange(2048, 4095);
  197. break;
  198. }
  199. window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
  200. SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
  201. SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  202. /* Clean up */
  203. _destroyVideoSuiteTestWindow(window);
  204. }
  205. }
  206. return TEST_COMPLETED;
  207. }
  208. /**
  209. * @brief Tests the functionality of the SDL_CreateWindow function using different flags
  210. */
  211. int
  212. video_createWindowVariousFlags(void *arg)
  213. {
  214. SDL_Window* window;
  215. const char* title = "video_createWindowVariousFlags Test Window";
  216. int x, y, w, h;
  217. int fVariation;
  218. SDL_WindowFlags flags;
  219. /* Standard window */
  220. x = SDLTest_RandomIntegerInRange(1, 100);
  221. y = SDLTest_RandomIntegerInRange(1, 100);
  222. w = SDLTest_RandomIntegerInRange(320, 1024);
  223. h = SDLTest_RandomIntegerInRange(320, 768);
  224. for (fVariation = 0; fVariation < 14; fVariation++) {
  225. switch(fVariation) {
  226. default:
  227. case 0:
  228. flags = SDL_WINDOW_FULLSCREEN;
  229. /* Skip - blanks screen; comment out next line to run test */
  230. continue;
  231. break;
  232. case 1:
  233. flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
  234. /* Skip - blanks screen; comment out next line to run test */
  235. continue;
  236. break;
  237. case 2:
  238. flags = SDL_WINDOW_OPENGL;
  239. break;
  240. case 3:
  241. flags = SDL_WINDOW_SHOWN;
  242. break;
  243. case 4:
  244. flags = SDL_WINDOW_HIDDEN;
  245. break;
  246. case 5:
  247. flags = SDL_WINDOW_BORDERLESS;
  248. break;
  249. case 6:
  250. flags = SDL_WINDOW_RESIZABLE;
  251. break;
  252. case 7:
  253. flags = SDL_WINDOW_MINIMIZED;
  254. break;
  255. case 8:
  256. flags = SDL_WINDOW_MAXIMIZED;
  257. break;
  258. case 9:
  259. flags = SDL_WINDOW_MOUSE_GRABBED;
  260. break;
  261. case 10:
  262. flags = SDL_WINDOW_INPUT_FOCUS;
  263. break;
  264. case 11:
  265. flags = SDL_WINDOW_MOUSE_FOCUS;
  266. break;
  267. case 12:
  268. flags = SDL_WINDOW_FOREIGN;
  269. break;
  270. case 13:
  271. flags = SDL_WINDOW_KEYBOARD_GRABBED;
  272. break;
  273. }
  274. window = SDL_CreateWindow(title, x, y, w, h, flags);
  275. SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
  276. SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  277. /* Clean up */
  278. _destroyVideoSuiteTestWindow(window);
  279. }
  280. return TEST_COMPLETED;
  281. }
  282. /**
  283. * @brief Tests the functionality of the SDL_GetWindowFlags function
  284. */
  285. int
  286. video_getWindowFlags(void *arg)
  287. {
  288. SDL_Window* window;
  289. const char* title = "video_getWindowFlags Test Window";
  290. SDL_WindowFlags flags;
  291. Uint32 actualFlags;
  292. /* Reliable flag set always set in test window */
  293. flags = SDL_WINDOW_SHOWN;
  294. /* Call against new test window */
  295. window = _createVideoSuiteTestWindow(title);
  296. if (window != NULL) {
  297. actualFlags = SDL_GetWindowFlags(window);
  298. SDLTest_AssertPass("Call to SDL_GetWindowFlags()");
  299. SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %" SDL_PRIu32, flags, actualFlags);
  300. }
  301. /* Clean up */
  302. _destroyVideoSuiteTestWindow(window);
  303. return TEST_COMPLETED;
  304. }
  305. /**
  306. * @brief Tests the functionality of the SDL_GetNumDisplayModes function
  307. */
  308. int
  309. video_getNumDisplayModes(void *arg)
  310. {
  311. int result;
  312. int displayNum;
  313. int i;
  314. /* Get number of displays */
  315. displayNum = SDL_GetNumVideoDisplays();
  316. SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays()");
  317. /* Make call for each display */
  318. for (i=0; i<displayNum; i++) {
  319. result = SDL_GetNumDisplayModes(i);
  320. SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d)", i);
  321. SDLTest_AssertCheck(result >= 1, "Validate returned value from function; expected: >=1; got: %d", result);
  322. }
  323. return TEST_COMPLETED;
  324. }
  325. /**
  326. * @brief Tests negative call to SDL_GetNumDisplayModes function
  327. */
  328. int
  329. video_getNumDisplayModesNegative(void *arg)
  330. {
  331. int result;
  332. int displayNum;
  333. int displayIndex;
  334. /* Get number of displays */
  335. displayNum = SDL_GetNumVideoDisplays();
  336. SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays()");
  337. /* Invalid boundary values */
  338. displayIndex = SDLTest_RandomSint32BoundaryValue(0, displayNum, SDL_FALSE);
  339. result = SDL_GetNumDisplayModes(displayIndex);
  340. SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/boundary)", displayIndex);
  341. SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);
  342. /* Large (out-of-bounds) display index */
  343. displayIndex = SDLTest_RandomIntegerInRange(-2000, -1000);
  344. result = SDL_GetNumDisplayModes(displayIndex);
  345. SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large negative)", displayIndex);
  346. SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);
  347. displayIndex = SDLTest_RandomIntegerInRange(1000, 2000);
  348. result = SDL_GetNumDisplayModes(displayIndex);
  349. SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large positive)", displayIndex);
  350. SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);
  351. return TEST_COMPLETED;
  352. }
  353. /**
  354. * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against current resolution
  355. */
  356. int
  357. video_getClosestDisplayModeCurrentResolution(void *arg)
  358. {
  359. int result;
  360. SDL_DisplayMode current;
  361. SDL_DisplayMode target;
  362. SDL_DisplayMode closest;
  363. SDL_DisplayMode* dResult;
  364. int displayNum;
  365. int i;
  366. int variation;
  367. /* Get number of displays */
  368. displayNum = SDL_GetNumVideoDisplays();
  369. SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays()");
  370. /* Make calls for each display */
  371. for (i=0; i<displayNum; i++) {
  372. SDLTest_Log("Testing against display: %d", i);
  373. /* Get first display mode to get a sane resolution; this should always work */
  374. result = SDL_GetDisplayMode(i, 0, &current);
  375. SDLTest_AssertPass("Call to SDL_GetDisplayMode()");
  376. SDLTest_AssertCheck(result == 0, "Verify return value, expected: 0, got: %d", result);
  377. if (result != 0) {
  378. return TEST_ABORTED;
  379. }
  380. /* Set the desired resolution equals to current resolution */
  381. target.w = current.w;
  382. target.h = current.h;
  383. for (variation = 0; variation < 8; variation ++) {
  384. /* Vary constraints on other query parameters */
  385. target.format = (variation & 1) ? current.format : 0;
  386. target.refresh_rate = (variation & 2) ? current.refresh_rate : 0;
  387. target.driverdata = (variation & 4) ? current.driverdata : 0;
  388. /* Make call */
  389. dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
  390. SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=current/variation%d)", variation);
  391. SDLTest_AssertCheck(dResult != NULL, "Verify returned value is not NULL");
  392. /* Check that one gets the current resolution back again */
  393. SDLTest_AssertCheck(closest.w == current.w, "Verify returned width matches current width; expected: %d, got: %d", current.w, closest.w);
  394. SDLTest_AssertCheck(closest.h == current.h, "Verify returned height matches current height; expected: %d, got: %d", current.h, closest.h);
  395. SDLTest_AssertCheck(closest.w == dResult->w, "Verify return value matches assigned value; expected: %d, got: %d", closest.w, dResult->w);
  396. SDLTest_AssertCheck(closest.h == dResult->h, "Verify return value matches assigned value; expected: %d, got: %d", closest.h, dResult->h);
  397. }
  398. }
  399. return TEST_COMPLETED;
  400. }
  401. /**
  402. * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against random resolution
  403. */
  404. int
  405. video_getClosestDisplayModeRandomResolution(void *arg)
  406. {
  407. SDL_DisplayMode target;
  408. SDL_DisplayMode closest;
  409. int displayNum;
  410. int i;
  411. int variation;
  412. /* Get number of displays */
  413. displayNum = SDL_GetNumVideoDisplays();
  414. SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays()");
  415. /* Make calls for each display */
  416. for (i=0; i<displayNum; i++) {
  417. SDLTest_Log("Testing against display: %d", i);
  418. for (variation = 0; variation < 16; variation ++) {
  419. /* Set random constraints */
  420. target.w = (variation & 1) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
  421. target.h = (variation & 2) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
  422. target.format = (variation & 4) ? SDLTest_RandomIntegerInRange(1, 10) : 0;
  423. target.refresh_rate = (variation & 8) ? SDLTest_RandomIntegerInRange(25, 120) : 0;
  424. target.driverdata = 0;
  425. /* Make call; may or may not find anything, so don't validate any further */
  426. SDL_GetClosestDisplayMode(i, &target, &closest);
  427. SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=random/variation%d)", variation);
  428. }
  429. }
  430. return TEST_COMPLETED;
  431. }
  432. /**
  433. * @brief Tests call to SDL_GetWindowDisplayMode
  434. *
  435. * @sa http://wiki.libsdl.org/SDL_GetWindowDisplayMode
  436. */
  437. int
  438. video_getWindowDisplayMode(void *arg)
  439. {
  440. SDL_Window* window;
  441. const char* title = "video_getWindowDisplayMode Test Window";
  442. SDL_DisplayMode mode;
  443. int result;
  444. /* Invalidate part of the mode content so we can check values later */
  445. mode.w = -1;
  446. mode.h = -1;
  447. mode.refresh_rate = -1;
  448. /* Call against new test window */
  449. window = _createVideoSuiteTestWindow(title);
  450. if (window != NULL) {
  451. result = SDL_GetWindowDisplayMode(window, &mode);
  452. SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode()");
  453. SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
  454. SDLTest_AssertCheck(mode.w > 0, "Validate mode.w content; expected: >0, got: %d", mode.w);
  455. SDLTest_AssertCheck(mode.h > 0, "Validate mode.h content; expected: >0, got: %d", mode.h);
  456. SDLTest_AssertCheck(mode.refresh_rate > 0, "Validate mode.refresh_rate content; expected: >0, got: %d", mode.refresh_rate);
  457. }
  458. /* Clean up */
  459. _destroyVideoSuiteTestWindow(window);
  460. return TEST_COMPLETED;
  461. }
  462. /* Helper function that checks for an 'Invalid window' error */
  463. void _checkInvalidWindowError()
  464. {
  465. const char *invalidWindowError = "Invalid window";
  466. char *lastError;
  467. lastError = (char *)SDL_GetError();
  468. SDLTest_AssertPass("SDL_GetError()");
  469. SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  470. if (lastError != NULL) {
  471. SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
  472. "SDL_GetError(): expected message '%s', was message: '%s'",
  473. invalidWindowError,
  474. lastError);
  475. SDL_ClearError();
  476. SDLTest_AssertPass("Call to SDL_ClearError()");
  477. }
  478. }
  479. /**
  480. * @brief Tests call to SDL_GetWindowDisplayMode with invalid input
  481. *
  482. * @sa http://wiki.libsdl.org/SDL_GetWindowDisplayMode
  483. */
  484. int
  485. video_getWindowDisplayModeNegative(void *arg)
  486. {
  487. const char *expectedError = "Parameter 'mode' is invalid";
  488. char *lastError;
  489. SDL_Window* window;
  490. const char* title = "video_getWindowDisplayModeNegative Test Window";
  491. SDL_DisplayMode mode;
  492. int result;
  493. /* Call against new test window */
  494. window = _createVideoSuiteTestWindow(title);
  495. if (window != NULL) {
  496. result = SDL_GetWindowDisplayMode(window, NULL);
  497. SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode(...,mode=NULL)");
  498. SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %d", result);
  499. lastError = (char *)SDL_GetError();
  500. SDLTest_AssertPass("SDL_GetError()");
  501. SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  502. if (lastError != NULL) {
  503. SDLTest_AssertCheck(SDL_strcmp(lastError, expectedError) == 0,
  504. "SDL_GetError(): expected message '%s', was message: '%s'",
  505. expectedError,
  506. lastError);
  507. }
  508. }
  509. /* Clean up */
  510. _destroyVideoSuiteTestWindow(window);
  511. /* Call against invalid window */
  512. result = SDL_GetWindowDisplayMode(NULL, &mode);
  513. SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode(window=NULL,...)");
  514. SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %d", result);
  515. _checkInvalidWindowError();
  516. return TEST_COMPLETED;
  517. }
  518. /* Helper for setting and checking the window mouse grab state */
  519. void
  520. _setAndCheckWindowMouseGrabState(SDL_Window* window, SDL_bool desiredState)
  521. {
  522. SDL_bool currentState;
  523. /* Set state */
  524. SDL_SetWindowMouseGrab(window, desiredState);
  525. SDLTest_AssertPass("Call to SDL_SetWindowMouseGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
  526. /* Get and check state */
  527. currentState = SDL_GetWindowMouseGrab(window);
  528. SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
  529. SDLTest_AssertCheck(
  530. currentState == desiredState,
  531. "Validate returned state; expected: %s, got: %s",
  532. (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
  533. (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
  534. if (desiredState) {
  535. SDLTest_AssertCheck(
  536. SDL_GetGrabbedWindow() == window,
  537. "Grabbed window should be to our window");
  538. SDLTest_AssertCheck(
  539. SDL_GetWindowGrab(window),
  540. "SDL_GetWindowGrab() should return SDL_TRUE");
  541. SDLTest_AssertCheck(
  542. SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED,
  543. "SDL_WINDOW_MOUSE_GRABBED should be set");
  544. } else {
  545. SDLTest_AssertCheck(
  546. !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_GRABBED),
  547. "SDL_WINDOW_MOUSE_GRABBED should be unset");
  548. }
  549. }
  550. /* Helper for setting and checking the window keyboard grab state */
  551. void
  552. _setAndCheckWindowKeyboardGrabState(SDL_Window* window, SDL_bool desiredState)
  553. {
  554. SDL_bool currentState;
  555. /* Set state */
  556. SDL_SetWindowKeyboardGrab(window, desiredState);
  557. SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
  558. /* Get and check state */
  559. currentState = SDL_GetWindowKeyboardGrab(window);
  560. SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
  561. SDLTest_AssertCheck(
  562. currentState == desiredState,
  563. "Validate returned state; expected: %s, got: %s",
  564. (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
  565. (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
  566. if (desiredState) {
  567. SDLTest_AssertCheck(
  568. SDL_GetGrabbedWindow() == window,
  569. "Grabbed window should be set to our window");
  570. SDLTest_AssertCheck(
  571. SDL_GetWindowGrab(window),
  572. "SDL_GetWindowGrab() should return SDL_TRUE");
  573. SDLTest_AssertCheck(
  574. SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED,
  575. "SDL_WINDOW_KEYBOARD_GRABBED should be set");
  576. } else {
  577. SDLTest_AssertCheck(
  578. !(SDL_GetWindowFlags(window) & SDL_WINDOW_KEYBOARD_GRABBED),
  579. "SDL_WINDOW_KEYBOARD_GRABBED should be unset");
  580. }
  581. }
  582. /**
  583. * @brief Tests keyboard and mouse grab support
  584. *
  585. * @sa http://wiki.libsdl.org/SDL_GetWindowGrab
  586. * @sa http://wiki.libsdl.org/SDL_SetWindowGrab
  587. */
  588. int
  589. video_getSetWindowGrab(void *arg)
  590. {
  591. const char* title = "video_getSetWindowGrab Test Window";
  592. SDL_Window* window;
  593. SDL_bool originalMouseState, originalKeyboardState;
  594. /* Call against new test window */
  595. window = _createVideoSuiteTestWindow(title);
  596. if (window == NULL) {
  597. return TEST_ABORTED;
  598. }
  599. /* Get state */
  600. originalMouseState = SDL_GetWindowMouseGrab(window);
  601. SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()");
  602. originalKeyboardState = SDL_GetWindowKeyboardGrab(window);
  603. SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab()");
  604. /* F */
  605. _setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
  606. _setAndCheckWindowMouseGrabState(window, SDL_FALSE);
  607. SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
  608. "SDL_GetWindowGrab should return SDL_FALSE");
  609. SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
  610. "Expected NULL grabbed window");
  611. /* F --> F */
  612. _setAndCheckWindowMouseGrabState(window, SDL_FALSE);
  613. _setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
  614. SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
  615. "Expected NULL grabbed window");
  616. /* F --> T */
  617. _setAndCheckWindowMouseGrabState(window, SDL_TRUE);
  618. _setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
  619. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  620. "SDL_GetWindowGrab() should return SDL_TRUE");
  621. /* T --> T */
  622. _setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
  623. _setAndCheckWindowMouseGrabState(window, SDL_TRUE);
  624. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  625. "SDL_GetWindowGrab() should return SDL_TRUE");
  626. /* M: T --> F */
  627. /* K: T --> T */
  628. _setAndCheckWindowKeyboardGrabState(window, SDL_TRUE);
  629. _setAndCheckWindowMouseGrabState(window, SDL_FALSE);
  630. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  631. "SDL_GetWindowGrab() should return SDL_TRUE");
  632. /* M: F --> T */
  633. /* K: T --> F */
  634. _setAndCheckWindowMouseGrabState(window, SDL_TRUE);
  635. _setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
  636. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  637. "SDL_GetWindowGrab() should return SDL_TRUE");
  638. /* M: T --> F */
  639. /* K: F --> F */
  640. _setAndCheckWindowMouseGrabState(window, SDL_FALSE);
  641. _setAndCheckWindowKeyboardGrabState(window, SDL_FALSE);
  642. SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
  643. "SDL_GetWindowGrab() should return SDL_FALSE");
  644. SDLTest_AssertCheck(SDL_GetGrabbedWindow() == NULL,
  645. "Expected NULL grabbed window");
  646. /* Using the older SDL_SetWindowGrab API should only grab mouse by default */
  647. SDL_SetWindowGrab(window, SDL_TRUE);
  648. SDLTest_AssertPass("Call to SDL_SetWindowGrab(SDL_TRUE)");
  649. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  650. "SDL_GetWindowGrab() should return SDL_TRUE");
  651. SDLTest_AssertCheck(SDL_GetWindowMouseGrab(window),
  652. "SDL_GetWindowMouseGrab() should return SDL_TRUE");
  653. SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
  654. "SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
  655. SDL_SetWindowGrab(window, SDL_FALSE);
  656. SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
  657. "SDL_GetWindowGrab() should return SDL_FALSE");
  658. SDLTest_AssertCheck(!SDL_GetWindowMouseGrab(window),
  659. "SDL_GetWindowMouseGrab() should return SDL_FALSE");
  660. SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
  661. "SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
  662. /* Now test with SDL_HINT_GRAB_KEYBOARD set. We should get keyboard grab now. */
  663. SDL_SetHint(SDL_HINT_GRAB_KEYBOARD, "1");
  664. SDL_SetWindowGrab(window, SDL_TRUE);
  665. SDLTest_AssertPass("Call to SDL_SetWindowGrab(SDL_TRUE)");
  666. SDLTest_AssertCheck(SDL_GetWindowGrab(window),
  667. "SDL_GetWindowGrab() should return SDL_TRUE");
  668. SDLTest_AssertCheck(SDL_GetWindowMouseGrab(window),
  669. "SDL_GetWindowMouseGrab() should return SDL_TRUE");
  670. SDLTest_AssertCheck(SDL_GetWindowKeyboardGrab(window),
  671. "SDL_GetWindowKeyboardGrab() should return SDL_TRUE");
  672. SDL_SetWindowGrab(window, SDL_FALSE);
  673. SDLTest_AssertCheck(!SDL_GetWindowGrab(window),
  674. "SDL_GetWindowGrab() should return SDL_FALSE");
  675. SDLTest_AssertCheck(!SDL_GetWindowMouseGrab(window),
  676. "SDL_GetWindowMouseGrab() should return SDL_FALSE");
  677. SDLTest_AssertCheck(!SDL_GetWindowKeyboardGrab(window),
  678. "SDL_GetWindowKeyboardGrab() should return SDL_FALSE");
  679. /* Negative tests */
  680. SDL_GetWindowGrab(NULL);
  681. SDLTest_AssertPass("Call to SDL_GetWindowGrab(window=NULL)");
  682. _checkInvalidWindowError();
  683. SDL_GetWindowKeyboardGrab(NULL);
  684. SDLTest_AssertPass("Call to SDL_GetWindowKeyboardGrab(window=NULL)");
  685. _checkInvalidWindowError();
  686. SDL_SetWindowGrab(NULL, SDL_FALSE);
  687. SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
  688. _checkInvalidWindowError();
  689. SDL_SetWindowKeyboardGrab(NULL, SDL_FALSE);
  690. SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_FALSE)");
  691. _checkInvalidWindowError();
  692. SDL_SetWindowGrab(NULL, SDL_TRUE);
  693. SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_TRUE)");
  694. _checkInvalidWindowError();
  695. SDL_SetWindowKeyboardGrab(NULL, SDL_TRUE);
  696. SDLTest_AssertPass("Call to SDL_SetWindowKeyboardGrab(window=NULL,SDL_TRUE)");
  697. _checkInvalidWindowError();
  698. /* Restore state */
  699. _setAndCheckWindowMouseGrabState(window, originalMouseState);
  700. _setAndCheckWindowKeyboardGrabState(window, originalKeyboardState);
  701. /* Clean up */
  702. _destroyVideoSuiteTestWindow(window);
  703. return TEST_COMPLETED;
  704. }
  705. /**
  706. * @brief Tests call to SDL_GetWindowID and SDL_GetWindowFromID
  707. *
  708. * @sa http://wiki.libsdl.org/SDL_GetWindowID
  709. * @sa http://wiki.libsdl.org/SDL_SetWindowFromID
  710. */
  711. int
  712. video_getWindowId(void *arg)
  713. {
  714. const char* title = "video_getWindowId Test Window";
  715. SDL_Window* window;
  716. SDL_Window* result;
  717. Uint32 id, randomId;
  718. /* Call against new test window */
  719. window = _createVideoSuiteTestWindow(title);
  720. if (window == NULL) {
  721. return TEST_ABORTED;
  722. }
  723. /* Get ID */
  724. id = SDL_GetWindowID(window);
  725. SDLTest_AssertPass("Call to SDL_GetWindowID()");
  726. /* Get window from ID */
  727. result = SDL_GetWindowFromID(id);
  728. SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 ")", id);
  729. SDLTest_AssertCheck(result == window, "Verify result matches window pointer");
  730. /* Get window from random large ID, no result check */
  731. randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX);
  732. result = SDL_GetWindowFromID(randomId);
  733. SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/random_large)", randomId);
  734. /* Get window from 0 and Uint32 max ID, no result check */
  735. result = SDL_GetWindowFromID(0);
  736. SDLTest_AssertPass("Call to SDL_GetWindowID(0)");
  737. result = SDL_GetWindowFromID(UINT32_MAX);
  738. SDLTest_AssertPass("Call to SDL_GetWindowID(UINT32_MAX)");
  739. /* Clean up */
  740. _destroyVideoSuiteTestWindow(window);
  741. /* Get window from ID for closed window */
  742. result = SDL_GetWindowFromID(id);
  743. SDLTest_AssertPass("Call to SDL_GetWindowID(%" SDL_PRIu32 "/closed_window)", id);
  744. SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
  745. /* Negative test */
  746. SDL_ClearError();
  747. SDLTest_AssertPass("Call to SDL_ClearError()");
  748. id = SDL_GetWindowID(NULL);
  749. SDLTest_AssertPass("Call to SDL_GetWindowID(window=NULL)");
  750. _checkInvalidWindowError();
  751. return TEST_COMPLETED;
  752. }
  753. /**
  754. * @brief Tests call to SDL_GetWindowPixelFormat
  755. *
  756. * @sa http://wiki.libsdl.org/SDL_GetWindowPixelFormat
  757. */
  758. int
  759. video_getWindowPixelFormat(void *arg)
  760. {
  761. const char* title = "video_getWindowPixelFormat Test Window";
  762. SDL_Window* window;
  763. Uint32 format;
  764. /* Call against new test window */
  765. window = _createVideoSuiteTestWindow(title);
  766. if (window == NULL) {
  767. return TEST_ABORTED;
  768. }
  769. /* Get format */
  770. format = SDL_GetWindowPixelFormat(window);
  771. SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()");
  772. SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %" SDL_PRIu32, SDL_PIXELFORMAT_UNKNOWN, format);
  773. /* Clean up */
  774. _destroyVideoSuiteTestWindow(window);
  775. /* Negative test */
  776. SDL_ClearError();
  777. SDLTest_AssertPass("Call to SDL_ClearError()");
  778. format = SDL_GetWindowPixelFormat(NULL);
  779. SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat(window=NULL)");
  780. _checkInvalidWindowError();
  781. return TEST_COMPLETED;
  782. }
  783. /**
  784. * @brief Tests call to SDL_GetWindowPosition and SDL_SetWindowPosition
  785. *
  786. * @sa http://wiki.libsdl.org/SDL_GetWindowPosition
  787. * @sa http://wiki.libsdl.org/SDL_SetWindowPosition
  788. */
  789. int
  790. video_getSetWindowPosition(void *arg)
  791. {
  792. const char* title = "video_getSetWindowPosition Test Window";
  793. SDL_Window* window;
  794. int xVariation, yVariation;
  795. int referenceX, referenceY;
  796. int currentX, currentY;
  797. int desiredX, desiredY;
  798. /* Call against new test window */
  799. window = _createVideoSuiteTestWindow(title);
  800. if (window == NULL) {
  801. return TEST_ABORTED;
  802. }
  803. for (xVariation = 0; xVariation < 4; xVariation++) {
  804. for (yVariation = 0; yVariation < 4; yVariation++) {
  805. switch(xVariation) {
  806. default:
  807. case 0:
  808. /* Zero X Position */
  809. desiredX = 0;
  810. break;
  811. case 1:
  812. /* Random X position inside screen */
  813. desiredX = SDLTest_RandomIntegerInRange(1, 100);
  814. break;
  815. case 2:
  816. /* Random X position outside screen (positive) */
  817. desiredX = SDLTest_RandomIntegerInRange(10000, 11000);
  818. break;
  819. case 3:
  820. /* Random X position outside screen (negative) */
  821. desiredX = SDLTest_RandomIntegerInRange(-1000, -100);
  822. break;
  823. }
  824. switch(yVariation) {
  825. default:
  826. case 0:
  827. /* Zero X Position */
  828. desiredY = 0;
  829. break;
  830. case 1:
  831. /* Random X position inside screen */
  832. desiredY = SDLTest_RandomIntegerInRange(1, 100);
  833. break;
  834. case 2:
  835. /* Random X position outside screen (positive) */
  836. desiredY = SDLTest_RandomIntegerInRange(10000, 11000);
  837. break;
  838. case 3:
  839. /* Random Y position outside screen (negative) */
  840. desiredY = SDLTest_RandomIntegerInRange(-1000, -100);
  841. break;
  842. }
  843. /* Set position */
  844. SDL_SetWindowPosition(window, desiredX, desiredY);
  845. SDLTest_AssertPass("Call to SDL_SetWindowPosition(...,%d,%d)", desiredX, desiredY);
  846. /* Get position */
  847. currentX = desiredX + 1;
  848. currentY = desiredY + 1;
  849. SDL_GetWindowPosition(window, &currentX, &currentY);
  850. SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
  851. SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
  852. SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
  853. /* Get position X */
  854. currentX = desiredX + 1;
  855. SDL_GetWindowPosition(window, &currentX, NULL);
  856. SDLTest_AssertPass("Call to SDL_GetWindowPosition(&y=NULL)");
  857. SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
  858. /* Get position Y */
  859. currentY = desiredY + 1;
  860. SDL_GetWindowPosition(window, NULL, &currentY);
  861. SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL)");
  862. SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
  863. }
  864. }
  865. /* Dummy call with both pointers NULL */
  866. SDL_GetWindowPosition(window, NULL, NULL);
  867. SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL,&y=NULL)");
  868. /* Clean up */
  869. _destroyVideoSuiteTestWindow(window);
  870. /* Set some 'magic' value for later check that nothing was changed */
  871. referenceX = SDLTest_RandomSint32();
  872. referenceY = SDLTest_RandomSint32();
  873. currentX = referenceX;
  874. currentY = referenceY;
  875. desiredX = SDLTest_RandomSint32();
  876. desiredY = SDLTest_RandomSint32();
  877. /* Negative tests */
  878. SDL_ClearError();
  879. SDLTest_AssertPass("Call to SDL_ClearError()");
  880. SDL_GetWindowPosition(NULL, &currentX, &currentY);
  881. SDLTest_AssertPass("Call to SDL_GetWindowPosition(window=NULL)");
  882. SDLTest_AssertCheck(
  883. currentX == referenceX && currentY == referenceY,
  884. "Verify that content of X and Y pointers has not been modified; expected: %d,%d; got: %d,%d",
  885. referenceX, referenceY,
  886. currentX, currentY);
  887. _checkInvalidWindowError();
  888. SDL_GetWindowPosition(NULL, NULL, NULL);
  889. SDLTest_AssertPass("Call to SDL_GetWindowPosition(NULL, NULL, NULL)");
  890. _checkInvalidWindowError();
  891. SDL_SetWindowPosition(NULL, desiredX, desiredY);
  892. SDLTest_AssertPass("Call to SDL_SetWindowPosition(window=NULL)");
  893. _checkInvalidWindowError();
  894. return TEST_COMPLETED;
  895. }
  896. /* Helper function that checks for an 'Invalid parameter' error */
  897. void _checkInvalidParameterError()
  898. {
  899. const char *invalidParameterError = "Parameter";
  900. char *lastError;
  901. lastError = (char *)SDL_GetError();
  902. SDLTest_AssertPass("SDL_GetError()");
  903. SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  904. if (lastError != NULL) {
  905. SDLTest_AssertCheck(SDL_strncmp(lastError, invalidParameterError, SDL_strlen(invalidParameterError)) == 0,
  906. "SDL_GetError(): expected message starts with '%s', was message: '%s'",
  907. invalidParameterError,
  908. lastError);
  909. SDL_ClearError();
  910. SDLTest_AssertPass("Call to SDL_ClearError()");
  911. }
  912. }
  913. /**
  914. * @brief Tests call to SDL_GetWindowSize and SDL_SetWindowSize
  915. *
  916. * @sa http://wiki.libsdl.org/SDL_GetWindowSize
  917. * @sa http://wiki.libsdl.org/SDL_SetWindowSize
  918. */
  919. int
  920. video_getSetWindowSize(void *arg)
  921. {
  922. const char* title = "video_getSetWindowSize Test Window";
  923. SDL_Window* window;
  924. int result;
  925. SDL_Rect display;
  926. int maxwVariation, maxhVariation;
  927. int wVariation, hVariation;
  928. int referenceW, referenceH;
  929. int currentW, currentH;
  930. int desiredW, desiredH;
  931. /* Get display bounds for size range */
  932. result = SDL_GetDisplayBounds(0, &display);
  933. SDLTest_AssertPass("SDL_GetDisplayBounds()");
  934. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  935. if (result != 0) {
  936. return TEST_ABORTED;
  937. }
  938. /* Call against new test window */
  939. window = _createVideoSuiteTestWindow(title);
  940. if (window == NULL) {
  941. return TEST_ABORTED;
  942. }
  943. #ifdef __WIN32__
  944. /* Platform clips window size to screen size */
  945. maxwVariation = 4;
  946. maxhVariation = 4;
  947. #else
  948. /* Platform allows window size >= screen size */
  949. maxwVariation = 5;
  950. maxhVariation = 5;
  951. #endif
  952. for (wVariation = 0; wVariation < maxwVariation; wVariation++) {
  953. for (hVariation = 0; hVariation < maxhVariation; hVariation++) {
  954. switch(wVariation) {
  955. default:
  956. case 0:
  957. /* 1 Pixel Wide */
  958. desiredW = 1;
  959. break;
  960. case 1:
  961. /* Random width inside screen */
  962. desiredW = SDLTest_RandomIntegerInRange(1, 100);
  963. break;
  964. case 2:
  965. /* Width 1 pixel smaller than screen */
  966. desiredW = display.w - 1;
  967. break;
  968. case 3:
  969. /* Width at screen size */
  970. desiredW = display.w;
  971. break;
  972. case 4:
  973. /* Width 1 pixel larger than screen */
  974. desiredW = display.w + 1;
  975. break;
  976. }
  977. switch(hVariation) {
  978. default:
  979. case 0:
  980. /* 1 Pixel High */
  981. desiredH = 1;
  982. break;
  983. case 1:
  984. /* Random height inside screen */
  985. desiredH = SDLTest_RandomIntegerInRange(1, 100);
  986. break;
  987. case 2:
  988. /* Height 1 pixel smaller than screen */
  989. desiredH = display.h - 1;
  990. break;
  991. case 3:
  992. /* Height at screen size */
  993. desiredH = display.h;
  994. break;
  995. case 4:
  996. /* Height 1 pixel larger than screen */
  997. desiredH = display.h + 1;
  998. break;
  999. }
  1000. /* Set size */
  1001. SDL_SetWindowSize(window, desiredW, desiredH);
  1002. SDLTest_AssertPass("Call to SDL_SetWindowSize(...,%d,%d)", desiredW, desiredH);
  1003. /* Get size */
  1004. currentW = desiredW + 1;
  1005. currentH = desiredH + 1;
  1006. SDL_GetWindowSize(window, &currentW, &currentH);
  1007. SDLTest_AssertPass("Call to SDL_GetWindowSize()");
  1008. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
  1009. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
  1010. /* Get just width */
  1011. currentW = desiredW + 1;
  1012. SDL_GetWindowSize(window, &currentW, NULL);
  1013. SDLTest_AssertPass("Call to SDL_GetWindowSize(&h=NULL)");
  1014. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
  1015. /* Get just height */
  1016. currentH = desiredH + 1;
  1017. SDL_GetWindowSize(window, NULL, &currentH);
  1018. SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL)");
  1019. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
  1020. }
  1021. }
  1022. /* Dummy call with both pointers NULL */
  1023. SDL_GetWindowSize(window, NULL, NULL);
  1024. SDLTest_AssertPass("Call to SDL_GetWindowSize(&w=NULL,&h=NULL)");
  1025. /* Negative tests for parameter input */
  1026. SDL_ClearError();
  1027. SDLTest_AssertPass("Call to SDL_ClearError()");
  1028. for (desiredH = -2; desiredH < 2; desiredH++) {
  1029. for (desiredW = -2; desiredW < 2; desiredW++) {
  1030. if (desiredW <= 0 || desiredH <= 0) {
  1031. SDL_SetWindowSize(window, desiredW, desiredH);
  1032. SDLTest_AssertPass("Call to SDL_SetWindowSize(...,%d,%d)", desiredW, desiredH);
  1033. _checkInvalidParameterError();
  1034. }
  1035. }
  1036. }
  1037. /* Clean up */
  1038. _destroyVideoSuiteTestWindow(window);
  1039. /* Set some 'magic' value for later check that nothing was changed */
  1040. referenceW = SDLTest_RandomSint32();
  1041. referenceH = SDLTest_RandomSint32();
  1042. currentW = referenceW;
  1043. currentH = referenceH;
  1044. desiredW = SDLTest_RandomSint32();
  1045. desiredH = SDLTest_RandomSint32();
  1046. /* Negative tests for window input */
  1047. SDL_ClearError();
  1048. SDLTest_AssertPass("Call to SDL_ClearError()");
  1049. SDL_GetWindowSize(NULL, &currentW, &currentH);
  1050. SDLTest_AssertPass("Call to SDL_GetWindowSize(window=NULL)");
  1051. SDLTest_AssertCheck(
  1052. currentW == referenceW && currentH == referenceH,
  1053. "Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
  1054. referenceW, referenceH,
  1055. currentW, currentH);
  1056. _checkInvalidWindowError();
  1057. SDL_GetWindowSize(NULL, NULL, NULL);
  1058. SDLTest_AssertPass("Call to SDL_GetWindowSize(NULL, NULL, NULL)");
  1059. _checkInvalidWindowError();
  1060. SDL_SetWindowSize(NULL, desiredW, desiredH);
  1061. SDLTest_AssertPass("Call to SDL_SetWindowSize(window=NULL)");
  1062. _checkInvalidWindowError();
  1063. return TEST_COMPLETED;
  1064. }
  1065. /**
  1066. * @brief Tests call to SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize
  1067. *
  1068. */
  1069. int
  1070. video_getSetWindowMinimumSize(void *arg)
  1071. {
  1072. const char* title = "video_getSetWindowMinimumSize Test Window";
  1073. SDL_Window* window;
  1074. int result;
  1075. SDL_Rect display;
  1076. int wVariation, hVariation;
  1077. int referenceW, referenceH;
  1078. int currentW, currentH;
  1079. int desiredW = 1;
  1080. int desiredH = 1;
  1081. /* Get display bounds for size range */
  1082. result = SDL_GetDisplayBounds(0, &display);
  1083. SDLTest_AssertPass("SDL_GetDisplayBounds()");
  1084. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1085. if (result != 0) {
  1086. return TEST_ABORTED;
  1087. }
  1088. /* Call against new test window */
  1089. window = _createVideoSuiteTestWindow(title);
  1090. if (window == NULL) {
  1091. return TEST_ABORTED;
  1092. }
  1093. for (wVariation = 0; wVariation < 5; wVariation++) {
  1094. for (hVariation = 0; hVariation < 5; hVariation++) {
  1095. switch(wVariation) {
  1096. case 0:
  1097. /* 1 Pixel Wide */
  1098. desiredW = 1;
  1099. break;
  1100. case 1:
  1101. /* Random width inside screen */
  1102. desiredW = SDLTest_RandomIntegerInRange(2, display.w - 1);
  1103. break;
  1104. case 2:
  1105. /* Width at screen size */
  1106. desiredW = display.w;
  1107. break;
  1108. }
  1109. switch(hVariation) {
  1110. case 0:
  1111. /* 1 Pixel High */
  1112. desiredH = 1;
  1113. break;
  1114. case 1:
  1115. /* Random height inside screen */
  1116. desiredH = SDLTest_RandomIntegerInRange(2, display.h - 1);
  1117. break;
  1118. case 2:
  1119. /* Height at screen size */
  1120. desiredH = display.h;
  1121. break;
  1122. case 4:
  1123. /* Height 1 pixel larger than screen */
  1124. desiredH = display.h + 1;
  1125. break;
  1126. }
  1127. /* Set size */
  1128. SDL_SetWindowMinimumSize(window, desiredW, desiredH);
  1129. SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(...,%d,%d)", desiredW, desiredH);
  1130. /* Get size */
  1131. currentW = desiredW + 1;
  1132. currentH = desiredH + 1;
  1133. SDL_GetWindowMinimumSize(window, &currentW, &currentH);
  1134. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize()");
  1135. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
  1136. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
  1137. /* Get just width */
  1138. currentW = desiredW + 1;
  1139. SDL_GetWindowMinimumSize(window, &currentW, NULL);
  1140. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&h=NULL)");
  1141. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentH);
  1142. /* Get just height */
  1143. currentH = desiredH + 1;
  1144. SDL_GetWindowMinimumSize(window, NULL, &currentH);
  1145. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&w=NULL)");
  1146. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredW, currentH);
  1147. }
  1148. }
  1149. /* Dummy call with both pointers NULL */
  1150. SDL_GetWindowMinimumSize(window, NULL, NULL);
  1151. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(&w=NULL,&h=NULL)");
  1152. /* Negative tests for parameter input */
  1153. SDL_ClearError();
  1154. SDLTest_AssertPass("Call to SDL_ClearError()");
  1155. for (desiredH = -2; desiredH < 2; desiredH++) {
  1156. for (desiredW = -2; desiredW < 2; desiredW++) {
  1157. if (desiredW <= 0 || desiredH <= 0) {
  1158. SDL_SetWindowMinimumSize(window, desiredW, desiredH);
  1159. SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(...,%d,%d)", desiredW, desiredH);
  1160. _checkInvalidParameterError();
  1161. }
  1162. }
  1163. }
  1164. /* Clean up */
  1165. _destroyVideoSuiteTestWindow(window);
  1166. /* Set some 'magic' value for later check that nothing was changed */
  1167. referenceW = SDLTest_RandomSint32();
  1168. referenceH = SDLTest_RandomSint32();
  1169. currentW = referenceW;
  1170. currentH = referenceH;
  1171. desiredW = SDLTest_RandomSint32();
  1172. desiredH = SDLTest_RandomSint32();
  1173. /* Negative tests for window input */
  1174. SDL_ClearError();
  1175. SDLTest_AssertPass("Call to SDL_ClearError()");
  1176. SDL_GetWindowMinimumSize(NULL, &currentW, &currentH);
  1177. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(window=NULL)");
  1178. SDLTest_AssertCheck(
  1179. currentW == referenceW && currentH == referenceH,
  1180. "Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
  1181. referenceW, referenceH,
  1182. currentW, currentH);
  1183. _checkInvalidWindowError();
  1184. SDL_GetWindowMinimumSize(NULL, NULL, NULL);
  1185. SDLTest_AssertPass("Call to SDL_GetWindowMinimumSize(NULL, NULL, NULL)");
  1186. _checkInvalidWindowError();
  1187. SDL_SetWindowMinimumSize(NULL, desiredW, desiredH);
  1188. SDLTest_AssertPass("Call to SDL_SetWindowMinimumSize(window=NULL)");
  1189. _checkInvalidWindowError();
  1190. return TEST_COMPLETED;
  1191. }
  1192. /**
  1193. * @brief Tests call to SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize
  1194. *
  1195. */
  1196. int
  1197. video_getSetWindowMaximumSize(void *arg)
  1198. {
  1199. const char* title = "video_getSetWindowMaximumSize Test Window";
  1200. SDL_Window* window;
  1201. int result;
  1202. SDL_Rect display;
  1203. int wVariation, hVariation;
  1204. int referenceW, referenceH;
  1205. int currentW, currentH;
  1206. int desiredW, desiredH;
  1207. /* Get display bounds for size range */
  1208. result = SDL_GetDisplayBounds(0, &display);
  1209. SDLTest_AssertPass("SDL_GetDisplayBounds()");
  1210. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1211. if (result != 0) {
  1212. return TEST_ABORTED;
  1213. }
  1214. /* Call against new test window */
  1215. window = _createVideoSuiteTestWindow(title);
  1216. if (window == NULL) {
  1217. return TEST_ABORTED;
  1218. }
  1219. for (wVariation = 0; wVariation < 3; wVariation++) {
  1220. for (hVariation = 0; hVariation < 3; hVariation++) {
  1221. switch(wVariation) {
  1222. case 0:
  1223. /* 1 Pixel Wide */
  1224. desiredW = 1;
  1225. break;
  1226. case 1:
  1227. /* Random width inside screen */
  1228. desiredW = SDLTest_RandomIntegerInRange(2, display.w - 1);
  1229. break;
  1230. case 2:
  1231. /* Width at screen size */
  1232. desiredW = display.w;
  1233. break;
  1234. }
  1235. switch(hVariation) {
  1236. case 0:
  1237. /* 1 Pixel High */
  1238. desiredH = 1;
  1239. break;
  1240. case 1:
  1241. /* Random height inside screen */
  1242. desiredH = SDLTest_RandomIntegerInRange(2, display.h - 1);
  1243. break;
  1244. case 2:
  1245. /* Height at screen size */
  1246. desiredH = display.h;
  1247. break;
  1248. }
  1249. /* Set size */
  1250. SDL_SetWindowMaximumSize(window, desiredW, desiredH);
  1251. SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(...,%d,%d)", desiredW, desiredH);
  1252. /* Get size */
  1253. currentW = desiredW + 1;
  1254. currentH = desiredH + 1;
  1255. SDL_GetWindowMaximumSize(window, &currentW, &currentH);
  1256. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize()");
  1257. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentW);
  1258. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredH, currentH);
  1259. /* Get just width */
  1260. currentW = desiredW + 1;
  1261. SDL_GetWindowMaximumSize(window, &currentW, NULL);
  1262. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&h=NULL)");
  1263. SDLTest_AssertCheck(desiredW == currentW, "Verify returned width; expected: %d, got: %d", desiredW, currentH);
  1264. /* Get just height */
  1265. currentH = desiredH + 1;
  1266. SDL_GetWindowMaximumSize(window, NULL, &currentH);
  1267. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&w=NULL)");
  1268. SDLTest_AssertCheck(desiredH == currentH, "Verify returned height; expected: %d, got: %d", desiredW, currentH);
  1269. }
  1270. }
  1271. /* Dummy call with both pointers NULL */
  1272. SDL_GetWindowMaximumSize(window, NULL, NULL);
  1273. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(&w=NULL,&h=NULL)");
  1274. /* Negative tests for parameter input */
  1275. SDL_ClearError();
  1276. SDLTest_AssertPass("Call to SDL_ClearError()");
  1277. for (desiredH = -2; desiredH < 2; desiredH++) {
  1278. for (desiredW = -2; desiredW < 2; desiredW++) {
  1279. if (desiredW <= 0 || desiredH <= 0) {
  1280. SDL_SetWindowMaximumSize(window, desiredW, desiredH);
  1281. SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(...,%d,%d)", desiredW, desiredH);
  1282. _checkInvalidParameterError();
  1283. }
  1284. }
  1285. }
  1286. /* Clean up */
  1287. _destroyVideoSuiteTestWindow(window);
  1288. /* Set some 'magic' value for later check that nothing was changed */
  1289. referenceW = SDLTest_RandomSint32();
  1290. referenceH = SDLTest_RandomSint32();
  1291. currentW = referenceW;
  1292. currentH = referenceH;
  1293. desiredW = SDLTest_RandomSint32();
  1294. desiredH = SDLTest_RandomSint32();
  1295. /* Negative tests */
  1296. SDL_ClearError();
  1297. SDLTest_AssertPass("Call to SDL_ClearError()");
  1298. SDL_GetWindowMaximumSize(NULL, &currentW, &currentH);
  1299. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(window=NULL)");
  1300. SDLTest_AssertCheck(
  1301. currentW == referenceW && currentH == referenceH,
  1302. "Verify that content of W and H pointers has not been modified; expected: %d,%d; got: %d,%d",
  1303. referenceW, referenceH,
  1304. currentW, currentH);
  1305. _checkInvalidWindowError();
  1306. SDL_GetWindowMaximumSize(NULL, NULL, NULL);
  1307. SDLTest_AssertPass("Call to SDL_GetWindowMaximumSize(NULL, NULL, NULL)");
  1308. _checkInvalidWindowError();
  1309. SDL_SetWindowMaximumSize(NULL, desiredW, desiredH);
  1310. SDLTest_AssertPass("Call to SDL_SetWindowMaximumSize(window=NULL)");
  1311. _checkInvalidWindowError();
  1312. return TEST_COMPLETED;
  1313. }
  1314. /**
  1315. * @brief Tests call to SDL_SetWindowData and SDL_GetWindowData
  1316. *
  1317. * @sa http://wiki.libsdl.org/SDL_SetWindowData
  1318. * @sa http://wiki.libsdl.org/SDL_GetWindowData
  1319. */
  1320. int
  1321. video_getSetWindowData(void *arg)
  1322. {
  1323. int returnValue = TEST_COMPLETED;
  1324. const char* title = "video_setGetWindowData Test Window";
  1325. SDL_Window* window;
  1326. const char *referenceName = "TestName";
  1327. const char *name = "TestName";
  1328. const char *referenceName2 = "TestName2";
  1329. const char *name2 = "TestName2";
  1330. int datasize;
  1331. char *referenceUserdata = NULL;
  1332. char *userdata = NULL;
  1333. char *referenceUserdata2 = NULL;
  1334. char *userdata2 = NULL;
  1335. char *result;
  1336. int iteration;
  1337. /* Call against new test window */
  1338. window = _createVideoSuiteTestWindow(title);
  1339. if (window == NULL) {
  1340. return TEST_ABORTED;
  1341. }
  1342. /* Create testdata */
  1343. datasize = SDLTest_RandomIntegerInRange(1, 32);
  1344. referenceUserdata = SDLTest_RandomAsciiStringOfSize(datasize);
  1345. if (referenceUserdata == NULL) {
  1346. returnValue = TEST_ABORTED;
  1347. goto cleanup;
  1348. }
  1349. userdata = SDL_strdup(referenceUserdata);
  1350. if (userdata == NULL) {
  1351. returnValue = TEST_ABORTED;
  1352. goto cleanup;
  1353. }
  1354. datasize = SDLTest_RandomIntegerInRange(1, 32);
  1355. referenceUserdata2 = SDLTest_RandomAsciiStringOfSize(datasize);
  1356. if (referenceUserdata2 == NULL) {
  1357. returnValue = TEST_ABORTED;
  1358. goto cleanup;
  1359. }
  1360. userdata2 = (char *)SDL_strdup(referenceUserdata2);
  1361. if (userdata2 == NULL) {
  1362. returnValue = TEST_ABORTED;
  1363. goto cleanup;
  1364. }
  1365. /* Get non-existent data */
  1366. result = (char *)SDL_GetWindowData(window, name);
  1367. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
  1368. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1369. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1370. /* Set data */
  1371. result = (char *)SDL_SetWindowData(window, name, userdata);
  1372. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s)", name, userdata);
  1373. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1374. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1375. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1376. /* Get data (twice) */
  1377. for (iteration = 1; iteration <= 2; iteration++) {
  1378. result = (char *)SDL_GetWindowData(window, name);
  1379. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [iteration %d]", name, iteration);
  1380. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
  1381. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1382. }
  1383. /* Set data again twice */
  1384. for (iteration = 1; iteration <= 2; iteration++) {
  1385. result = (char *)SDL_SetWindowData(window, name, userdata);
  1386. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [iteration %d]", name, userdata, iteration);
  1387. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
  1388. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1389. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1390. }
  1391. /* Get data again */
  1392. result = (char *)SDL_GetWindowData(window, name);
  1393. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again]", name);
  1394. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
  1395. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1396. /* Set data with new data */
  1397. result = (char *)SDL_SetWindowData(window, name, userdata2);
  1398. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata]", name, userdata2);
  1399. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
  1400. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1401. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1402. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
  1403. /* Set data with new data again */
  1404. result = (char *)SDL_SetWindowData(window, name, userdata2);
  1405. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata again]", name, userdata2);
  1406. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
  1407. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1408. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1409. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
  1410. /* Get new data */
  1411. result = (char *)SDL_GetWindowData(window, name);
  1412. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
  1413. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
  1414. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1415. /* Set data with NULL to clear */
  1416. result = (char *)SDL_SetWindowData(window, name, NULL);
  1417. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL)", name);
  1418. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
  1419. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1420. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1421. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
  1422. /* Set data with NULL to clear again */
  1423. result = (char *)SDL_SetWindowData(window, name, NULL);
  1424. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL) [again]", name);
  1425. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1426. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1427. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1428. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
  1429. /* Get non-existent data */
  1430. result = (char *)SDL_GetWindowData(window, name);
  1431. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
  1432. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1433. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1434. /* Get non-existent data new name */
  1435. result = (char *)SDL_GetWindowData(window, name2);
  1436. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name2);
  1437. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1438. SDLTest_AssertCheck(SDL_strcmp(referenceName2, name2) == 0, "Validate that name2 was not changed, expected: %s, got: %s", referenceName2, name2);
  1439. /* Set data (again) */
  1440. result = (char *)SDL_SetWindowData(window, name, userdata);
  1441. SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [again, after clear]", name, userdata);
  1442. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1443. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1444. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
  1445. /* Get data (again) */
  1446. result = (char *)SDL_GetWindowData(window, name);
  1447. SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again, after clear]", name);
  1448. SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
  1449. SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
  1450. /* Negative test */
  1451. SDL_ClearError();
  1452. SDLTest_AssertPass("Call to SDL_ClearError()");
  1453. /* Set with invalid window */
  1454. result = (char *)SDL_SetWindowData(NULL, name, userdata);
  1455. SDLTest_AssertPass("Call to SDL_SetWindowData(window=NULL)");
  1456. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1457. _checkInvalidWindowError();
  1458. /* Set data with NULL name, valid userdata */
  1459. result = (char *)SDL_SetWindowData(window, NULL, userdata);
  1460. SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL)");
  1461. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1462. _checkInvalidParameterError();
  1463. /* Set data with empty name, valid userdata */
  1464. result = (char *)SDL_SetWindowData(window, "", userdata);
  1465. SDLTest_AssertPass("Call to SDL_SetWindowData(name='')");
  1466. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1467. _checkInvalidParameterError();
  1468. /* Set data with NULL name, NULL userdata */
  1469. result = (char *)SDL_SetWindowData(window, NULL, NULL);
  1470. SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL,userdata=NULL)");
  1471. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1472. _checkInvalidParameterError();
  1473. /* Set data with empty name, NULL userdata */
  1474. result = (char *)SDL_SetWindowData(window, "", NULL);
  1475. SDLTest_AssertPass("Call to SDL_SetWindowData(name='',userdata=NULL)");
  1476. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1477. _checkInvalidParameterError();
  1478. /* Get with invalid window */
  1479. result = (char *)SDL_GetWindowData(NULL, name);
  1480. SDLTest_AssertPass("Call to SDL_GetWindowData(window=NULL)");
  1481. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1482. _checkInvalidWindowError();
  1483. /* Get data with NULL name */
  1484. result = (char *)SDL_GetWindowData(window, NULL);
  1485. SDLTest_AssertPass("Call to SDL_GetWindowData(name=NULL)");
  1486. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1487. _checkInvalidParameterError();
  1488. /* Get data with empty name */
  1489. result = (char *)SDL_GetWindowData(window, "");
  1490. SDLTest_AssertPass("Call to SDL_GetWindowData(name='')");
  1491. SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
  1492. _checkInvalidParameterError();
  1493. /* Clean up */
  1494. _destroyVideoSuiteTestWindow(window);
  1495. cleanup:
  1496. SDL_free(referenceUserdata);
  1497. SDL_free(referenceUserdata2);
  1498. SDL_free(userdata);
  1499. SDL_free(userdata2);
  1500. return returnValue;
  1501. }
  1502. /**
  1503. * @brief Tests the functionality of the SDL_WINDOWPOS_CENTERED_DISPLAY along with SDL_WINDOW_FULLSCREEN_DESKTOP.
  1504. *
  1505. * Espeically useful when run on a multi-monitor system with different DPI scales per monitor,
  1506. * to test that the window size is maintained when moving between monitors.
  1507. */
  1508. int
  1509. video_setWindowCenteredOnDisplay(void *arg)
  1510. {
  1511. SDL_Window *window;
  1512. const char *title = "video_setWindowCenteredOnDisplay Test Window";
  1513. int x, y, w, h;
  1514. int xVariation, yVariation;
  1515. int displayNum;
  1516. int result;
  1517. SDL_Rect display0, display1;
  1518. displayNum = SDL_GetNumVideoDisplays();
  1519. /* Get display bounds */
  1520. result = SDL_GetDisplayBounds(0 % displayNum, &display0);
  1521. SDLTest_AssertPass("SDL_GetDisplayBounds()");
  1522. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1523. if (result != 0) {
  1524. return TEST_ABORTED;
  1525. }
  1526. result = SDL_GetDisplayBounds(1 % displayNum, &display1);
  1527. SDLTest_AssertPass("SDL_GetDisplayBounds()");
  1528. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1529. if (result != 0) {
  1530. return TEST_ABORTED;
  1531. }
  1532. for (xVariation = 0; xVariation < 2; xVariation++) {
  1533. for (yVariation = 0; yVariation < 2; yVariation++) {
  1534. int currentX = 0, currentY = 0;
  1535. int currentW = 0, currentH = 0;
  1536. int expectedX = 0, expectedY = 0;
  1537. int currentDisplay;
  1538. int expectedDisplay;
  1539. SDL_Rect expectedDisplayRect;
  1540. /* xVariation is the display we start on */
  1541. expectedDisplay = xVariation % displayNum;
  1542. x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
  1543. y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
  1544. w = SDLTest_RandomIntegerInRange(640, 800);
  1545. h = SDLTest_RandomIntegerInRange(400, 600);
  1546. expectedDisplayRect = (xVariation == 0) ? display0 : display1;
  1547. expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
  1548. expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
  1549. window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
  1550. SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
  1551. SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  1552. /* Check the window is centered on the requested display */
  1553. currentDisplay = SDL_GetWindowDisplayIndex(window);
  1554. SDL_GetWindowSize(window, &currentW, &currentH);
  1555. SDL_GetWindowPosition(window, &currentX, &currentY);
  1556. SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
  1557. SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
  1558. SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
  1559. SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
  1560. SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
  1561. /* Enter fullscreen desktop */
  1562. result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
  1563. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1564. /* Check we are filling the full display */
  1565. currentDisplay = SDL_GetWindowDisplayIndex(window);
  1566. SDL_GetWindowSize(window, &currentW, &currentH);
  1567. SDL_GetWindowPosition(window, &currentX, &currentY);
  1568. SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
  1569. SDLTest_AssertCheck(currentW == expectedDisplayRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedDisplayRect.w);
  1570. SDLTest_AssertCheck(currentH == expectedDisplayRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedDisplayRect.h);
  1571. SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x);
  1572. SDLTest_AssertCheck(currentY == expectedDisplayRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedDisplayRect.y);
  1573. /* Leave fullscreen desktop */
  1574. result = SDL_SetWindowFullscreen(window, 0);
  1575. SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
  1576. /* Check window was restored correctly */
  1577. currentDisplay = SDL_GetWindowDisplayIndex(window);
  1578. SDL_GetWindowSize(window, &currentW, &currentH);
  1579. SDL_GetWindowPosition(window, &currentX, &currentY);
  1580. SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
  1581. SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
  1582. SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
  1583. SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
  1584. SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
  1585. /* Center on display yVariation, and check window properties */
  1586. expectedDisplay = yVariation % displayNum;
  1587. x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
  1588. y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay);
  1589. expectedDisplayRect = (expectedDisplay == 0) ? display0 : display1;
  1590. expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
  1591. expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
  1592. SDL_SetWindowPosition(window, x, y);
  1593. currentDisplay = SDL_GetWindowDisplayIndex(window);
  1594. SDL_GetWindowSize(window, &currentW, &currentH);
  1595. SDL_GetWindowPosition(window, &currentX, &currentY);
  1596. SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay);
  1597. SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w);
  1598. SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h);
  1599. SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX);
  1600. SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY);
  1601. /* Clean up */
  1602. _destroyVideoSuiteTestWindow(window);
  1603. }
  1604. }
  1605. return TEST_COMPLETED;
  1606. }
  1607. /* ================= Test References ================== */
  1608. /* Video test cases */
  1609. static const SDLTest_TestCaseReference videoTest1 =
  1610. { (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver", "Enable and disable screenaver while checking state", TEST_ENABLED };
  1611. static const SDLTest_TestCaseReference videoTest2 =
  1612. { (SDLTest_TestCaseFp)video_createWindowVariousPositions, "video_createWindowVariousPositions", "Create windows at various locations", TEST_ENABLED };
  1613. static const SDLTest_TestCaseReference videoTest3 =
  1614. { (SDLTest_TestCaseFp)video_createWindowVariousSizes, "video_createWindowVariousSizes", "Create windows with various sizes", TEST_ENABLED };
  1615. static const SDLTest_TestCaseReference videoTest4 =
  1616. { (SDLTest_TestCaseFp)video_createWindowVariousFlags, "video_createWindowVariousFlags", "Create windows using various flags", TEST_ENABLED };
  1617. static const SDLTest_TestCaseReference videoTest5 =
  1618. { (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags", "Get window flags set during SDL_CreateWindow", TEST_ENABLED };
  1619. static const SDLTest_TestCaseReference videoTest6 =
  1620. { (SDLTest_TestCaseFp)video_getNumDisplayModes, "video_getNumDisplayModes", "Use SDL_GetNumDisplayModes function to get number of display modes", TEST_ENABLED };
  1621. static const SDLTest_TestCaseReference videoTest7 =
  1622. { (SDLTest_TestCaseFp)video_getNumDisplayModesNegative, "video_getNumDisplayModesNegative", "Negative tests for SDL_GetNumDisplayModes", TEST_ENABLED };
  1623. static const SDLTest_TestCaseReference videoTest8 =
  1624. { (SDLTest_TestCaseFp)video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution", "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED };
  1625. static const SDLTest_TestCaseReference videoTest9 =
  1626. { (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution", "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED };
  1627. static const SDLTest_TestCaseReference videoTest10 =
  1628. { (SDLTest_TestCaseFp)video_getWindowDisplayMode, "video_getWindowDisplayMode", "Get window display mode", TEST_ENABLED };
  1629. static const SDLTest_TestCaseReference videoTest11 =
  1630. { (SDLTest_TestCaseFp)video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative", "Get window display mode with invalid input", TEST_ENABLED };
  1631. static const SDLTest_TestCaseReference videoTest12 =
  1632. { (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab", "Checks SDL_GetWindowGrab and SDL_SetWindowGrab positive and negative cases", TEST_ENABLED };
  1633. static const SDLTest_TestCaseReference videoTest13 =
  1634. { (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId", "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED };
  1635. static const SDLTest_TestCaseReference videoTest14 =
  1636. { (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat", "Checks SDL_GetWindowPixelFormat", TEST_ENABLED };
  1637. static const SDLTest_TestCaseReference videoTest15 =
  1638. { (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition", "Checks SDL_GetWindowPosition and SDL_SetWindowPosition positive and negative cases", TEST_ENABLED };
  1639. static const SDLTest_TestCaseReference videoTest16 =
  1640. { (SDLTest_TestCaseFp)video_getSetWindowSize, "video_getSetWindowSize", "Checks SDL_GetWindowSize and SDL_SetWindowSize positive and negative cases", TEST_ENABLED };
  1641. static const SDLTest_TestCaseReference videoTest17 =
  1642. { (SDLTest_TestCaseFp)video_getSetWindowMinimumSize, "video_getSetWindowMinimumSize", "Checks SDL_GetWindowMinimumSize and SDL_SetWindowMinimumSize positive and negative cases", TEST_ENABLED };
  1643. static const SDLTest_TestCaseReference videoTest18 =
  1644. { (SDLTest_TestCaseFp)video_getSetWindowMaximumSize, "video_getSetWindowMaximumSize", "Checks SDL_GetWindowMaximumSize and SDL_SetWindowMaximumSize positive and negative cases", TEST_ENABLED };
  1645. static const SDLTest_TestCaseReference videoTest19 =
  1646. { (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED };
  1647. static const SDLTest_TestCaseReference videoTest20 =
  1648. { (SDLTest_TestCaseFp) video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED };
  1649. /* Sequence of Video test cases */
  1650. static const SDLTest_TestCaseReference *videoTests[] = {
  1651. &videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6,
  1652. &videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12,
  1653. &videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17,
  1654. &videoTest18, &videoTest19, &videoTest20, NULL
  1655. };
  1656. /* Video test suite (global) */
  1657. SDLTest_TestSuiteReference videoTestSuite = {
  1658. "Video",
  1659. NULL,
  1660. videoTests,
  1661. NULL
  1662. };
  1663. /* vi: set ts=4 sw=4 expandtab: */