🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

610 lines
20 KiB

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