test/testautomation_video.c
author Andreas Schiffler <aschiffler@ferzkopp.net>
Sun, 03 Mar 2013 17:22:51 -0800
changeset 6956 afdc35fa58e9
parent 6936 76d9c31e823d
child 6984 ae9c4b12f3e2
permissions -rw-r--r--
Fix behavior of SDL_GetWindowPosition for invalid input; add test cases to video suite
     1 /**
     2  * Video test suite
     3  */
     4 
     5 #include <stdio.h>
     6 
     7 /* Visual Studio 2008 doesn't have stdint.h */
     8 #if defined(_MSC_VER) && _MSC_VER <= 1500
     9 #define UINT8_MAX   ~(Uint8)0
    10 #define UINT16_MAX  ~(Uint16)0
    11 #define UINT32_MAX  ~(Uint32)0
    12 #define UINT64_MAX  ~(Uint64)0
    13 #else
    14 #include <stdint.h>
    15 #endif
    16 
    17 #include "SDL.h"
    18 #include "SDL_test.h"
    19 
    20 /* Private helpers */
    21 
    22 /* 
    23  * Create a test window
    24  */
    25 SDL_Window *_createVideoSuiteTestWindow(const char *title)
    26 {
    27   SDL_Window* window;
    28   int x, y, w, h;
    29   SDL_WindowFlags flags;
    30 
    31   /* Standard window */
    32   x = SDLTest_RandomIntegerInRange(1, 100);
    33   y = SDLTest_RandomIntegerInRange(1, 100);
    34   w = SDLTest_RandomIntegerInRange(320, 1024);
    35   h = SDLTest_RandomIntegerInRange(320, 768);
    36   flags = SDL_WINDOW_SHOWN;
    37   
    38   window = SDL_CreateWindow(title, x, y, w, h, flags);
    39   SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
    40   SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
    41 
    42   return window;
    43 }
    44 
    45 /*
    46  * Destroy test window  
    47  */
    48 void _destroyVideoSuiteTestWindow(SDL_Window *window)
    49 {
    50   if (window != NULL) {  
    51      SDL_DestroyWindow(window);
    52      window = NULL;
    53      SDLTest_AssertPass("Call to SDL_DestroyWindow");
    54   }
    55 }
    56 
    57 /* Test case functions */
    58 
    59 /**
    60  * @brief Enable and disable screensaver while checking state
    61  */
    62 int
    63 video_enableDisableScreensaver(void *arg)
    64 {
    65 	SDL_bool initialResult;
    66 	SDL_bool result;
    67 
    68 	/* Get current state and proceed according to current state */
    69 	initialResult = SDL_IsScreenSaverEnabled();
    70 	SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");	
    71 	if (initialResult == SDL_TRUE) {
    72 	
    73 	  /* Currently enabled: disable first, then enable again */
    74 	  
    75 	  /* Disable screensaver and check */	
    76 	  SDL_DisableScreenSaver();
    77 	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
    78 	  result = SDL_IsScreenSaverEnabled();
    79 	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    80 	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
    81 	
    82 	  /* Enable screensaver and check */	
    83 	  SDL_EnableScreenSaver();
    84 	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
    85 	  result = SDL_IsScreenSaverEnabled();
    86 	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    87 	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
    88 
    89 	} else {
    90 
    91 	  /* Currently disabled: enable first, then disable again */
    92 	  
    93 	  /* Enable screensaver and check */	
    94 	  SDL_EnableScreenSaver();
    95 	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
    96 	  result = SDL_IsScreenSaverEnabled();
    97 	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    98 	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
    99 
   100 	  /* Disable screensaver and check */	
   101 	  SDL_DisableScreenSaver();
   102 	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
   103 	  result = SDL_IsScreenSaverEnabled();
   104 	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
   105 	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);	
   106 	}	
   107 	
   108 	return TEST_COMPLETED;
   109 }
   110 
   111 /**
   112  * @brief Tests the functionality of the SDL_CreateWindow function using different positions
   113  */
   114 int
   115 video_createWindowVariousPositions(void *arg)
   116 {
   117   SDL_Window* window;
   118   const char* title = "video_createWindowVariousPositions Test Window";
   119   int x, y, w, h;
   120   int xVariation, yVariation;
   121   
   122   for (xVariation = 0; xVariation < 6; xVariation++) {
   123    for (yVariation = 0; yVariation < 6; yVariation++) {
   124     switch(xVariation) {
   125      case 0:
   126       /* Zero X Position */  
   127       x = 0;
   128       break;
   129      case 1:
   130       /* Random X position inside screen */  
   131       x = SDLTest_RandomIntegerInRange(1, 100);
   132       break;
   133      case 2:
   134       /* Random X position outside screen (positive) */  
   135       x = SDLTest_RandomIntegerInRange(10000, 11000);
   136       break;
   137      case 3:
   138       /* Random X position outside screen (negative) */  
   139       x = SDLTest_RandomIntegerInRange(-1000, -100);
   140       break;
   141      case 4:
   142       /* Centered X position */  
   143       x = SDL_WINDOWPOS_CENTERED;
   144       break;
   145      case 5:
   146       /* Undefined X position */  
   147       x = SDL_WINDOWPOS_UNDEFINED;
   148       break;
   149     }
   150 
   151     switch(yVariation) {
   152      case 0:
   153       /* Zero X Position */  
   154       y = 0;
   155       break;
   156      case 1:
   157       /* Random X position inside screen */  
   158       y = SDLTest_RandomIntegerInRange(1, 100);
   159       break;
   160      case 2:
   161       /* Random X position outside screen (positive) */  
   162       y = SDLTest_RandomIntegerInRange(10000, 11000);
   163       break;
   164      case 3:
   165       /* Random Y position outside screen (negative) */  
   166       y = SDLTest_RandomIntegerInRange(-1000, -100);
   167       break;
   168      case 4:
   169       /* Centered Y position */  
   170       y = SDL_WINDOWPOS_CENTERED;
   171       break;
   172      case 5:
   173       /* Undefined Y position */  
   174       y = SDL_WINDOWPOS_UNDEFINED;
   175       break;
   176     }
   177      
   178     w = SDLTest_RandomIntegerInRange(32, 96);
   179     h = SDLTest_RandomIntegerInRange(32, 96);
   180     window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
   181     SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
   182     SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
   183 
   184     /* Clean up */    
   185     _destroyVideoSuiteTestWindow(window);
   186    }
   187   } 
   188 
   189   return TEST_COMPLETED;
   190 }
   191 
   192 /**
   193  * @brief Tests the functionality of the SDL_CreateWindow function using different sizes
   194  */
   195 int
   196 video_createWindowVariousSizes(void *arg)
   197 {
   198   SDL_Window* window;
   199   const char* title = "video_createWindowVariousSizes Test Window";
   200   int x, y, w, h;
   201   int wVariation, hVariation;
   202   
   203   x = SDLTest_RandomIntegerInRange(1, 100);
   204   y = SDLTest_RandomIntegerInRange(1, 100);
   205   for (wVariation = 0; wVariation < 3; wVariation++) {
   206    for (hVariation = 0; hVariation < 3; hVariation++) {
   207     switch(wVariation) {
   208      case 0:
   209       /* Width of 1 */  
   210       w = 1;
   211       break;
   212      case 1:
   213       /* Random "normal" width */  
   214       w = SDLTest_RandomIntegerInRange(320, 1920);
   215       break;
   216      case 2:
   217       /* Random "large" width */  
   218       w = SDLTest_RandomIntegerInRange(2048, 4095);
   219       break;
   220     }
   221 
   222     switch(hVariation) {
   223      case 0:
   224       /* Height of 1 */  
   225       h = 1;
   226       break;
   227      case 1:
   228       /* Random "normal" height */  
   229       h = SDLTest_RandomIntegerInRange(320, 1080);
   230       break;
   231      case 2:
   232       /* Random "large" height */  
   233       h = SDLTest_RandomIntegerInRange(2048, 4095);
   234       break;
   235      }
   236      
   237     window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN);
   238     SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
   239     SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
   240 
   241     /* Clean up */    
   242     _destroyVideoSuiteTestWindow(window);
   243    }
   244   }  
   245 
   246   return TEST_COMPLETED;
   247 }
   248 
   249 /**
   250  * @brief Tests the functionality of the SDL_CreateWindow function using different flags
   251  */
   252 int
   253 video_createWindowVariousFlags(void *arg)
   254 {
   255   SDL_Window* window;
   256   const char* title = "video_createWindowVariousFlags Test Window";
   257   int x, y, w, h;
   258   int fVariation;
   259   SDL_WindowFlags flags;
   260   
   261   /* Standard window */
   262   x = SDLTest_RandomIntegerInRange(1, 100);
   263   y = SDLTest_RandomIntegerInRange(1, 100);
   264   w = SDLTest_RandomIntegerInRange(320, 1024);
   265   h = SDLTest_RandomIntegerInRange(320, 768);
   266 
   267   for (fVariation = 0; fVariation < 13; fVariation++) {
   268     switch(fVariation) {
   269      case 0:
   270       flags = SDL_WINDOW_FULLSCREEN;
   271       /* Skip - blanks screen; comment out next line to run test */
   272       continue;   
   273       break;
   274      case 1:
   275       flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
   276       /* Skip - blanks screen; comment out next line to run test */
   277       continue;  
   278       break;
   279      case 2:
   280       flags = SDL_WINDOW_OPENGL;
   281       break;  
   282      case 3:
   283       flags = SDL_WINDOW_SHOWN;
   284       break;   
   285      case 4:    
   286       flags = SDL_WINDOW_HIDDEN;
   287       break;     
   288      case 5:
   289       flags = SDL_WINDOW_BORDERLESS;
   290       break;       
   291      case 6:
   292       flags = SDL_WINDOW_RESIZABLE;
   293       break;         
   294      case 7:
   295       flags = SDL_WINDOW_MINIMIZED;
   296       break;           
   297      case 8:
   298       flags = SDL_WINDOW_MAXIMIZED;
   299       break;
   300      case 9: 
   301       flags = SDL_WINDOW_INPUT_GRABBED;
   302       break;
   303      case 10:              
   304       flags = SDL_WINDOW_INPUT_FOCUS;
   305       break;                 
   306      case 11:                      
   307       flags = SDL_WINDOW_MOUSE_FOCUS;
   308       break;
   309      case 12: 
   310       flags = SDL_WINDOW_FOREIGN;
   311       break;
   312     }
   313        
   314     window = SDL_CreateWindow(title, x, y, w, h, flags);
   315     SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
   316     SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
   317 
   318 
   319     /* Clean up */    
   320     _destroyVideoSuiteTestWindow(window);  
   321   }
   322 
   323   return TEST_COMPLETED;
   324 }
   325 
   326 
   327 /**
   328  * @brief Tests the functionality of the SDL_GetWindowFlags function
   329  */
   330 int
   331 video_getWindowFlags(void *arg)
   332 {
   333   SDL_Window* window;
   334   const char* title = "video_getWindowFlags Test Window";
   335   SDL_WindowFlags flags;
   336   Uint32 actualFlags;
   337   
   338   /* Reliable flag set always set in test window */
   339   flags = SDL_WINDOW_SHOWN;
   340   
   341   /* Call against new test window */ 
   342   window = _createVideoSuiteTestWindow(title);
   343   if (window != NULL) {
   344       actualFlags = SDL_GetWindowFlags(window);
   345       SDLTest_AssertPass("Call to SDL_GetWindowFlags");
   346       SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags);
   347   }
   348 
   349   /* Clean up */    
   350   _destroyVideoSuiteTestWindow(window);
   351   
   352   return TEST_COMPLETED;
   353 }
   354 
   355 /**
   356  * @brief Tests the functionality of the SDL_GetNumDisplayModes function
   357  */
   358 int
   359 video_getNumDisplayModes(void *arg)
   360 {
   361   int result;
   362   int displayNum;
   363   int i;
   364 
   365   /* Get number of displays */
   366   displayNum = SDL_GetNumVideoDisplays();
   367   SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
   368 
   369   /* Make call for each display */  
   370   for (i=0; i<displayNum; i++) {
   371     result = SDL_GetNumDisplayModes(i);
   372     SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d)", i);
   373     SDLTest_AssertCheck(result >= 1, "Validate returned value from function; expected: >=1; got: %d", result);
   374   }
   375 
   376   return TEST_COMPLETED;
   377 }
   378 
   379 /**
   380  * @brief Tests negative call to SDL_GetNumDisplayModes function
   381  */
   382 int
   383 video_getNumDisplayModesNegative(void *arg)
   384 {
   385   int result;
   386   int displayNum;
   387   int displayIndex;
   388 
   389   /* Get number of displays */
   390   displayNum = SDL_GetNumVideoDisplays();
   391   SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
   392 
   393   /* Invalid boundary values */
   394   displayIndex =  SDLTest_RandomSint32BoundaryValue(0, displayNum, SDL_FALSE);
   395   result = SDL_GetNumDisplayModes(displayIndex);
   396   SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/boundary)", displayIndex);
   397   SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
   398   
   399   /* Large (out-of-bounds) display index */
   400   displayIndex = SDLTest_RandomIntegerInRange(-2000, -1000);
   401   result = SDL_GetNumDisplayModes(displayIndex);
   402   SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large negative)", displayIndex);
   403   SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
   404 
   405   displayIndex = SDLTest_RandomIntegerInRange(1000, 2000);
   406   result = SDL_GetNumDisplayModes(displayIndex);
   407   SDLTest_AssertPass("Call to SDL_GetNumDisplayModes(%d=out-of-bounds/large positive)", displayIndex);
   408   SDLTest_AssertCheck(result < 0, "Validate returned value from function; expected: <0; got: %d", result);  
   409 
   410   return TEST_COMPLETED;
   411 }
   412 
   413 /**
   414  * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against current resolution
   415  */
   416 int
   417 video_getClosestDisplayModeCurrentResolution(void *arg)
   418 {
   419   int result;
   420   SDL_DisplayMode current; 
   421   SDL_DisplayMode target; 
   422   SDL_DisplayMode closest;
   423   SDL_DisplayMode* dResult;
   424   int displayNum;
   425   int i;
   426   int variation;
   427 
   428   /* Get number of displays */
   429   displayNum = SDL_GetNumVideoDisplays();
   430   SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
   431 
   432   /* Make calls for each display */  
   433   for (i=0; i<displayNum; i++) {
   434     SDLTest_Log("Testing against display: %d", i);
   435   
   436     /* Get first display mode to get a sane resolution; this should always work */
   437     result = SDL_GetDisplayMode(i, 0, &current);
   438     SDLTest_AssertPass("Call to SDL_GetDisplayMode");
   439     SDLTest_AssertCheck(result == 0, "Verify return value, expected: 0, got: %d", result);
   440     if (result != 0) {
   441       return TEST_ABORTED;
   442     }
   443        
   444     /* Set the desired resolution equals to current resolution */
   445     target.w = current.w;
   446     target.h = current.h;    
   447     for (variation = 0; variation < 8; variation ++) {
   448       /* Vary constraints on other query parameters */
   449       target.format = (variation & 1) ? current.format : 0;
   450       target.refresh_rate = (variation & 2) ? current.refresh_rate : 0;
   451       target.driverdata = (variation & 4) ? current.driverdata : 0;
   452           
   453       /* Make call */
   454       dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
   455       SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=current/variation%d)", variation);
   456       SDLTest_AssertCheck(dResult != NULL, "Verify returned value is not NULL");
   457     
   458       /* Check that one gets the current resolution back again */
   459       SDLTest_AssertCheck(closest.w == current.w, "Verify returned width matches current width; expected: %d, got: %d", current.w, closest.w);
   460       SDLTest_AssertCheck(closest.h == current.h, "Verify returned height matches current height; expected: %d, got: %d", current.h, closest.h);
   461       SDLTest_AssertCheck(closest.w == dResult->w, "Verify return value matches assigned value; expected: %d, got: %d", closest.w, dResult->w);
   462       SDLTest_AssertCheck(closest.h == dResult->h, "Verify return value matches assigned value; expected: %d, got: %d", closest.h, dResult->h);
   463     }
   464   }
   465 
   466   return TEST_COMPLETED;
   467 }
   468 
   469 /**
   470  * @brief Tests the functionality of the SDL_GetClosestDisplayMode function against random resolution
   471  */
   472 int
   473 video_getClosestDisplayModeRandomResolution(void *arg)
   474 {
   475   SDL_DisplayMode target; 
   476   SDL_DisplayMode closest;
   477   SDL_DisplayMode* dResult;
   478   int displayNum;
   479   int i;
   480   int variation;
   481 
   482   /* Get number of displays */
   483   displayNum = SDL_GetNumVideoDisplays();
   484   SDLTest_AssertPass("Call to SDL_GetNumVideoDisplays");
   485 
   486   /* Make calls for each display */  
   487   for (i=0; i<displayNum; i++) {
   488     SDLTest_Log("Testing against display: %d", i);
   489          
   490     for (variation = 0; variation < 16; variation ++) {
   491     
   492       /* Set random constraints */
   493       target.w = (variation & 1) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;
   494       target.h = (variation & 2) ? SDLTest_RandomIntegerInRange(1, 4096) : 0;    
   495       target.format = (variation & 4) ? SDLTest_RandomIntegerInRange(1, 10) : 0;
   496       target.refresh_rate = (variation & 8) ? SDLTest_RandomIntegerInRange(25, 120) : 0;
   497       target.driverdata = 0;
   498           
   499       /* Make call; may or may not find anything, so don't validate any further */
   500       dResult = SDL_GetClosestDisplayMode(i, &target, &closest);
   501       SDLTest_AssertPass("Call to SDL_GetClosestDisplayMode(target=random/variation%d)", variation);      
   502     }
   503   }
   504 
   505   return TEST_COMPLETED;
   506 }
   507 
   508 /**
   509  * @brief Tests call to SDL_GetWindowBrightness
   510  *
   511 * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowBrightness
   512  */
   513 int
   514 video_getWindowBrightness(void *arg)
   515 {
   516   SDL_Window* window;
   517   const char* title = "video_getWindowBrightness Test Window";
   518   float result;
   519 
   520   /* Call against new test window */ 
   521   window = _createVideoSuiteTestWindow(title);
   522   if (window != NULL) {
   523       result = SDL_GetWindowBrightness(window);
   524       SDLTest_AssertPass("Call to SDL_GetWindowBrightness");
   525       SDLTest_AssertCheck(result >= 0.0 && result <= 1.0, "Validate range of result value; expected: [0.0, 1.0], got: %f", result);
   526   }
   527 
   528   /* Clean up */    
   529   _destroyVideoSuiteTestWindow(window);
   530   
   531   return TEST_COMPLETED;
   532 }
   533 
   534 /**
   535  * @brief Tests call to SDL_GetWindowBrightness with invalid input
   536  *
   537 * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowBrightness
   538  */
   539 int
   540 video_getWindowBrightnessNegative(void *arg)
   541 {
   542   const char *invalidWindowError = "Invalid window";
   543   char *lastError;
   544   const char* title = "video_getWindowBrightnessNegative Test Window";
   545   float result;
   546 
   547   /* Call against invalid window */ 
   548   result = SDL_GetWindowBrightness(NULL);
   549   SDLTest_AssertPass("Call to SDL_GetWindowBrightness(window=NULL)");
   550   SDLTest_AssertCheck(result == 1.0, "Validate result value; expected: 1.0, got: %f", result);
   551   lastError = (char *)SDL_GetError();
   552   SDLTest_AssertPass("SDL_GetError()");
   553   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   554   if (lastError != NULL) {
   555       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   556          "SDL_GetError(): expected message '%s', was message: '%s'",
   557          invalidWindowError,
   558          lastError);
   559   }
   560 
   561   return TEST_COMPLETED;
   562 }
   563 
   564 /**
   565  * @brief Tests call to SDL_GetWindowDisplayMode
   566  *
   567  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowDisplayMode
   568  */
   569 int
   570 video_getWindowDisplayMode(void *arg)
   571 {
   572   SDL_Window* window;
   573   const char* title = "video_getWindowDisplayMode Test Window";
   574   SDL_DisplayMode mode;
   575   int result;
   576 
   577   /* Invalidate part of the mode content so we can check values later */
   578   mode.w = -1;
   579   mode.h = -1;
   580   mode.refresh_rate = -1;
   581 
   582   /* Call against new test window */ 
   583   window = _createVideoSuiteTestWindow(title);
   584   if (window != NULL) {
   585       result = SDL_GetWindowDisplayMode(window, &mode);
   586       SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode");
   587       SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   588       SDLTest_AssertCheck(mode.w > 0, "Validate mode.w content; expected: >0, got: %d", mode.w);
   589       SDLTest_AssertCheck(mode.h > 0, "Validate mode.h content; expected: >0, got: %d", mode.h);
   590       SDLTest_AssertCheck(mode.refresh_rate > 0, "Validate mode.refresh_rate content; expected: >0, got: %d", mode.refresh_rate);
   591   }
   592 
   593   /* Clean up */    
   594   _destroyVideoSuiteTestWindow(window);
   595   
   596   return TEST_COMPLETED;
   597 }
   598 
   599 /**
   600  * @brief Tests call to SDL_GetWindowDisplayMode with invalid input
   601  *
   602  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowDisplayMode
   603  */
   604 int
   605 video_getWindowDisplayModeNegative(void *arg)
   606 {
   607   const char *expectedError = "Parameter 'mode' is invalid";
   608   const char *invalidWindowError = "Invalid window";
   609   char *lastError;
   610   SDL_Window* window;
   611   const char* title = "video_getWindowDisplayModeNegative Test Window";
   612   SDL_DisplayMode mode;
   613   int result;
   614 
   615   /* Call against new test window */ 
   616   window = _createVideoSuiteTestWindow(title);
   617   if (window != NULL) {
   618       result = SDL_GetWindowDisplayMode(window, NULL);
   619       SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode(...,mode=NULL)");
   620       SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %d", result);
   621       lastError = (char *)SDL_GetError();
   622       SDLTest_AssertPass("SDL_GetError()");
   623       SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   624       if (lastError != NULL) {
   625       	SDLTest_AssertCheck(SDL_strcmp(lastError, expectedError) == 0,
   626              "SDL_GetError(): expected message '%s', was message: '%s'",
   627              expectedError,
   628              lastError);
   629       }
   630   }
   631 
   632   /* Clean up */    
   633   _destroyVideoSuiteTestWindow(window);
   634   
   635   /* Call against invalid window */
   636   result = SDL_GetWindowDisplayMode(NULL, &mode);
   637   SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode(window=NULL,...)");
   638   SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %d", result);
   639   lastError = (char *)SDL_GetError();
   640   SDLTest_AssertPass("SDL_GetError()");
   641   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   642   if (lastError != NULL) {
   643       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   644          "SDL_GetError(): expected message '%s', was message: '%s'",
   645          invalidWindowError,
   646          lastError);
   647   }
   648   
   649   return TEST_COMPLETED;
   650 }
   651 
   652 /**
   653  * @brief Tests call to SDL_GetWindowGammaRamp
   654  *
   655  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGammaRamp
   656  */
   657 int
   658 video_getWindowGammaRamp(void *arg)
   659 {
   660   SDL_Window* window;
   661   const char* title = "video_getWindowGammaRamp Test Window";
   662   Uint16 red[256];
   663   Uint16 green[256];
   664   Uint16 blue[256];
   665   int result;
   666 
   667   /* Call against new test window */ 
   668   window = _createVideoSuiteTestWindow(title);
   669   if (window == NULL) return TEST_ABORTED;
   670   
   671   /* Retrieve no channel */
   672   result = SDL_GetWindowGammaRamp(window, NULL, NULL, NULL);
   673   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(all NULL)");
   674   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   675 
   676   /* Retrieve single channel */
   677   result = SDL_GetWindowGammaRamp(window, red, NULL, NULL);
   678   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r)");
   679   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   680 
   681   result = SDL_GetWindowGammaRamp(window, NULL, green, NULL);
   682   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g)");
   683   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   684 
   685   result = SDL_GetWindowGammaRamp(window, NULL, NULL, blue);
   686   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(b)");
   687   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   688 
   689   /* Retrieve two channels */
   690   result = SDL_GetWindowGammaRamp(window, red, green, NULL);
   691   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r, g)");
   692   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   693 
   694   result = SDL_GetWindowGammaRamp(window, NULL, green, blue);
   695   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g,b)");
   696   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   697 
   698   result = SDL_GetWindowGammaRamp(window, red, NULL, blue);
   699   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,b)");
   700   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   701 
   702   /* Retrieve all channels */
   703   result = SDL_GetWindowGammaRamp(window, red, green, blue);
   704   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,g,b)");
   705   SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
   706 
   707   /* Clean up */    
   708   _destroyVideoSuiteTestWindow(window);
   709   
   710   return TEST_COMPLETED;
   711 }
   712 
   713 /**
   714  * @brief Tests call to SDL_GetWindowGammaRamp with invalid input
   715  *
   716 * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGammaRamp
   717  */
   718 int
   719 video_getWindowGammaRampNegative(void *arg)
   720 {
   721   const char *invalidWindowError = "Invalid window";
   722   char *lastError;
   723   const char* title = "video_getWindowGammaRampNegative Test Window";
   724   Uint16 red[256];
   725   Uint16 green[256];
   726   Uint16 blue[256];
   727   int result;
   728 
   729   /* Call against invalid window */ 
   730   result = SDL_GetWindowGammaRamp(NULL, red, green, blue);
   731   SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(window=NULL,r,g,b)");
   732   SDLTest_AssertCheck(result == -1, "Validate result value; expected: -1, got: %f", result);
   733   lastError = (char *)SDL_GetError();
   734   SDLTest_AssertPass("SDL_GetError()");
   735   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   736   if (lastError != NULL) {
   737       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   738          "SDL_GetError(): expected message '%s', was message: '%s'",
   739          invalidWindowError,
   740          lastError);
   741   }
   742 
   743   return TEST_COMPLETED;
   744 }
   745 
   746 /* Helper for setting and checking the window grab state */
   747 void 
   748 _setAndCheckWindowGrabState(SDL_Window* window, SDL_bool desiredState)
   749 {
   750   SDL_bool currentState;
   751   
   752   /* Set state */
   753   SDL_SetWindowGrab(window, desiredState);
   754   SDLTest_AssertPass("Call to SDL_SetWindowGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   755 
   756   /* Get and check state */
   757   currentState = SDL_GetWindowGrab(window);
   758   SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   759   SDLTest_AssertCheck(
   760       currentState == desiredState, 
   761       "Validate returned state; expected: %s, got: %s", 
   762       (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
   763       (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   764 }
   765 
   766 /**
   767  * @brief Tests call to SDL_GetWindowGrab and SDL_SetWindowGrab
   768  *
   769  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGrab
   770  * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowGrab
   771  */
   772 int
   773 video_getSetWindowGrab(void *arg)
   774 {
   775   const char *invalidWindowError = "Invalid window";
   776   char *lastError;
   777   const char* title = "video_getSetWindowGrab Test Window";
   778   SDL_Window* window;
   779   SDL_bool originalState, dummyState, currentState, desiredState;
   780 
   781   /* Call against new test window */ 
   782   window = _createVideoSuiteTestWindow(title);
   783   if (window == NULL) return TEST_ABORTED;
   784 
   785   /* Get state */  
   786   originalState = SDL_GetWindowGrab(window);
   787   SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   788 
   789   /* F */
   790   _setAndCheckWindowGrabState(window, SDL_FALSE);
   791 
   792   /* F --> F */
   793   _setAndCheckWindowGrabState(window, SDL_FALSE);
   794   
   795   /* F --> T */
   796   _setAndCheckWindowGrabState(window, SDL_TRUE);
   797 
   798   /* T --> T */
   799   _setAndCheckWindowGrabState(window, SDL_TRUE);
   800 
   801   /* T --> F */
   802   _setAndCheckWindowGrabState(window, SDL_FALSE);
   803   
   804   /* Negative tests */
   805   dummyState = SDL_GetWindowGrab(NULL);
   806   SDLTest_AssertPass("Call to SDL_GetWindowGrab(window=NULL)");
   807   lastError = (char *)SDL_GetError();
   808   SDLTest_AssertPass("SDL_GetError()");
   809   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   810   if (lastError != NULL) {
   811       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   812          "SDL_GetError(): expected message '%s', was message: '%s'",
   813          invalidWindowError,
   814          lastError);
   815   }
   816 
   817   SDL_SetWindowGrab(NULL, SDL_FALSE);
   818   SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
   819   lastError = (char *)SDL_GetError();
   820   SDLTest_AssertPass("SDL_GetError()");
   821   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   822   if (lastError != NULL) {
   823       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   824          "SDL_GetError(): expected message '%s', was message: '%s'",
   825          invalidWindowError,
   826          lastError);
   827   }
   828 
   829   SDL_SetWindowGrab(NULL, SDL_TRUE);
   830   SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
   831   lastError = (char *)SDL_GetError();
   832   SDLTest_AssertPass("SDL_GetError()");
   833   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   834   if (lastError != NULL) {
   835       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   836          "SDL_GetError(): expected message '%s', was message: '%s'",
   837          invalidWindowError,
   838          lastError);
   839   }
   840   
   841   /* State should still be F */
   842   desiredState = SDL_FALSE;
   843   currentState = SDL_GetWindowGrab(window);
   844   SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   845   SDLTest_AssertCheck(
   846       currentState == desiredState, 
   847       "Validate returned state; expected: %s, got: %s", 
   848       (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
   849       (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   850     
   851   /* Restore state */  
   852   _setAndCheckWindowGrabState(window, originalState);
   853 
   854   /* Clean up */    
   855   _destroyVideoSuiteTestWindow(window);
   856 
   857   return TEST_COMPLETED;
   858 }
   859 
   860 /**
   861  * @brief Tests call to SDL_GetWindowID and SDL_GetWindowFromID
   862  *
   863  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowID
   864  * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowFromID
   865  */
   866 int
   867 video_getWindowId(void *arg)
   868 {
   869   const char *invalidWindowError = "Invalid window";
   870   char *lastError;
   871   const char* title = "video_getWindowId Test Window";
   872   SDL_Window* window;
   873   SDL_Window* result;
   874   Uint32 id, randomId;
   875 
   876   /* Call against new test window */ 
   877   window = _createVideoSuiteTestWindow(title);
   878   if (window == NULL) return TEST_ABORTED;
   879 
   880   /* Get ID */
   881   id = SDL_GetWindowID(window);
   882   SDLTest_AssertPass("Call to SDL_GetWindowID()");
   883 
   884   /* Get window from ID */
   885   result = SDL_GetWindowFromID(id);
   886   SDLTest_AssertPass("Call to SDL_GetWindowID(%d)", id);
   887   SDLTest_AssertCheck(result == window, "Verify result matches window pointer");
   888 
   889   /* Get window from random large ID, no result check */
   890   randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX);
   891   result = SDL_GetWindowFromID(randomId);
   892   SDLTest_AssertPass("Call to SDL_GetWindowID(%d/random_large)", randomId);
   893 
   894   /* Get window from 0 and Uint32 max ID, no result check */
   895   result = SDL_GetWindowFromID(0);
   896   SDLTest_AssertPass("Call to SDL_GetWindowID(0)");
   897   result = SDL_GetWindowFromID(UINT32_MAX);
   898   SDLTest_AssertPass("Call to SDL_GetWindowID(UINT32_MAX)");
   899 
   900   /* Clean up */    
   901   _destroyVideoSuiteTestWindow(window);
   902     
   903   /* Get window from ID for closed window*/
   904   result = SDL_GetWindowFromID(id);
   905   SDLTest_AssertPass("Call to SDL_GetWindowID(%d/closed_window)", id);
   906   SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
   907 
   908   /* Negative test */
   909   id = SDL_GetWindowID(NULL);
   910   SDLTest_AssertPass("Call to SDL_GetWindowID(window=NULL)");
   911   lastError = (char *)SDL_GetError();
   912   SDLTest_AssertPass("SDL_GetError()");
   913   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   914   if (lastError != NULL) {
   915       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   916          "SDL_GetError(): expected message '%s', was message: '%s'",
   917          invalidWindowError,
   918          lastError);
   919   }
   920 
   921   return TEST_COMPLETED;
   922 }
   923 
   924 /**
   925  * @brief Tests call to SDL_GetWindowPixelFormat
   926  *
   927  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPixelFormat
   928  */
   929 int
   930 video_getWindowPixelFormat(void *arg)
   931 {
   932   const char *invalidWindowError = "Invalid window";
   933   char *lastError;
   934   const char* title = "video_getWindowPixelFormat Test Window";
   935   SDL_Window* window;
   936   Uint32 format;
   937 
   938   /* Call against new test window */ 
   939   window = _createVideoSuiteTestWindow(title);
   940   if (window == NULL) return TEST_ABORTED;
   941 
   942   /* Get format */
   943   format = SDL_GetWindowPixelFormat(window);
   944   SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()");
   945   SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %d", SDL_PIXELFORMAT_UNKNOWN, format);
   946    
   947   /* Clean up */    
   948   _destroyVideoSuiteTestWindow(window);
   949     
   950   /* Negative test */
   951   format = SDL_GetWindowPixelFormat(NULL);
   952   SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat(window=NULL)");
   953   lastError = (char *)SDL_GetError();
   954   SDLTest_AssertPass("SDL_GetError()");
   955   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   956   if (lastError != NULL) {
   957       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   958          "SDL_GetError(): expected message '%s', was message: '%s'",
   959          invalidWindowError,
   960          lastError);
   961   }
   962 
   963   return TEST_COMPLETED;
   964 }
   965 
   966 /**
   967  * @brief Tests call to SDL_GetWindowPosition and SDL_SetWindowPosition
   968  *
   969  * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPosition
   970  * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowPosition
   971  */
   972 int
   973 video_getSetWindowPosition(void *arg)
   974 {
   975   const char *invalidWindowError = "Invalid window";
   976   char *lastError;
   977   const char* title = "video_getSetWindowPosition Test Window";
   978   SDL_Window* window;
   979   int xVariation, yVariation;
   980   int referenceX, referenceY;
   981   int currentX, currentY;
   982   int desiredX, desiredY;
   983 
   984   /* Call against new test window */ 
   985   window = _createVideoSuiteTestWindow(title);
   986   if (window == NULL) return TEST_ABORTED;
   987   
   988   for (xVariation = 0; xVariation < 4; xVariation++) {
   989    for (yVariation = 0; yVariation < 4; yVariation++) {
   990     switch(xVariation) {
   991      case 0:
   992       /* Zero X Position */  
   993       desiredX = 0;
   994       break;
   995      case 1:
   996       /* Random X position inside screen */  
   997       desiredX = SDLTest_RandomIntegerInRange(1, 100);
   998       break;
   999      case 2:
  1000       /* Random X position outside screen (positive) */  
  1001       desiredX = SDLTest_RandomIntegerInRange(10000, 11000);
  1002       break;
  1003      case 3:
  1004       /* Random X position outside screen (negative) */  
  1005       desiredX = SDLTest_RandomIntegerInRange(-1000, -100);
  1006       break;
  1007     }
  1008 
  1009     switch(yVariation) {
  1010      case 0:
  1011       /* Zero X Position */  
  1012       desiredY = 0;
  1013       break;
  1014      case 1:
  1015       /* Random X position inside screen */  
  1016       desiredY = SDLTest_RandomIntegerInRange(1, 100);
  1017       break;
  1018      case 2:
  1019       /* Random X position outside screen (positive) */  
  1020       desiredY = SDLTest_RandomIntegerInRange(10000, 11000);
  1021       break;
  1022      case 3:
  1023       /* Random Y position outside screen (negative) */  
  1024       desiredY = SDLTest_RandomIntegerInRange(-1000, -100);
  1025       break;
  1026     }
  1027 
  1028     /* Set position */
  1029     SDL_SetWindowPosition(window, desiredX, desiredY);
  1030     SDLTest_AssertPass("Call to SDL_SetWindowPosition(...,%d,%d)", desiredX, desiredY);
  1031    
  1032     /* Get position */
  1033     currentX = desiredX + 1;
  1034     currentY = desiredY + 1;
  1035     SDL_GetWindowPosition(window, &currentX, &currentY);
  1036     SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
  1037     SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
  1038     SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
  1039 
  1040     /* Get position X */
  1041     currentX = desiredX + 1;    
  1042     SDL_GetWindowPosition(window, &currentX, NULL);
  1043     SDLTest_AssertPass("Call to SDL_GetWindowPosition(&y=NULL)");
  1044     SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
  1045 
  1046     /* Get position Y */
  1047     currentY = desiredY + 1;
  1048     SDL_GetWindowPosition(window, NULL, &currentY);
  1049     SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL)");
  1050     SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
  1051    }
  1052   }
  1053 
  1054   /* Dummy call with both pointers NULL */
  1055   SDL_GetWindowPosition(window, NULL, NULL);
  1056   SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL,&y=NULL)");
  1057    
  1058   /* Clean up */    
  1059   _destroyVideoSuiteTestWindow(window);
  1060     
  1061   /* Set some 'magic' value for later check that nothing was changed */
  1062   referenceX = SDLTest_RandomSint32();
  1063   referenceY = SDLTest_RandomSint32();
  1064   currentX = referenceX;
  1065   currentY = referenceY;
  1066   desiredX = SDLTest_RandomSint32();
  1067   desiredY = SDLTest_RandomSint32();
  1068   
  1069   /* Negative tests */
  1070   SDL_GetWindowPosition(NULL, &currentX, &currentY);
  1071   SDLTest_AssertPass("Call to SDL_GetWindowPosition(window=NULL)");
  1072   SDLTest_AssertCheck(
  1073   	currentX == referenceX && currentY == referenceY, 
  1074   	"Verify that content of X and Y pointers has not been modified; expected: %d,%d; got: %d,%d",
  1075   	referenceX, referenceY,
  1076   	currentX, currentY);
  1077   lastError = (char *)SDL_GetError();
  1078   SDLTest_AssertPass("SDL_GetError()");
  1079   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  1080   if (lastError != NULL) {
  1081       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
  1082          "SDL_GetError(): expected message '%s', was message: '%s'",
  1083          invalidWindowError,
  1084          lastError);
  1085   }
  1086 
  1087   SDL_GetWindowPosition(NULL, NULL, NULL);
  1088   SDLTest_AssertPass("Call to SDL_GetWindowPosition(NULL, NULL, NULL)");
  1089   lastError = (char *)SDL_GetError();
  1090   SDLTest_AssertPass("SDL_GetError()");
  1091   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  1092   if (lastError != NULL) {
  1093       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
  1094          "SDL_GetError(): expected message '%s', was message: '%s'",
  1095          invalidWindowError,
  1096          lastError);
  1097   }
  1098 
  1099   SDL_SetWindowPosition(NULL, desiredX, desiredY);
  1100   SDLTest_AssertPass("Call to SDL_SetWindowPosition(window=NULL)");
  1101   lastError = (char *)SDL_GetError();
  1102   SDLTest_AssertPass("SDL_GetError()");
  1103   SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
  1104   if (lastError != NULL) {
  1105       SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
  1106          "SDL_GetError(): expected message '%s', was message: '%s'",
  1107          invalidWindowError,
  1108          lastError);
  1109   }
  1110   
  1111   return TEST_COMPLETED;
  1112 }
  1113 
  1114 /* ================= Test References ================== */
  1115 
  1116 /* Video test cases */
  1117 static const SDLTest_TestCaseReference videoTest1 =
  1118 		{ (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver",  "Enable and disable screenaver while checking state", TEST_ENABLED };
  1119 
  1120 static const SDLTest_TestCaseReference videoTest2 =
  1121 		{ (SDLTest_TestCaseFp)video_createWindowVariousPositions, "video_createWindowVariousPositions",  "Create windows at various locations", TEST_ENABLED };
  1122 
  1123 static const SDLTest_TestCaseReference videoTest3 =
  1124 		{ (SDLTest_TestCaseFp)video_createWindowVariousSizes, "video_createWindowVariousSizes",  "Create windows with various sizes", TEST_ENABLED };
  1125 
  1126 static const SDLTest_TestCaseReference videoTest4 =
  1127 		{ (SDLTest_TestCaseFp)video_createWindowVariousFlags, "video_createWindowVariousFlags",  "Create windows using various flags", TEST_ENABLED };
  1128 
  1129 static const SDLTest_TestCaseReference videoTest5 =
  1130 		{ (SDLTest_TestCaseFp)video_getWindowFlags, "video_getWindowFlags",  "Get window flags set during SDL_CreateWindow", TEST_ENABLED };
  1131 
  1132 static const SDLTest_TestCaseReference videoTest6 =
  1133 		{ (SDLTest_TestCaseFp)video_getNumDisplayModes, "video_getNumDisplayModes",  "Use SDL_GetNumDisplayModes function to get number of display modes", TEST_ENABLED };
  1134 
  1135 static const SDLTest_TestCaseReference videoTest7 =
  1136 		{ (SDLTest_TestCaseFp)video_getNumDisplayModesNegative, "video_getNumDisplayModesNegative",  "Negative tests for SDL_GetNumDisplayModes", TEST_ENABLED };
  1137 
  1138 static const SDLTest_TestCaseReference videoTest8 =
  1139 		{ (SDLTest_TestCaseFp)video_getClosestDisplayModeCurrentResolution, "video_getClosestDisplayModeCurrentResolution",  "Use function to get closes match to requested display mode for current resolution", TEST_ENABLED };
  1140 
  1141 static const SDLTest_TestCaseReference videoTest9 =
  1142 		{ (SDLTest_TestCaseFp)video_getClosestDisplayModeRandomResolution, "video_getClosestDisplayModeRandomResolution",  "Use function to get closes match to requested display mode for random resolution", TEST_ENABLED };
  1143 
  1144 static const SDLTest_TestCaseReference videoTest10 =
  1145 		{ (SDLTest_TestCaseFp)video_getWindowBrightness, "video_getWindowBrightness",  "Get window brightness", TEST_ENABLED };
  1146 
  1147 static const SDLTest_TestCaseReference videoTest11 =
  1148 		{ (SDLTest_TestCaseFp)video_getWindowBrightnessNegative, "video_getWindowBrightnessNegative",  "Get window brightness with invalid input", TEST_ENABLED };
  1149 
  1150 static const SDLTest_TestCaseReference videoTest12 =
  1151 		{ (SDLTest_TestCaseFp)video_getWindowDisplayMode, "video_getWindowDisplayMode",  "Get window display mode", TEST_ENABLED };
  1152 
  1153 static const SDLTest_TestCaseReference videoTest13 =
  1154 		{ (SDLTest_TestCaseFp)video_getWindowDisplayModeNegative, "video_getWindowDisplayModeNegative",  "Get window display mode with invalid input", TEST_ENABLED };
  1155 
  1156 static const SDLTest_TestCaseReference videoTest14 =
  1157 		{ (SDLTest_TestCaseFp)video_getWindowGammaRamp, "video_getWindowGammaRamp",  "Get window gamma ramp", TEST_ENABLED };
  1158 
  1159 static const SDLTest_TestCaseReference videoTest15 =
  1160 		{ (SDLTest_TestCaseFp)video_getWindowGammaRampNegative, "video_getWindowGammaRampNegative",  "Get window gamma ramp against invalid input", TEST_ENABLED };
  1161 
  1162 static const SDLTest_TestCaseReference videoTest16 =
  1163 		{ (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab",  "Checks SDL_GetWindowGrab and SDL_SetWindowGrab", TEST_ENABLED };
  1164 
  1165 static const SDLTest_TestCaseReference videoTest17 =
  1166 		{ (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId",  "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED };
  1167 
  1168 static const SDLTest_TestCaseReference videoTest18 =
  1169 		{ (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat",  "Checks SDL_GetWindowPixelFormat", TEST_ENABLED };
  1170 
  1171 static const SDLTest_TestCaseReference videoTest19 =
  1172 		{ (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition",  "Checks SDL_GetWindowPosition and SDL_SetWindowPosition", TEST_ENABLED };
  1173 
  1174 /* Sequence of Video test cases */
  1175 static const SDLTest_TestCaseReference *videoTests[] =  {
  1176 	&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, 
  1177 	&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, 
  1178 	&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, 
  1179 	&videoTest18, &videoTest19, NULL
  1180 };
  1181 
  1182 /* Video test suite (global) */
  1183 SDLTest_TestSuiteReference videoTestSuite = {
  1184 	"Video",
  1185 	NULL,
  1186 	videoTests,
  1187 	NULL
  1188 };