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. More...
int | hints_setHint (void *arg)
| Call to SDL_SetHint. More...

## 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]);
SDLTest_AssertCheck(
(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);
}
return TEST_COMPLETED;
}
SDLTest_AssertPass
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
Definition: SDL_test_assert.c:94
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:197
_HintsVerbose
char * _HintsVerbose[]
Definition: testautomation_hints.c:40
SDLTest_AssertCheck
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
Definition: SDL_test_assert.c:65
TEST_COMPLETED
#define TEST_COMPLETED
Definition: SDL_test_harness.h:53
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
_numHintsEnum
const int _numHintsEnum
Definition: testautomation_hints.c:11
_HintsEnum
char * _HintsEnum[]
Definition: testautomation_hints.c:12
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423

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;
SDL_bool result;
int i, j;
/* Create random values to set */
value = SDLTest_RandomAsciiStringOfSize(10);
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);
SDLTest_AssertCheck(
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]);
SDLTest_AssertCheck(
(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]);
SDLTest_AssertCheck(
result == SDL_TRUE || result == SDL_FALSE,
"Verify valid result was returned, got: %i",
(int)result);
}
SDL_free(value);
return TEST_COMPLETED;
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDLTest_AssertPass
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
Definition: SDL_test_assert.c:94
SDL_GetHint
#define SDL_GetHint
Definition: SDL_dynapi_overrides.h:197
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDLTest_RandomAsciiStringOfSize
char * SDLTest_RandomAsciiStringOfSize(int size)
Definition: SDL_test_fuzzer.c:500
_HintsVerbose
char * _HintsVerbose[]
Definition: testautomation_hints.c:40
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDLTest_AssertCheck
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
Definition: SDL_test_assert.c:65
SDL_free
void SDL_free(void *mem)
SDL_TRUE
Definition: SDL_stdinc.h:129
TEST_COMPLETED
#define TEST_COMPLETED
Definition: SDL_test_harness.h:53
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_SetHint
#define SDL_SetHint
Definition: SDL_dynapi_overrides.h:196
SDL_FALSE
Definition: SDL_stdinc.h:128
_numHintsEnum
const int _numHintsEnum
Definition: testautomation_hints.c:11
_HintsEnum
char * _HintsEnum[]
Definition: testautomation_hints.c:12
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:423
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:42

## Variable Documentation

char* _HintsEnum[]

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,
}
SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
A variable that lets you enable joystick (and gamecontroller) events even when your app is in the bac...
Definition: SDL_hints.h:334
SDL_HINT_RENDER_VSYNC
#define SDL_HINT_RENDER_VSYNC
A variable controlling whether updates to the SDL screen surface should be synchronized with the vert...
Definition: SDL_hints.h:142
SDL_HINT_RENDER_SCALE_QUALITY
#define SDL_HINT_RENDER_SCALE_QUALITY
A variable controlling the scaling quality.
Definition: SDL_hints.h:131
SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS
Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true...
Definition: SDL_hints.h:250
SDL_HINT_VIDEO_ALLOW_SCREENSAVER
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:153
SDL_HINT_VIDEO_HIGHDPI_DISABLED
#define SDL_HINT_VIDEO_HIGHDPI_DISABLED
If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS)
Definition: SDL_hints.h:379
SDL_HINT_RENDER_OPENGL_SHADERS
#define SDL_HINT_RENDER_OPENGL_SHADERS
A variable controlling whether the OpenGL render driver uses shaders if they are available.
Definition: SDL_hints.h:95
SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK
#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK
A variable that determines whether ctrl+click should generate a right-click event on Mac...
Definition: SDL_hints.h:387
SDL_HINT_TIMER_RESOLUTION
#define SDL_HINT_TIMER_RESOLUTION
A variable that controls the timer resolution, in milliseconds.
Definition: SDL_hints.h:362
SDL_HINT_GRAB_KEYBOARD
#define SDL_HINT_GRAB_KEYBOARD
A variable controlling whether grabbing input grabs the keyboard.
Definition: SDL_hints.h:233
SDL_HINT_XINPUT_ENABLED
#define SDL_HINT_XINPUT_ENABLED
A variable that lets you disable the detection and use of Xinput gamepad devices. ...
Definition: SDL_hints.h:299
SDL_HINT_VIDEO_WIN_D3DCOMPILER
#define SDL_HINT_VIDEO_WIN_D3DCOMPILER
A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries...
Definition: SDL_hints.h:403
SDL_HINT_ACCELEROMETER_AS_JOYSTICK
#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK
A variable controlling whether the Android / iOS built-in accelerometer should be listed as a joystic...
Definition: SDL_hints.h:289
SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES
A variable that dictates policy for fullscreen Spaces on Mac OS X.
Definition: SDL_hints.h:540
SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT
A variable that is the address of another SDL_Window* (as a hex string formatted with "%p")...
Definition: SDL_hints.h:422
SDL_HINT_IDLE_TIMER_DISABLED
#define SDL_HINT_IDLE_TIMER_DISABLED
A variable controlling whether the idle timer is disabled on iOS.
Definition: SDL_hints.h:267
SDL_HINT_RENDER_DIRECT3D_THREADSAFE
#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE
A variable controlling whether the Direct3D device is initialized for thread-safe operations...
Definition: SDL_hints.h:106
SDL_HINT_ORIENTATIONS
#define SDL_HINT_ORIENTATIONS
A variable controlling which orientations are allowed on iOS.
Definition: SDL_hints.h:278
SDL_HINT_VIDEO_X11_XRANDR
#define SDL_HINT_VIDEO_X11_XRANDR
A variable controlling whether the X11 XRandR extension should be used.
Definition: SDL_hints.h:186
SDL_HINT_FRAMEBUFFER_ACCELERATION
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
Definition: SDL_hints.h:65
SDL_HINT_RENDER_DRIVER
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
Definition: SDL_hints.h:84
SDL_HINT_GAMECONTROLLERCONFIG
#define SDL_HINT_GAMECONTROLLERCONFIG
A variable that lets you manually hint extra gamecontroller db entries.
Definition: SDL_hints.h:320
SDL_HINT_VIDEO_X11_XVIDMODE
#define SDL_HINT_VIDEO_X11_XVIDMODE
A variable controlling whether the X11 VidMode extension should be used.
Definition: SDL_hints.h:164
SDL_HINT_MOUSE_RELATIVE_MODE_WARP
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP
A variable controlling whether relative mouse mode is implemented using mouse warping.
Definition: SDL_hints.h:244
SDL_HINT_VIDEO_X11_XINERAMA
#define SDL_HINT_VIDEO_X11_XINERAMA
A variable controlling whether the X11 Xinerama extension should be used.
Definition: SDL_hints.h:175

Definition at line 12 of file testautomation_hints.c.

Referenced by hints_getHint(), and hints_setHint().

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 }
SDLTest_TestCaseFp
int(* SDLTest_TestCaseFp)(void *arg)
Definition: SDL_test_harness.h:67
TEST_ENABLED
#define TEST_ENABLED
Definition: SDL_test_harness.h:47
hints_getHint
int hints_getHint(void *arg)
Call to SDL_GetHint.
Definition: testautomation_hints.c:76

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 }
hints_setHint
int hints_setHint(void *arg)
Call to SDL_SetHint.
Definition: testautomation_hints.c:101
SDLTest_TestCaseFp
int(* SDLTest_TestCaseFp)(void *arg)
Definition: SDL_test_harness.h:67
TEST_ENABLED
#define TEST_ENABLED
Definition: SDL_test_harness.h:47

Definition at line 154 of file testautomation_hints.c.

const SDLTest_TestCaseReference* hintsTests[]

static

Initial value:
= {
&hintsTest1, &hintsTest2, NULL
}
hintsTest1
static const SDLTest_TestCaseReference hintsTest1
Definition: testautomation_hints.c:151
NULL
#define NULL
Definition: begin_code.h:143
hintsTest2
static const SDLTest_TestCaseReference hintsTest2
Definition: testautomation_hints.c:154

Definition at line 158 of file testautomation_hints.c.

SDLTest_TestSuiteReference hintsTestSuite

Initial value:
= {
"Hints",
NULL,
hintsTests,
NULL
}
NULL
#define NULL
Definition: begin_code.h:143
hintsTests
static const SDLTest_TestCaseReference * hintsTests[]
Definition: testautomation_hints.c:158

Definition at line 163 of file testautomation_hints.c.