testautomation_syswm.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. int 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. /* Make call */
  25. result = SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION);
  26. SDLTest_AssertPass("Call to SDL_GetWindowWMInfo()");
  27. SDLTest_Log((result == 0) ? "Got window information" : "Couldn't get window information");
  28. SDL_DestroyWindow(window);
  29. SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  30. return TEST_COMPLETED;
  31. }
  32. /* ================= Test References ================== */
  33. /* SysWM test cases */
  34. static const SDLTest_TestCaseReference syswmTest1 =
  35. { (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
  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. };