testautomation_mouse.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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) {
  204. return TEST_ABORTED;
  205. }
  206. /* Create a color cursor from surface */
  207. cursor = SDL_CreateColorCursor(face, 0, 0);
  208. SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
  209. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
  210. if (cursor == NULL) {
  211. SDL_FreeSurface(face);
  212. return TEST_ABORTED;
  213. }
  214. /* Free cursor again */
  215. SDL_FreeCursor(cursor);
  216. SDLTest_AssertPass("Call to SDL_FreeCursor()");
  217. /* Clean up */
  218. SDL_FreeSurface(face);
  219. return TEST_COMPLETED;
  220. }
  221. /* Helper that changes cursor visibility */
  222. void _changeCursorVisibility(int state)
  223. {
  224. int oldState;
  225. int newState;
  226. int result;
  227. oldState = SDL_ShowCursor(SDL_QUERY);
  228. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  229. result = SDL_ShowCursor(state);
  230. SDLTest_AssertPass("Call to SDL_ShowCursor(%s)", (state == SDL_ENABLE) ? "SDL_ENABLE" : "SDL_DISABLE");
  231. SDLTest_AssertCheck(result == oldState, "Validate result from SDL_ShowCursor(%s), expected: %i, got: %i",
  232. (state == SDL_ENABLE) ? "SDL_ENABLE" : "SDL_DISABLE", oldState, result);
  233. newState = SDL_ShowCursor(SDL_QUERY);
  234. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  235. SDLTest_AssertCheck(state == newState, "Validate new state, expected: %i, got: %i",
  236. state, newState);
  237. }
  238. /**
  239. * @brief Check call to SDL_ShowCursor
  240. *
  241. * @sa http://wiki.libsdl.org/SDL_ShowCursor
  242. */
  243. int
  244. mouse_showCursor(void *arg)
  245. {
  246. int currentState;
  247. /* Get current state */
  248. currentState = SDL_ShowCursor(SDL_QUERY);
  249. SDLTest_AssertPass("Call to SDL_ShowCursor(SDL_QUERY)");
  250. SDLTest_AssertCheck(currentState == SDL_DISABLE || currentState == SDL_ENABLE,
  251. "Validate result is %i or %i, got: %i", SDL_DISABLE, SDL_ENABLE, currentState);
  252. if (currentState == SDL_DISABLE) {
  253. /* Show the cursor, then hide it again */
  254. _changeCursorVisibility(SDL_ENABLE);
  255. _changeCursorVisibility(SDL_DISABLE);
  256. } else if (currentState == SDL_ENABLE) {
  257. /* Hide the cursor, then show it again */
  258. _changeCursorVisibility(SDL_DISABLE);
  259. _changeCursorVisibility(SDL_ENABLE);
  260. } else {
  261. return TEST_ABORTED;
  262. }
  263. return TEST_COMPLETED;
  264. }
  265. /**
  266. * @brief Check call to SDL_SetCursor
  267. *
  268. * @sa http://wiki.libsdl.org/SDL_SetCursor
  269. */
  270. int
  271. mouse_setCursor(void *arg)
  272. {
  273. SDL_Cursor *cursor;
  274. /* Create a cursor */
  275. cursor = _initArrowCursor(_mouseArrowData);
  276. SDLTest_AssertPass("Call to SDL_CreateCursor()");
  277. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateCursor() is not NULL");
  278. if (cursor == NULL) {
  279. return TEST_ABORTED;
  280. }
  281. /* Set the arrow cursor */
  282. SDL_SetCursor(cursor);
  283. SDLTest_AssertPass("Call to SDL_SetCursor(cursor)");
  284. /* Force redraw */
  285. SDL_SetCursor(NULL);
  286. SDLTest_AssertPass("Call to SDL_SetCursor(NULL)");
  287. /* Free cursor again */
  288. SDL_FreeCursor(cursor);
  289. SDLTest_AssertPass("Call to SDL_FreeCursor()");
  290. return TEST_COMPLETED;
  291. }
  292. /**
  293. * @brief Check call to SDL_GetCursor
  294. *
  295. * @sa http://wiki.libsdl.org/SDL_GetCursor
  296. */
  297. int
  298. mouse_getCursor(void *arg)
  299. {
  300. SDL_Cursor *cursor;
  301. /* Get current cursor */
  302. cursor = SDL_GetCursor();
  303. SDLTest_AssertPass("Call to SDL_GetCursor()");
  304. SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_GetCursor() is not NULL");
  305. return TEST_COMPLETED;
  306. }
  307. /**
  308. * @brief Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode
  309. *
  310. * @sa http://wiki.libsdl.org/SDL_GetRelativeMouseMode
  311. * @sa http://wiki.libsdl.org/SDL_SetRelativeMouseMode
  312. */
  313. int
  314. mouse_getSetRelativeMouseMode(void *arg)
  315. {
  316. int result;
  317. int i;
  318. SDL_bool initialState;
  319. SDL_bool currentState;
  320. /* Capture original state so we can revert back to it later */
  321. initialState = SDL_GetRelativeMouseMode();
  322. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  323. /* Repeat twice to check D->D transition */
  324. for (i=0; i<2; i++) {
  325. /* Disable - should always be supported */
  326. result = SDL_SetRelativeMouseMode(SDL_FALSE);
  327. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
  328. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  329. currentState = SDL_GetRelativeMouseMode();
  330. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  331. SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
  332. }
  333. /* Repeat twice to check D->E->E transition */
  334. for (i=0; i<2; i++) {
  335. /* Enable - may not be supported */
  336. result = SDL_SetRelativeMouseMode(SDL_TRUE);
  337. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(TRUE)");
  338. if (result != -1) {
  339. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  340. currentState = SDL_GetRelativeMouseMode();
  341. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  342. SDLTest_AssertCheck(currentState == SDL_TRUE, "Validate current state is TRUE, got: %i", currentState);
  343. }
  344. }
  345. /* Disable to check E->D transition */
  346. result = SDL_SetRelativeMouseMode(SDL_FALSE);
  347. SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
  348. SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
  349. currentState = SDL_GetRelativeMouseMode();
  350. SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
  351. SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
  352. /* Revert to original state - ignore result */
  353. result = SDL_SetRelativeMouseMode(initialState);
  354. return TEST_COMPLETED;
  355. }
  356. #define MOUSE_TESTWINDOW_WIDTH 320
  357. #define MOUSE_TESTWINDOW_HEIGHT 200
  358. /**
  359. * Creates a test window
  360. */
  361. SDL_Window *_createMouseSuiteTestWindow()
  362. {
  363. int posX = 100, posY = 100, width = MOUSE_TESTWINDOW_WIDTH, height = MOUSE_TESTWINDOW_HEIGHT;
  364. SDL_Window *window;
  365. window = SDL_CreateWindow("mouse_createMouseSuiteTestWindow", posX, posY, width, height, 0);
  366. SDLTest_AssertPass("SDL_CreateWindow()");
  367. SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
  368. return window;
  369. }
  370. /*
  371. * Destroy test window
  372. */
  373. void _destroyMouseSuiteTestWindow(SDL_Window *window)
  374. {
  375. if (window != NULL) {
  376. SDL_DestroyWindow(window);
  377. window = NULL;
  378. SDLTest_AssertPass("SDL_DestroyWindow()");
  379. }
  380. }
  381. /**
  382. * @brief Check call to SDL_WarpMouseInWindow
  383. *
  384. * @sa http://wiki.libsdl.org/SDL_WarpMouseInWindow
  385. */
  386. int
  387. mouse_warpMouseInWindow(void *arg)
  388. {
  389. const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
  390. int numPositions = 6;
  391. int xPositions[6];
  392. int yPositions[6];
  393. int x, y, i, j;
  394. SDL_Window *window;
  395. xPositions[0] = -1;
  396. xPositions[1] = 0;
  397. xPositions[2] = 1;
  398. xPositions[3] = w-1;
  399. xPositions[4] = w;
  400. xPositions[5] = w+1;
  401. yPositions[0] = -1;
  402. yPositions[1] = 0;
  403. yPositions[2] = 1;
  404. yPositions[3] = h-1;
  405. yPositions[4] = h;
  406. yPositions[5] = h+1;
  407. /* Create test window */
  408. window = _createMouseSuiteTestWindow();
  409. if (window == NULL) {
  410. return TEST_ABORTED;
  411. }
  412. /* Mouse to random position inside window */
  413. x = SDLTest_RandomIntegerInRange(1, w-1);
  414. y = SDLTest_RandomIntegerInRange(1, h-1);
  415. SDL_WarpMouseInWindow(window, x, y);
  416. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  417. /* Same position again */
  418. SDL_WarpMouseInWindow(window, x, y);
  419. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  420. /* Mouse to various boundary positions */
  421. for (i=0; i<numPositions; i++) {
  422. for (j=0; j<numPositions; j++) {
  423. x = xPositions[i];
  424. y = yPositions[j];
  425. SDL_WarpMouseInWindow(window, x, y);
  426. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  427. /* TODO: add tracking of events and check that each call generates a mouse motion event */
  428. SDL_PumpEvents();
  429. SDLTest_AssertPass("SDL_PumpEvents()");
  430. }
  431. }
  432. /* Clean up test window */
  433. _destroyMouseSuiteTestWindow(window);
  434. return TEST_COMPLETED;
  435. }
  436. /**
  437. * @brief Check call to SDL_GetMouseFocus
  438. *
  439. * @sa http://wiki.libsdl.org/SDL_GetMouseFocus
  440. */
  441. int
  442. mouse_getMouseFocus(void *arg)
  443. {
  444. const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
  445. int x, y;
  446. SDL_Window *window;
  447. SDL_Window *focusWindow;
  448. /* Get focus - focus non-deterministic */
  449. focusWindow = SDL_GetMouseFocus();
  450. SDLTest_AssertPass("SDL_GetMouseFocus()");
  451. /* Create test window */
  452. window = _createMouseSuiteTestWindow();
  453. if (window == NULL) {
  454. return TEST_ABORTED;
  455. }
  456. /* Mouse to random position inside window */
  457. x = SDLTest_RandomIntegerInRange(1, w-1);
  458. y = SDLTest_RandomIntegerInRange(1, h-1);
  459. SDL_WarpMouseInWindow(window, x, y);
  460. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  461. /* Pump events to update focus state */
  462. SDL_Delay(100);
  463. SDL_PumpEvents();
  464. SDLTest_AssertPass("SDL_PumpEvents()");
  465. /* Get focus with explicit window setup - focus deterministic */
  466. focusWindow = SDL_GetMouseFocus();
  467. SDLTest_AssertPass("SDL_GetMouseFocus()");
  468. SDLTest_AssertCheck (focusWindow != NULL, "Check returned window value is not NULL");
  469. SDLTest_AssertCheck (focusWindow == window, "Check returned window value is test window");
  470. /* Mouse to random position outside window */
  471. x = SDLTest_RandomIntegerInRange(-9, -1);
  472. y = SDLTest_RandomIntegerInRange(-9, -1);
  473. SDL_WarpMouseInWindow(window, x, y);
  474. SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y);
  475. /* Clean up test window */
  476. _destroyMouseSuiteTestWindow(window);
  477. /* Pump events to update focus state */
  478. SDL_PumpEvents();
  479. SDLTest_AssertPass("SDL_PumpEvents()");
  480. /* Get focus for non-existing window */
  481. focusWindow = SDL_GetMouseFocus();
  482. SDLTest_AssertPass("SDL_GetMouseFocus()");
  483. SDLTest_AssertCheck (focusWindow == NULL, "Check returned window value is NULL");
  484. return TEST_COMPLETED;
  485. }
  486. /* ================= Test References ================== */
  487. /* Mouse test cases */
  488. static const SDLTest_TestCaseReference mouseTest1 =
  489. { (SDLTest_TestCaseFp)mouse_getMouseState, "mouse_getMouseState", "Check call to SDL_GetMouseState", TEST_ENABLED };
  490. static const SDLTest_TestCaseReference mouseTest2 =
  491. { (SDLTest_TestCaseFp)mouse_getRelativeMouseState, "mouse_getRelativeMouseState", "Check call to SDL_GetRelativeMouseState", TEST_ENABLED };
  492. static const SDLTest_TestCaseReference mouseTest3 =
  493. { (SDLTest_TestCaseFp)mouse_createFreeCursor, "mouse_createFreeCursor", "Check call to SDL_CreateCursor and SDL_FreeCursor", TEST_ENABLED };
  494. static const SDLTest_TestCaseReference mouseTest4 =
  495. { (SDLTest_TestCaseFp)mouse_showCursor, "mouse_showCursor", "Check call to SDL_ShowCursor", TEST_ENABLED };
  496. static const SDLTest_TestCaseReference mouseTest5 =
  497. { (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED };
  498. static const SDLTest_TestCaseReference mouseTest6 =
  499. { (SDLTest_TestCaseFp)mouse_getCursor, "mouse_getCursor", "Check call to SDL_GetCursor", TEST_ENABLED };
  500. static const SDLTest_TestCaseReference mouseTest7 =
  501. { (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED };
  502. static const SDLTest_TestCaseReference mouseTest8 =
  503. { (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED };
  504. static const SDLTest_TestCaseReference mouseTest9 =
  505. { (SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_FreeCursor", TEST_ENABLED };
  506. static const SDLTest_TestCaseReference mouseTest10 =
  507. { (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode", TEST_ENABLED };
  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. };