Test lib updates: updated harness to support filtering, added surface comparer, updated interface to test images; added Render test suite from GSOC project
This commit is contained in:
parent
f5af517cd2
commit
81eb615d45
17 changed files with 1739 additions and 184 deletions
|
@ -162,6 +162,7 @@
|
|||
<ClInclude Include="..\..\include\SDL_test_md5.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_random.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_images.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_compare.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
|
||||
|
@ -178,6 +179,7 @@
|
|||
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_compare.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
<ClInclude Include="..\..\include\SDL_test_md5.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_random.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_images.h" />
|
||||
<ClInclude Include="..\..\include\SDL_test_compare.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\test\SDL_test_assert.c" />
|
||||
|
@ -182,6 +183,7 @@
|
|||
<ClCompile Include="..\..\src\test\SDL_test_imageFace.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitives.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_imagePrimitivesBlend.c" />
|
||||
<ClCompile Include="..\..\src\test\SDL_test_compare.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "SDL_test_assert.h"
|
||||
#include "SDL_test_harness.h"
|
||||
#include "SDL_test_images.h"
|
||||
#include "SDL_test_compare.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
|
|
72
include/SDL_test_compare.h
Normal file
72
include/SDL_test_compare.h
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
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_compare.h
|
||||
*
|
||||
* Include file for SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL2_test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Defines comparison functions (i.e. for surfaces).
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _SDL_test_compare_h
|
||||
#define _SDL_test_compare_h
|
||||
|
||||
#include "SDL.h"
|
||||
#include "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
|
||||
|
||||
/**
|
||||
* \brief Compares a surface and with reference image data for equality
|
||||
*
|
||||
* \param sur Surface used in comparison
|
||||
* \param img Test Surface used in comparison
|
||||
* \param allowable_error Allowable difference in blending accuracy
|
||||
*
|
||||
* \returns 0 if comparison succeeded, >0 (=number of pixels where comparison failed) if comparison failed, <0 for any other error.
|
||||
*/
|
||||
int SDLTest_CompareSurfaces(SDL_Surface *sur, SDL_Surface *img, int allowable_error);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
/* *INDENT-OFF* */
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
#endif
|
||||
#include "close_code.h"
|
||||
|
||||
#endif /* _SDL_test_compare_h */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -105,11 +105,12 @@ typedef struct SDLTest_TestSuiteReference {
|
|||
* \param testSuites Suites containing the test case.
|
||||
* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
|
||||
* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
|
||||
* \param filter Filter specification. NULL disables. Case sensitive.
|
||||
* \param testIterations Number of iterations to run each test case.
|
||||
*
|
||||
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations);
|
||||
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, char *filter, int testIterations);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#ifndef _SDL_test_images_h
|
||||
#define _SDL_test_images_h
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
@ -44,29 +46,28 @@ 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 */
|
||||
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;
|
||||
SDL_Surface *SDLTest_ImageBlit();
|
||||
SDL_Surface *SDLTest_ImageBlitColor();
|
||||
SDL_Surface *SDLTest_ImageBlitAlpha();
|
||||
SDL_Surface *SDLTest_ImageBlitBlendAdd();
|
||||
SDL_Surface *SDLTest_ImageBlitBlend();
|
||||
SDL_Surface *SDLTest_ImageBlitBlendMod();
|
||||
SDL_Surface *SDLTest_ImageBlitBlendNone();
|
||||
SDL_Surface *SDLTest_ImageBlitBlendAll();
|
||||
SDL_Surface *SDLTest_ImageFace();
|
||||
SDL_Surface *SDLTest_ImagePrimitives();
|
||||
SDL_Surface *SDLTest_ImagePrimitivesBlend();
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
83
src/test/SDL_test_compare.c
Normal file
83
src/test/SDL_test_compare.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Based on automated SDL_Surface tests originally written by Edgar Simo 'bobbens'.
|
||||
|
||||
Rewritten for test lib by Andreas Schiffler.
|
||||
|
||||
*/
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_test.h"
|
||||
|
||||
|
||||
int SDLTest_CompareSurfaces( SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error )
|
||||
{
|
||||
int ret;
|
||||
int i,j;
|
||||
int bpp, bpp_reference;
|
||||
Uint8 *p, *p_reference;
|
||||
int dist;
|
||||
Uint8 R, G, B, A;
|
||||
Uint8 Rd, Gd, Bd, Ad;
|
||||
|
||||
/* Make surfacee size is the same. */
|
||||
if ((surface->w != referenceSurface->w) || (surface->h != referenceSurface->h))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_LockSurface( surface );
|
||||
SDL_LockSurface( referenceSurface );
|
||||
|
||||
ret = 0;
|
||||
bpp = surface->format->BytesPerPixel;
|
||||
bpp_reference = referenceSurface->format->BytesPerPixel;
|
||||
|
||||
/* Compare image - should be same format. */
|
||||
for (j=0; j<surface->h; j++) {
|
||||
for (i=0; i<surface->w; i++) {
|
||||
p = (Uint8 *)surface->pixels + j * surface->pitch + i * bpp;
|
||||
p_reference = (Uint8 *)referenceSurface->pixels + j * referenceSurface->pitch + i * bpp_reference;
|
||||
dist = 0;
|
||||
|
||||
SDL_GetRGBA(*(Uint32*)p, surface->format, &R, &G, &B, &A);
|
||||
SDL_GetRGBA(*(Uint32*)p_reference, referenceSurface->format, &Rd, &Gd, &Bd, &Ad);
|
||||
|
||||
dist += (R-Rd)*(R-Rd);
|
||||
dist += (G-Gd)*(G-Gd);
|
||||
dist += (B-Bd)*(B-Bd);
|
||||
|
||||
/* Allow some difference in blending accuracy */
|
||||
if (dist > allowable_error) {
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockSurface( surface );
|
||||
SDL_UnlockSurface( referenceSurface );
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -116,8 +116,8 @@ SDLTest_RandomUint32()
|
|||
Uint64
|
||||
SDLTest_RandomUint64()
|
||||
{
|
||||
Uint64 value;
|
||||
Uint32 *vp = (void*)&value;
|
||||
Uint64 value = 0;
|
||||
Uint32 *vp = (void *)&value;
|
||||
|
||||
fuzzerInvocationCounter++;
|
||||
|
||||
|
@ -130,8 +130,8 @@ SDLTest_RandomUint64()
|
|||
Sint64
|
||||
SDLTest_RandomSint64()
|
||||
{
|
||||
Uint64 value;
|
||||
Uint32 *vp = (void*)&value;
|
||||
Uint64 value = 0;
|
||||
Uint32 *vp = (void *)&value;
|
||||
|
||||
fuzzerInvocationCounter++;
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
|
||||
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.
|
||||
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:
|
||||
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.
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
@ -41,17 +41,17 @@ const char *SDLTest_FinalResultFormat = ">>> %s '%s': %s\n";
|
|||
static Uint32 SDLTest_TestCaseTimeout = 3600;
|
||||
|
||||
/**
|
||||
* Generates a random run seed string for the harness. The generated seed
|
||||
* will contain alphanumeric characters (0-9A-Z).
|
||||
*
|
||||
* Note: The returned string needs to be deallocated by the caller.
|
||||
*
|
||||
* \param length The length of the seed string to generate
|
||||
*
|
||||
* \returns The generated seed string
|
||||
*/
|
||||
* Generates a random run seed string for the harness. The generated seed
|
||||
* will contain alphanumeric characters (0-9A-Z).
|
||||
*
|
||||
* Note: The returned string needs to be deallocated by the caller.
|
||||
*
|
||||
* \param length The length of the seed string to generate
|
||||
*
|
||||
* \returns The generated seed string
|
||||
*/
|
||||
char *
|
||||
SDLTest_GenerateRunSeed(const int length)
|
||||
SDLTest_GenerateRunSeed(const int length)
|
||||
{
|
||||
char *seed = NULL;
|
||||
SDLTest_RandomContext randomContext;
|
||||
|
@ -86,18 +86,18 @@ SDLTest_GenerateRunSeed(const int length)
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates an execution key for the fuzzer.
|
||||
*
|
||||
* \param runSeed The run seed to use
|
||||
* \param suiteName The name of the test suite
|
||||
* \param testName The name of the test
|
||||
* \param iteration The iteration count
|
||||
*
|
||||
* \returns The generated execution key to initialize the fuzzer with.
|
||||
*
|
||||
*/
|
||||
* Generates an execution key for the fuzzer.
|
||||
*
|
||||
* \param runSeed The run seed to use
|
||||
* \param suiteName The name of the test suite
|
||||
* \param testName The name of the test
|
||||
* \param iteration The iteration count
|
||||
*
|
||||
* \returns The generated execution key to initialize the fuzzer with.
|
||||
*
|
||||
*/
|
||||
Uint64
|
||||
SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
|
||||
SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration)
|
||||
{
|
||||
SDLTest_Md5Context md5Context;
|
||||
Uint64 *keys;
|
||||
|
@ -157,17 +157,17 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Set timeout handler for test.
|
||||
*
|
||||
* Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
|
||||
*
|
||||
* \param timeout Timeout interval in seconds.
|
||||
* \param callback Function that will be called after timeout has elapsed.
|
||||
*
|
||||
* \return Timer id or -1 on failure.
|
||||
*/
|
||||
* \brief Set timeout handler for test.
|
||||
*
|
||||
* Note: SDL_Init(SDL_INIT_TIMER) will be called if it wasn't done so before.
|
||||
*
|
||||
* \param timeout Timeout interval in seconds.
|
||||
* \param callback Function that will be called after timeout has elapsed.
|
||||
*
|
||||
* \return Timer id or -1 on failure.
|
||||
*/
|
||||
SDL_TimerID
|
||||
SDLTest_SetTestTimeout(int timeout, void (*callback)())
|
||||
SDLTest_SetTestTimeout(int timeout, void (*callback)())
|
||||
{
|
||||
Uint32 timeoutInMilliseconds;
|
||||
SDL_TimerID timerID;
|
||||
|
@ -201,24 +201,27 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)())
|
|||
return timerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Timeout handler. Aborts test run and exits harness process.
|
||||
*/
|
||||
void
|
||||
SDLTest_BailOut()
|
||||
SDLTest_BailOut()
|
||||
{
|
||||
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
|
||||
exit(TEST_ABORTED); // bail out from the test
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Execute a test using the given execution key.
|
||||
*
|
||||
* \param testSuite Suite containing the test case.
|
||||
* \param testCase Case to execute.
|
||||
* \param execKey Execution key for the fuzzer.
|
||||
*
|
||||
* \returns Test case result.
|
||||
*/
|
||||
* \brief Execute a test using the given execution key.
|
||||
*
|
||||
* \param testSuite Suite containing the test case.
|
||||
* \param testCase Case to execute.
|
||||
* \param execKey Execution key for the fuzzer.
|
||||
*
|
||||
* \returns Test case result.
|
||||
*/
|
||||
int
|
||||
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
|
||||
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey)
|
||||
{
|
||||
SDL_TimerID timer = 0;
|
||||
int testResult = 0;
|
||||
|
@ -232,11 +235,12 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
|
|||
|
||||
if (!testCase->enabled)
|
||||
{
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped");
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Skipped (Disabled)");
|
||||
return TEST_RESULT_SKIPPED;
|
||||
}
|
||||
|
||||
// Initialize fuzzer
|
||||
|
||||
// Initialize fuzzer
|
||||
SDLTest_FuzzerInit(execKey);
|
||||
|
||||
// Reset assert tracker
|
||||
|
@ -315,17 +319,21 @@ float GetClock()
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Execute a test suite using the given run seend and execution key.
|
||||
*
|
||||
* \param testSuites Suites containing the test case.
|
||||
* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
|
||||
* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
|
||||
* \param testIterations Number of iterations to run each test case.
|
||||
*
|
||||
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
* \brief Execute a test suite using the given run seend and execution key.
|
||||
*
|
||||
* The filter string is matched to the suite name (full comparison) to select a single suite,
|
||||
* or if no suite matches, it is matched to the test names (full comparison) to select a single test.
|
||||
*
|
||||
* \param testSuites Suites containing the test case.
|
||||
* \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one.
|
||||
* \param userExecKey Custom execution key provided by user, or 0 to autogenerate one.
|
||||
* \param filter Filter specification. NULL disables. Case sensitive.
|
||||
* \param testIterations Number of iterations to run each test case.
|
||||
*
|
||||
* \returns Test run result; 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
int
|
||||
SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, int testIterations)
|
||||
SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, Uint64 userExecKey, char *filter, int testIterations)
|
||||
{
|
||||
int suiteCounter;
|
||||
int testCounter;
|
||||
|
@ -343,6 +351,10 @@ SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, U
|
|||
float suiteEndSeconds;
|
||||
float testEndSeconds;
|
||||
float runtime;
|
||||
int suiteFilter = 0;
|
||||
char *suiteFilterName = NULL;
|
||||
int testFilter = 0;
|
||||
char *testFilterName = NULL;
|
||||
int testResult = 0;
|
||||
int runResult = 0;
|
||||
Uint32 totalTestFailedCount = 0;
|
||||
|
@ -370,6 +382,7 @@ SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, U
|
|||
runSeed = userRunSeed;
|
||||
}
|
||||
|
||||
|
||||
// Reset per-run counters
|
||||
totalTestFailedCount = 0;
|
||||
totalTestPassedCount = 0;
|
||||
|
@ -381,121 +394,184 @@ SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, U
|
|||
// Log run with fuzzer parameters
|
||||
SDLTest_Log("::::: Test Run /w seed '%s' started\n", runSeed);
|
||||
|
||||
// Initialize filtering
|
||||
if (filter != NULL && SDL_strlen(filter) > 0) {
|
||||
/* Loop over all suites to check if we have a filter match */
|
||||
suiteCounter = 0;
|
||||
while (testSuites[suiteCounter] && suiteFilter == 0) {
|
||||
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
|
||||
suiteCounter++;
|
||||
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
|
||||
/* Matched a suite name */
|
||||
suiteFilter = 1;
|
||||
suiteFilterName = testSuite->name;
|
||||
SDLTest_Log("Filtering: running only suite '%s'", suiteFilterName);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Within each suite, loop over all test cases to check if we have a filter match */
|
||||
testCounter = 0;
|
||||
while (testSuite->testCases[testCounter] && testFilter == 0)
|
||||
{
|
||||
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
|
||||
testCounter++;
|
||||
if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
|
||||
/* Matched a test name */
|
||||
suiteFilter = 1;
|
||||
suiteFilterName = testSuite->name;
|
||||
testFilter = 1;
|
||||
testFilterName = testCase->name;
|
||||
SDLTest_Log("Filtering: running only test '%s' in suite '%s'", testFilterName, suiteFilterName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (suiteFilter == 0 && testFilter == 0) {
|
||||
SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
|
||||
SDLTest_Log("Exit code: 2");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over all suites
|
||||
suiteCounter = 0;
|
||||
while(testSuites[suiteCounter]) {
|
||||
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
|
||||
currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
|
||||
suiteCounter++;
|
||||
|
||||
// Reset per-suite counters
|
||||
testFailedCount = 0;
|
||||
testPassedCount = 0;
|
||||
testSkippedCount = 0;
|
||||
// Filter suite if flag set and we have a name
|
||||
if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL &&
|
||||
SDL_strcmp(suiteFilterName, testSuite->name) != 0) {
|
||||
// Skip suite
|
||||
SDLTest_Log("===== Test Suite %i: '%s' skipped\n",
|
||||
suiteCounter,
|
||||
currentSuiteName);
|
||||
} else {
|
||||
|
||||
// Take time - suite start
|
||||
suiteStartSeconds = GetClock();
|
||||
// Reset per-suite counters
|
||||
testFailedCount = 0;
|
||||
testPassedCount = 0;
|
||||
testSkippedCount = 0;
|
||||
|
||||
// Log suite started
|
||||
currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTest_InvalidNameFormat);
|
||||
SDLTest_Log("===== Test Suite %i: '%s' started\n",
|
||||
suiteCounter,
|
||||
currentSuiteName);
|
||||
// Take time - suite start
|
||||
suiteStartSeconds = GetClock();
|
||||
|
||||
// Loop over all test cases
|
||||
testCounter = 0;
|
||||
while(testSuite->testCases[testCounter])
|
||||
{
|
||||
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
|
||||
testCounter++;
|
||||
|
||||
// Take time - test start
|
||||
testStartSeconds = GetClock();
|
||||
// Log suite started
|
||||
SDLTest_Log("===== Test Suite %i: '%s' started\n",
|
||||
suiteCounter,
|
||||
currentSuiteName);
|
||||
|
||||
// Log test started
|
||||
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
|
||||
SDLTest_Log("----- Test Case %i.%i: '%s' started",
|
||||
suiteCounter,
|
||||
testCounter,
|
||||
currentTestName);
|
||||
if (testCase->description != NULL && strlen(testCase->description)>0) {
|
||||
SDLTest_Log("Test Description: '%s'",
|
||||
(testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
|
||||
}
|
||||
|
||||
// Loop over all iterations
|
||||
iterationCounter = 0;
|
||||
while(iterationCounter < testIterations)
|
||||
// Loop over all test cases
|
||||
testCounter = 0;
|
||||
while(testSuite->testCases[testCounter])
|
||||
{
|
||||
iterationCounter++;
|
||||
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter];
|
||||
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTest_InvalidNameFormat);
|
||||
testCounter++;
|
||||
|
||||
if (userExecKey != 0) {
|
||||
execKey = userExecKey;
|
||||
// Filter tests if flag set and we have a name
|
||||
if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL &&
|
||||
SDL_strcmp(testFilterName, testCase->name) != 0) {
|
||||
// Skip test
|
||||
SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n",
|
||||
suiteCounter,
|
||||
testCounter,
|
||||
currentTestName);
|
||||
} else {
|
||||
execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
|
||||
}
|
||||
|
||||
SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
|
||||
testResult = SDLTest_RunTest(testSuite, testCase, execKey);
|
||||
// Take time - test start
|
||||
testStartSeconds = GetClock();
|
||||
|
||||
// Log test started
|
||||
SDLTest_Log("----- Test Case %i.%i: '%s' started",
|
||||
suiteCounter,
|
||||
testCounter,
|
||||
currentTestName);
|
||||
if (testCase->description != NULL && strlen(testCase->description)>0) {
|
||||
SDLTest_Log("Test Description: '%s'",
|
||||
(testCase->description) ? testCase->description : SDLTest_InvalidNameFormat);
|
||||
}
|
||||
|
||||
// Loop over all iterations
|
||||
iterationCounter = 0;
|
||||
while(iterationCounter < testIterations)
|
||||
{
|
||||
iterationCounter++;
|
||||
|
||||
if (userExecKey != 0) {
|
||||
execKey = userExecKey;
|
||||
} else {
|
||||
execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
|
||||
}
|
||||
|
||||
SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
|
||||
testResult = SDLTest_RunTest(testSuite, testCase, execKey);
|
||||
|
||||
if (testResult == TEST_RESULT_PASSED) {
|
||||
testPassedCount++;
|
||||
totalTestPassedCount++;
|
||||
} else if (testResult == TEST_RESULT_SKIPPED) {
|
||||
testSkippedCount++;
|
||||
totalTestSkippedCount++;
|
||||
} else {
|
||||
testFailedCount++;
|
||||
totalTestFailedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Take time - test end
|
||||
testEndSeconds = GetClock();
|
||||
runtime = testEndSeconds - testStartSeconds;
|
||||
if (runtime < 0.0f) runtime = 0.0f;
|
||||
|
||||
if (testIterations > 1) {
|
||||
// Log test runtime
|
||||
SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
|
||||
SDLTest_Log("Average Test runtime: %.5f sec", runtime / (float)testIterations);
|
||||
} else {
|
||||
// Log test runtime
|
||||
SDLTest_Log("Total Test runtime: %.1f sec", runtime);
|
||||
}
|
||||
|
||||
// Log final test result
|
||||
switch (testResult) {
|
||||
case TEST_RESULT_PASSED:
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
|
||||
break;
|
||||
case TEST_RESULT_FAILED:
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
|
||||
break;
|
||||
case TEST_RESULT_NO_ASSERT:
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
|
||||
break;
|
||||
}
|
||||
|
||||
if (testResult == TEST_RESULT_PASSED) {
|
||||
testPassedCount++;
|
||||
totalTestPassedCount++;
|
||||
} else if (testResult == TEST_RESULT_SKIPPED) {
|
||||
testSkippedCount++;
|
||||
totalTestSkippedCount++;
|
||||
} else {
|
||||
testFailedCount++;
|
||||
totalTestFailedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Take time - test end
|
||||
testEndSeconds = GetClock();
|
||||
runtime = testEndSeconds - testStartSeconds;
|
||||
// Take time - suite end
|
||||
suiteEndSeconds = GetClock();
|
||||
runtime = suiteEndSeconds - suiteStartSeconds;
|
||||
if (runtime < 0.0f) runtime = 0.0f;
|
||||
|
||||
if (testIterations > 1) {
|
||||
// Log test runtime
|
||||
SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
|
||||
SDLTest_Log("Test runtime: %.5f sec", runtime / (float)testIterations);
|
||||
} else {
|
||||
// Log test runtime
|
||||
SDLTest_Log("Test runtime: %.1f sec", runtime);
|
||||
}
|
||||
// Log suite runtime
|
||||
SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
|
||||
|
||||
// Log final test result
|
||||
switch (testResult) {
|
||||
case TEST_RESULT_PASSED:
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Passed");
|
||||
break;
|
||||
case TEST_RESULT_FAILED:
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", currentTestName, "Failed");
|
||||
break;
|
||||
case TEST_RESULT_NO_ASSERT:
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat,"Test", currentTestName, "No Asserts");
|
||||
break;
|
||||
// Log summary and final Suite result
|
||||
countSum = testPassedCount + testFailedCount + testSkippedCount;
|
||||
if (testFailedCount == 0)
|
||||
{
|
||||
SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
|
||||
}
|
||||
}
|
||||
|
||||
// Take time - suite end
|
||||
suiteEndSeconds = GetClock();
|
||||
runtime = suiteEndSeconds - suiteStartSeconds;
|
||||
if (runtime < 0.0f) runtime = 0.0f;
|
||||
|
||||
// Log suite runtime
|
||||
SDLTest_Log("Suite runtime: %.1f sec", runtime);
|
||||
|
||||
// Log summary and final Suite result
|
||||
countSum = testPassedCount + testFailedCount + testSkippedCount;
|
||||
if (testFailedCount == 0)
|
||||
{
|
||||
SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
|
||||
SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
|
||||
SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,11 +581,11 @@ SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], char *userRunSeed, U
|
|||
if (runtime < 0.0f) runtime = 0.0f;
|
||||
|
||||
// Log total runtime
|
||||
SDLTest_Log("Total runtime: %.1f sec", runtime);
|
||||
SDLTest_Log("Total Run runtime: %.1f sec", runtime);
|
||||
|
||||
// Log summary and final run result
|
||||
countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
|
||||
if (testFailedCount == 0)
|
||||
if (totalTestFailedCount == 0)
|
||||
{
|
||||
runResult = 0;
|
||||
SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
|
||||
|
|
|
@ -535,6 +535,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
|
|||
"\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the Blit test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlit()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlit.pixel_data,
|
||||
SDLTest_imageBlit.width,
|
||||
SDLTest_imageBlit.height,
|
||||
SDLTest_imageBlit.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@ -992,6 +1018,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitColor test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitColor()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitColor.pixel_data,
|
||||
SDLTest_imageBlitColor.width,
|
||||
SDLTest_imageBlitColor.height,
|
||||
SDLTest_imageBlitColor.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@ -1478,3 +1530,28 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitAlpha test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitAlpha()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitAlpha.pixel_data,
|
||||
SDLTest_imageBlitAlpha.width,
|
||||
SDLTest_imageBlitAlpha.height,
|
||||
SDLTest_imageBlitAlpha.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -575,6 +575,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitBlendAdd test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitBlendAdd()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitBlendAdd.pixel_data,
|
||||
SDLTest_imageBlitBlendAdd.width,
|
||||
SDLTest_imageBlitBlendAdd.height,
|
||||
SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@ -1079,6 +1105,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitBlend test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitBlend()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitBlend.pixel_data,
|
||||
SDLTest_imageBlitBlend.width,
|
||||
SDLTest_imageBlitBlend.height,
|
||||
SDLTest_imageBlitBlend.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@ -1483,6 +1535,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitBlendMod test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitBlendMod()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitBlendMod.pixel_data,
|
||||
SDLTest_imageBlitBlendMod.width,
|
||||
SDLTest_imageBlitBlendMod.height,
|
||||
SDLTest_imageBlitBlendMod.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
|
||||
80, 60, 3,
|
||||
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
|
||||
|
@ -2270,6 +2348,32 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
|
|||
"\377\377\377\377\377\377\377\377",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitBlendNone test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitBlendNone()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitBlendNone.pixel_data,
|
||||
SDLTest_imageBlitBlendNone.width,
|
||||
SDLTest_imageBlitBlendNone.height,
|
||||
SDLTest_imageBlitBlendNone.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
|
||||
80, 60, 3,
|
||||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|
||||
|
@ -2712,3 +2816,28 @@ const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
|
|||
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the BlitBlendAll test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageBlitBlendAll()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageBlitBlendAll.pixel_data,
|
||||
SDLTest_imageBlitBlendAll.width,
|
||||
SDLTest_imageBlitBlendAll.height,
|
||||
SDLTest_imageBlitBlendAll.bytes_per_pixel * 8,
|
||||
SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/* GIMP RGBA C-Source image dump (face.c) */
|
||||
|
||||
const SDLTest_SurfaceImage_t SDLTest_ImageFace = {
|
||||
const SDLTest_SurfaceImage_t SDLTest_imageFace = {
|
||||
32, 32, 4,
|
||||
"\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
|
||||
"\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"
|
||||
|
@ -218,3 +218,29 @@ const SDLTest_SurfaceImage_t SDLTest_ImageFace = {
|
|||
"\377\377\0\377\377\377\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the Face test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImageFace()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imageFace.pixel_data,
|
||||
SDLTest_imageFace.width,
|
||||
SDLTest_imageFace.height,
|
||||
SDLTest_imageFace.bytes_per_pixel * 8,
|
||||
SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
|
|
@ -485,3 +485,28 @@ const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
|
|||
"\310\15I\310\15I\310\15I\310\15I\310\5ii",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the Primitives test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImagePrimitives()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imagePrimitives.pixel_data,
|
||||
SDLTest_imagePrimitives.width,
|
||||
SDLTest_imagePrimitives.height,
|
||||
SDLTest_imagePrimitives.bytes_per_pixel * 8,
|
||||
SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -667,3 +667,28 @@ const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
|
|||
"\377\377\377\377\377\377\377\377\324X2\377\377\377\333bB\377\377\377",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Returns the PrimitivesBlend test image as SDL_Surface.
|
||||
*/
|
||||
SDL_Surface *SDLTest_ImagePrimitivesBlend()
|
||||
{
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)SDLTest_imagePrimitivesBlend.pixel_data,
|
||||
SDLTest_imagePrimitivesBlend.width,
|
||||
SDLTest_imagePrimitivesBlend.height,
|
||||
SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8,
|
||||
SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel,
|
||||
#if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
0xff000000, /* Red bit mask. */
|
||||
0x00ff0000, /* Green bit mask. */
|
||||
0x0000ff00, /* Blue bit mask. */
|
||||
0x000000ff /* Alpha bit mask. */
|
||||
#else
|
||||
0x000000ff, /* Red bit mask. */
|
||||
0x0000ff00, /* Green bit mask. */
|
||||
0x00ff0000, /* Blue bit mask. */
|
||||
0xff000000 /* Alpha bit mask. */
|
||||
#endif
|
||||
);
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ main(int argc, char *argv[])
|
|||
int testIterations = 1;
|
||||
Uint64 userExecKey = 0;
|
||||
char *userRunSeed = NULL;
|
||||
char *filter = NULL;
|
||||
int i;
|
||||
|
||||
/* Initialize test framework */
|
||||
|
@ -74,6 +75,12 @@ main(int argc, char *argv[])
|
|||
consumed = 2;
|
||||
}
|
||||
}
|
||||
else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
filter = SDL_strdup(argv[i + 1]);
|
||||
consumed = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (consumed < 0) {
|
||||
fprintf(stderr,
|
||||
|
@ -98,12 +105,15 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* Call Harness */
|
||||
result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, testIterations);
|
||||
result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, filter, testIterations);
|
||||
|
||||
/* Clean up */
|
||||
if (userRunSeed != NULL) {
|
||||
SDL_free(userRunSeed);
|
||||
}
|
||||
if (filter != NULL) {
|
||||
SDL_free(filter);
|
||||
}
|
||||
|
||||
/* Shutdown everything */
|
||||
quit(result);
|
||||
|
|
1025
test/tests/testrender.c
Normal file
1025
test/tests/testrender.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,7 +15,7 @@ extern SDLTest_TestSuiteReference clipboardTestSuite;
|
|||
//extern SDLTest_TestSuiteReference keyboardTestSuite;
|
||||
extern SDLTest_TestSuiteReference platformTestSuite;
|
||||
extern SDLTest_TestSuiteReference rectTestSuite;
|
||||
//extern SDLTest_TestSuiteReference renderTestSuite;
|
||||
extern SDLTest_TestSuiteReference renderTestSuite;
|
||||
extern SDLTest_TestSuiteReference rwopsTestSuite;
|
||||
//extern SDLTest_TestSuiteReference surfaceTestSuite;
|
||||
//extern SDLTest_TestSuiteReference syswmTestSuite;
|
||||
|
@ -29,7 +29,7 @@ SDLTest_TestSuiteReference *testSuites[] = {
|
|||
// &keyboardTestSuite,
|
||||
&platformTestSuite,
|
||||
&rectTestSuite,
|
||||
// &renderTestSuite,
|
||||
&renderTestSuite,
|
||||
&rwopsTestSuite,
|
||||
// &surfaceTestSuite,
|
||||
// &syswmTestSuite,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue