test/testautomation_video.c
changeset 6800 26c6795ec1a4
child 6891 177f29ae5279
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/testautomation_video.c	Sun Jan 06 15:17:59 2013 -0800
     1.3 @@ -0,0 +1,81 @@
     1.4 +/**
     1.5 + * Video test suite
     1.6 + */
     1.7 +
     1.8 +#include <stdio.h>
     1.9 +
    1.10 +#include "SDL.h"
    1.11 +#include "SDL_test.h"
    1.12 +
    1.13 +/* Test case functions */
    1.14 +
    1.15 +/**
    1.16 + * @brief Enable and disable screensaver while checking state
    1.17 + */
    1.18 +int
    1.19 +video_enableDisableScreensaver(void *arg)
    1.20 +{
    1.21 +	SDL_bool initialResult;
    1.22 +	SDL_bool result;
    1.23 +
    1.24 +	/* Get current state and proceed according to current state */
    1.25 +	initialResult = SDL_IsScreenSaverEnabled();
    1.26 +	SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");	
    1.27 +	if (initialResult == SDL_TRUE) {
    1.28 +	
    1.29 +	  /* Currently enabled: disable first, then enable again */
    1.30 +	  
    1.31 +	  /* Disable screensaver and check */	
    1.32 +	  SDL_DisableScreenSaver();
    1.33 +	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
    1.34 +	  result = SDL_IsScreenSaverEnabled();
    1.35 +	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    1.36 +	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);
    1.37 +	
    1.38 +	  /* Enable screensaver and check */	
    1.39 +	  SDL_EnableScreenSaver();
    1.40 +	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
    1.41 +	  result = SDL_IsScreenSaverEnabled();
    1.42 +	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    1.43 +	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
    1.44 +
    1.45 +	} else {
    1.46 +
    1.47 +	  /* Currently disabled: enable first, then disable again */
    1.48 +	  
    1.49 +	  /* Enable screensaver and check */	
    1.50 +	  SDL_EnableScreenSaver();
    1.51 +	  SDLTest_AssertPass("Call to SDL_EnableScreenSaver()");
    1.52 +	  result = SDL_IsScreenSaverEnabled();
    1.53 +	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    1.54 +	  SDLTest_AssertCheck(result == SDL_TRUE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_TRUE, result);
    1.55 +
    1.56 +	  /* Disable screensaver and check */	
    1.57 +	  SDL_DisableScreenSaver();
    1.58 +	  SDLTest_AssertPass("Call to SDL_DisableScreenSaver()");	
    1.59 +	  result = SDL_IsScreenSaverEnabled();
    1.60 +	  SDLTest_AssertPass("Call to SDL_IsScreenSaverEnabled()");
    1.61 +	  SDLTest_AssertCheck(result == SDL_FALSE, "Verify result from SDL_IsScreenSaverEnabled, expected: %i, got: %i", SDL_FALSE, result);	
    1.62 +	}	
    1.63 +	
    1.64 +	return TEST_COMPLETED;
    1.65 +}
    1.66 +
    1.67 +/* ================= Test References ================== */
    1.68 +
    1.69 +/* Video test cases */
    1.70 +static const SDLTest_TestCaseReference videoTest1 =
    1.71 +		{ (SDLTest_TestCaseFp)video_enableDisableScreensaver, "video_enableDisableScreensaver",  "Enable and disable screenaver while checking state", TEST_ENABLED };
    1.72 +
    1.73 +/* Sequence of Video test cases */
    1.74 +static const SDLTest_TestCaseReference *videoTests[] =  {
    1.75 +	&videoTest1, NULL
    1.76 +};
    1.77 +
    1.78 +/* Video test suite (global) */
    1.79 +SDLTest_TestSuiteReference videoTestSuite = {
    1.80 +	"Video",
    1.81 +	NULL,
    1.82 +	videoTests,
    1.83 +	NULL
    1.84 +};