test/testautomation_syswm.c
changeset 6800 26c6795ec1a4
child 7191 75360622e65f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/testautomation_syswm.c	Sun Jan 06 15:17:59 2013 -0800
     1.3 @@ -0,0 +1,61 @@
     1.4 +/**
     1.5 + * SysWM test suite
     1.6 + */
     1.7 +
     1.8 +#include <stdio.h>
     1.9 +
    1.10 +#include "SDL.h"
    1.11 +#include "SDL_syswm.h"
    1.12 +#include "SDL_test.h"
    1.13 +
    1.14 +/* Test case functions */
    1.15 +
    1.16 +/**
    1.17 + * @brief Call to SDL_GetWindowWMInfo
    1.18 + */
    1.19 +int
    1.20 +syswm_getWindowWMInfo(void *arg)
    1.21 +{
    1.22 +  SDL_bool result;
    1.23 +  SDL_Window *window; 
    1.24 +  SDL_SysWMinfo info;
    1.25 +  
    1.26 +  window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
    1.27 +  SDLTest_AssertPass("Call to SDL_CreateWindow()");
    1.28 +  SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
    1.29 +  if (window == NULL) {
    1.30 +     return TEST_ABORTED;
    1.31 +  }
    1.32 +  
    1.33 +  /* Initialize info structure with SDL version info */
    1.34 +  SDL_VERSION(&info.version); 
    1.35 +  
    1.36 +  /* Make call */
    1.37 +  result = SDL_GetWindowWMInfo(window, &info);
    1.38 +  SDLTest_AssertPass("Call to SDL_GetWindowWMInfo");
    1.39 +  SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information");
    1.40 +                                                                                                      		
    1.41 +  SDL_DestroyWindow(window);
    1.42 +  SDLTest_AssertPass("Call to SDL_DestroyWindow()");
    1.43 +  
    1.44 +  return TEST_COMPLETED;
    1.45 +}
    1.46 +
    1.47 +/* ================= Test References ================== */
    1.48 +
    1.49 +/* SysWM test cases */
    1.50 +static const SDLTest_TestCaseReference syswmTest1 =
    1.51 +		{ (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
    1.52 +
    1.53 +/* Sequence of SysWM test cases */
    1.54 +static const SDLTest_TestCaseReference *syswmTests[] =  {
    1.55 +	&syswmTest1, NULL
    1.56 +};
    1.57 +
    1.58 +/* SysWM test suite (global) */
    1.59 +SDLTest_TestSuiteReference syswmTestSuite = {
    1.60 +	"SysWM",
    1.61 +	NULL,
    1.62 +	syswmTests,
    1.63 +	NULL
    1.64 +};