testautomation_syswm.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * SysWM test suite
  3. */
  4. #include <SDL3/SDL.h>
  5. #include <SDL3/SDL_syswm.h>
  6. #include <SDL3/SDL_test.h>
  7. #include "testautomation_suites.h"
  8. /* Test case functions */
  9. /**
  10. * \brief Call to SDL_GetWindowWMInfo
  11. */
  12. static int syswm_getWindowWMInfo(void *arg)
  13. {
  14. int result;
  15. SDL_Window *window;
  16. SDL_SysWMinfo info;
  17. window = SDL_CreateWindow("", 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. };
  36. /* Sequence of SysWM test cases */
  37. static const SDLTest_TestCaseReference *syswmTests[] = {
  38. &syswmTest1, NULL
  39. };
  40. /* SysWM test suite (global) */
  41. SDLTest_TestSuiteReference syswmTestSuite = {
  42. "SysWM",
  43. NULL,
  44. syswmTests,
  45. NULL
  46. };