Test both MSB and LSB indexed surfaces in testautomation
parent
39870031d1
commit
fda69e5e79
|
@ -632,12 +632,12 @@ static int surface_testOverflow(void *arg)
|
|||
|
||||
/* Less than 1 byte per pixel: the pitch can legitimately be less than
|
||||
* the width, but it must be enough to hold the appropriate number of
|
||||
* bits per pixel. SDL_PIXELFORMAT_INDEX4LSB* needs 1 byte per 2 pixels. */
|
||||
* bits per pixel. SDL_PIXELFORMAT_INDEX4* needs 1 byte per 2 pixels. */
|
||||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4MSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
|
@ -646,7 +646,7 @@ static int surface_testOverflow(void *arg)
|
|||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4MSB);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
|
@ -655,7 +655,7 @@ static int surface_testOverflow(void *arg)
|
|||
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4MSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
|
@ -665,7 +665,7 @@ static int surface_testOverflow(void *arg)
|
|||
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1MSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
|
@ -674,7 +674,7 @@ static int surface_testOverflow(void *arg)
|
|||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1MSB);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
|
@ -683,7 +683,7 @@ static int surface_testOverflow(void *arg)
|
|||
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
|
||||
surface = SDL_CreateSurfaceFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1MSB);
|
||||
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
|
|
Loading…
Reference in New Issue