testautomation_video.c 77 KB

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