test/testautomation_video.c
changeset 6956 afdc35fa58e9
parent 6936 76d9c31e823d
child 6984 ae9c4b12f3e2
     1.1 --- a/test/testautomation_video.c	Sun Mar 03 11:25:43 2013 -0800
     1.2 +++ b/test/testautomation_video.c	Sun Mar 03 17:22:51 2013 -0800
     1.3 @@ -4,6 +4,16 @@
     1.4  
     1.5  #include <stdio.h>
     1.6  
     1.7 +/* Visual Studio 2008 doesn't have stdint.h */
     1.8 +#if defined(_MSC_VER) && _MSC_VER <= 1500
     1.9 +#define UINT8_MAX   ~(Uint8)0
    1.10 +#define UINT16_MAX  ~(Uint16)0
    1.11 +#define UINT32_MAX  ~(Uint32)0
    1.12 +#define UINT64_MAX  ~(Uint64)0
    1.13 +#else
    1.14 +#include <stdint.h>
    1.15 +#endif
    1.16 +
    1.17  #include "SDL.h"
    1.18  #include "SDL_test.h"
    1.19  
    1.20 @@ -656,43 +666,43 @@
    1.21  
    1.22    /* Call against new test window */ 
    1.23    window = _createVideoSuiteTestWindow(title);
    1.24 -  if (window != NULL) {
    1.25 -      /* Retrieve no channel */
    1.26 -      result = SDL_GetWindowGammaRamp(window, NULL, NULL, NULL);
    1.27 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(all NULL)");
    1.28 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.29 +  if (window == NULL) return TEST_ABORTED;
    1.30 +  
    1.31 +  /* Retrieve no channel */
    1.32 +  result = SDL_GetWindowGammaRamp(window, NULL, NULL, NULL);
    1.33 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(all NULL)");
    1.34 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.35  
    1.36 -      /* Retrieve single channel */
    1.37 -      result = SDL_GetWindowGammaRamp(window, red, NULL, NULL);
    1.38 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r)");
    1.39 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.40 +  /* Retrieve single channel */
    1.41 +  result = SDL_GetWindowGammaRamp(window, red, NULL, NULL);
    1.42 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r)");
    1.43 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.44  
    1.45 -      result = SDL_GetWindowGammaRamp(window, NULL, green, NULL);
    1.46 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g)");
    1.47 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.48 +  result = SDL_GetWindowGammaRamp(window, NULL, green, NULL);
    1.49 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g)");
    1.50 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.51  
    1.52 -      result = SDL_GetWindowGammaRamp(window, NULL, NULL, blue);
    1.53 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(b)");
    1.54 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.55 +  result = SDL_GetWindowGammaRamp(window, NULL, NULL, blue);
    1.56 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(b)");
    1.57 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.58  
    1.59 -      /* Retrieve two channels */
    1.60 -      result = SDL_GetWindowGammaRamp(window, red, green, NULL);
    1.61 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r, g)");
    1.62 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.63 +  /* Retrieve two channels */
    1.64 +  result = SDL_GetWindowGammaRamp(window, red, green, NULL);
    1.65 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r, g)");
    1.66 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.67  
    1.68 -      result = SDL_GetWindowGammaRamp(window, NULL, green, blue);
    1.69 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g,b)");
    1.70 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.71 +  result = SDL_GetWindowGammaRamp(window, NULL, green, blue);
    1.72 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(g,b)");
    1.73 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.74  
    1.75 -      result = SDL_GetWindowGammaRamp(window, red, NULL, blue);
    1.76 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,b)");
    1.77 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.78 +  result = SDL_GetWindowGammaRamp(window, red, NULL, blue);
    1.79 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,b)");
    1.80 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.81  
    1.82 -      /* Retrieve all channels */
    1.83 -      result = SDL_GetWindowGammaRamp(window, red, green, blue);
    1.84 -      SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,g,b)");
    1.85 -      SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.86 -  }
    1.87 +  /* Retrieve all channels */
    1.88 +  result = SDL_GetWindowGammaRamp(window, red, green, blue);
    1.89 +  SDLTest_AssertPass("Call to SDL_GetWindowGammaRamp(r,g,b)");
    1.90 +  SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result);
    1.91  
    1.92    /* Clean up */    
    1.93    _destroyVideoSuiteTestWindow(window);
    1.94 @@ -733,6 +743,374 @@
    1.95    return TEST_COMPLETED;
    1.96  }
    1.97  
    1.98 +/* Helper for setting and checking the window grab state */
    1.99 +void 
   1.100 +_setAndCheckWindowGrabState(SDL_Window* window, SDL_bool desiredState)
   1.101 +{
   1.102 +  SDL_bool currentState;
   1.103 +  
   1.104 +  /* Set state */
   1.105 +  SDL_SetWindowGrab(window, desiredState);
   1.106 +  SDLTest_AssertPass("Call to SDL_SetWindowGrab(%s)", (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   1.107 +
   1.108 +  /* Get and check state */
   1.109 +  currentState = SDL_GetWindowGrab(window);
   1.110 +  SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   1.111 +  SDLTest_AssertCheck(
   1.112 +      currentState == desiredState, 
   1.113 +      "Validate returned state; expected: %s, got: %s", 
   1.114 +      (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
   1.115 +      (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   1.116 +}
   1.117 +
   1.118 +/**
   1.119 + * @brief Tests call to SDL_GetWindowGrab and SDL_SetWindowGrab
   1.120 + *
   1.121 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowGrab
   1.122 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowGrab
   1.123 + */
   1.124 +int
   1.125 +video_getSetWindowGrab(void *arg)
   1.126 +{
   1.127 +  const char *invalidWindowError = "Invalid window";
   1.128 +  char *lastError;
   1.129 +  const char* title = "video_getSetWindowGrab Test Window";
   1.130 +  SDL_Window* window;
   1.131 +  SDL_bool originalState, dummyState, currentState, desiredState;
   1.132 +
   1.133 +  /* Call against new test window */ 
   1.134 +  window = _createVideoSuiteTestWindow(title);
   1.135 +  if (window == NULL) return TEST_ABORTED;
   1.136 +
   1.137 +  /* Get state */  
   1.138 +  originalState = SDL_GetWindowGrab(window);
   1.139 +  SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   1.140 +
   1.141 +  /* F */
   1.142 +  _setAndCheckWindowGrabState(window, SDL_FALSE);
   1.143 +
   1.144 +  /* F --> F */
   1.145 +  _setAndCheckWindowGrabState(window, SDL_FALSE);
   1.146 +  
   1.147 +  /* F --> T */
   1.148 +  _setAndCheckWindowGrabState(window, SDL_TRUE);
   1.149 +
   1.150 +  /* T --> T */
   1.151 +  _setAndCheckWindowGrabState(window, SDL_TRUE);
   1.152 +
   1.153 +  /* T --> F */
   1.154 +  _setAndCheckWindowGrabState(window, SDL_FALSE);
   1.155 +  
   1.156 +  /* Negative tests */
   1.157 +  dummyState = SDL_GetWindowGrab(NULL);
   1.158 +  SDLTest_AssertPass("Call to SDL_GetWindowGrab(window=NULL)");
   1.159 +  lastError = (char *)SDL_GetError();
   1.160 +  SDLTest_AssertPass("SDL_GetError()");
   1.161 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.162 +  if (lastError != NULL) {
   1.163 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.164 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.165 +         invalidWindowError,
   1.166 +         lastError);
   1.167 +  }
   1.168 +
   1.169 +  SDL_SetWindowGrab(NULL, SDL_FALSE);
   1.170 +  SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
   1.171 +  lastError = (char *)SDL_GetError();
   1.172 +  SDLTest_AssertPass("SDL_GetError()");
   1.173 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.174 +  if (lastError != NULL) {
   1.175 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.176 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.177 +         invalidWindowError,
   1.178 +         lastError);
   1.179 +  }
   1.180 +
   1.181 +  SDL_SetWindowGrab(NULL, SDL_TRUE);
   1.182 +  SDLTest_AssertPass("Call to SDL_SetWindowGrab(window=NULL,SDL_FALSE)");
   1.183 +  lastError = (char *)SDL_GetError();
   1.184 +  SDLTest_AssertPass("SDL_GetError()");
   1.185 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.186 +  if (lastError != NULL) {
   1.187 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.188 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.189 +         invalidWindowError,
   1.190 +         lastError);
   1.191 +  }
   1.192 +  
   1.193 +  /* State should still be F */
   1.194 +  desiredState = SDL_FALSE;
   1.195 +  currentState = SDL_GetWindowGrab(window);
   1.196 +  SDLTest_AssertPass("Call to SDL_GetWindowGrab()");
   1.197 +  SDLTest_AssertCheck(
   1.198 +      currentState == desiredState, 
   1.199 +      "Validate returned state; expected: %s, got: %s", 
   1.200 +      (desiredState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE",
   1.201 +      (currentState == SDL_FALSE) ? "SDL_FALSE" : "SDL_TRUE");
   1.202 +    
   1.203 +  /* Restore state */  
   1.204 +  _setAndCheckWindowGrabState(window, originalState);
   1.205 +
   1.206 +  /* Clean up */    
   1.207 +  _destroyVideoSuiteTestWindow(window);
   1.208 +
   1.209 +  return TEST_COMPLETED;
   1.210 +}
   1.211 +
   1.212 +/**
   1.213 + * @brief Tests call to SDL_GetWindowID and SDL_GetWindowFromID
   1.214 + *
   1.215 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowID
   1.216 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowFromID
   1.217 + */
   1.218 +int
   1.219 +video_getWindowId(void *arg)
   1.220 +{
   1.221 +  const char *invalidWindowError = "Invalid window";
   1.222 +  char *lastError;
   1.223 +  const char* title = "video_getWindowId Test Window";
   1.224 +  SDL_Window* window;
   1.225 +  SDL_Window* result;
   1.226 +  Uint32 id, randomId;
   1.227 +
   1.228 +  /* Call against new test window */ 
   1.229 +  window = _createVideoSuiteTestWindow(title);
   1.230 +  if (window == NULL) return TEST_ABORTED;
   1.231 +
   1.232 +  /* Get ID */
   1.233 +  id = SDL_GetWindowID(window);
   1.234 +  SDLTest_AssertPass("Call to SDL_GetWindowID()");
   1.235 +
   1.236 +  /* Get window from ID */
   1.237 +  result = SDL_GetWindowFromID(id);
   1.238 +  SDLTest_AssertPass("Call to SDL_GetWindowID(%d)", id);
   1.239 +  SDLTest_AssertCheck(result == window, "Verify result matches window pointer");
   1.240 +
   1.241 +  /* Get window from random large ID, no result check */
   1.242 +  randomId = SDLTest_RandomIntegerInRange(UINT8_MAX,UINT16_MAX);
   1.243 +  result = SDL_GetWindowFromID(randomId);
   1.244 +  SDLTest_AssertPass("Call to SDL_GetWindowID(%d/random_large)", randomId);
   1.245 +
   1.246 +  /* Get window from 0 and Uint32 max ID, no result check */
   1.247 +  result = SDL_GetWindowFromID(0);
   1.248 +  SDLTest_AssertPass("Call to SDL_GetWindowID(0)");
   1.249 +  result = SDL_GetWindowFromID(UINT32_MAX);
   1.250 +  SDLTest_AssertPass("Call to SDL_GetWindowID(UINT32_MAX)");
   1.251 +
   1.252 +  /* Clean up */    
   1.253 +  _destroyVideoSuiteTestWindow(window);
   1.254 +    
   1.255 +  /* Get window from ID for closed window*/
   1.256 +  result = SDL_GetWindowFromID(id);
   1.257 +  SDLTest_AssertPass("Call to SDL_GetWindowID(%d/closed_window)", id);
   1.258 +  SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
   1.259 +
   1.260 +  /* Negative test */
   1.261 +  id = SDL_GetWindowID(NULL);
   1.262 +  SDLTest_AssertPass("Call to SDL_GetWindowID(window=NULL)");
   1.263 +  lastError = (char *)SDL_GetError();
   1.264 +  SDLTest_AssertPass("SDL_GetError()");
   1.265 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.266 +  if (lastError != NULL) {
   1.267 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.268 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.269 +         invalidWindowError,
   1.270 +         lastError);
   1.271 +  }
   1.272 +
   1.273 +  return TEST_COMPLETED;
   1.274 +}
   1.275 +
   1.276 +/**
   1.277 + * @brief Tests call to SDL_GetWindowPixelFormat
   1.278 + *
   1.279 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPixelFormat
   1.280 + */
   1.281 +int
   1.282 +video_getWindowPixelFormat(void *arg)
   1.283 +{
   1.284 +  const char *invalidWindowError = "Invalid window";
   1.285 +  char *lastError;
   1.286 +  const char* title = "video_getWindowPixelFormat Test Window";
   1.287 +  SDL_Window* window;
   1.288 +  Uint32 format;
   1.289 +
   1.290 +  /* Call against new test window */ 
   1.291 +  window = _createVideoSuiteTestWindow(title);
   1.292 +  if (window == NULL) return TEST_ABORTED;
   1.293 +
   1.294 +  /* Get format */
   1.295 +  format = SDL_GetWindowPixelFormat(window);
   1.296 +  SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat()");
   1.297 +  SDLTest_AssertCheck(format != SDL_PIXELFORMAT_UNKNOWN, "Verify that returned format is valid; expected: != %d, got: %d", SDL_PIXELFORMAT_UNKNOWN, format);
   1.298 +   
   1.299 +  /* Clean up */    
   1.300 +  _destroyVideoSuiteTestWindow(window);
   1.301 +    
   1.302 +  /* Negative test */
   1.303 +  format = SDL_GetWindowPixelFormat(NULL);
   1.304 +  SDLTest_AssertPass("Call to SDL_GetWindowPixelFormat(window=NULL)");
   1.305 +  lastError = (char *)SDL_GetError();
   1.306 +  SDLTest_AssertPass("SDL_GetError()");
   1.307 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.308 +  if (lastError != NULL) {
   1.309 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.310 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.311 +         invalidWindowError,
   1.312 +         lastError);
   1.313 +  }
   1.314 +
   1.315 +  return TEST_COMPLETED;
   1.316 +}
   1.317 +
   1.318 +/**
   1.319 + * @brief Tests call to SDL_GetWindowPosition and SDL_SetWindowPosition
   1.320 + *
   1.321 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_GetWindowPosition
   1.322 + * @sa http://wiki.libsdl.org/moin.fcg/SDL_SetWindowPosition
   1.323 + */
   1.324 +int
   1.325 +video_getSetWindowPosition(void *arg)
   1.326 +{
   1.327 +  const char *invalidWindowError = "Invalid window";
   1.328 +  char *lastError;
   1.329 +  const char* title = "video_getSetWindowPosition Test Window";
   1.330 +  SDL_Window* window;
   1.331 +  int xVariation, yVariation;
   1.332 +  int referenceX, referenceY;
   1.333 +  int currentX, currentY;
   1.334 +  int desiredX, desiredY;
   1.335 +
   1.336 +  /* Call against new test window */ 
   1.337 +  window = _createVideoSuiteTestWindow(title);
   1.338 +  if (window == NULL) return TEST_ABORTED;
   1.339 +  
   1.340 +  for (xVariation = 0; xVariation < 4; xVariation++) {
   1.341 +   for (yVariation = 0; yVariation < 4; yVariation++) {
   1.342 +    switch(xVariation) {
   1.343 +     case 0:
   1.344 +      /* Zero X Position */  
   1.345 +      desiredX = 0;
   1.346 +      break;
   1.347 +     case 1:
   1.348 +      /* Random X position inside screen */  
   1.349 +      desiredX = SDLTest_RandomIntegerInRange(1, 100);
   1.350 +      break;
   1.351 +     case 2:
   1.352 +      /* Random X position outside screen (positive) */  
   1.353 +      desiredX = SDLTest_RandomIntegerInRange(10000, 11000);
   1.354 +      break;
   1.355 +     case 3:
   1.356 +      /* Random X position outside screen (negative) */  
   1.357 +      desiredX = SDLTest_RandomIntegerInRange(-1000, -100);
   1.358 +      break;
   1.359 +    }
   1.360 +
   1.361 +    switch(yVariation) {
   1.362 +     case 0:
   1.363 +      /* Zero X Position */  
   1.364 +      desiredY = 0;
   1.365 +      break;
   1.366 +     case 1:
   1.367 +      /* Random X position inside screen */  
   1.368 +      desiredY = SDLTest_RandomIntegerInRange(1, 100);
   1.369 +      break;
   1.370 +     case 2:
   1.371 +      /* Random X position outside screen (positive) */  
   1.372 +      desiredY = SDLTest_RandomIntegerInRange(10000, 11000);
   1.373 +      break;
   1.374 +     case 3:
   1.375 +      /* Random Y position outside screen (negative) */  
   1.376 +      desiredY = SDLTest_RandomIntegerInRange(-1000, -100);
   1.377 +      break;
   1.378 +    }
   1.379 +
   1.380 +    /* Set position */
   1.381 +    SDL_SetWindowPosition(window, desiredX, desiredY);
   1.382 +    SDLTest_AssertPass("Call to SDL_SetWindowPosition(...,%d,%d)", desiredX, desiredY);
   1.383 +   
   1.384 +    /* Get position */
   1.385 +    currentX = desiredX + 1;
   1.386 +    currentY = desiredY + 1;
   1.387 +    SDL_GetWindowPosition(window, &currentX, &currentY);
   1.388 +    SDLTest_AssertPass("Call to SDL_GetWindowPosition()");
   1.389 +    SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
   1.390 +    SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
   1.391 +
   1.392 +    /* Get position X */
   1.393 +    currentX = desiredX + 1;    
   1.394 +    SDL_GetWindowPosition(window, &currentX, NULL);
   1.395 +    SDLTest_AssertPass("Call to SDL_GetWindowPosition(&y=NULL)");
   1.396 +    SDLTest_AssertCheck(desiredX == currentX, "Verify returned X position; expected: %d, got: %d", desiredX, currentX);
   1.397 +
   1.398 +    /* Get position Y */
   1.399 +    currentY = desiredY + 1;
   1.400 +    SDL_GetWindowPosition(window, NULL, &currentY);
   1.401 +    SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL)");
   1.402 +    SDLTest_AssertCheck(desiredY == currentY, "Verify returned Y position; expected: %d, got: %d", desiredY, currentY);
   1.403 +   }
   1.404 +  }
   1.405 +
   1.406 +  /* Dummy call with both pointers NULL */
   1.407 +  SDL_GetWindowPosition(window, NULL, NULL);
   1.408 +  SDLTest_AssertPass("Call to SDL_GetWindowPosition(&x=NULL,&y=NULL)");
   1.409 +   
   1.410 +  /* Clean up */    
   1.411 +  _destroyVideoSuiteTestWindow(window);
   1.412 +    
   1.413 +  /* Set some 'magic' value for later check that nothing was changed */
   1.414 +  referenceX = SDLTest_RandomSint32();
   1.415 +  referenceY = SDLTest_RandomSint32();
   1.416 +  currentX = referenceX;
   1.417 +  currentY = referenceY;
   1.418 +  desiredX = SDLTest_RandomSint32();
   1.419 +  desiredY = SDLTest_RandomSint32();
   1.420 +  
   1.421 +  /* Negative tests */
   1.422 +  SDL_GetWindowPosition(NULL, &currentX, &currentY);
   1.423 +  SDLTest_AssertPass("Call to SDL_GetWindowPosition(window=NULL)");
   1.424 +  SDLTest_AssertCheck(
   1.425 +  	currentX == referenceX && currentY == referenceY, 
   1.426 +  	"Verify that content of X and Y pointers has not been modified; expected: %d,%d; got: %d,%d",
   1.427 +  	referenceX, referenceY,
   1.428 +  	currentX, currentY);
   1.429 +  lastError = (char *)SDL_GetError();
   1.430 +  SDLTest_AssertPass("SDL_GetError()");
   1.431 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.432 +  if (lastError != NULL) {
   1.433 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.434 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.435 +         invalidWindowError,
   1.436 +         lastError);
   1.437 +  }
   1.438 +
   1.439 +  SDL_GetWindowPosition(NULL, NULL, NULL);
   1.440 +  SDLTest_AssertPass("Call to SDL_GetWindowPosition(NULL, NULL, NULL)");
   1.441 +  lastError = (char *)SDL_GetError();
   1.442 +  SDLTest_AssertPass("SDL_GetError()");
   1.443 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.444 +  if (lastError != NULL) {
   1.445 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.446 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.447 +         invalidWindowError,
   1.448 +         lastError);
   1.449 +  }
   1.450 +
   1.451 +  SDL_SetWindowPosition(NULL, desiredX, desiredY);
   1.452 +  SDLTest_AssertPass("Call to SDL_SetWindowPosition(window=NULL)");
   1.453 +  lastError = (char *)SDL_GetError();
   1.454 +  SDLTest_AssertPass("SDL_GetError()");
   1.455 +  SDLTest_AssertCheck(lastError != NULL, "Verify error message is not NULL");
   1.456 +  if (lastError != NULL) {
   1.457 +      SDLTest_AssertCheck(SDL_strcmp(lastError, invalidWindowError) == 0,
   1.458 +         "SDL_GetError(): expected message '%s', was message: '%s'",
   1.459 +         invalidWindowError,
   1.460 +         lastError);
   1.461 +  }
   1.462 +  
   1.463 +  return TEST_COMPLETED;
   1.464 +}
   1.465 +
   1.466  /* ================= Test References ================== */
   1.467  
   1.468  /* Video test cases */
   1.469 @@ -781,11 +1159,24 @@
   1.470  static const SDLTest_TestCaseReference videoTest15 =
   1.471  		{ (SDLTest_TestCaseFp)video_getWindowGammaRampNegative, "video_getWindowGammaRampNegative",  "Get window gamma ramp against invalid input", TEST_ENABLED };
   1.472  
   1.473 +static const SDLTest_TestCaseReference videoTest16 =
   1.474 +		{ (SDLTest_TestCaseFp)video_getSetWindowGrab, "video_getSetWindowGrab",  "Checks SDL_GetWindowGrab and SDL_SetWindowGrab", TEST_ENABLED };
   1.475 +
   1.476 +static const SDLTest_TestCaseReference videoTest17 =
   1.477 +		{ (SDLTest_TestCaseFp)video_getWindowId, "video_getWindowId",  "Checks SDL_GetWindowID and SDL_GetWindowFromID", TEST_ENABLED };
   1.478 +
   1.479 +static const SDLTest_TestCaseReference videoTest18 =
   1.480 +		{ (SDLTest_TestCaseFp)video_getWindowPixelFormat, "video_getWindowPixelFormat",  "Checks SDL_GetWindowPixelFormat", TEST_ENABLED };
   1.481 +
   1.482 +static const SDLTest_TestCaseReference videoTest19 =
   1.483 +		{ (SDLTest_TestCaseFp)video_getSetWindowPosition, "video_getSetWindowPosition",  "Checks SDL_GetWindowPosition and SDL_SetWindowPosition", TEST_ENABLED };
   1.484 +
   1.485  /* Sequence of Video test cases */
   1.486  static const SDLTest_TestCaseReference *videoTests[] =  {
   1.487  	&videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, 
   1.488  	&videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, 
   1.489 -	&videoTest13, &videoTest14, &videoTest15, NULL
   1.490 +	&videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, 
   1.491 +	&videoTest18, &videoTest19, NULL
   1.492  };
   1.493  
   1.494  /* Video test suite (global) */