SDL  2.0
testautomation_hints.c File Reference
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
+ Include dependency graph for testautomation_hints.c:

Go to the source code of this file.

Functions

int hints_getHint (void *arg)
 Call to SDL_GetHint.
int hints_setHint (void *arg)
 Call to SDL_SetHint.

Variables

const int _numHintsEnum = 25
char * _HintsEnum []
char * _HintsVerbose []
static const
SDLTest_TestCaseReference 
hintsTest1
static const
SDLTest_TestCaseReference 
hintsTest2
static const
SDLTest_TestCaseReference
hintsTests []
SDLTest_TestSuiteReference hintsTestSuite

Function Documentation

int hints_getHint ( void arg)

Call to SDL_GetHint.

Definition at line 76 of file testautomation_hints.c.

References _HintsEnum, _HintsVerbose, _numHintsEnum, i, NULL, SDL_GetHint, SDL_strcmp, SDLTest_AssertCheck(), SDLTest_AssertPass(), and TEST_COMPLETED.

{
char *result1;
char *result2;
int i;
for (i=0; i<_numHintsEnum; i++) {
result1 = (char *)SDL_GetHint((char*)_HintsEnum[i]);
SDLTest_AssertPass("Call to SDL_GetHint(%s) - using define definition", (char*)_HintsEnum[i]);
result2 = (char *)SDL_GetHint((char *)_HintsVerbose[i]);
SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
(result1 == NULL && result2 == NULL) || (SDL_strcmp(result1, result2) == 0),
"Verify returned values are equal; got: result1='%s' result2='%s",
(result1 == NULL) ? "null" : result1,
(result2 == NULL) ? "null" : result2);
}
}
int hints_setHint ( void arg)

Call to SDL_SetHint.

Definition at line 101 of file testautomation_hints.c.

References _HintsEnum, _HintsVerbose, _numHintsEnum, i, j, NULL, SDL_FALSE, SDL_free, SDL_GetHint, SDL_SetHint, SDL_strcmp, SDL_TRUE, SDLTest_AssertCheck(), SDLTest_AssertPass(), SDLTest_RandomAsciiStringOfSize(), and TEST_COMPLETED.

{
char *originalValue;
char *value;
char *testValue;
int i, j;
/* Create random values to set */
for (i=0; i<_numHintsEnum; i++) {
/* Capture current value */
originalValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
SDLTest_AssertPass("Call to SDL_GetHint(%s)", (char*)_HintsEnum[i]);
/* Set value (twice) */
for (j=1; j<=2; j++) {
result = SDL_SetHint((char*)_HintsEnum[i], value);
SDLTest_AssertPass("Call to SDL_SetHint(%s, %s) (iteration %i)", (char*)_HintsEnum[i], value, j);
result == SDL_TRUE || result == SDL_FALSE,
"Verify valid result was returned, got: %i",
(int)result);
testValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
(SDL_strcmp(value, testValue) == 0),
"Verify returned value equals set value; got: testValue='%s' value='%s",
(testValue == NULL) ? "null" : testValue,
value);
}
/* Reset original value */
result = SDL_SetHint((char*)_HintsEnum[i], originalValue);
SDLTest_AssertPass("Call to SDL_SetHint(%s, originalValue)", (char*)_HintsEnum[i]);
result == SDL_TRUE || result == SDL_FALSE,
"Verify valid result was returned, got: %i",
(int)result);
}
SDL_free(value);
}

Variable Documentation

char* _HintsVerbose[]
Initial value:
{
"SDL_HINT_ACCELEROMETER_AS_JOYSTICK",
"SDL_HINT_FRAMEBUFFER_ACCELERATION",
"SDL_HINT_GAMECONTROLLERCONFIG",
"SDL_HINT_GRAB_KEYBOARD",
"SDL_HINT_IDLE_TIMER_DISABLED",
"SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS",
"SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK",
"SDL_HINT_MOUSE_RELATIVE_MODE_WARP",
"SDL_HINT_ORIENTATIONS",
"SDL_HINT_RENDER_DIRECT3D_THREADSAFE",
"SDL_HINT_RENDER_DRIVER",
"SDL_HINT_RENDER_OPENGL_SHADERS",
"SDL_HINT_RENDER_SCALE_QUALITY",
"SDL_HINT_RENDER_VSYNC",
"SDL_HINT_TIMER_RESOLUTION",
"SDL_HINT_VIDEO_ALLOW_SCREENSAVER",
"SDL_HINT_VIDEO_HIGHDPI_DISABLED",
"SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES",
"SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS",
"SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT",
"SDL_HINT_VIDEO_WIN_D3DCOMPILER",
"SDL_HINT_VIDEO_X11_XINERAMA",
"SDL_HINT_VIDEO_X11_XRANDR",
"SDL_HINT_VIDEO_X11_XVIDMODE",
"SDL_HINT_XINPUT_ENABLED"
}

Definition at line 40 of file testautomation_hints.c.

Referenced by hints_getHint(), and hints_setHint().

const int _numHintsEnum = 25

Hints test suite

Definition at line 11 of file testautomation_hints.c.

Referenced by hints_getHint(), and hints_setHint().

const SDLTest_TestCaseReference hintsTest1
static
Initial value:
{ (SDLTest_TestCaseFp)hints_getHint, "hints_getHint", "Call to SDL_GetHint", TEST_ENABLED }

Definition at line 151 of file testautomation_hints.c.

const SDLTest_TestCaseReference hintsTest2
static
Initial value:
{ (SDLTest_TestCaseFp)hints_setHint, "hints_setHint", "Call to SDL_SetHint", TEST_ENABLED }

Definition at line 154 of file testautomation_hints.c.

const SDLTest_TestCaseReference* hintsTests[]
static
Initial value:

Definition at line 158 of file testautomation_hints.c.

Initial value:
{
"Hints",
}

Definition at line 163 of file testautomation_hints.c.