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

Commit

Permalink
Ported surface tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jul 9, 2011
1 parent b999514 commit 7f82c6f
Show file tree
Hide file tree
Showing 15 changed files with 424 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/test-automation/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I acinclude -I build-scripts

SUBDIRS = testdummy testrect testplatform testaudio
SUBDIRS = testdummy testrect testplatform testaudio testsurface

bin_PROGRAMS = runner
runner_SOURCES = runner.c SDL_test.c logger.c xml_logger.c plain_logger.c xml.c logger_helpers.c
Expand Down
12 changes: 7 additions & 5 deletions test/test-automation/SDL_test.c
Expand Up @@ -74,7 +74,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
_testReturnValue = 1;
_testAssertsFailed++;
} else {
AssertWithValues("AssertEquals", 1, "AssertEquals passed",
AssertWithValues("AssertEquals", 1, buf,
actual, expected, time(0));

_testAssertsPassed++;
Expand All @@ -92,15 +92,17 @@ AssertTrue(int condition, char *message, ...)
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );

//printf("AssertTrue failed: %s\n", buf);
Assert("AssertTrue", 0, buf, time(0));

_testReturnValue = 1;
_testAssertsFailed++;
} else {
//printf("AssertTrue passed\n");
Assert("AssertTrue", 1, "AssertTrue passed", time(0));
_testAssertsPassed++;
va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args );

Assert("AssertTrue", 1, buf, time(0));
_testAssertsPassed++;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/test-automation/build-scripts/install-tests.sh
Expand Up @@ -16,7 +16,7 @@ elif [[ $PLATFORM == "Darwin" ]]; then
fi

# TODO: put the test in an array
for suite in "testdummy" "testplatform" "testrect" "testaudio"
for suite in "testdummy" "testplatform" "testrect" "testaudio" "testsurface"
do
cp -f "$suite/.libs/lib$suite.$EXT" $DIRECTORY
done
Expand Down
3 changes: 0 additions & 3 deletions test/test-automation/common/common.c
Expand Up @@ -7,12 +7,9 @@
*/


#include "SDL.h"
#include "../SDL_at.h"

#include "common.h"


/**
* @brief Compares a surface and a surface image for equality.
*/
Expand Down
1 change: 1 addition & 0 deletions test/test-automation/common/common.h
Expand Up @@ -10,6 +10,7 @@
#ifndef COMMON_H
# define COMMON_H

#include "SDL/SDL.h"

# define FORMAT SDL_PIXELFORMAT_ARGB8888
# define AMASK 0xff000000 /**< Alpha bit mask. */
Expand Down
2 changes: 2 additions & 0 deletions test/test-automation/common/img_blit.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/test-automation/common/img_blitblend.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/test-automation/common/img_face.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/test-automation/common/img_primitives.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/test-automation/common/img_primitivesblend.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/test-automation/configure.ac
Expand Up @@ -36,7 +36,8 @@ AC_CONFIG_FILES([Makefile
testdummy/Makefile
testrect/Makefile
testplatform/Makefile
testaudio/Makefile])
testaudio/Makefile
testsurface/Makefile])
AC_OUTPUT

echo ""
Expand Down
Binary file added test/test-automation/icon.bmp
Binary file not shown.
6 changes: 3 additions & 3 deletions test/test-automation/plain_logger.c
Expand Up @@ -104,16 +104,16 @@ PlainAssert(const char *assertName, int assertResult, const char *assertMessage,
time_t eventTime)
{
const char *result = (assertResult) ? "passed" : "failed";
Output(indentLevel, "%s: %s", assertName, assertMessage);
Output(indentLevel, "%s: %s; %s", assertName, result, assertMessage);
}

void
PlainAssertWithValues(const char *assertName, int assertResult, const char *assertMessage,
int actualValue, int expected, time_t eventTime)
{
const char *result = (assertResult) ? "passed" : "failed";
Output(indentLevel, "%s %d (expected %d, actualValue &d): %s",
assertName, assertResult, expected, actualValue, assertMessage);
Output(indentLevel, "%s %s (expected %d, actualValue &d): %s",
assertName, result, expected, actualValue, assertMessage);
}

void
Expand Down
5 changes: 5 additions & 0 deletions test/test-automation/testsurface/Makefile.am
@@ -0,0 +1,5 @@
lib_LTLIBRARIES = libtestsurface.la
libtestsurface_la_SOURCES = testsurface.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c \
../common/common.c ../common/img_blit.c ../common/img_blitblend.c ../common/img_face.c ../common/img_primitives.c ../common/img_primitivesblend.c
libtestsurface_la_CLAGS = -fPIC -g
libtestsurface_la_LDFLAGS = `sdl-config --libs`

0 comments on commit 7f82c6f

Please sign in to comment.