Switched the test code over to use the common functions in the test library.

This commit is contained in:
Sam Lantinga 2012-12-31 10:26:38 -08:00
parent f367ee7277
commit ac0f89315c
16 changed files with 209 additions and 1554 deletions

View file

@ -13,15 +13,15 @@
#include <stdlib.h>
#include <stdio.h>
#include "common.h"
#include "SDL_test_common.h"
static CommonState *state;
static SDLTest_CommonState *state;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
quit(int rc)
{
CommonQuit(state);
SDLTest_CommonQuit(state);
exit(rc);
}
@ -50,7 +50,7 @@ main(int argc, char *argv[])
SDL_Cursor *cursor = NULL;
/* Initialize test framework */
state = CommonCreateState(argv, SDL_INIT_VIDEO);
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) {
return 1;
}
@ -58,17 +58,17 @@ main(int argc, char *argv[])
for (i = 1; i < argc;) {
int consumed;
consumed = CommonArg(state, i);
consumed = SDLTest_CommonArg(state, i);
if (consumed == 0) {
consumed = -1;
}
if (consumed < 0) {
fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
quit(1);
}
i += consumed;
}
if (!CommonInit(state)) {
if (!SDLTest_CommonInit(state)) {
quit(2);
}
@ -77,7 +77,7 @@ main(int argc, char *argv[])
while (!done) {
/* Check for events */
while (SDL_PollEvent(&event)) {
CommonEvent(state, &event, &done);
SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_WINDOWEVENT) {
if (event.window.event == SDL_WINDOWEVENT_MOVED) {