13#define TESTRENDER_SCREEN_W 80
14#define TESTRENDER_SCREEN_H 60
16#define RENDER_COMPARE_FORMAT SDL_PIXELFORMAT_ARGB8888
17#define RENDER_COMPARE_AMASK 0xff000000
18#define RENDER_COMPARE_RMASK 0x00ff0000
19#define RENDER_COMPARE_GMASK 0x0000ff00
20#define RENDER_COMPARE_BMASK 0x000000ff
22#define ALLOWABLE_ERROR_OPAQUE 0
23#define ALLOWABLE_ERROR_BLENDED 64
45 int posX = 100, posY = 100,
width = 320,
height = 240;
129 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
132 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
140 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
143 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
151 for (
y=0;
y<3;
y++) {
154 if (ret != 0) checkFailCount1++;
157 if (ret != 0) checkFailCount2++;
160 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
161 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount2);
168 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
171 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
174 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
177 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
180 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
183 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
186 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
189 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
232 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
235 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
238 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
245 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
248 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
251 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
258 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
261 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
264 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
271 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
274 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
277 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
286 if (ret != 0) checkFailCount1++;
290 if (ret != 0) checkFailCount2++;
293 if (ret != 0) checkFailCount3++;
295 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
296 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
297 SDLTest_AssertCheck(checkFailCount3 == 0,
"Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
304 if (ret != 0) checkFailCount1++;
308 if (ret != 0) checkFailCount2++;
311 if (ret != 0) checkFailCount3++;
313 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
314 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
315 SDLTest_AssertCheck(checkFailCount3 == 0,
"Validate results from calls to SDL_RenderDrawLine, expected: 0, got: %i", checkFailCount3);
324 if (ret != 0) checkFailCount1++;
328 if (ret != 0) checkFailCount2++;
331 if (ret != 0) checkFailCount3++;
334 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetRenderDrawColor, expected: 0, got: %i", checkFailCount1);
335 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
336 SDLTest_AssertCheck(checkFailCount3 == 0,
"Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
388 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_QueryTexture, expected 0, got %i", ret);
396 for (
j=0;
j <= nj;
j+=4) {
397 for (
i=0;
i <= ni;
i+=4) {
402 if (ret != 0) checkFailCount1++;
405 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
456 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_QueryTexture, expected 0, got %i", ret);
465 for (
j=0;
j <= nj;
j+=4) {
466 for (
i=0;
i <= ni;
i+=4) {
469 if (ret != 0) checkFailCount1++;
475 if (ret != 0) checkFailCount2++;
478 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
479 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
533 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_QueryTexture, expected 0, got %i", ret);
542 for (
j=0;
j <= nj;
j+=4) {
543 for (
i=0;
i <= ni;
i+=4) {
546 if (ret != 0) checkFailCount1++;
552 if (ret != 0) checkFailCount2++;
555 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
556 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
598 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_QueryTexture, expected 0, got %i", ret);
607 for (
j=0;
j <= nj;
j+=4) {
608 for (
i=0;
i <= ni;
i+=4) {
611 if (ret != 0) checkFailCount1++;
617 if (ret != 0) checkFailCount2++;
620 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount1);
621 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
663 SDLTest_AssertCheck(ret == 0,
"Verify result from SDL_QueryTexture, expected 0, got %i", ret);
671 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
721 for (
j=0;
j <= nj;
j+=4) {
722 for (
i=0;
i <= ni;
i+=4) {
726 if (ret != 0) checkFailCount1++;
730 if (ret != 0) checkFailCount2++;
739 if (ret != 0) checkFailCount3++;
745 if (ret != 0) checkFailCount4++;
748 SDLTest_AssertCheck(checkFailCount1 == 0,
"Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
749 SDLTest_AssertCheck(checkFailCount2 == 0,
"Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount2);
750 SDLTest_AssertCheck(checkFailCount3 == 0,
"Validate results from calls to SDL_SetTextureBlendMode, expected: 0, got: %i", checkFailCount3);
751 SDLTest_AssertCheck(checkFailCount4 == 0,
"Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount4);
811 else if ((
r != 100) || (
g != 100) || (
b != 100) || (
a != 100))
936 else if ((
r != 100) || (
g != 100) || (
b != 100))
1042 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
1046 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_RenderClear, expected: 0, got: %i", ret);
1053 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
1056 SDLTest_AssertCheck(ret == 0,
"Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
#define SDL_SetTextureAlphaMod
#define SDL_RenderPresent
#define SDL_DestroyWindow
#define SDL_RenderFillRect
#define SDL_DestroyRenderer
#define SDL_DestroyTexture
#define SDL_GetTextureAlphaMod
#define SDL_SetRenderDrawColor
#define SDL_CreateTextureFromSurface
#define SDL_RenderDrawLine
#define SDL_GetRenderDrawColor
#define SDL_GetRenderDrawBlendMode
#define SDL_SetRenderDrawBlendMode
#define SDL_GetTextureColorMod
#define SDL_CreateRenderer
#define SDL_RenderDrawPoint
#define SDL_SetTextureBlendMode
#define SDL_GetNumRenderDrivers
#define SDL_CreateRGBSurfaceFrom
#define SDL_SetTextureColorMod
#define SDL_RenderReadPixels
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
GLint GLint GLsizei width
GLdouble GLdouble GLdouble r
GLint GLint GLint GLint GLint x
GLint GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLenum GLuint GLint GLenum face
@ SDL_RENDERER_ACCELERATED
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.
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 SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
int(* SDLTest_TestCaseFp)(void *arg)
SDL_Surface * SDLTest_ImageBlitBlendNone(void)
Returns the BlitBlendNone test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitBlend(void)
Returns the BlitBlend test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitBlendAdd(void)
Returns the BlitBlendAdd test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitBlendAll(void)
Returns the BlitBlendAll test image as SDL_Surface.
SDL_Surface * SDLTest_ImageFace(void)
Returns the Face test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlit(void)
Returns the Blit test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitAlpha(void)
Returns the BlitAlpha test image as SDL_Surface.
SDL_Surface * SDLTest_ImagePrimitives(void)
Returns the Primitives test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitBlendMod(void)
Returns the BlitBlendMod test image as SDL_Surface.
SDL_Surface * SDLTest_ImagePrimitivesBlend(void)
Returns the PrimitivesBlend test image as SDL_Surface.
SDL_Surface * SDLTest_ImageBlitColor(void)
Returns the BlitColor test image as SDL_Surface.
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
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)
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)
EGLSurface EGLNativeWindowType * window
A rectangle, with the origin at the upper left (integer).
A collection of pixels used in software blitting.
The type used to identify a window.
int render_testBlitAlpha(void *arg)
Tests blitting with alpha.
static const SDLTest_TestCaseReference renderTest2
int render_testPrimitives(void *arg)
Tests the SDL primitives for rendering.
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.
SDLTest_TestSuiteReference renderTestSuite
int render_testBlitBlend(void *arg)
Tests some more blitting routines.
#define RENDER_COMPARE_RMASK
#define ALLOWABLE_ERROR_OPAQUE
static const SDLTest_TestCaseReference renderTest6
static SDL_Texture * _loadTestFace(void)
Loads the test image 'Face' as texture. Helper function.
#define TESTRENDER_SCREEN_H
int render_testBlit(void *arg)
Tests some blitting routines.
static int _hasTexColor(void)
Test to see if can set texture color mode. Helper function.
static void _testBlitBlendMode(SDL_Texture *tface, int mode)
Tests a blend mode.
#define TESTRENDER_SCREEN_W
static const SDLTest_TestCaseReference renderTest1
static int _hasTexAlpha(void)
Test to see if we can vary the alpha of the texture. Helper function.
#define RENDER_COMPARE_AMASK
static const SDLTest_TestCaseReference * renderTests[]
void CleanupDestroyRenderer(void *arg)
static int _clearScreen(void)
Clears the screen. Helper function.
int render_testGetNumRenderDrivers(void *arg)
Tests call to SDL_GetNumRenderDrivers.
void InitCreateRenderer(void *arg)
int render_testBlitColor(void *arg)
Blits doing color tests.
#define RENDER_COMPARE_FORMAT
static int _hasBlendModes(void)
Test to see if we can vary the blend mode. Helper function.
#define ALLOWABLE_ERROR_BLENDED
static const SDLTest_TestCaseReference renderTest3
#define RENDER_COMPARE_BMASK
static const SDLTest_TestCaseReference renderTest4
static const SDLTest_TestCaseReference renderTest5
int render_testPrimitivesBlend(void *arg)
Tests the SDL primitives with alpha for rendering.
#define RENDER_COMPARE_GMASK
static int _hasDrawColor(void)
Test to see if we can vary the draw color. Helper function.
static const SDLTest_TestCaseReference renderTest7
static SDL_Surface * testSurface
static SDL_Surface * referenceSurface