Go to the documentation of this file.
7 #define _CRT_SECURE_NO_DEPRECATE
8 #define _CRT_NONSTDC_NO_DEPRECATE
32 #define TEST_SURFACE_WIDTH testSurface->w
33 #define TEST_SURFACE_HEIGHT testSurface->h
44 Uint32 rmask, gmask, bmask, amask;
45 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
92 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_FillRect, expected: 0, got: %i", ret);
123 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetSurfaceAlphaMod(), expected: 0, got: %i", ret);
128 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetSurfaceColorMod(), expected: 0, got: %i", ret);
133 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetColorKey(), expected: 0, got: %i", ret);
150 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetSurfaceBlendMode(..., %i), expected: 0, got: %i",
mode, ret);
158 for (
j=0;
j <= nj;
j+=4) {
159 for (
i=0;
i <= ni;
i+=4) {
163 if (ret != 0) checkFailCount2++;
165 else if (
mode == -3) {
168 if (ret != 0) checkFailCount3++;
170 else if (
mode == -4) {
172 nmode = (
i/4*
j/4) % 4;
175 }
else if (nmode==1) {
177 }
else if (nmode==2) {
179 }
else if (nmode==3) {
183 if (ret != 0) checkFailCount4++;
190 if (ret != 0) checkFailCount1++;
193 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_BlitSurface, expected: 0, got: %i", checkFailCount1);
194 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_SetSurfaceColorMod, expected: 0, got: %i", checkFailCount2);
195 SDLTest_AssertCheck(checkFailCount3 == 0,
"Validate results from calls to SDL_SetSurfaceAlphaMod, expected: 0, got: %i", checkFailCount3);
196 SDLTest_AssertCheck(checkFailCount4 == 0,
"Validate results from calls to SDL_SetSurfaceBlendMode, expected: 0, got: %i", checkFailCount4);
223 const char *sampleFilename =
"testSaveLoadBitmap.bmp";
233 unlink(sampleFilename);
238 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SaveBMP, expected: 0, got: %i", ret);
251 unlink(sampleFilename);
278 if (
face->format->palette) {
281 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
291 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
309 Uint32 pixel_formats[] = {
349 if (
face->format->palette) {
352 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_SetColorKey, expected: 0, got: %i", ret);
369 (fmt1->
Amask != 0) == (
face->format->Amask != 0) &&
370 (fmt2->
Amask != 0) == (
face->format->Amask != 0) ) {
376 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
421 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
444 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
467 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
491 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
514 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
537 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
560 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
583 SDLTest_AssertCheck(ret == 0,
"Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
@ SDL_PIXELFORMAT_ARGB1555
static const SDLTest_TestCaseReference surfaceTest2
@ SDL_PIXELFORMAT_BGRA4444
int surface_testBlitColorMod(void *arg)
Tests some blitting routines with color mod.
SDL_Surface * SDLTest_ImageBlitBlendAdd(void)
Returns the BlitBlendAdd test image as SDL_Surface.
static SDL_BlendMode blendMode
A collection of pixels used in software blitting.
int surface_testBlitBlendNone(void *arg)
Tests some more blitting routines.
@ SDL_PIXELFORMAT_RGBX8888
static SDL_Surface * referenceSurface
static const SDLTest_TestCaseReference surfaceTest9
static const SDLTest_TestCaseReference surfaceTest7
void _surfaceSetUp(void *arg)
SDL_Surface * SDLTest_ImageBlitColor(void)
Returns the BlitColor test image as SDL_Surface.
#define SDL_ConvertSurface
static const SDLTest_TestCaseReference surfaceTest4
static const SDLTest_TestCaseReference surfaceTest10
@ SDL_PIXELFORMAT_BGRX8888
int surface_testLoadFailure(void *arg)
Tests sprite loading. A failure case.
int surface_testBlit(void *arg)
Tests some blitting routines.
#define SDL_GetSurfaceBlendMode
int surface_testCompleteSurfaceConversion(void *arg)
void _AssertFileExist(const char *filename)
SDL_Surface * SDLTest_ImageFace(void)
Returns the Face test image as SDL_Surface.
static const SDLTest_TestCaseReference surfaceTest5
int surface_testBlitBlendAdd(void *arg)
Tests some more blitting routines.
@ SDL_PIXELFORMAT_ARGB4444
@ SDL_PIXELFORMAT_RGBA5551
int(* SDLTest_TestCaseFp)(void *arg)
#define SDL_SetSurfaceColorMod
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
static const SDLTest_TestCaseReference surfaceTest8
int surface_testBlitBlendBlend(void *arg)
Tests some more blitting routines.
@ SDL_PIXELFORMAT_ARGB2101010
int surface_testSurfaceConversion(void *arg)
@ SDL_PIXELFORMAT_ABGR1555
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
int surface_testBlitBlendLoop(void *arg)
Tests some more blitting routines with loop.
static SDL_Surface * testSurface
@ SDL_PIXELFORMAT_ABGR4444
@ SDL_PIXELFORMAT_ARGB8888
#define SDL_LoadBMP(file)
SDL_Surface * SDLTest_ImageBlitBlendAll(void)
Returns the BlitBlendAll test image as SDL_Surface.
#define SDL_assert(condition)
@ SDL_PIXELFORMAT_RGBA4444
int surface_testBlitAlphaMod(void *arg)
Tests some blitting routines with alpha mod.
SDL_Surface * SDLTest_ImageBlitBlendNone(void)
Returns the BlitBlendNone test image as SDL_Surface.
void _surfaceTearDown(void *arg)
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
#define SDL_CreateRGBSurface
static const SDLTest_TestCaseReference surfaceTest11
#define SDL_arraysize(array)
void _testBlitBlendMode(int mode)
SDLTest_TestSuiteReference surfaceTestSuite
static const SDLTest_TestCaseReference surfaceTest12
@ SDL_PIXELFORMAT_RGBA8888
A rectangle, with the origin at the upper left (integer).
SDL_Surface * SDLTest_ImageBlitAlpha(void)
Returns the BlitAlpha test image as SDL_Surface.
@ SDL_PIXELFORMAT_BGRA5551
static const SDLTest_TestCaseReference * surfaceTests[]
@ SDL_PIXELFORMAT_BGRA8888
#define SDL_SetSurfaceBlendMode
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
static const SDLTest_TestCaseReference surfaceTest6
GLenum GLuint GLint GLenum face
#define SDL_SaveBMP(surface, file)
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst st
@ SDL_PIXELFORMAT_ABGR8888
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
int surface_testSaveLoadBitmap(void *arg)
Tests sprite saving and loading.
SDL_Surface * SDLTest_ImageBlitBlend(void)
Returns the BlitBlend test image as SDL_Surface.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
static const SDLTest_TestCaseReference surfaceTest3
SDL_Surface * SDLTest_ImageBlitBlendMod(void)
Returns the BlitBlendMod test image as SDL_Surface.
static const SDLTest_TestCaseReference surfaceTest1
#define SDL_SetSurfaceAlphaMod
SDL_Surface * SDLTest_ImageBlit(void)
Returns the Blit test image as SDL_Surface.
int surface_testBlitBlendMod(void *arg)
Tests some more blitting routines.