mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 09:45:32 +00:00
Fixed testautomation --filter pixels_allocFreeFormat
Error messages are not part of the ABI, so we can't validate those.
Technically SDL_AllocFormat() on a FOURCC format in SDL2 should fail, but SDL3 supports it and we don't expect SDL2 applications to actually do this, so skip that test.
Hand-picked from 5cf9438f88
This commit is contained in:
parent
4bceea70c5
commit
e56dc9c30e
|
@ -102,8 +102,8 @@ const char *_nonRGBPixelFormatsVerbose[] = {
|
||||||
/* Definition of some invalid formats for negative tests */
|
/* Definition of some invalid formats for negative tests */
|
||||||
const int _numInvalidPixelFormats = 2;
|
const int _numInvalidPixelFormats = 2;
|
||||||
Uint32 _invalidPixelFormats[] = {
|
Uint32 _invalidPixelFormats[] = {
|
||||||
0xfffffffe,
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1010102 + 1, 32, 4),
|
||||||
0xffffffff
|
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1010102 + 2, 32, 4)
|
||||||
};
|
};
|
||||||
const char *_invalidPixelFormatsVerbose[] = {
|
const char *_invalidPixelFormatsVerbose[] = {
|
||||||
"SDL_PIXELFORMAT_UNKNOWN",
|
"SDL_PIXELFORMAT_UNKNOWN",
|
||||||
|
@ -121,7 +121,6 @@ const char *_invalidPixelFormatsVerbose[] = {
|
||||||
int pixels_allocFreeFormat(void *arg)
|
int pixels_allocFreeFormat(void *arg)
|
||||||
{
|
{
|
||||||
const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
|
const char *unknownFormat = "SDL_PIXELFORMAT_UNKNOWN";
|
||||||
const char *expectedError = "Parameter 'format' is invalid";
|
|
||||||
const char *error;
|
const char *error;
|
||||||
int i;
|
int i;
|
||||||
Uint32 format;
|
Uint32 format;
|
||||||
|
@ -172,6 +171,7 @@ int pixels_allocFreeFormat(void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* This succeeds for SDL3, but we don't expect SDL2 applications to call SDL_AllocFormat() for FOURCC formats directly */
|
||||||
/* Non-RGB formats */
|
/* Non-RGB formats */
|
||||||
for (i = 0; i < _numNonRGBPixelFormats; i++) {
|
for (i = 0; i < _numNonRGBPixelFormats; i++) {
|
||||||
format = _nonRGBPixelFormats[i];
|
format = _nonRGBPixelFormats[i];
|
||||||
|
@ -182,6 +182,7 @@ int pixels_allocFreeFormat(void *arg)
|
||||||
SDLTest_AssertPass("Call to SDL_AllocFormat()");
|
SDLTest_AssertPass("Call to SDL_AllocFormat()");
|
||||||
SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
|
SDLTest_AssertCheck(result == NULL, "Verify result is NULL");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Negative cases */
|
/* Negative cases */
|
||||||
|
|
||||||
|
@ -196,23 +197,6 @@ int pixels_allocFreeFormat(void *arg)
|
||||||
error = SDL_GetError();
|
error = SDL_GetError();
|
||||||
SDLTest_AssertPass("Call to SDL_GetError()");
|
SDLTest_AssertPass("Call to SDL_GetError()");
|
||||||
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
|
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
|
||||||
if (error != NULL) {
|
|
||||||
SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
|
|
||||||
"Validate error message, expected: '%s', got: '%s'", expectedError, error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Invalid free pointer */
|
|
||||||
SDL_ClearError();
|
|
||||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
|
||||||
SDL_FreeFormat(NULL);
|
|
||||||
SDLTest_AssertPass("Call to SDL_FreeFormat(NULL)");
|
|
||||||
error = SDL_GetError();
|
|
||||||
SDLTest_AssertPass("Call to SDL_GetError()");
|
|
||||||
SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
|
|
||||||
if (error != NULL) {
|
|
||||||
SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0,
|
|
||||||
"Validate error message, expected: '%s', got: '%s'", expectedError, error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
|
Loading…
Reference in a new issue