Added a test to check the read/write pixels API
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404306
This commit is contained in:
parent
9ea9c7518d
commit
c2767e72dd
2 changed files with 29 additions and 1 deletions
|
@ -82,7 +82,6 @@ int surface_compare( SDL_Surface *sur, const SurfaceImage_t *img, int allowable_
|
|||
|
||||
bpp = sur->format->BytesPerPixel;
|
||||
|
||||
/* Compare image - should be same format. */
|
||||
if (bpp == 4) {
|
||||
for (j=0; j<sur->h; j++) {
|
||||
for (i=0; i<sur->w; i++) {
|
||||
|
|
|
@ -37,6 +37,7 @@ static int render_hasTexColor (void);
|
|||
static int render_hasTexAlpha (void);
|
||||
static int render_clearScreen (void);
|
||||
/* Testcases. */
|
||||
static int render_testReadWrite (void);
|
||||
static int render_testPrimitives (void);
|
||||
static int render_testPrimitivesBlend (void);
|
||||
static int render_testBlit (void);
|
||||
|
@ -362,6 +363,31 @@ static int render_clearScreen (void)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Test reading and writing framebuffer
|
||||
*/
|
||||
static int render_testReadWrite (void)
|
||||
{
|
||||
int ret;
|
||||
SDL_Rect rect;
|
||||
|
||||
/* Write pixels. */
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = 80;
|
||||
rect.h = 60;
|
||||
ret = SDL_RenderWritePixels( &rect, SDL_PIXELFORMAT_RGB24, img_primitives.pixel_data, img_primitives.width*img_primitives.bytes_per_pixel );
|
||||
if (SDL_ATassert( "SDL_RenderWritePixels", ret==0) )
|
||||
return 1;
|
||||
|
||||
/* See if it's the same. */
|
||||
if (render_compare( "Read/write output not the same.", &img_primitives, ALLOWABLE_ERROR_OPAQUE ))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Tests the SDL primitives for rendering.
|
||||
*/
|
||||
|
@ -932,6 +958,9 @@ int render_runTests (void)
|
|||
SDL_ATprintVerbose( 1, " Texture Alpha Mod supported\n" );
|
||||
|
||||
/* Software surface blitting. */
|
||||
ret = render_testReadWrite();
|
||||
if (ret)
|
||||
return -1;
|
||||
ret = render_testPrimitives();
|
||||
if (ret)
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue