SDL  2.0
testautomation_render.c File Reference
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for testautomation_render.c:

Go to the source code of this file.

Macros

#define TESTRENDER_SCREEN_W   80
 
#define TESTRENDER_SCREEN_H   60
 
#define RENDER_COMPARE_FORMAT   SDL_PIXELFORMAT_ARGB8888
 
#define RENDER_COMPARE_AMASK   0xff000000
 
#define RENDER_COMPARE_RMASK   0x00ff0000
 
#define RENDER_COMPARE_GMASK   0x0000ff00
 
#define RENDER_COMPARE_BMASK   0x000000ff
 
#define ALLOWABLE_ERROR_OPAQUE   0
 
#define ALLOWABLE_ERROR_BLENDED   64
 

Functions

static int _clearScreen (void)
 Clears the screen. Helper function. More...
 
static void _compare (SDL_Surface *referenceSurface, int allowable_error)
 Compares screen pixels with image pixels. Helper function. More...
 
static int _hasTexAlpha (void)
 Test to see if we can vary the alpha of the texture. Helper function. More...
 
static int _hasTexColor (void)
 Test to see if can set texture color mode. Helper function. More...
 
static SDL_Texture_loadTestFace (void)
 Loads the test image 'Face' as texture. Helper function. More...
 
static int _hasBlendModes (void)
 Test to see if we can vary the blend mode. Helper function. More...
 
static int _hasDrawColor (void)
 Test to see if we can vary the draw color. Helper function. More...
 
static int _isSupported (int code)
 Checks to see if functionality is supported. Helper function. More...
 
void InitCreateRenderer (void *arg)
 
void CleanupDestroyRenderer (void *arg)
 
int render_testGetNumRenderDrivers (void *arg)
 Tests call to SDL_GetNumRenderDrivers. More...
 
int render_testPrimitives (void *arg)
 Tests the SDL primitives for rendering. More...
 
int render_testPrimitivesBlend (void *arg)
 Tests the SDL primitives with alpha for rendering. More...
 
int render_testBlit (void *arg)
 Tests some blitting routines. More...
 
int render_testBlitColor (void *arg)
 Blits doing color tests. More...
 
int render_testBlitAlpha (void *arg)
 Tests blitting with alpha. More...
 
static void _testBlitBlendMode (SDL_Texture *tface, int mode)
 Tests a blend mode. More...
 
int render_testBlitBlend (void *arg)
 Tests some more blitting routines. More...
 

Variables

SDL_Windowwindow = NULL
 
SDL_Rendererrenderer = NULL
 
static const SDLTest_TestCaseReference renderTest1
 
static const SDLTest_TestCaseReference renderTest2
 
static const SDLTest_TestCaseReference renderTest3
 
static const SDLTest_TestCaseReference renderTest4
 
static const SDLTest_TestCaseReference renderTest5
 
static const SDLTest_TestCaseReference renderTest6
 
static const SDLTest_TestCaseReference renderTest7
 
static const SDLTest_TestCaseReferencerenderTests []
 
SDLTest_TestSuiteReference renderTestSuite
 

Macro Definition Documentation

◆ ALLOWABLE_ERROR_BLENDED

#define ALLOWABLE_ERROR_BLENDED   64

◆ ALLOWABLE_ERROR_OPAQUE

#define ALLOWABLE_ERROR_OPAQUE   0

◆ RENDER_COMPARE_AMASK

#define RENDER_COMPARE_AMASK   0xff000000

Alpha bit mask.

Definition at line 17 of file testautomation_render.c.

Referenced by _compare().

◆ RENDER_COMPARE_BMASK

#define RENDER_COMPARE_BMASK   0x000000ff

Blue bit mask.

Definition at line 20 of file testautomation_render.c.

Referenced by _compare().

◆ RENDER_COMPARE_FORMAT

#define RENDER_COMPARE_FORMAT   SDL_PIXELFORMAT_ARGB8888

Definition at line 16 of file testautomation_render.c.

Referenced by _compare().

◆ RENDER_COMPARE_GMASK

#define RENDER_COMPARE_GMASK   0x0000ff00

Green bit mask.

Definition at line 19 of file testautomation_render.c.

Referenced by _compare().

◆ RENDER_COMPARE_RMASK

#define RENDER_COMPARE_RMASK   0x00ff0000

Red bit mask.

Definition at line 18 of file testautomation_render.c.

Referenced by _compare().

◆ TESTRENDER_SCREEN_H

◆ TESTRENDER_SCREEN_W

#define TESTRENDER_SCREEN_W   80

Original code: automated SDL platform test written by Edgar Simo "bobbens" Extended and extensively updated by aschiffler at ferzkopp dot net

Definition at line 13 of file testautomation_render.c.

Referenced by _compare(), _testBlitBlendMode(), render_testBlit(), render_testBlitAlpha(), render_testBlitBlend(), render_testBlitColor(), render_testPrimitives(), and render_testPrimitivesBlend().

Function Documentation

◆ _clearScreen()

static int _clearScreen ( void  )
static

Clears the screen. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor http://wiki.libsdl.org/moin.cgi/SDL_RenderClear http://wiki.libsdl.org/moin.cgi/SDL_RenderPresent http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode

Definition at line 1036 of file testautomation_render.c.

References SDL_ALPHA_OPAQUE, SDL_BLENDMODE_NONE, SDL_RenderClear, SDL_RenderPresent, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, and SDLTest_AssertCheck().

Referenced by _testBlitBlendMode(), render_testBlit(), render_testBlitAlpha(), render_testBlitBlend(), render_testBlitColor(), render_testPrimitives(), and render_testPrimitivesBlend().

1037 {
1038  int ret;
1039 
1040  /* Set color. */
1042  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
1043 
1044  /* Clear screen. */
1045  ret = SDL_RenderClear(renderer);
1046  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderClear, expected: 0, got: %i", ret);
1047 
1048  /* Make current */
1050 
1051  /* Set defaults. */
1053  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
1054 
1055  ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE );
1056  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
1057 
1058  return 0;
1059 }
#define SDL_SetRenderDrawBlendMode
SDL_Renderer * renderer
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...
#define SDL_RenderClear
#define SDL_SetRenderDrawColor
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:46
#define SDL_RenderPresent

◆ _compare()

static void _compare ( SDL_Surface referenceSurface,
int  allowable_error 
)
static

Compares screen pixels with image pixels. Helper function.

Parameters
sImage to compare against.
See also
http://wiki.libsdl.org/moin.cgi/SDL_RenderReadPixels http://wiki.libsdl.org/moin.cgi/SDL_CreateRGBSurfaceFrom http://wiki.libsdl.org/moin.cgi/SDL_FreeSurface

Definition at line 992 of file testautomation_render.c.

References SDL_Rect::h, NULL, rect, RENDER_COMPARE_AMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_FORMAT, RENDER_COMPARE_GMASK, RENDER_COMPARE_RMASK, SDL_CreateRGBSurfaceFrom, SDL_free, SDL_FreeSurface, SDL_malloc, SDL_RenderReadPixels, SDLTest_AssertCheck(), SDLTest_CompareSurfaces(), TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, testSurface, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by render_testBlit(), render_testBlitAlpha(), render_testBlitBlend(), render_testBlitColor(), render_testPrimitives(), and render_testPrimitivesBlend().

993 {
994  int result;
995  SDL_Rect rect;
996  Uint8 *pixels;
998 
999  /* Read pixels. */
1001  SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
1002  if (pixels == NULL) return;
1003 
1004  /* Explicitly specify the rect in case the window isn't the expected size... */
1005  rect.x = 0;
1006  rect.y = 0;
1007  rect.w = TESTRENDER_SCREEN_W;
1008  rect.h = TESTRENDER_SCREEN_H;
1009  result = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pixels, 80*4 );
1010  SDLTest_AssertCheck(result == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", result);
1011 
1012  /* Create surface. */
1013  testSurface = SDL_CreateRGBSurfaceFrom(pixels, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
1015  SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom is not NULL");
1016 
1017  /* Compare surface. */
1018  result = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
1019  SDLTest_AssertCheck(result == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", result);
1020 
1021  /* Clean up. */
1022  SDL_free(pixels);
1023  SDL_FreeSurface(testSurface);
1024 }
#define SDL_RenderReadPixels
#define RENDER_COMPARE_RMASK
int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error)
Compares a surface and with reference image data for equality.
GLuint64EXT * result
SDL_Rect rect
Definition: testrelative.c:27
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
#define RENDER_COMPARE_AMASK
#define SDL_CreateRGBSurfaceFrom
#define RENDER_COMPARE_FORMAT
SDL_Renderer * renderer
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...
#define SDL_FreeSurface
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define SDL_free
int x
Definition: SDL_rect.h:66
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: SDL_opengl.h:1572
int w
Definition: SDL_rect.h:67
#define NULL
Definition: begin_code.h:164
#define RENDER_COMPARE_BMASK
int h
Definition: SDL_rect.h:67
static SDL_Surface * testSurface
#define TESTRENDER_SCREEN_W
#define SDL_malloc
#define RENDER_COMPARE_GMASK
#define TESTRENDER_SCREEN_H
int y
Definition: SDL_rect.h:66
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

◆ _hasBlendModes()

static int _hasBlendModes ( void  )
static

Test to see if we can vary the blend mode. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawBlendMode

Definition at line 824 of file testautomation_render.c.

References _isSupported(), SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_NONE, SDL_GetRenderDrawBlendMode, and SDL_SetRenderDrawBlendMode.

Referenced by render_testBlitBlend(), and render_testPrimitivesBlend().

825 {
826  int fail;
827  int ret;
829 
830  fail = 0;
831 
833  if (!_isSupported(ret))
834  fail = 1;
835  ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
836  if (!_isSupported(ret))
837  fail = 1;
838  ret = (mode != SDL_BLENDMODE_BLEND);
839  if (!_isSupported(ret))
840  fail = 1;
842  if (!_isSupported(ret))
843  fail = 1;
844  ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
845  if (!_isSupported(ret))
846  fail = 1;
847  ret = (mode != SDL_BLENDMODE_ADD);
848  if (!_isSupported(ret))
849  fail = 1;
851  if (!_isSupported(ret))
852  fail = 1;
853  ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
854  if (!_isSupported(ret))
855  fail = 1;
856  ret = (mode != SDL_BLENDMODE_MOD);
857  if (!_isSupported(ret))
858  fail = 1;
860  if (!_isSupported(ret))
861  fail = 1;
862  ret = SDL_GetRenderDrawBlendMode(renderer, &mode );
863  if (!_isSupported(ret))
864  fail = 1;
865  ret = (mode != SDL_BLENDMODE_NONE);
866  if (!_isSupported(ret))
867  fail = 1;
868 
869  return !fail;
870 }
#define SDL_GetRenderDrawBlendMode
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
#define SDL_SetRenderDrawBlendMode
SDL_Renderer * renderer
GLenum mode
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.

◆ _hasDrawColor()

static int _hasDrawColor ( void  )
static

Test to see if we can vary the draw color. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor http://wiki.libsdl.org/moin.cgi/SDL_GetRenderDrawColor

Definition at line 786 of file testautomation_render.c.

References _isSupported(), SDL_ALPHA_OPAQUE, SDL_GetRenderDrawColor, and SDL_SetRenderDrawColor.

Referenced by render_testBlit(), render_testPrimitives(), and render_testPrimitivesBlend().

787 {
788  int ret, fail;
789  Uint8 r, g, b, a;
790 
791  fail = 0;
792 
793  /* Set color. */
794  ret = SDL_SetRenderDrawColor(renderer, 100, 100, 100, 100 );
795  if (!_isSupported(ret))
796  fail = 1;
797  ret = SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a );
798  if (!_isSupported(ret))
799  fail = 1;
800 
801  /* Restore natural. */
803  if (!_isSupported(ret))
804  fail = 1;
805 
806  /* Something failed, consider not available. */
807  if (fail)
808  return 0;
809 
810  /* Not set properly, consider failed. */
811  else if ((r != 100) || (g != 100) || (b != 100) || (a != 100))
812  return 0;
813  return 1;
814 }
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
SDL_Renderer * renderer
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define SDL_GetRenderDrawColor
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.
#define SDL_SetRenderDrawColor
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:46
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean g
GLboolean GLboolean GLboolean b

◆ _hasTexAlpha()

static int _hasTexAlpha ( void  )
static

Test to see if we can vary the alpha of the texture. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod http://wiki.libsdl.org/moin.cgi/SDL_GetTextureAlphaMod http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 950 of file testautomation_render.c.

References _isSupported(), _loadTestFace(), NULL, SDL_DestroyTexture, SDL_GetTextureAlphaMod, and SDL_SetTextureAlphaMod.

Referenced by render_testBlitAlpha(), and render_testBlitBlend().

951 {
952  int fail;
953  int ret;
954  SDL_Texture *tface;
955  Uint8 a;
956 
957  /* Get test face. */
958  tface = _loadTestFace();
959  if (tface == NULL)
960  return 0;
961 
962  /* See if supported. */
963  fail = 0;
964  ret = SDL_SetTextureAlphaMod( tface, 100 );
965  if (!_isSupported(ret))
966  fail = 1;
967  ret = SDL_GetTextureAlphaMod( tface, &a );
968  if (!_isSupported(ret))
969  fail = 1;
970 
971  /* Clean up. */
972  SDL_DestroyTexture( tface );
973 
974  if (fail)
975  return 0;
976  else if (a != 100)
977  return 0;
978  return 1;
979 }
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_GetTextureAlphaMod
uint8_t Uint8
Definition: SDL_stdinc.h:157
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.
#define NULL
Definition: begin_code.h:164
#define SDL_DestroyTexture
GLboolean GLboolean GLboolean GLboolean a
#define SDL_SetTextureAlphaMod

◆ _hasTexColor()

static int _hasTexColor ( void  )
static

Test to see if can set texture color mode. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod http://wiki.libsdl.org/moin.cgi/SDL_GetTextureColorMod http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 910 of file testautomation_render.c.

References _isSupported(), _loadTestFace(), NULL, SDL_DestroyTexture, SDL_GetTextureColorMod, and SDL_SetTextureColorMod.

Referenced by render_testBlitBlend().

911 {
912  int fail;
913  int ret;
914  SDL_Texture *tface;
915  Uint8 r, g, b;
916 
917  /* Get test face. */
918  tface = _loadTestFace();
919  if (tface == NULL)
920  return 0;
921 
922  /* See if supported. */
923  fail = 0;
924  ret = SDL_SetTextureColorMod( tface, 100, 100, 100 );
925  if (!_isSupported(ret))
926  fail = 1;
927  ret = SDL_GetTextureColorMod( tface, &r, &g, &b );
928  if (!_isSupported(ret))
929  fail = 1;
930 
931  /* Clean up. */
932  SDL_DestroyTexture( tface );
933 
934  if (fail)
935  return 0;
936  else if ((r != 100) || (g != 100) || (b != 100))
937  return 0;
938  return 1;
939 }
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_GetTextureColorMod
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define SDL_SetTextureColorMod
static int _isSupported(int code)
Checks to see if functionality is supported. Helper function.
#define NULL
Definition: begin_code.h:164
#define SDL_DestroyTexture
GLboolean GLboolean g
GLboolean GLboolean GLboolean b

◆ _isSupported()

static int _isSupported ( int  code)
static

Checks to see if functionality is supported. Helper function.

Definition at line 773 of file testautomation_render.c.

Referenced by _hasBlendModes(), _hasDrawColor(), _hasTexAlpha(), and _hasTexColor().

774 {
775  return (code == 0);
776 }

◆ _loadTestFace()

static SDL_Texture * _loadTestFace ( void  )
static

Loads the test image 'Face' as texture. Helper function.

See also
http://wiki.libsdl.org/moin.cgi/SDL_CreateTextureFromSurface

Definition at line 880 of file testautomation_render.c.

References NULL, SDL_CreateTextureFromSurface, SDL_FreeSurface, SDL_GetError, SDLTest_ImageFace(), and SDLTest_LogError().

Referenced by _hasTexAlpha(), _hasTexColor(), render_testBlit(), render_testBlitAlpha(), render_testBlitBlend(), and render_testBlitColor().

881 {
882  SDL_Surface *face;
883  SDL_Texture *tface;
884 
885  face = SDLTest_ImageFace();
886  if (face == NULL) {
887  return NULL;
888  }
889 
890  tface = SDL_CreateTextureFromSurface(renderer, face);
891  if (tface == NULL) {
892  SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError());
893  }
894 
895  SDL_FreeSurface(face);
896 
897  return tface;
898 }
#define SDL_GetError
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
SDL_Surface * SDLTest_ImageFace(void)
Returns the Face test image as SDL_Surface.
SDL_Renderer * renderer
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.
Definition: SDL_test_log.c:103
GLenum GLuint GLint GLenum face
#define SDL_CreateTextureFromSurface
#define SDL_FreeSurface
#define NULL
Definition: begin_code.h:164

◆ _testBlitBlendMode()

static void _testBlitBlendMode ( SDL_Texture tface,
int  mode 
)
static

Tests a blend mode.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy

Definition at line 583 of file testautomation_render.c.

References _clearScreen(), SDL_Rect::h, i, j, NULL, rect, SDL_QueryTexture, SDL_RenderCopy, SDL_SetTextureBlendMode, SDLTest_AssertCheck(), TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by render_testBlitBlend().

584 {
585  int ret;
586  Uint32 tformat;
587  int taccess, tw, th;
588  int i, j, ni, nj;
589  SDL_Rect rect;
590  int checkFailCount1;
591  int checkFailCount2;
592 
593  /* Clear surface. */
594  _clearScreen();
595 
596  /* Constant values. */
597  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
598  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
599  rect.w = tw;
600  rect.h = th;
601  ni = TESTRENDER_SCREEN_W - tw;
602  nj = TESTRENDER_SCREEN_H - th;
603 
604  /* Test blend mode. */
605  checkFailCount1 = 0;
606  checkFailCount2 = 0;
607  for (j=0; j <= nj; j+=4) {
608  for (i=0; i <= ni; i+=4) {
609  /* Set blend mode. */
610  ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
611  if (ret != 0) checkFailCount1++;
612 
613  /* Blitting. */
614  rect.x = i;
615  rect.y = j;
616  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
617  if (ret != 0) checkFailCount2++;
618  }
619  }
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);
622 }
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
SDL_Rect rect
Definition: testrelative.c:27
#define SDL_SetTextureBlendMode
uint32_t Uint32
Definition: SDL_stdinc.h:181
#define SDL_RenderCopy
SDL_Renderer * renderer
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...
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)
Definition: SDL_x11sym.h:50
#define SDL_QueryTexture
GLenum mode
int x
Definition: SDL_rect.h:66
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define TESTRENDER_SCREEN_H
int y
Definition: SDL_rect.h:66
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64

◆ CleanupDestroyRenderer()

void CleanupDestroyRenderer ( void arg)

Definition at line 66 of file testautomation_render.c.

References NULL, SDL_DestroyRenderer, SDL_DestroyWindow, and SDLTest_AssertPass().

67 {
68  if (renderer != NULL) {
70  renderer = NULL;
71  SDLTest_AssertPass("SDL_DestroyRenderer()");
72  }
73 
74  if (window != NULL) {
76  window = NULL;
77  SDLTest_AssertPass("SDL_DestroyWindow");
78  }
79 }
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.
SDL_Renderer * renderer
#define NULL
Definition: begin_code.h:164
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
#define SDL_DestroyRenderer
#define SDL_DestroyWindow

◆ InitCreateRenderer()

void InitCreateRenderer ( void arg)

Create software renderer for tests

Definition at line 43 of file testautomation_render.c.

References NULL, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyWindow, SDL_RENDERER_ACCELERATED, SDLTest_AssertCheck(), and SDLTest_AssertPass().

44 {
45  int posX = 100, posY = 100, width = 320, height = 240;
46  renderer = NULL;
47  window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0);
48  SDLTest_AssertPass("SDL_CreateWindow()");
49  SDLTest_AssertCheck(window != NULL, "Check SDL_CreateWindow result");
50  if (window == NULL) {
51  return;
52  }
53 
55  SDLTest_AssertPass("SDL_CreateRenderer()");
56  SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
57  if (renderer == NULL) {
59  return;
60  }
61 }
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.
#define SDL_CreateWindow
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_Renderer * renderer
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...
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
EGLSurface EGLNativeWindowType * window
Definition: eglext.h:1025
#define SDL_DestroyWindow
#define SDL_CreateRenderer

◆ render_testBlit()

int render_testBlit ( void arg)

Tests some blitting routines.

See also
http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 362 of file testautomation_render.c.

References _clearScreen(), _compare(), _hasDrawColor(), _loadTestFace(), ALLOWABLE_ERROR_OPAQUE, SDL_Rect::h, i, j, NULL, rect, referenceSurface, SDL_DestroyTexture, SDL_FreeSurface, SDL_QueryTexture, SDL_RenderCopy, SDL_RenderPresent, SDLTest_AssertCheck(), SDLTest_ImageBlit(), TEST_ABORTED, TEST_COMPLETED, TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

363 {
364  int ret;
365  SDL_Rect rect;
366  SDL_Texture *tface;
368  Uint32 tformat;
369  int taccess, tw, th;
370  int i, j, ni, nj;
371  int checkFailCount1;
372 
373  /* Clear surface. */
374  _clearScreen();
375 
376  /* Need drawcolor or just skip test. */
377  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor)");
378 
379  /* Create face surface. */
380  tface = _loadTestFace();
381  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
382  if (tface == NULL) {
383  return TEST_ABORTED;
384  }
385 
386  /* Constant values. */
387  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
388  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
389  rect.w = tw;
390  rect.h = th;
391  ni = TESTRENDER_SCREEN_W - tw;
392  nj = TESTRENDER_SCREEN_H - th;
393 
394  /* Loop blit. */
395  checkFailCount1 = 0;
396  for (j=0; j <= nj; j+=4) {
397  for (i=0; i <= ni; i+=4) {
398  /* Blitting. */
399  rect.x = i;
400  rect.y = j;
401  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
402  if (ret != 0) checkFailCount1++;
403  }
404  }
405  SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
406 
407  /* Make current */
409 
410  /* See if it's the same */
411  referenceSurface = SDLTest_ImageBlit();
412  _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
413 
414  /* Clean up. */
415  SDL_DestroyTexture( tface );
416  SDL_FreeSurface(referenceSurface);
417  referenceSurface = NULL;
418 
419  return TEST_COMPLETED;
420 }
#define TEST_ABORTED
SDL_Rect rect
Definition: testrelative.c:27
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
uint32_t Uint32
Definition: SDL_stdinc.h:181
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_RenderCopy
SDL_Renderer * renderer
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...
#define SDL_FreeSurface
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)
Definition: SDL_x11sym.h:50
#define SDL_QueryTexture
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_OPAQUE
static int _hasDrawColor(void)
Test to see if we can vary the draw color. Helper function.
SDL_Surface * SDLTest_ImageBlit(void)
Returns the Blit test image as SDL_Surface.
#define SDL_DestroyTexture
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define TESTRENDER_SCREEN_H
static SDL_Surface * referenceSurface
int y
Definition: SDL_rect.h:66
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent

◆ render_testBlitAlpha()

int render_testBlitAlpha ( void arg)

Tests blitting with alpha.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 506 of file testautomation_render.c.

References _clearScreen(), _compare(), _hasTexAlpha(), _loadTestFace(), ALLOWABLE_ERROR_BLENDED, SDL_Rect::h, i, j, NULL, rect, referenceSurface, SDL_DestroyTexture, SDL_FreeSurface, SDL_QueryTexture, SDL_RenderCopy, SDL_RenderPresent, SDL_SetTextureAlphaMod, SDLTest_AssertCheck(), SDLTest_ImageBlitAlpha(), TEST_ABORTED, TEST_COMPLETED, TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

507 {
508  int ret;
509  SDL_Rect rect;
510  SDL_Texture *tface;
512  Uint32 tformat;
513  int taccess, tw, th;
514  int i, j, ni, nj;
515  int checkFailCount1;
516  int checkFailCount2;
517 
518  /* Clear surface. */
519  _clearScreen();
520 
521  /* Need alpha or just skip test. */
522  SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
523 
524  /* Create face surface. */
525  tface = _loadTestFace();
526  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
527  if (tface == NULL) {
528  return TEST_ABORTED;
529  }
530 
531  /* Constant values. */
532  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
533  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
534  rect.w = tw;
535  rect.h = th;
536  ni = TESTRENDER_SCREEN_W - tw;
537  nj = TESTRENDER_SCREEN_H - th;
538 
539  /* Test blitting with alpha mod. */
540  checkFailCount1 = 0;
541  checkFailCount2 = 0;
542  for (j=0; j <= nj; j+=4) {
543  for (i=0; i <= ni; i+=4) {
544  /* Set alpha mod. */
545  ret = SDL_SetTextureAlphaMod( tface, (255/ni)*i );
546  if (ret != 0) checkFailCount1++;
547 
548  /* Blitting. */
549  rect.x = i;
550  rect.y = j;
551  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
552  if (ret != 0) checkFailCount2++;
553  }
554  }
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);
557 
558  /* Make current */
560 
561  /* See if it's the same. */
562  referenceSurface = SDLTest_ImageBlitAlpha();
563  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
564 
565  /* Clean up. */
566  SDL_DestroyTexture( tface );
567  SDL_FreeSurface(referenceSurface);
568  referenceSurface = NULL;
569 
570  return TEST_COMPLETED;
571 }
#define TEST_ABORTED
SDL_Rect rect
Definition: testrelative.c:27
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
SDL_Surface * SDLTest_ImageBlitAlpha(void)
Returns the BlitAlpha test image as SDL_Surface.
uint32_t Uint32
Definition: SDL_stdinc.h:181
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_RenderCopy
SDL_Renderer * renderer
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...
#define SDL_FreeSurface
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)
Definition: SDL_x11sym.h:50
#define SDL_QueryTexture
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_BLENDED
#define SDL_DestroyTexture
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define TESTRENDER_SCREEN_H
static SDL_Surface * referenceSurface
int y
Definition: SDL_rect.h:66
static int _hasTexAlpha(void)
Test to see if we can vary the alpha of the texture. Helper function.
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent
#define SDL_SetTextureAlphaMod

◆ render_testBlitBlend()

int render_testBlitBlend ( void arg)

Tests some more blitting routines.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod http://wiki.libsdl.org/moin.cgi/SDL_SetTextureAlphaMod http://wiki.libsdl.org/moin.cgi/SDL_SetTextureBlendMode http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 635 of file testautomation_render.c.

References _clearScreen(), _compare(), _hasBlendModes(), _hasTexAlpha(), _hasTexColor(), _loadTestFace(), _testBlitBlendMode(), ALLOWABLE_ERROR_BLENDED, ALLOWABLE_ERROR_OPAQUE, SDL_Rect::h, i, j, NULL, rect, referenceSurface, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_MOD, SDL_BLENDMODE_NONE, SDL_DestroyTexture, SDL_FreeSurface, SDL_QueryTexture, SDL_RenderCopy, SDL_RenderPresent, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_SetTextureColorMod, SDLTest_AssertCheck(), SDLTest_ImageBlitBlend(), SDLTest_ImageBlitBlendAdd(), SDLTest_ImageBlitBlendAll(), SDLTest_ImageBlitBlendMod(), SDLTest_ImageBlitBlendNone(), TEST_ABORTED, TEST_COMPLETED, TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

636 {
637  int ret;
638  SDL_Rect rect;
639  SDL_Texture *tface;
641  Uint32 tformat;
642  int taccess, tw, th;
643  int i, j, ni, nj;
644  int mode;
645  int checkFailCount1;
646  int checkFailCount2;
647  int checkFailCount3;
648  int checkFailCount4;
649 
650  SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
651  SDLTest_AssertCheck(_hasTexColor(), "_hasTexColor");
652  SDLTest_AssertCheck(_hasTexAlpha(), "_hasTexAlpha");
653 
654  /* Create face surface. */
655  tface = _loadTestFace();
656  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
657  if (tface == NULL) {
658  return TEST_ABORTED;
659  }
660 
661  /* Constant values. */
662  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
663  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
664  rect.w = tw;
665  rect.h = th;
666  ni = TESTRENDER_SCREEN_W - tw;
667  nj = TESTRENDER_SCREEN_H - th;
668 
669  /* Set alpha mod. */
670  ret = SDL_SetTextureAlphaMod( tface, 100 );
671  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetTextureAlphaMod, expected: 0, got: %i", ret);
672 
673  /* Test None. */
675  referenceSurface = SDLTest_ImageBlitBlendNone();
676 
677  /* Make current and compare */
679  _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
680  SDL_FreeSurface(referenceSurface);
681  referenceSurface = NULL;
682 
683  /* Test Blend. */
685  referenceSurface = SDLTest_ImageBlitBlend();
686 
687  /* Make current and compare */
689  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
690  SDL_FreeSurface(referenceSurface);
691  referenceSurface = NULL;
692 
693  /* Test Add. */
695  referenceSurface = SDLTest_ImageBlitBlendAdd();
696 
697  /* Make current and compare */
699  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
700  SDL_FreeSurface(referenceSurface);
701  referenceSurface = NULL;
702 
703  /* Test Mod. */
705  referenceSurface = SDLTest_ImageBlitBlendMod();
706 
707  /* Make current and compare */
709  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
710  SDL_FreeSurface(referenceSurface);
711  referenceSurface = NULL;
712 
713  /* Clear surface. */
714  _clearScreen();
715 
716  /* Loop blit. */
717  checkFailCount1 = 0;
718  checkFailCount2 = 0;
719  checkFailCount3 = 0;
720  checkFailCount4 = 0;
721  for (j=0; j <= nj; j+=4) {
722  for (i=0; i <= ni; i+=4) {
723 
724  /* Set color mod. */
725  ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
726  if (ret != 0) checkFailCount1++;
727 
728  /* Set alpha mod. */
729  ret = SDL_SetTextureAlphaMod( tface, (100/ni)*i );
730  if (ret != 0) checkFailCount2++;
731 
732  /* Crazy blending mode magic. */
733  mode = (i/4*j/4) % 4;
734  if (mode==0) mode = SDL_BLENDMODE_NONE;
735  else if (mode==1) mode = SDL_BLENDMODE_BLEND;
736  else if (mode==2) mode = SDL_BLENDMODE_ADD;
737  else if (mode==3) mode = SDL_BLENDMODE_MOD;
738  ret = SDL_SetTextureBlendMode( tface, (SDL_BlendMode)mode );
739  if (ret != 0) checkFailCount3++;
740 
741  /* Blitting. */
742  rect.x = i;
743  rect.y = j;
744  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
745  if (ret != 0) checkFailCount4++;
746  }
747  }
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);
752 
753  /* Clean up. */
754  SDL_DestroyTexture( tface );
755 
756  /* Make current */
758 
759  /* Check to see if final image matches. */
760  referenceSurface = SDLTest_ImageBlitBlendAll();
761  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
762  SDL_FreeSurface(referenceSurface);
763  referenceSurface = NULL;
764 
765  return TEST_COMPLETED;
766 }
#define TEST_ABORTED
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
SDL_Rect rect
Definition: testrelative.c:27
static void _testBlitBlendMode(SDL_Texture *tface, int mode)
Tests a blend mode.
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
#define SDL_SetTextureBlendMode
SDL_Surface * SDLTest_ImageBlitBlendAdd(void)
Returns the BlitBlendAdd test image as SDL_Surface.
uint32_t Uint32
Definition: SDL_stdinc.h:181
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_RenderCopy
SDL_Renderer * renderer
SDL_Surface * SDLTest_ImageBlitBlendAll(void)
Returns the BlitBlendAll test image as SDL_Surface.
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...
static int _hasTexColor(void)
Test to see if can set texture color mode. Helper function.
#define SDL_FreeSurface
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)
Definition: SDL_x11sym.h:50
#define SDL_QueryTexture
GLenum mode
#define SDL_SetTextureColorMod
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_BLENDED
#define ALLOWABLE_ERROR_OPAQUE
static int _hasBlendModes(void)
Test to see if we can vary the blend mode. Helper function.
#define SDL_DestroyTexture
int h
Definition: SDL_rect.h:67
SDL_Surface * SDLTest_ImageBlitBlend(void)
Returns the BlitBlend test image as SDL_Surface.
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define TESTRENDER_SCREEN_H
static SDL_Surface * referenceSurface
SDL_Surface * SDLTest_ImageBlitBlendMod(void)
Returns the BlitBlendMod test image as SDL_Surface.
int y
Definition: SDL_rect.h:66
SDL_Surface * SDLTest_ImageBlitBlendNone(void)
Returns the BlitBlendNone test image as SDL_Surface.
static int _hasTexAlpha(void)
Test to see if we can vary the alpha of the texture. Helper function.
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent
#define SDL_SetTextureAlphaMod

◆ render_testBlitColor()

int render_testBlitColor ( void arg)

Blits doing color tests.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetTextureColorMod http://wiki.libsdl.org/moin.cgi/SDL_RenderCopy http://wiki.libsdl.org/moin.cgi/SDL_DestroyTexture

Definition at line 432 of file testautomation_render.c.

References _clearScreen(), _compare(), _loadTestFace(), ALLOWABLE_ERROR_OPAQUE, SDL_Rect::h, i, j, NULL, rect, referenceSurface, SDL_DestroyTexture, SDL_FreeSurface, SDL_QueryTexture, SDL_RenderCopy, SDL_RenderPresent, SDL_SetTextureColorMod, SDLTest_AssertCheck(), SDLTest_ImageBlitColor(), TEST_ABORTED, TEST_COMPLETED, TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

433 {
434  int ret;
435  SDL_Rect rect;
436  SDL_Texture *tface;
438  Uint32 tformat;
439  int taccess, tw, th;
440  int i, j, ni, nj;
441  int checkFailCount1;
442  int checkFailCount2;
443 
444  /* Clear surface. */
445  _clearScreen();
446 
447  /* Create face surface. */
448  tface = _loadTestFace();
449  SDLTest_AssertCheck(tface != NULL, "Verify _loadTestFace() result");
450  if (tface == NULL) {
451  return TEST_ABORTED;
452  }
453 
454  /* Constant values. */
455  ret = SDL_QueryTexture(tface, &tformat, &taccess, &tw, &th);
456  SDLTest_AssertCheck(ret == 0, "Verify result from SDL_QueryTexture, expected 0, got %i", ret);
457  rect.w = tw;
458  rect.h = th;
459  ni = TESTRENDER_SCREEN_W - tw;
460  nj = TESTRENDER_SCREEN_H - th;
461 
462  /* Test blitting with color mod. */
463  checkFailCount1 = 0;
464  checkFailCount2 = 0;
465  for (j=0; j <= nj; j+=4) {
466  for (i=0; i <= ni; i+=4) {
467  /* Set color mod. */
468  ret = SDL_SetTextureColorMod( tface, (255/nj)*j, (255/ni)*i, (255/nj)*j );
469  if (ret != 0) checkFailCount1++;
470 
471  /* Blitting. */
472  rect.x = i;
473  rect.y = j;
474  ret = SDL_RenderCopy(renderer, tface, NULL, &rect );
475  if (ret != 0) checkFailCount2++;
476  }
477  }
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);
480 
481  /* Make current */
483 
484  /* See if it's the same. */
485  referenceSurface = SDLTest_ImageBlitColor();
486  _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
487 
488  /* Clean up. */
489  SDL_DestroyTexture( tface );
490  SDL_FreeSurface(referenceSurface);
491  referenceSurface = NULL;
492 
493  return TEST_COMPLETED;
494 }
#define TEST_ABORTED
SDL_Rect rect
Definition: testrelative.c:27
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
uint32_t Uint32
Definition: SDL_stdinc.h:181
static SDL_Texture * _loadTestFace(void)
Loads the test image &#39;Face&#39; as texture. Helper function.
#define SDL_RenderCopy
SDL_Renderer * renderer
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...
#define SDL_FreeSurface
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)
Definition: SDL_x11sym.h:50
#define SDL_QueryTexture
#define SDL_SetTextureColorMod
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_OPAQUE
#define SDL_DestroyTexture
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define TESTRENDER_SCREEN_H
static SDL_Surface * referenceSurface
int y
Definition: SDL_rect.h:66
SDL_Surface * SDLTest_ImageBlitColor(void)
Returns the BlitColor test image as SDL_Surface.
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent

◆ render_testGetNumRenderDrivers()

int render_testGetNumRenderDrivers ( void arg)

Tests call to SDL_GetNumRenderDrivers.

See also
http://wiki.libsdl.org/moin.cgi/SDL_GetNumRenderDrivers

Definition at line 89 of file testautomation_render.c.

References SDL_GetNumRenderDrivers, SDLTest_AssertCheck(), and TEST_COMPLETED.

90 {
91  int n;
93  SDLTest_AssertCheck(n >= 1, "Number of renderers >= 1, reported as %i", n);
94  return TEST_COMPLETED;
95 }
#define SDL_GetNumRenderDrivers
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...
#define TEST_COMPLETED
GLdouble n

◆ render_testPrimitives()

int render_testPrimitives ( void arg)

Tests the SDL primitives for rendering.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect http://wiki.libsdl.org/moin.cgi/SDL_RenderDrawLine

Definition at line 107 of file testautomation_render.c.

References _clearScreen(), _compare(), _hasDrawColor(), ALLOWABLE_ERROR_OPAQUE, SDL_Rect::h, NULL, rect, referenceSurface, SDL_ALPHA_OPAQUE, SDL_FreeSurface, SDL_RenderDrawLine, SDL_RenderDrawPoint, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetRenderDrawColor, SDLTest_AssertCheck(), SDLTest_ImagePrimitives(), TEST_COMPLETED, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

108 {
109  int ret;
110  int x, y;
111  SDL_Rect rect;
113  int checkFailCount1;
114  int checkFailCount2;
115 
116  /* Clear surface. */
117  _clearScreen();
118 
119  /* Need drawcolor or just skip test. */
120  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
121 
122  /* Draw a rectangle. */
123  rect.x = 40;
124  rect.y = 0;
125  rect.w = 40;
126  rect.h = 80;
127 
128  ret = SDL_SetRenderDrawColor(renderer, 13, 73, 200, SDL_ALPHA_OPAQUE );
129  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
130 
131  ret = SDL_RenderFillRect(renderer, &rect );
132  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
133 
134  /* Draw a rectangle. */
135  rect.x = 10;
136  rect.y = 10;
137  rect.w = 60;
138  rect.h = 40;
139  ret = SDL_SetRenderDrawColor(renderer, 200, 0, 100, SDL_ALPHA_OPAQUE );
140  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
141 
142  ret = SDL_RenderFillRect(renderer, &rect );
143  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
144 
145  /* Draw some points like so:
146  * X.X.X.X..
147  * .X.X.X.X.
148  * X.X.X.X.. */
149  checkFailCount1 = 0;
150  checkFailCount2 = 0;
151  for (y=0; y<3; y++) {
152  for (x = y % 2; x<TESTRENDER_SCREEN_W; x+=2) {
153  ret = SDL_SetRenderDrawColor(renderer, x*y, x*y/2, x*y/3, SDL_ALPHA_OPAQUE );
154  if (ret != 0) checkFailCount1++;
155 
156  ret = SDL_RenderDrawPoint(renderer, x, y );
157  if (ret != 0) checkFailCount2++;
158  }
159  }
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);
162 
163  /* Draw some lines. */
165  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor");
166 
167  ret = SDL_RenderDrawLine(renderer, 0, 30, TESTRENDER_SCREEN_W, 30 );
168  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
169 
171  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
172 
173  ret = SDL_RenderDrawLine(renderer, 40, 30, 40, 60 );
174  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
175 
176  ret = SDL_SetRenderDrawColor(renderer, 5, 105, 105, SDL_ALPHA_OPAQUE );
177  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
178 
179  ret = SDL_RenderDrawLine(renderer, 0, 0, 29, 29 );
180  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
181 
182  ret = SDL_RenderDrawLine(renderer, 29, 30, 0, 59 );
183  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
184 
185  ret = SDL_RenderDrawLine(renderer, 79, 0, 50, 29 );
186  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
187 
188  ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
189  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
190 
191  /* Make current */
193 
194  /* See if it's the same. */
195  referenceSurface = SDLTest_ImagePrimitives();
196  _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
197 
198  /* Clean up. */
199  SDL_FreeSurface(referenceSurface);
200  referenceSurface = NULL;
201 
202  return TEST_COMPLETED;
203 }
#define SDL_RenderDrawPoint
SDL_Surface * SDLTest_ImagePrimitives(void)
Returns the Primitives test image as SDL_Surface.
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_Rect rect
Definition: testrelative.c:27
#define SDL_RenderFillRect
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
SDL_Renderer * renderer
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...
#define SDL_FreeSurface
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_OPAQUE
static int _hasDrawColor(void)
Test to see if we can vary the draw color. Helper function.
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define SDL_SetRenderDrawColor
#define SDL_ALPHA_OPAQUE
Definition: SDL_pixels.h:46
#define SDL_RenderDrawLine
static SDL_Surface * referenceSurface
int y
Definition: SDL_rect.h:66
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent

◆ render_testPrimitivesBlend()

int render_testPrimitivesBlend ( void arg)

Tests the SDL primitives with alpha for rendering.

See also
http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawColor http://wiki.libsdl.org/moin.cgi/SDL_SetRenderDrawBlendMode http://wiki.libsdl.org/moin.cgi/SDL_RenderFillRect

Definition at line 213 of file testautomation_render.c.

References _clearScreen(), _compare(), _hasBlendModes(), _hasDrawColor(), ALLOWABLE_ERROR_BLENDED, SDL_Rect::h, i, j, NULL, rect, referenceSurface, SDL_BLENDMODE_ADD, SDL_BLENDMODE_BLEND, SDL_BLENDMODE_NONE, SDL_FreeSurface, SDL_RenderDrawLine, SDL_RenderDrawPoint, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, SDLTest_AssertCheck(), SDLTest_ImagePrimitivesBlend(), TEST_COMPLETED, TESTRENDER_SCREEN_H, TESTRENDER_SCREEN_W, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.

214 {
215  int ret;
216  int i, j;
217  SDL_Rect rect;
219  int checkFailCount1;
220  int checkFailCount2;
221  int checkFailCount3;
222 
223  /* Clear surface. */
224  _clearScreen();
225 
226  /* Need drawcolor and blendmode or just skip test. */
227  SDLTest_AssertCheck(_hasDrawColor(), "_hasDrawColor");
228  SDLTest_AssertCheck(_hasBlendModes(), "_hasBlendModes");
229 
230  /* Create some rectangles for each blend mode. */
231  ret = SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0 );
232  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
233 
235  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
236 
238  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
239 
240  rect.x = 10;
241  rect.y = 25;
242  rect.w = 40;
243  rect.h = 25;
244  ret = SDL_SetRenderDrawColor(renderer, 240, 10, 10, 75 );
245  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
246 
248  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
249 
250  ret = SDL_RenderFillRect(renderer, &rect );
251  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
252 
253  rect.x = 30;
254  rect.y = 40;
255  rect.w = 45;
256  rect.h = 15;
257  ret = SDL_SetRenderDrawColor(renderer, 10, 240, 10, 100 );
258  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
259 
261  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
262 
263  ret = SDL_RenderFillRect(renderer, &rect );
264  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
265 
266  rect.x = 25;
267  rect.y = 25;
268  rect.w = 25;
269  rect.h = 25;
270  ret = SDL_SetRenderDrawColor(renderer, 10, 10, 240, 125 );
271  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret);
272 
274  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawBlendMode, expected: 0, got: %i", ret);
275 
276  ret = SDL_RenderFillRect(renderer, &rect );
277  SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderFillRect, expected: 0, got: %i", ret);
278 
279 
280  /* Draw blended lines, lines for everyone. */
281  checkFailCount1 = 0;
282  checkFailCount2 = 0;
283  checkFailCount3 = 0;
284  for (i=0; i<TESTRENDER_SCREEN_W; i+=2) {
285  ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
286  if (ret != 0) checkFailCount1++;
287 
289  (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
290  if (ret != 0) checkFailCount2++;
291 
292  ret = SDL_RenderDrawLine(renderer, 0, 0, i, 59 );
293  if (ret != 0) checkFailCount3++;
294  }
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);
298 
299  checkFailCount1 = 0;
300  checkFailCount2 = 0;
301  checkFailCount3 = 0;
302  for (i=0; i<TESTRENDER_SCREEN_H; i+=2) {
303  ret = SDL_SetRenderDrawColor(renderer, 60+2*i, 240-2*i, 50, 3*i );
304  if (ret != 0) checkFailCount1++;
305 
307  (((i/2)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
308  if (ret != 0) checkFailCount2++;
309 
310  ret = SDL_RenderDrawLine(renderer, 0, 0, 79, i );
311  if (ret != 0) checkFailCount3++;
312  }
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);
316 
317  /* Draw points. */
318  checkFailCount1 = 0;
319  checkFailCount2 = 0;
320  checkFailCount3 = 0;
321  for (j=0; j<TESTRENDER_SCREEN_H; j+=3) {
322  for (i=0; i<TESTRENDER_SCREEN_W; i+=3) {
323  ret = SDL_SetRenderDrawColor(renderer, j*4, i*3, j*4, i*3 );
324  if (ret != 0) checkFailCount1++;
325 
326  ret = SDL_SetRenderDrawBlendMode(renderer, ((((i+j)/3)%3)==0) ? SDL_BLENDMODE_BLEND :
327  ((((i+j)/3)%3)==1) ? SDL_BLENDMODE_ADD : SDL_BLENDMODE_NONE );
328  if (ret != 0) checkFailCount2++;
329 
330  ret = SDL_RenderDrawPoint(renderer, i, j );
331  if (ret != 0) checkFailCount3++;
332  }
333  }
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);
337 
338  /* Make current */
340 
341  /* See if it's the same. */
342  referenceSurface = SDLTest_ImagePrimitivesBlend();
343  _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
344 
345  /* Clean up. */
346  SDL_FreeSurface(referenceSurface);
347  referenceSurface = NULL;
348 
349  return TEST_COMPLETED;
350 }
#define SDL_RenderDrawPoint
SDL_Rect rect
Definition: testrelative.c:27
#define SDL_RenderFillRect
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
static void _compare(SDL_Surface *reference, int allowable_error)
Compares screen pixels with image pixels. Helper function.
#define SDL_SetRenderDrawBlendMode
SDL_Renderer * renderer
SDL_Surface * SDLTest_ImagePrimitivesBlend(void)
Returns the PrimitivesBlend test image as SDL_Surface.
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...
#define SDL_FreeSurface
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)
Definition: SDL_x11sym.h:50
int x
Definition: SDL_rect.h:66
#define TEST_COMPLETED
int w
Definition: SDL_rect.h:67
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)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define ALLOWABLE_ERROR_BLENDED
static int _hasDrawColor(void)
Test to see if we can vary the draw color. Helper function.
static int _hasBlendModes(void)
Test to see if we can vary the blend mode. Helper function.
int h
Definition: SDL_rect.h:67
#define TESTRENDER_SCREEN_W
static int _clearScreen(void)
Clears the screen. Helper function.
#define SDL_SetRenderDrawColor
#define TESTRENDER_SCREEN_H
#define SDL_RenderDrawLine
static SDL_Surface * referenceSurface
int y
Definition: SDL_rect.h:66
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RenderPresent

Variable Documentation

◆ renderer

SDL_Renderer* renderer = NULL

Definition at line 27 of file testautomation_render.c.

◆ renderTest1

const SDLTest_TestCaseReference renderTest1
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED }
int render_testGetNumRenderDrivers(void *arg)
Tests call to SDL_GetNumRenderDrivers.
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED

Definition at line 1064 of file testautomation_render.c.

◆ renderTest2

const SDLTest_TestCaseReference renderTest2
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testPrimitives, "render_testPrimitives", "Tests rendering primitives", TEST_ENABLED }
int render_testPrimitives(void *arg)
Tests the SDL primitives for rendering.
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED

Definition at line 1067 of file testautomation_render.c.

◆ renderTest3

const SDLTest_TestCaseReference renderTest3
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testPrimitivesBlend, "render_testPrimitivesBlend", "Tests rendering primitives with blending", TEST_DISABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_DISABLED
int render_testPrimitivesBlend(void *arg)
Tests the SDL primitives with alpha for rendering.

Definition at line 1071 of file testautomation_render.c.

◆ renderTest4

const SDLTest_TestCaseReference renderTest4
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testBlit, "render_testBlit", "Tests blitting", TEST_ENABLED }
int(* SDLTest_TestCaseFp)(void *arg)
int render_testBlit(void *arg)
Tests some blitting routines.
#define TEST_ENABLED

Definition at line 1074 of file testautomation_render.c.

◆ renderTest5

const SDLTest_TestCaseReference renderTest5
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testBlitColor, "render_testBlitColor", "Tests blitting with color", TEST_ENABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED
int render_testBlitColor(void *arg)
Blits doing color tests.

Definition at line 1077 of file testautomation_render.c.

◆ renderTest6

const SDLTest_TestCaseReference renderTest6
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testBlitAlpha, "render_testBlitAlpha", "Tests blitting with alpha", TEST_DISABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_DISABLED
int render_testBlitAlpha(void *arg)
Tests blitting with alpha.

Definition at line 1081 of file testautomation_render.c.

◆ renderTest7

const SDLTest_TestCaseReference renderTest7
static
Initial value:
=
{ (SDLTest_TestCaseFp)render_testBlitBlend, "render_testBlitBlend", "Tests blitting with blending", TEST_DISABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_DISABLED
int render_testBlitBlend(void *arg)
Tests some more blitting routines.

Definition at line 1085 of file testautomation_render.c.

◆ renderTests

const SDLTest_TestCaseReference* renderTests[]
static
Initial value:
= {
}
static const SDLTest_TestCaseReference renderTest2
static const SDLTest_TestCaseReference renderTest3
static const SDLTest_TestCaseReference renderTest1
static const SDLTest_TestCaseReference renderTest7
#define NULL
Definition: begin_code.h:164
static const SDLTest_TestCaseReference renderTest6
static const SDLTest_TestCaseReference renderTest5
static const SDLTest_TestCaseReference renderTest4

Definition at line 1089 of file testautomation_render.c.

◆ renderTestSuite

SDLTest_TestSuiteReference renderTestSuite
Initial value:
= {
"Render",
}
void CleanupDestroyRenderer(void *arg)
void InitCreateRenderer(void *arg)
static const SDLTest_TestCaseReference * renderTests[]

Definition at line 1094 of file testautomation_render.c.

◆ window

Definition at line 26 of file testautomation_render.c.