testautomation_syswm.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * SysWM test suite
  3. */
  4. /* Avoid inclusion of e.g. X11 headers when these are not installed */
  5. #include <build_config/SDL_build_config.h>
  6. #include <SDL3/SDL.h>
  7. #include <SDL3/SDL_syswm.h>
  8. #include <SDL3/SDL_test.h>
  9. #include "testautomation_suites.h"
  10. /* Test case functions */
  11. /**
  12. * \brief Call to SDL_GetWindowWMInfo
  13. */
  14. static int syswm_getWindowWMInfo(void *arg)
  15. {
  16. int result;
  17. SDL_Window *window;
  18. SDL_SysWMinfo info;
  19. window = SDL_CreateWindow("", 0, 0, SDL_WINDOW_HIDDEN);
  20. SDLTest_AssertPass("Call to SDL_CreateWindow()");
  21. SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
  22. if (window == NULL) {
  23. return TEST_ABORTED;
  24. }
  25. /* Make call */
  26. result = SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION);
  27. SDLTest_AssertPass("Call to SDL_GetWindowWMInfo()");
  28. SDLTest_Log((result == 0) ? "Got window information" : "Couldn't get window information");
  29. SDL_DestroyWindow(window);
  30. SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  31. return TEST_COMPLETED;
  32. }
  33. /* ================= Test References ================== */
  34. /* SysWM test cases */
  35. static const SDLTest_TestCaseReference syswmTest1 = {
  36. (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED
  37. };
  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. };