Add mouse tests; update test suites
This commit is contained in:
parent
896befb67b
commit
2e9dea31c5
5 changed files with 192 additions and 68 deletions
|
@ -3,9 +3,6 @@
|
||||||
* New/updated tests: aschiffler at ferzkopp dot net
|
* New/updated tests: aschiffler at ferzkopp dot net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* quiet windows compiler warnings */
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -311,29 +308,29 @@ int audio_buildAudioCVTNegative()
|
||||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
SDLTest_AssertPass("Call to SDL_ClearError()");
|
||||||
|
|
||||||
/* Set various invalid format inputs */
|
/* Set various invalid format inputs */
|
||||||
strcpy(message, "Invalid: ");
|
SDL_strlcpy(message, "Invalid: ", 256);
|
||||||
if (i & 1) {
|
if (i & 1) {
|
||||||
strcat(message, " spec1.format");
|
SDL_strlcat(message, " spec1.format", 256);
|
||||||
spec1.format = 0;
|
spec1.format = 0;
|
||||||
}
|
}
|
||||||
if (i & 2) {
|
if (i & 2) {
|
||||||
strcat(message, " spec1.channels");
|
SDL_strlcat(message, " spec1.channels", 256);
|
||||||
spec1.channels = 0;
|
spec1.channels = 0;
|
||||||
}
|
}
|
||||||
if (i & 4) {
|
if (i & 4) {
|
||||||
strcat(message, " spec1.freq");
|
SDL_strlcat(message, " spec1.freq", 256);
|
||||||
spec1.freq = 0;
|
spec1.freq = 0;
|
||||||
}
|
}
|
||||||
if (i & 8) {
|
if (i & 8) {
|
||||||
strcat(message, " spec2.format");
|
SDL_strlcat(message, " spec2.format", 256);
|
||||||
spec2.format = 0;
|
spec2.format = 0;
|
||||||
}
|
}
|
||||||
if (i & 16) {
|
if (i & 16) {
|
||||||
strcat(message, " spec2.channels");
|
SDL_strlcat(message, " spec2.channels", 256);
|
||||||
spec2.channels = 0;
|
spec2.channels = 0;
|
||||||
}
|
}
|
||||||
if (i & 32) {
|
if (i & 32) {
|
||||||
strcat(message, " spec2.freq");
|
SDL_strlcat(message, " spec2.freq", 256);
|
||||||
spec2.freq = 0;
|
spec2.freq = 0;
|
||||||
}
|
}
|
||||||
SDLTest_Log(message);
|
SDLTest_Log(message);
|
||||||
|
|
|
@ -118,9 +118,9 @@ clipboard_testClipboardTextFunctions(void *arg)
|
||||||
charResult != NULL,
|
charResult != NULL,
|
||||||
"Verify SDL_GetClipboardText did not return NULL");
|
"Verify SDL_GetClipboardText did not return NULL");
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
strlen(charResult) == 0,
|
SDL_strlen(charResult) == 0,
|
||||||
"Verify SDL_GetClipboardText returned string with length 0, got length %i",
|
"Verify SDL_GetClipboardText returned string with length 0, got length %i",
|
||||||
strlen(charResult));
|
SDL_strlen(charResult));
|
||||||
intResult = SDL_SetClipboardText((const char *)text);
|
intResult = SDL_SetClipboardText((const char *)text);
|
||||||
SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
|
SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded");
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
|
@ -128,7 +128,7 @@ clipboard_testClipboardTextFunctions(void *arg)
|
||||||
"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
|
"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i",
|
||||||
intResult);
|
intResult);
|
||||||
SDLTest_AssertCheck(
|
SDLTest_AssertCheck(
|
||||||
strcmp(textRef, text) == 0,
|
SDL_strcmp(textRef, text) == 0,
|
||||||
"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
|
"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'",
|
||||||
textRef, text);
|
textRef, text);
|
||||||
boolResult = SDL_HasClipboardText();
|
boolResult = SDL_HasClipboardText();
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
int _mouseStateCheck(Uint8 state)
|
int _mouseStateCheck(Uint8 state)
|
||||||
{
|
{
|
||||||
return (state == 0) ||
|
return (state == 0) ||
|
||||||
SDL_BUTTON(SDL_BUTTON_LEFT) ||
|
(state == SDL_BUTTON(SDL_BUTTON_LEFT)) ||
|
||||||
SDL_BUTTON(SDL_BUTTON_MIDDLE) ||
|
(state == SDL_BUTTON(SDL_BUTTON_MIDDLE)) ||
|
||||||
SDL_BUTTON(SDL_BUTTON_RIGHT) ||
|
(state == SDL_BUTTON(SDL_BUTTON_RIGHT)) ||
|
||||||
SDL_BUTTON(SDL_BUTTON_X1) ||
|
(state == SDL_BUTTON(SDL_BUTTON_X1)) ||
|
||||||
SDL_BUTTON(SDL_BUTTON_X2);
|
(state == SDL_BUTTON(SDL_BUTTON_X2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,6 +215,42 @@ mouse_createFreeCursor(void *arg)
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check call to SDL_CreateColorCursor and SDL_FreeCursor
|
||||||
|
*
|
||||||
|
* @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateColorCursor
|
||||||
|
* @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
mouse_createFreeColorCursor(void *arg)
|
||||||
|
{
|
||||||
|
SDL_Surface *face;
|
||||||
|
SDL_Cursor *cursor;
|
||||||
|
|
||||||
|
/* Get sample surface */
|
||||||
|
face = SDLTest_ImageFace();
|
||||||
|
SDLTest_AssertCheck(face != NULL, "Validate sample input image is not NULL");
|
||||||
|
if (face == NULL) return TEST_ABORTED;
|
||||||
|
|
||||||
|
/* Create a color cursor from surface */
|
||||||
|
cursor = SDL_CreateColorCursor(face, 0, 0);
|
||||||
|
SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
|
||||||
|
SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
|
||||||
|
if (cursor == NULL) {
|
||||||
|
SDL_FreeSurface(face);
|
||||||
|
return TEST_ABORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free cursor again */
|
||||||
|
SDL_FreeCursor(cursor);
|
||||||
|
SDLTest_AssertPass("Call to SDL_FreeCursor()");
|
||||||
|
|
||||||
|
/* Clean up */
|
||||||
|
SDL_FreeSurface(face);
|
||||||
|
|
||||||
|
return TEST_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper that changes cursor visibility */
|
/* Helper that changes cursor visibility */
|
||||||
void _changeCursorVisibility(int state)
|
void _changeCursorVisibility(int state)
|
||||||
{
|
{
|
||||||
|
@ -299,6 +335,80 @@ mouse_setCursor(void *arg)
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check call to SDL_GetCursor
|
||||||
|
*
|
||||||
|
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetCursor
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
mouse_getCursor(void *arg)
|
||||||
|
{
|
||||||
|
SDL_Cursor *cursor;
|
||||||
|
|
||||||
|
/* Get current cursor */
|
||||||
|
cursor = SDL_GetCursor();
|
||||||
|
SDLTest_AssertPass("Call to SDL_GetCursor()");
|
||||||
|
SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_GetCursor() is not NULL");
|
||||||
|
|
||||||
|
return TEST_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode
|
||||||
|
*
|
||||||
|
* @sa http://wiki.libsdl.org/moin.cgi/SDL_GetRelativeMouseMode
|
||||||
|
* @sa http://wiki.libsdl.org/moin.cgi/SDL_SetRelativeMouseMode
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
mouse_getSetRelativeMouseMode(void *arg)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
int i;
|
||||||
|
SDL_bool initialState;
|
||||||
|
SDL_bool currentState;
|
||||||
|
|
||||||
|
/* Capture original state so we can revert back to it later */
|
||||||
|
initialState = SDL_GetRelativeMouseMode();
|
||||||
|
SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
|
||||||
|
|
||||||
|
/* Repeat twice to check D->D transition */
|
||||||
|
for (i=0; i<2; i++) {
|
||||||
|
/* Disable - should always be supported */
|
||||||
|
result = SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
|
SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
|
||||||
|
SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
|
||||||
|
currentState = SDL_GetRelativeMouseMode();
|
||||||
|
SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
|
||||||
|
SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Repeat twice to check D->E->E transition */
|
||||||
|
for (i=0; i<2; i++) {
|
||||||
|
/* Enable - may not be supported */
|
||||||
|
result = SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
|
SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(TRUE)");
|
||||||
|
if (result != -1) {
|
||||||
|
SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
|
||||||
|
currentState = SDL_GetRelativeMouseMode();
|
||||||
|
SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
|
||||||
|
SDLTest_AssertCheck(currentState == SDL_TRUE, "Validate current state is TRUE, got: %i", currentState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable to check E->D transition */
|
||||||
|
result = SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
|
SDLTest_AssertPass("Call to SDL_SetRelativeMouseMode(FALSE)");
|
||||||
|
SDLTest_AssertCheck(result == 0, "Validate result value from SDL_SetRelativeMouseMode, expected: 0, got: %i", result);
|
||||||
|
currentState = SDL_GetRelativeMouseMode();
|
||||||
|
SDLTest_AssertPass("Call to SDL_GetRelativeMouseMode()");
|
||||||
|
SDLTest_AssertCheck(currentState == SDL_FALSE, "Validate current state is FALSE, got: %i", currentState);
|
||||||
|
|
||||||
|
/* Revert to originl state - ignore result */
|
||||||
|
result = SDL_SetRelativeMouseMode(initialState);
|
||||||
|
|
||||||
|
return TEST_COMPLETED;
|
||||||
|
}
|
||||||
|
|
||||||
#define MOUSE_TESTWINDOW_WIDTH 320
|
#define MOUSE_TESTWINDOW_WIDTH 320
|
||||||
#define MOUSE_TESTWINDOW_HEIGHT 200
|
#define MOUSE_TESTWINDOW_HEIGHT 200
|
||||||
|
|
||||||
|
@ -455,14 +565,24 @@ static const SDLTest_TestCaseReference mouseTest5 =
|
||||||
{ (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED };
|
{ (SDLTest_TestCaseFp)mouse_setCursor, "mouse_setCursor", "Check call to SDL_SetCursor", TEST_ENABLED };
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference mouseTest6 =
|
static const SDLTest_TestCaseReference mouseTest6 =
|
||||||
{ (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED };
|
{ (SDLTest_TestCaseFp)mouse_getCursor, "mouse_getCursor", "Check call to SDL_GetCursor", TEST_ENABLED };
|
||||||
|
|
||||||
static const SDLTest_TestCaseReference mouseTest7 =
|
static const SDLTest_TestCaseReference mouseTest7 =
|
||||||
|
{ (SDLTest_TestCaseFp)mouse_warpMouseInWindow, "mouse_warpMouseInWindow", "Check call to SDL_WarpMouseInWindow", TEST_ENABLED };
|
||||||
|
|
||||||
|
static const SDLTest_TestCaseReference mouseTest8 =
|
||||||
{ (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED };
|
{ (SDLTest_TestCaseFp)mouse_getMouseFocus, "mouse_getMouseFocus", "Check call to SDL_getMouseFocus", TEST_ENABLED };
|
||||||
|
|
||||||
|
static const SDLTest_TestCaseReference mouseTest9 =
|
||||||
|
{ (SDLTest_TestCaseFp)mouse_createFreeColorCursor, "mouse_createFreeColorCursor", "Check call to SDL_CreateColorCursor and SDL_FreeCursor", TEST_ENABLED };
|
||||||
|
|
||||||
|
static const SDLTest_TestCaseReference mouseTest10 =
|
||||||
|
{ (SDLTest_TestCaseFp)mouse_getSetRelativeMouseMode, "mouse_getSetRelativeMouseMode", "Check call to SDL_GetRelativeMouseMode and SDL_SetRelativeMouseMode", TEST_ENABLED };
|
||||||
|
|
||||||
/* Sequence of Mouse test cases */
|
/* Sequence of Mouse test cases */
|
||||||
static const SDLTest_TestCaseReference *mouseTests[] = {
|
static const SDLTest_TestCaseReference *mouseTests[] = {
|
||||||
&mouseTest1, &mouseTest2, &mouseTest3, &mouseTest4, &mouseTest5, &mouseTest6, &mouseTest7, NULL
|
&mouseTest1, &mouseTest2, &mouseTest3, &mouseTest4, &mouseTest5, &mouseTest6,
|
||||||
|
&mouseTest7, &mouseTest8, &mouseTest9, &mouseTest10, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Mouse test suite (global) */
|
/* Mouse test suite (global) */
|
||||||
|
|
|
@ -969,30 +969,37 @@ _hasTexAlpha(void)
|
||||||
static void
|
static void
|
||||||
_compare(SDL_Surface *referenceSurface, int allowable_error)
|
_compare(SDL_Surface *referenceSurface, int allowable_error)
|
||||||
{
|
{
|
||||||
int ret;
|
int result;
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
Uint8 pix[4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H];
|
Uint8 *pixels;
|
||||||
SDL_Surface *testSurface;
|
SDL_Surface *testSurface;
|
||||||
|
|
||||||
/* Read pixels. */
|
/* Read pixels. */
|
||||||
|
pixels = (Uint8 *)SDL_malloc(4*TESTRENDER_SCREEN_W*TESTRENDER_SCREEN_H);
|
||||||
|
SDLTest_AssertCheck(pixels != NULL, "Validate allocated temp pixel buffer");
|
||||||
|
if (pixels == NULL) return;
|
||||||
|
|
||||||
/* Explicitly specify the rect in case the window isn't the expected size... */
|
/* Explicitly specify the rect in case the window isn't the expected size... */
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.w = TESTRENDER_SCREEN_W;
|
rect.w = TESTRENDER_SCREEN_W;
|
||||||
rect.h = TESTRENDER_SCREEN_H;
|
rect.h = TESTRENDER_SCREEN_H;
|
||||||
ret = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pix, 80*4 );
|
result = SDL_RenderReadPixels(renderer, &rect, RENDER_COMPARE_FORMAT, pixels, 80*4 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(result == 0, "Validate result from SDL_RenderReadPixels, expected: 0, got: %i", result);
|
||||||
|
|
||||||
/* Create surface. */
|
/* Create surface. */
|
||||||
testSurface = SDL_CreateRGBSurfaceFrom( pix, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
|
testSurface = SDL_CreateRGBSurfaceFrom(pixels, TESTRENDER_SCREEN_W, TESTRENDER_SCREEN_H, 32, TESTRENDER_SCREEN_W*4,
|
||||||
RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
|
RENDER_COMPARE_RMASK, RENDER_COMPARE_GMASK, RENDER_COMPARE_BMASK, RENDER_COMPARE_AMASK);
|
||||||
SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom");
|
SDLTest_AssertCheck(testSurface != NULL, "Verify result from SDL_CreateRGBSurfaceFrom is not NULL");
|
||||||
|
|
||||||
/* Compare surface. */
|
/* Compare surface. */
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
|
result = SDLTest_CompareSurfaces( testSurface, referenceSurface, allowable_error );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(result == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", result);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
|
if (pixels != NULL) {
|
||||||
|
SDL_free(pixels);
|
||||||
|
}
|
||||||
if (testSurface != NULL) {
|
if (testSurface != NULL) {
|
||||||
SDL_FreeSurface(testSurface);
|
SDL_FreeSurface(testSurface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,19 +326,19 @@ int
|
||||||
surface_testBlit(void *arg)
|
surface_testBlit(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Basic blitting */
|
/* Basic blitting */
|
||||||
_testBlitBlendMode(-1);
|
_testBlitBlendMode(-1);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlit();
|
compareSurface = SDLTest_ImageBlit();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -351,19 +351,19 @@ int
|
||||||
surface_testBlitColorMod(void *arg)
|
surface_testBlitColorMod(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Basic blitting with color mod */
|
/* Basic blitting with color mod */
|
||||||
_testBlitBlendMode(-2);
|
_testBlitBlendMode(-2);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitColor();
|
compareSurface = SDLTest_ImageBlitColor();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -376,19 +376,19 @@ int
|
||||||
surface_testBlitAlphaMod(void *arg)
|
surface_testBlitAlphaMod(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Basic blitting with alpha mod */
|
/* Basic blitting with alpha mod */
|
||||||
_testBlitBlendMode(-3);
|
_testBlitBlendMode(-3);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitAlpha();
|
compareSurface = SDLTest_ImageBlitAlpha();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -402,19 +402,19 @@ int
|
||||||
surface_testBlitBlendNone(void *arg)
|
surface_testBlitBlendNone(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Basic blitting */
|
/* Basic blitting */
|
||||||
_testBlitBlendMode(SDL_BLENDMODE_NONE);
|
_testBlitBlendMode(SDL_BLENDMODE_NONE);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitBlendNone();
|
compareSurface = SDLTest_ImageBlitBlendNone();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -427,19 +427,19 @@ int
|
||||||
surface_testBlitBlendBlend(void *arg)
|
surface_testBlitBlendBlend(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Blend blitting */
|
/* Blend blitting */
|
||||||
_testBlitBlendMode(SDL_BLENDMODE_BLEND);
|
_testBlitBlendMode(SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitBlend();
|
compareSurface = SDLTest_ImageBlitBlend();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -452,19 +452,19 @@ int
|
||||||
surface_testBlitBlendAdd(void *arg)
|
surface_testBlitBlendAdd(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Add blitting */
|
/* Add blitting */
|
||||||
_testBlitBlendMode(SDL_BLENDMODE_ADD);
|
_testBlitBlendMode(SDL_BLENDMODE_ADD);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitBlendAdd();
|
compareSurface = SDLTest_ImageBlitBlendAdd();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -477,19 +477,19 @@ int
|
||||||
surface_testBlitBlendMod(void *arg)
|
surface_testBlitBlendMod(void *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* Mod blitting */
|
/* Mod blitting */
|
||||||
_testBlitBlendMode(SDL_BLENDMODE_MOD);
|
_testBlitBlendMode(SDL_BLENDMODE_MOD);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitBlendMod();
|
compareSurface = SDLTest_ImageBlitBlendMod();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface( compareSurface );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
@ -502,19 +502,19 @@ int
|
||||||
surface_testBlitBlendLoop(void *arg) {
|
surface_testBlitBlendLoop(void *arg) {
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
SDL_Surface *referenceSurface;
|
SDL_Surface *compareSurface;
|
||||||
|
|
||||||
/* All blitting modes */
|
/* All blitting modes */
|
||||||
_testBlitBlendMode(-4);
|
_testBlitBlendMode(-4);
|
||||||
|
|
||||||
/* Verify result by comparing surfaces */
|
/* Verify result by comparing surfaces */
|
||||||
referenceSurface = SDLTest_ImageBlitBlendAll();
|
compareSurface = SDLTest_ImageBlitBlendAll();
|
||||||
ret = SDLTest_CompareSurfaces( testSurface, referenceSurface, 0 );
|
ret = SDLTest_CompareSurfaces( testSurface, compareSurface, 0 );
|
||||||
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
SDLTest_AssertCheck(ret == 0, "Validate result from SDLTest_CompareSurfaces, expected: 0, got: %i", ret);
|
||||||
|
|
||||||
/* Clean up. */
|
/* Clean up. */
|
||||||
if (referenceSurface != NULL) {
|
if (compareSurface != NULL) {
|
||||||
SDL_FreeSurface( referenceSurface );
|
SDL_FreeSurface(compareSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue