testautomation_mouse.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /**
  2. * Mouse test suite
  3. */
  4. #include <stdio.h>
  5. #include <limits.h>
  6. #include "SDL.h"
  7. #include "SDL_test.h"
  8. /* ================= Test Case Implementation ================== */
  9. /* Test case functions */
  10. /* Helper to evaluate state returned from SDL_GetMouseState */
  11. int _mouseStateCheck(Uint32 state)
  12. {
  13. return (state == 0) ||
  14. (state == SDL_BUTTON(SDL_BUTTON_LEFT)) ||
  15. (state == SDL_BUTTON(SDL_BUTTON_MIDDLE)) ||
  16. (state == SDL_BUTTON(SDL_BUTTON_RIGHT)) ||
  17. (state == SDL_BUTTON(SDL_BUTTON_X1)) ||
  18. (state == SDL_BUTTON(SDL_BUTTON_X2));
  19. }
  20. /**
  21. * @brief Check call to SDL_GetMouseState
  22. *
  23. */
  24. int
  25. mouse_getMouseState(void *arg)
  26. {
  27. int x;
  28. int y;
  29. Uint32 state;
  30. /* Pump some events to update mouse state */
  31. SDL_PumpEvents();
  32. SDLTest_AssertPass("Call to SDL_PumpEvents()");
  33. /* Case where x, y pointer is NULL */
  34. state = SDL_GetMouseState(NULL, NULL);
  35. SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, NULL)");
  36. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  37. /* Case where x pointer is not NULL */
  38. x = INT_MIN;
  39. state = SDL_GetMouseState(&x, NULL);
  40. SDLTest_AssertPass("Call to SDL_GetMouseState(&x, NULL)");
  41. SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
  42. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  43. /* Case where y pointer is not NULL */
  44. y = INT_MIN;
  45. state = SDL_GetMouseState(NULL, &y);
  46. SDLTest_AssertPass("Call to SDL_GetMouseState(NULL, &y)");
  47. SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
  48. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  49. /* Case where x and y pointer is not NULL */
  50. x = INT_MIN;
  51. y = INT_MIN;
  52. state = SDL_GetMouseState(&x, &y);
  53. SDLTest_AssertPass("Call to SDL_GetMouseState(&x, &y)");
  54. SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
  55. SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
  56. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  57. return TEST_COMPLETED;
  58. }
  59. /**
  60. * @brief Check call to SDL_GetRelativeMouseState
  61. *
  62. */
  63. int
  64. mouse_getRelativeMouseState(void *arg)
  65. {
  66. int x;
  67. int y;
  68. Uint32 state;
  69. /* Pump some events to update mouse state */
  70. SDL_PumpEvents();
  71. SDLTest_AssertPass("Call to SDL_PumpEvents()");
  72. /* Case where x, y pointer is NULL */
  73. state = SDL_GetRelativeMouseState(NULL, NULL);
  74. SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, NULL)");
  75. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  76. /* Case where x pointer is not NULL */
  77. x = INT_MIN;
  78. state = SDL_GetRelativeMouseState(&x, NULL);
  79. SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, NULL)");
  80. SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
  81. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  82. /* Case where y pointer is not NULL */
  83. y = INT_MIN;
  84. state = SDL_GetRelativeMouseState(NULL, &y);
  85. SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(NULL, &y)");
  86. SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
  87. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  88. /* Case where x and y pointer is not NULL */
  89. x = INT_MIN;
  90. y = INT_MIN;
  91. state = SDL_GetRelativeMouseState(&x, &y);
  92. SDLTest_AssertPass("Call to SDL_GetRelativeMouseState(&x, &y)");
  93. SDLTest_AssertCheck(x > INT_MIN, "Validate that value of x is > INT_MIN, got: %i", x);
  94. SDLTest_AssertCheck(y > INT_MIN, "Validate that value of y is > INT_MIN, got: %i", y);
  95. SDLTest_AssertCheck(_mouseStateCheck(state), "Validate state returned from function, got: %i", state);
  96. return TEST_COMPLETED;
  97. }
  98. /* XPM definition of mouse Cursor */
  99. static const char *_mouseArrowData[] = {
  100. /* pixels */
  101. "X ",
  102. "XX ",
  103. "X.X ",
  104. "X..X ",
  105. "X...X ",
  106. "X....X ",
  107. "X.....X ",
  108. "X......X ",
  109. "X.......X ",
  110. "X........X ",
  111. "X.....XXXXX ",
  112. "X..X..X ",
  113. "X.X X..X ",
  114. "XX X..X ",
  115. "X X..X ",
  116. " X..X ",
  117. " X..X ",
  118. " X..X ",
  119. " XX ",
  120. " ",
  121. " ",
  122. " ",
  123. " ",
  124. " ",
  125. " ",
  126. " ",
  127. " ",
  128. " ",
  129. " ",
  130. " ",
  131. " ",
  132. " "
  133. };
  134. /* Helper that creates a new mouse cursor from an XPM */
  135. static SDL_Cursor *_initArrowCursor(const char *image[])
  136. {
  137. SDL_Cursor *cursor;
  138. int i, row, col;
  139. Uint8 data[4*32];
  140. Uint8 mask[4*32];
  141. i = -1;
  142. for ( row=0; row<32; ++row ) {
  143. for ( col=0; col<32; ++col ) {
  144. if ( col % 8 ) {
  145. data[i] <<= 1;
  146. mask[i] <<= 1;
  147. } else {
  148. ++i;
  149. data[i] = mask[i] = 0;
  150. }
  151. switch (image[row][col]) {
  152. case 'X':
  153. data[i] |= 0x01;
  154. mask[i] |= 0x01;
  155. break;
  156. case '.':
  157. mask[i] |= 0x01;
  158. break;
  159. case ' ':
  160. break;
  161. }
  162. }
  163. }
  164. cursor = SDL_CreateCursor(data, mask, 32, 32, 0, 0);
  165. return cursor;
  166. }
  167. /**
  168. * @brief Check call to SDL_CreateCursor and SDL_FreeCursor
  169. *
  170. * @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateCursor
  171. * @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
  172. */
  173. int
  174. mouse_createFreeCursor(void *arg)
  175. {
  176. SDL_Cursor *cursor;
  177. /* Create a cursor */
  178. cursor = _initArrowCursor(_mouseArrowData);
  179. SDLTest_AssertPass("Call to SDL_CreateCursor()");
  180. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateCursor() is not NULL");
  181. if (cursor == NULL) {
  182. return TEST_ABORTED;
  183. }
  184. /* Free cursor again */
  185. SDL_FreeCursor(cursor);
  186. SDLTest_AssertPass("Call to SDL_FreeCursor()");
  187. return TEST_COMPLETED;
  188. }
  189. /**
  190. * @brief Check call to SDL_CreateColorCursor and SDL_FreeCursor
  191. *
  192. * @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateColorCursor
  193. * @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
  194. */
  195. int
  196. mouse_createFreeColorCursor(void *arg)
  197. {
  198. SDL_Surface *face;
  199. SDL_Cursor *cursor;
  200. /* Get sample surface */
  201. face = SDLTest_ImageFace();
  202. SDLTest_AssertCheck(face != NULL, "Validate sample input image is not NULL");
  203. if (face == NULL) return TEST_ABORTED;
  204. /* Create a color cursor from surface */
  205. cursor = SDL_CreateColorCursor(face, 0, 0);
  206. SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
  207. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
  208. if (cursor == NULL) {
  209. SDL_FreeSurface(face);
  210. return TEST_ABORTED;
  211. }
  212. /* Free cursor again */
  213. SDL_FreeCursor(cursor);
  214. SDLTest_AssertPass("Call to SDL_FreeCursor()");
  215. /* Clean up */
  216. SDL_FreeSurface(face);
  217. return TEST_COMPLETED;
  218. }
  219. /* Helper that changes cursor visibility */
  220. void _changeCursorVisibility(int state)
  221. {
  222. int oldState;
  223. int newState;
  224. int result;
  225. oldState = SDL_ShowCursor(SDL_QUERY);
  226. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  227. result = SDL_ShowCursor(state);
  228. SDLTest_AssertPass("Call to SDL_ShowCursor(%s)", (state == SDL_ENABLE) ? "SDL_ENABLE" : "SDL_DISABLE");
  229. SDLTest_AssertCheck(result == oldState, "Validate result from SDL_ShowCursor(%s), expected: %i, got: %i",
  230. (state == SDL_ENABLE) ? "SDL_ENABLE" : "SDL_DISABLE", oldState, result);
  231. newState = SDL_ShowCursor(SDL_QUERY);
  232. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  233. SDLTest_AssertCheck(state == newState, "Validate new state, expected: %i, got: %i",
  234. state, newState);
  235. }
  236. /**
  237. * @brief Check call to SDL_ShowCursor
  238. *
  239. * @sa http://wiki.libsdl.org/moin.cgi/SDL_ShowCursor
  240. */
  241. int
  242. mouse_showCursor(void *arg)
  243. {
  244. int currentState;
  245. /* Get current state */
  246. currentState = SDL_ShowCursor(SDL_QUERY);
  247. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  248. SDLTest_AssertCheck(currentState == SDL_DISABLE || currentState == SDL_ENABLE,
  249. "Validate result is %i or %i, got: %i", SDL_DISABLE, SDL_ENABLE, currentState);
  250. if (currentState == SDL_DISABLE) {
  251. /* Show the cursor, then hide it again */
  252. _changeCursorVisibility(SDL_ENABLE);
  253. _changeCursorVisibility(SDL_DISABLE);
  254. } else if (currentState == SDL_ENABLE) {
  255. /* Hide the cursor, then show it again */
  256. _changeCursorVisibility(SDL_DISABLE);
  257. _changeCursorVisibility(SDL_ENABLE);
  258. } else {
  259. return TEST_ABORTED;
  260. }
  261. return TEST_COMPLETED;
  262. }
  263. /**
  264. * @brief Check call to SDL_SetCursor
  265. *
  266. * @sa http://wiki.libsdl.org/moin.cgi/SDL_SetCursor
  267. */
  268. int
  269. mouse_setCursor(void *arg)
  270. {
  271. SDL_Cursor *cursor;
  272. /* Create a cursor */
  273. cursor = _initArrowCursor(_mouseArrowData);
  274. SDLTest_AssertPass("Call to SDL_CreateCursor()");
  275. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateCursor() is not NULL");
  276. if (cursor == NULL) {
  277. return TEST_ABORTED;
  278. }
  279. /* Set the arrow cursor */
  280. SDL_SetCursor(cursor);
  281. SDLTest_AssertPass("Call to SDL_SetCursor(cursor)");
  282. /* Force redraw */
  283. SDL_SetCursor(NULL);
  284. SDLTest_AssertPass("Call to SDL_SetCursor(NULL)");
  285. /* Free cursor again */
  286. SDL_FreeCursor(cursor);
  287. SDLTest_AssertPass("Call to SDL_FreeCursor()");
  288. return TEST_COMPLETED;
  289. }
  290. /**
  291. * @brief Check call to SDL_GetCursor
  292. *
  293. * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetCursor
  294. */
  295. int
  296. mouse_getCursor(void *arg)
  297. {
  298. SDL_Cursor *cursor;
  299. /* Get current cursor */
  300. cursor = SDL_GetCursor();
  301. SDLTest_AssertPass("Call to SDL_GetCursor()");
  302. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_GetCursor() is not NULL");
  303. return TEST_COMPLETED;
  304. }
  305. /**
  306. * @brief Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode
  307. *
  308. * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetRelativeMouseMode
  309. * @sa http://wiki.libsdl.org/moin.cgi/SDL_SetRelativeMouseMode
  310. */
  311. int
  312. mouse_getSetRelativeMouseMode(void *arg)
  313. {
  314. int result;
  315. int i;
  316. SDL_bool initialState;
  317. SDL_bool currentState;
  318. /* Capture original state so we can revert back to it later */
  319. initialState = SDL_GetRelativeMouseMode();
  320. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  321. /* Repeat twice to check D->D transition */
  322. for (i=0; i<2; i++) {
  323. /* Disable - should always be supported */
  324. result = SDL_SetRelativeMouseMode(SDL_FALSE);
  325. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
  326. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  327. currentState = SDL_GetRelativeMouseMode();
  328. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  329. SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
  330. }
  331. /* Repeat twice to check D->E->E transition */
  332. for (i=0; i<2; i++) {
  333. /* Enable - may not be supported */
  334. result = SDL_SetRelativeMouseMode(SDL_TRUE);
  335. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(TRUE)");
  336. if (result != -1) {
  337. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  338. currentState = SDL_GetRelativeMouseMode();
  339. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  340. SDLTest_AssertCheck(currentState == SDL_TRUE, "Validate current state is TRUE, got: %i", currentState);
  341. }
  342. }
  343. /* Disable to check E->D transition */
  344. result = SDL_SetRelativeMouseMode(SDL_FALSE);
  345. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
  346. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  347. currentState = SDL_GetRelativeMouseMode();
  348. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  349. SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
  350. /* Revert to original state - ignore result */
  351. result = SDL_SetRelativeMouseMode(initialState);
  352. return TEST_COMPLETED;
  353. }
  354. #define MOUSE_TESTWINDOW_WIDTH 320
  355. #define MOUSE_TESTWINDOW_HEIGHT 200
  356. /**
  357. * Creates a test window
  358. */
  359. SDL_Window *_createMouseSuiteTestWindow()
  360. {
  361. int posX = 100, posY = 100, width = MOUSE_TESTWINDOW_WIDTH, height = MOUSE_TESTWINDOW_HEIGHT;
  362. SDL_Window *window;
  363. window = SDL_CreateWindow("mouse_createMouseSuiteTestWindow", posX, posY, width, height, 0);
  364. SDLTest_AssertPass("SDL_CreateWindow()");
  365. SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
  366. return window;
  367. }
  368. /*
  369. * Destroy test window
  370. */
  371. void _destroyMouseSuiteTestWindow(SDL_Window *window)
  372. {
  373. if (window != NULL) {
  374. SDL_DestroyWindow(window);
  375. window = NULL;
  376. SDLTest_AssertPass("SDL_DestroyWindow()");
  377. }
  378. }
  379. /**
  380. * @brief Check call to SDL_WarpMouseInWindow
  381. *
  382. * @sa http://wiki.libsdl.org/moin.cgi/SDL_WarpMouseInWindow
  383. */
  384. int
  385. mouse_warpMouseInWindow(void *arg)
  386. {
  387. const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
  388. int numPositions = 6;
  389. int xPositions[] = {-1, 0, 1, w-1, w, w+1 };
  390. int yPositions[] = {-1, 0, 1, h-1, h, h+1 };
  391. int x, y, i, j;
  392. SDL_Window *window;
  393. /* Create test window */
  394. window = _createMouseSuiteTestWindow();
  395. if (window == NULL) return TEST_ABORTED;
  396. /* Mouse to random position inside window */
  397. x = SDLTest_RandomIntegerInRange(1, w-1);
  398. y = SDLTest_RandomIntegerInRange(1, h-1);
  399. SDL_WarpMouseInWindow(window, x, y);
  400. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  401. /* Same position again */
  402. SDL_WarpMouseInWindow(window, x, y);
  403. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  404. /* Mouse to various boundary positions */
  405. for (i=0; i<numPositions; i++) {
  406. for (j=0; j<numPositions; j++) {
  407. x = xPositions[i];
  408. y = yPositions[j];
  409. SDL_WarpMouseInWindow(window, x, y);
  410. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  411. /* TODO: add tracking of events and check that each call generates a mouse motion event */
  412. SDL_PumpEvents();
  413. SDLTest_AssertPass("SDL_PumpEvents()");
  414. }
  415. }
  416. /* Clean up test window */
  417. _destroyMouseSuiteTestWindow(window);
  418. return TEST_COMPLETED;
  419. }
  420. /**
  421. * @brief Check call to SDL_GetMouseFocus
  422. *
  423. * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetMouseFocus
  424. */
  425. int
  426. mouse_getMouseFocus(void *arg)
  427. {
  428. const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
  429. int x, y;
  430. SDL_Window *window;
  431. SDL_Window *focusWindow;
  432. /* Get focus - focus non-deterministic */
  433. focusWindow = SDL_GetMouseFocus();
  434. SDLTest_AssertPass("SDL_GetMouseFocus()");
  435. /* Create test window */
  436. window = _createMouseSuiteTestWindow();
  437. if (window == NULL) return TEST_ABORTED;
  438. /* Mouse to random position inside window */
  439. x = SDLTest_RandomIntegerInRange(1, w-1);
  440. y = SDLTest_RandomIntegerInRange(1, h-1);
  441. SDL_WarpMouseInWindow(window, x, y);
  442. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  443. /* Pump events to update focus state */
  444. SDL_PumpEvents();
  445. SDLTest_AssertPass("SDL_PumpEvents()");
  446. /* Get focus with explicit window setup - focus deterministic */
  447. focusWindow = SDL_GetMouseFocus();
  448. SDLTest_AssertPass("SDL_GetMouseFocus()");
  449. SDLTest_AssertCheck (focusWindow != NULL, "Check returned window value is not NULL");
  450. SDLTest_AssertCheck (focusWindow == window, "Check returned window value is test window");
  451. /* Mouse to random position outside window */
  452. x = SDLTest_RandomIntegerInRange(-9, -1);
  453. y = SDLTest_RandomIntegerInRange(-9, -1);
  454. SDL_WarpMouseInWindow(window, x, y);
  455. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  456. /* Clean up test window */
  457. _destroyMouseSuiteTestWindow(window);
  458. /* Pump events to update focus state */
  459. SDL_PumpEvents();
  460. SDLTest_AssertPass("SDL_PumpEvents()");
  461. /* Get focus for non-existing window */
  462. focusWindow = SDL_GetMouseFocus();
  463. SDLTest_AssertPass("SDL_GetMouseFocus()");
  464. SDLTest_AssertCheck (focusWindow == NULL, "Check returned window value is NULL");
  465. return TEST_COMPLETED;
  466. }
  467. /* ================= Test References ================== */
  468. /* Mouse test cases */
  469. static const SDLTest_TestCaseReference mouseTest1 =
  470. { (SDLTest_TestCaseFp)mouse_getMouseState, "mouse_getMouseState", "Check call to SDL_GetMouseState", TEST_ENABLED };
  471. static const SDLTest_TestCaseReference mouseTest2 =
  472. { (SDLTest_TestCaseFp)mouse_getRelativeMouseState, "mouse_getRelativeMouseState", "Check call to SDL_GetRelativeMouseState", TEST_ENABLED };
  473. static const SDLTest_TestCaseReference mouseTest3 =
  474. { (SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_FreeCursor", TEST_ENABLED };
  475. static const SDLTest_TestCaseReference mouseTest4 =
  476. { (SDLTest_TestCaseFp)mouse_showCursor, "mouse_showCursor", "Check call to SDL_ShowCursor", TEST_ENABLED };
  477. static const SDLTest_TestCaseReference mouseTest5 =
  478. { (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED };
  479. static const SDLTest_TestCaseReference mouseTest6 =
  480. { (SDLTest_TestCaseFp)mouse_getCursor, "mouse_getCursor", "Check call to SDL_GetCursor", TEST_ENABLED };
  481. static const SDLTest_TestCaseReference mouseTest7 =
  482. { (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED };
  483. static const SDLTest_TestCaseReference mouseTest8 =
  484. { (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED };
  485. static const SDLTest_TestCaseReference mouseTest9 =
  486. { (SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_FreeCursor", TEST_ENABLED };
  487. static const SDLTest_TestCaseReference mouseTest10 =
  488. { (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode", TEST_ENABLED };
  489. /* Sequence of Mouse test cases */
  490. static const SDLTest_TestCaseReference *mouseTests[] = {
  491. &mouseTest1, &mouseTest2, &mouseTest3, &mouseTest4, &mouseTest5, &mouseTest6,
  492. &mouseTest7, &mouseTest8, &mouseTest9, &mouseTest10, NULL
  493. };
  494. /* Mouse test suite (global) */
  495. SDLTest_TestSuiteReference mouseTestSuite = {
  496. "Mouse",
  497. NULL,
  498. mouseTests,
  499. NULL
  500. };