testautomation_syswm.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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
  12. syswm_getWindowWMInfo(void *arg)
  13. {
  14. int result;
  15. SDL_Window *window;
  16. SDL_SysWMinfo info;
  17. window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
  18. SDLTest_AssertPass("Call to SDL_CreateWindow()");
  19. SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
  20. if (window == NULL) {
  21. return TEST_ABORTED;
  22. }
  23. /* Make call */
  24. result = SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION);
  25. SDLTest_AssertPass("Call to SDL_GetWindowWMInfo()");
  26. SDLTest_Log((result == 0) ? "Got window information" : "Couldn't get window information");
  27. SDL_DestroyWindow(window);
  28. SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  29. return TEST_COMPLETED;
  30. }
  31. /* ================= Test References ================== */
  32. /* SysWM test cases */
  33. static const SDLTest_TestCaseReference syswmTest1 =
  34. { (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
  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. };
  46. /* vi: set ts=4 sw=4 expandtab: */