testautomation_syswm.c 1.4 KB

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