🛠️🐜 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.

607 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
  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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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: %" SDL_PRIu32, 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/SDL_CreateCursor
  171. * @sa http://wiki.libsdl.org/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/SDL_CreateColorCursor
  193. * @sa http://wiki.libsdl.org/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/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/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/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/SDL_GetRelativeMouseMode
  309. * @sa http://wiki.libsdl.org/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/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[6];
  390. int yPositions[6];
  391. int x, y, i, j;
  392. SDL_Window *window;
  393. xPositions[0] = -1;
  394. xPositions[1] = 0;
  395. xPositions[2] = 1;
  396. xPositions[3] = w-1;
  397. xPositions[4] = w;
  398. xPositions[5] = w+1;
  399. yPositions[0] = -1;
  400. yPositions[1] = 0;
  401. yPositions[2] = 1;
  402. yPositions[3] = h-1;
  403. yPositions[4] = h;
  404. yPositions[5] = h+1;
  405. /* Create test window */
  406. window = _createMouseSuiteTestWindow();
  407. if (window == NULL) return TEST_ABORTED;
  408. /* Mouse to random position inside window */
  409. x = SDLTest_RandomIntegerInRange(1, w-1);
  410. y = SDLTest_RandomIntegerInRange(1, h-1);
  411. SDL_WarpMouseInWindow(window, x, y);
  412. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  413. /* Same position again */
  414. SDL_WarpMouseInWindow(window, x, y);
  415. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  416. /* Mouse to various boundary positions */
  417. for (i=0; i<numPositions; i++) {
  418. for (j=0; j<numPositions; j++) {
  419. x = xPositions[i];
  420. y = yPositions[j];
  421. SDL_WarpMouseInWindow(window, x, y);
  422. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  423. /* TODO: add tracking of events and check that each call generates a mouse motion event */
  424. SDL_PumpEvents();
  425. SDLTest_AssertPass("SDL_PumpEvents()");
  426. }
  427. }
  428. /* Clean up test window */
  429. _destroyMouseSuiteTestWindow(window);
  430. return TEST_COMPLETED;
  431. }
  432. /**
  433. * @brief Check call to SDL_GetMouseFocus
  434. *
  435. * @sa http://wiki.libsdl.org/SDL_GetMouseFocus
  436. */
  437. int
  438. mouse_getMouseFocus(void *arg)
  439. {
  440. const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
  441. int x, y;
  442. SDL_Window *window;
  443. SDL_Window *focusWindow;
  444. /* Get focus - focus non-deterministic */
  445. focusWindow = SDL_GetMouseFocus();
  446. SDLTest_AssertPass("SDL_GetMouseFocus()");
  447. /* Create test window */
  448. window = _createMouseSuiteTestWindow();
  449. if (window == NULL) return TEST_ABORTED;
  450. /* Mouse to random position inside window */
  451. x = SDLTest_RandomIntegerInRange(1, w-1);
  452. y = SDLTest_RandomIntegerInRange(1, h-1);
  453. SDL_WarpMouseInWindow(window, x, y);
  454. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  455. /* Pump events to update focus state */
  456. SDL_Delay(100);
  457. SDL_PumpEvents();
  458. SDLTest_AssertPass("SDL_PumpEvents()");
  459. /* Get focus with explicit window setup - focus deterministic */
  460. focusWindow = SDL_GetMouseFocus();
  461. SDLTest_AssertPass("SDL_GetMouseFocus()");
  462. SDLTest_AssertCheck (focusWindow != NULL, "Check returned window value is not NULL");
  463. SDLTest_AssertCheck (focusWindow == window, "Check returned window value is test window");
  464. /* Mouse to random position outside window */
  465. x = SDLTest_RandomIntegerInRange(-9, -1);
  466. y = SDLTest_RandomIntegerInRange(-9, -1);
  467. SDL_WarpMouseInWindow(window, x, y);
  468. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  469. /* Clean up test window */
  470. _destroyMouseSuiteTestWindow(window);
  471. /* Pump events to update focus state */
  472. SDL_PumpEvents();
  473. SDLTest_AssertPass("SDL_PumpEvents()");
  474. /* Get focus for non-existing window */
  475. focusWindow = SDL_GetMouseFocus();
  476. SDLTest_AssertPass("SDL_GetMouseFocus()");
  477. SDLTest_AssertCheck (focusWindow == NULL, "Check returned window value is NULL");
  478. return TEST_COMPLETED;
  479. }
  480. /* ================= Test References ================== */
  481. /* Mouse test cases */
  482. static const SDLTest_TestCaseReference mouseTest1 =
  483. { (SDLTest_TestCaseFp)mouse_getMouseState, "mouse_getMouseState", "Check call to SDL_GetMouseState", TEST_ENABLED };
  484. static const SDLTest_TestCaseReference mouseTest2 =
  485. { (SDLTest_TestCaseFp)mouse_getRelativeMouseState, "mouse_getRelativeMouseState", "Check call to SDL_GetRelativeMouseState", TEST_ENABLED };
  486. static const SDLTest_TestCaseReference mouseTest3 =
  487. { (SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_FreeCursor", TEST_ENABLED };
  488. static const SDLTest_TestCaseReference mouseTest4 =
  489. { (SDLTest_TestCaseFp)mouse_showCursor, "mouse_showCursor", "Check call to SDL_ShowCursor", TEST_ENABLED };
  490. static const SDLTest_TestCaseReference mouseTest5 =
  491. { (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED };
  492. static const SDLTest_TestCaseReference mouseTest6 =
  493. { (SDLTest_TestCaseFp)mouse_getCursor, "mouse_getCursor", "Check call to SDL_GetCursor", TEST_ENABLED };
  494. static const SDLTest_TestCaseReference mouseTest7 =
  495. { (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED };
  496. static const SDLTest_TestCaseReference mouseTest8 =
  497. { (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED };
  498. static const SDLTest_TestCaseReference mouseTest9 =
  499. { (SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_FreeCursor", TEST_ENABLED };
  500. static const SDLTest_TestCaseReference mouseTest10 =
  501. { (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode", TEST_ENABLED };
  502. /* Sequence of Mouse test cases */
  503. static const SDLTest_TestCaseReference *mouseTests[] = {
  504. &mouseTest1, &mouseTest2, &mouseTest3, &mouseTest4, &mouseTest5, &mouseTest6,
  505. &mouseTest7, &mouseTest8, &mouseTest9, &mouseTest10, NULL
  506. };
  507. /* Mouse test suite (global) */
  508. SDLTest_TestSuiteReference mouseTestSuite = {
  509. "Mouse",
  510. NULL,
  511. mouseTests,
  512. NULL
  513. };