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. 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_TestCaseReferencehintsTests []
 
SDLTest_TestSuiteReference hintsTestSuite
 

Function Documentation

◆ hints_getHint()

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.

77 {
78  char *result1;
79  char *result2;
80  int i;
81 
82  for (i=0; i<_numHintsEnum; i++) {
83  result1 = (char *)SDL_GetHint((char*)_HintsEnum[i]);
84  SDLTest_AssertPass("Call to SDL_GetHint(%s) - using define definition", (char*)_HintsEnum[i]);
85  result2 = (char *)SDL_GetHint((char *)_HintsVerbose[i]);
86  SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
88  (result1 == NULL && result2 == NULL) || (SDL_strcmp(result1, result2) == 0),
89  "Verify returned values are equal; got: result1='%s' result2='%s",
90  (result1 == NULL) ? "null" : result1,
91  (result2 == NULL) ? "null" : result2);
92  }
93 
94  return TEST_COMPLETED;
95 }
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.
#define SDL_GetHint
char * _HintsVerbose[]
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...
#define TEST_COMPLETED
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:50
#define NULL
Definition: begin_code.h:164
const int _numHintsEnum
char * _HintsEnum[]
#define SDL_strcmp

◆ hints_setHint()

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.

102 {
103  char *originalValue;
104  char *value;
105  char *testValue;
107  int i, j;
108 
109  /* Create random values to set */
111 
112  for (i=0; i<_numHintsEnum; i++) {
113  /* Capture current value */
114  originalValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
115  SDLTest_AssertPass("Call to SDL_GetHint(%s)", (char*)_HintsEnum[i]);
116 
117  /* Set value (twice) */
118  for (j=1; j<=2; j++) {
119  result = SDL_SetHint((char*)_HintsEnum[i], value);
120  SDLTest_AssertPass("Call to SDL_SetHint(%s, %s) (iteration %i)", (char*)_HintsEnum[i], value, j);
122  result == SDL_TRUE || result == SDL_FALSE,
123  "Verify valid result was returned, got: %i",
124  (int)result);
125  testValue = (char *)SDL_GetHint((char*)_HintsEnum[i]);
126  SDLTest_AssertPass("Call to SDL_GetHint(%s) - using string definition", (char*)_HintsVerbose[i]);
128  (SDL_strcmp(value, testValue) == 0),
129  "Verify returned value equals set value; got: testValue='%s' value='%s",
130  (testValue == NULL) ? "null" : testValue,
131  value);
132  }
133 
134  /* Reset original value */
135  result = SDL_SetHint((char*)_HintsEnum[i], originalValue);
136  SDLTest_AssertPass("Call to SDL_SetHint(%s, originalValue)", (char*)_HintsEnum[i]);
138  result == SDL_TRUE || result == SDL_FALSE,
139  "Verify valid result was returned, got: %i",
140  (int)result);
141  }
142 
143  SDL_free(value);
144 
145  return TEST_COMPLETED;
146 }
GLuint64EXT * result
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.
#define SDL_GetHint
char * SDLTest_RandomAsciiStringOfSize(int size)
char * _HintsVerbose[]
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...
#define SDL_free
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:50
GLsizei const GLfloat * value
#define TEST_COMPLETED
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:50
#define NULL
Definition: begin_code.h:164
SDL_bool
Definition: SDL_stdinc.h:139
#define SDL_SetHint
const int _numHintsEnum
char * _HintsEnum[]
#define SDL_strcmp

Variable Documentation

◆ _HintsEnum

char* _HintsEnum[]
Initial value:
=
{
}
#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:466
#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:154
#define SDL_HINT_RENDER_SCALE_QUALITY
A variable controlling the scaling quality.
Definition: SDL_hints.h:143
#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:312
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER
A variable controlling whether the screensaver is enabled.
Definition: SDL_hints.h:165
#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:536
#define SDL_HINT_RENDER_OPENGL_SHADERS
A variable controlling whether the OpenGL render driver uses shaders if they are available.
Definition: SDL_hints.h:96
#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:544
#define SDL_HINT_TIMER_RESOLUTION
A variable that controls the timer resolution, in milliseconds.
Definition: SDL_hints.h:492
#define SDL_HINT_GRAB_KEYBOARD
A variable controlling whether grabbing input grabs the keyboard.
Definition: SDL_hints.h:263
#define SDL_HINT_XINPUT_ENABLED
A variable that lets you disable the detection and use of Xinput gamepad devices. ...
Definition: SDL_hints.h:408
#define SDL_HINT_VIDEO_WIN_D3DCOMPILER
A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries...
Definition: SDL_hints.h:560
#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:389
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES
A variable that dictates policy for fullscreen Spaces on Mac OS X.
Definition: SDL_hints.h:697
#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:579
#define SDL_HINT_IDLE_TIMER_DISABLED
A variable controlling whether the idle timer is disabled on iOS.
Definition: SDL_hints.h:329
#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE
A variable controlling whether the Direct3D device is initialized for thread-safe operations...
Definition: SDL_hints.h:107
#define SDL_HINT_ORIENTATIONS
A variable controlling which orientations are allowed on iOS.
Definition: SDL_hints.h:340
#define SDL_HINT_VIDEO_X11_XRANDR
A variable controlling whether the X11 XRandR extension should be used.
Definition: SDL_hints.h:198
#define SDL_HINT_FRAMEBUFFER_ACCELERATION
A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
Definition: SDL_hints.h:65
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
Definition: SDL_hints.h:85
#define SDL_HINT_GAMECONTROLLERCONFIG
A variable that lets you manually hint extra gamecontroller db entries.
Definition: SDL_hints.h:427
#define SDL_HINT_VIDEO_X11_XVIDMODE
A variable controlling whether the X11 VidMode extension should be used.
Definition: SDL_hints.h:176
#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP
A variable controlling whether relative mouse mode is implemented using mouse warping.
Definition: SDL_hints.h:284
#define SDL_HINT_VIDEO_X11_XINERAMA
A variable controlling whether the X11 Xinerama extension should be used.
Definition: SDL_hints.h:187

Definition at line 12 of file testautomation_hints.c.

Referenced by hints_getHint(), and hints_setHint().

◆ _HintsVerbose

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().

◆ _numHintsEnum

const int _numHintsEnum = 25

Hints test suite

Definition at line 11 of file testautomation_hints.c.

Referenced by hints_getHint(), and hints_setHint().

◆ hintsTest1

const SDLTest_TestCaseReference hintsTest1
static
Initial value:
=
{ (SDLTest_TestCaseFp)hints_getHint, "hints_getHint", "Call to SDL_GetHint", TEST_ENABLED }
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED
int hints_getHint(void *arg)
Call to SDL_GetHint.

Definition at line 151 of file testautomation_hints.c.

◆ hintsTest2

const SDLTest_TestCaseReference hintsTest2
static
Initial value:
=
{ (SDLTest_TestCaseFp)hints_setHint, "hints_setHint", "Call to SDL_SetHint", TEST_ENABLED }
int hints_setHint(void *arg)
Call to SDL_SetHint.
int(* SDLTest_TestCaseFp)(void *arg)
#define TEST_ENABLED

Definition at line 154 of file testautomation_hints.c.

◆ hintsTests

const SDLTest_TestCaseReference* hintsTests[]
static
Initial value:
= {
}
static const SDLTest_TestCaseReference hintsTest1
#define NULL
Definition: begin_code.h:164
static const SDLTest_TestCaseReference hintsTest2

Definition at line 158 of file testautomation_hints.c.

◆ hintsTestSuite

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

Definition at line 163 of file testautomation_hints.c.