Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Add image data definitions (for render tests) to test lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ferzkopp committed Dec 20, 2012
1 parent a8fc8b8 commit 1b949cc
Show file tree
Hide file tree
Showing 10 changed files with 5,667 additions and 3 deletions.
6 changes: 6 additions & 0 deletions VisualC/SDLtest/SDLtest_VS2010.vcxproj
Expand Up @@ -161,6 +161,7 @@
<ClInclude Include="..\..\include\SDL_test_log.h" />
<ClInclude Include="..\..\include\SDL_test_md5.h" />
<ClInclude Include="..\..\include\SDL_test_random.h" />
<ClInclude Include="..\..\include\SDL_test_images.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
Expand All @@ -172,6 +173,11 @@
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
<ClCompile Include="..\..\src\test\SDL_test_random.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
6 changes: 6 additions & 0 deletions VisualC/SDLtest/SDLtest_VS2012.vcxproj
Expand Up @@ -165,6 +165,7 @@
<ClInclude Include="..\..\include\SDL_test_log.h" />
<ClInclude Include="..\..\include\SDL_test_md5.h" />
<ClInclude Include="..\..\include\SDL_test_random.h" />
<ClInclude Include="..\..\include\SDL_test_images.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
Expand All @@ -176,6 +177,11 @@
<ClCompile Include="..\..\src\test\SDL_test_log.c" />
<ClCompile Include="..\..\src\test\SDL_test_md5.c" />
<ClCompile Include="..\..\src\test\SDL_test_random.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlit.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageBlitBlend.c" />
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
1 change: 1 addition & 0 deletions include/SDL_test.h
Expand Up @@ -40,6 +40,7 @@
#include "SDL_test_log.h"
#include "SDL_test_assert.h"
#include "SDL_test_harness.h"
#include "SDL_test_images.h"

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
Expand Down
81 changes: 81 additions & 0 deletions include/SDL_test_images.h
@@ -0,0 +1,81 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

/**
* \file SDL_test_images.h
*
* Include file for SDL test framework.
*
* This code is a part of the SDL2_test library, not the main SDL library.
*/

/*
Defines some images for tests.
*/

#ifndef _SDL_test_images_h
#define _SDL_test_images_h

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
#endif


/**
*Type for test images.
*/
typedef struct SDLTest_SurfaceImage_s {
int width;
int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
const unsigned char pixel_data[];
} SDLTest_SurfaceImage_t;

/* Test images */
const SDLTest_SurfaceImage_t SDLTest_imageBlit;
const SDLTest_SurfaceImage_t SDLTest_imageBlitColor;
const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone;
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll;
const SDLTest_SurfaceImage_t SDLTest_ImageFace;
const SDLTest_SurfaceImage_t SDLTest_imagePrimitives;
const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend;

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
#endif
#include "close_code.h"

#endif /* _SDL_test_images_h */

/* vi: set ts=4 sw=4 expandtab: */
6 changes: 3 additions & 3 deletions src/test/SDL_test_assert.c
Expand Up @@ -50,7 +50,7 @@ void SDLTest_Assert(int assertCondition, char *assertDescription, ...)
char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];

// Print assert description into a buffer
memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, assertDescription);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
va_end(list);
Expand All @@ -69,7 +69,7 @@ int SDLTest_AssertCheck(int assertCondition, char *assertDescription, ...)
char *logFormat = (char *)SDLTest_AssertCheckFormat;

// Print assert description into a buffer
memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, assertDescription);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
va_end(list);
Expand Down Expand Up @@ -99,7 +99,7 @@ void SDLTest_AssertPass(char *assertDescription, ...)
char *logFormat = (char *)SDLTest_AssertCheckFormat;

// Print assert description into a buffer
memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
va_start(list, assertDescription);
SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
va_end(list);
Expand Down

0 comments on commit 1b949cc

Please sign in to comment.