test/testautomation_pixels.c
changeset 7721 bdf8c2c84e14
parent 7677 871d43c6968a
child 7879 cee8a400dc51
equal deleted inserted replaced
7720:f9a649383362 7721:bdf8c2c84e14
   240   /* Get name of format */
   240   /* Get name of format */
   241   result = (char *)SDL_GetPixelFormatName(format);
   241   result = (char *)SDL_GetPixelFormatName(format);
   242   SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   242   SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   243   SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   243   SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   244   if (result != NULL) {
   244   if (result != NULL) {
   245       SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
   245       SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
   246       SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
   246       SDLTest_AssertCheck(SDL_strcmp(result, unknownFormat) == 0,
   247         "Verify result text; expected: %s, got %s", unknownFormat, result);
   247         "Verify result text; expected: %s, got %s", unknownFormat, result);
   248   }
   248   }
   249 
   249 
   250   /* RGB formats */
   250   /* RGB formats */
   255     /* Get name of format */
   255     /* Get name of format */
   256     result = (char *)SDL_GetPixelFormatName(format);
   256     result = (char *)SDL_GetPixelFormatName(format);
   257     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   257     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   258     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   258     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   259     if (result != NULL) {
   259     if (result != NULL) {
   260       SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
   260       SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
   261       SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
   261       SDLTest_AssertCheck(SDL_strcmp(result, _RGBPixelFormatsVerbose[i]) == 0,
   262         "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
   262         "Verify result text; expected: %s, got %s", _RGBPixelFormatsVerbose[i], result);
   263     }
   263     }
   264   }
   264   }
   265 
   265 
   271     /* Get name of format */
   271     /* Get name of format */
   272     result = (char *)SDL_GetPixelFormatName(format);
   272     result = (char *)SDL_GetPixelFormatName(format);
   273     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   273     SDLTest_AssertPass("Call to SDL_GetPixelFormatName()");
   274     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   274     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   275     if (result != NULL) {
   275     if (result != NULL) {
   276       SDLTest_AssertCheck(SDL_strlen(result) > 0, "Verify result is non-empty");
   276       SDLTest_AssertCheck(result[0] != '\0', "Verify result is non-empty");
   277       SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
   277       SDLTest_AssertCheck(SDL_strcmp(result, _nonRGBPixelFormatsVerbose[i]) == 0,
   278         "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
   278         "Verify result text; expected: %s, got %s", _nonRGBPixelFormatsVerbose[i], result);
   279     }
   279     }
   280   }
   280   }
   281 
   281 
   288     format = _invalidPixelFormats[i];
   288     format = _invalidPixelFormats[i];
   289     result = (char *)SDL_GetPixelFormatName(format);
   289     result = (char *)SDL_GetPixelFormatName(format);
   290     SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
   290     SDLTest_AssertPass("Call to SDL_GetPixelFormatName(%u)", format);
   291     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   291     SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
   292     if (result != NULL) {
   292     if (result != NULL) {
   293       SDLTest_AssertCheck(SDL_strlen(result) > 0,
   293       SDLTest_AssertCheck(result[0] != '\0',
   294         "Verify result is non-empty; got: %s", result);
   294         "Verify result is non-empty; got: %s", result);
   295       SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
   295       SDLTest_AssertCheck(SDL_strcmp(result, _invalidPixelFormatsVerbose[i]) == 0,
   296         "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
   296         "Validate name is UNKNOWN, expected: '%s', got: '%s'", _invalidPixelFormatsVerbose[i], result);
   297     }
   297     }
   298     error = SDL_GetError();
   298     error = SDL_GetError();
   299     SDLTest_AssertPass("Call to SDL_GetError()");
   299     SDLTest_AssertPass("Call to SDL_GetError()");
   300     SDLTest_AssertCheck(error != NULL && SDL_strlen(error) == 0, "Validate that error message is empty");
   300     SDLTest_AssertCheck(error != NULL && error[0] != '\0', "Validate that error message is empty");
   301   }
   301   }
   302 
   302 
   303   return TEST_COMPLETED;
   303   return TEST_COMPLETED;
   304 }
   304 }
   305 
   305