testautomation_syswm.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * SysWM test suite
  3. */
  4. #include <stdio.h>
  5. #include "SDL.h"
  6. #include "SDL_syswm.h"
  7. #include "SDL_test.h"
  8. /* Test case functions */
  9. /**
  10. * @brief Call to SDL_GetWindowWMInfo
  11. */
  12. int
  13. syswm_getWindowWMInfo(void *arg)
  14. {
  15. SDL_bool result;
  16. SDL_Window *window;
  17. SDL_SysWMinfo info;
  18. window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
  19. SDLTest_AssertPass("Call to SDL_CreateWindow()");
  20. SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
  21. if (window == NULL) {
  22. return TEST_ABORTED;
  23. }
  24. /* Initialize info structure with SDL version info */
  25. SDL_VERSION(&info.version);
  26. /* Make call */
  27. result = SDL_GetWindowWMInfo(window, &info);
  28. SDLTest_AssertPass("Call to SDL_GetWindowWMInfo");
  29. SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information");
  30. SDL_DestroyWindow(window);
  31. SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  32. return TEST_COMPLETED;
  33. }
  34. /* ================= Test References ================== */
  35. /* SysWM test cases */
  36. static const SDLTest_TestCaseReference syswmTest1 =
  37. { (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
  38. /* Sequence of SysWM test cases */
  39. static const SDLTest_TestCaseReference *syswmTests[] = {
  40. &syswmTest1, NULL
  41. };
  42. /* SysWM test suite (global) */
  43. SDLTest_TestSuiteReference syswmTestSuite = {
  44. "SysWM",
  45. NULL,
  46. syswmTests,
  47. NULL
  48. };