Fixed swizzle of SDL_FillRect() on 24-bit surface (thanks, "nagydavid91"!).
Fixes Bugzilla #2986.
1 /* See COPYING.txt for the full license governing this code. */
3 * \file SDL_visualtest_variator_common.h
5 * Header for common functionality used by variators.
9 #include "SDL_visualtest_sut_configparser.h"
11 #ifndef _SDL_visualtest_variator_common_h
12 #define _SDL_visualtest_variator_common_h
14 /** The number of variations one integer option would generate */
15 #define SDL_SUT_INTEGER_OPTION_TEST_STEPS 3
17 /* Set up for C function definitions, even when using C++ */
22 /** enum for indicating the type of variator being used */
23 typedef enum SDLVisualTest_VariatorType
25 SDL_VARIATOR_NONE = 0,
26 SDL_VARIATOR_EXHAUSTIVE,
28 } SDLVisualTest_VariatorType;
31 * One possible value for a command line option to the SUT.
33 typedef union SDLVisualTest_SUTOptionValue
35 /*! Value if the option is of type boolean */
37 /*! Value if the option is of type integer. If on is true then the option
38 will be passed to the SUT, otherwise it will be ignored. */
43 /*! Index of the string in the enum_values field of the corresponding
44 SDLVisualTest_SUTOption object. If on is true the option will passed
45 to the SUT, otherwise it will be ignored. */
50 /*! Value if the option is of type string. If on is true the option will
51 be passed to the SUT, otherwise it will be ignored. */
56 } SDLVisualTest_SUTOptionValue;
59 * Represents a valid combination of parameters that can be passed to the SUT.
60 * The ordering of the values here is the same as the ordering of the options in
61 * the SDLVisualTest_SUTConfig object for this variation.
63 typedef struct SDLVisualTest_Variation
65 /*! Pointer to array of option values */
66 SDLVisualTest_SUTOptionValue* vars;
67 /*! Number of option values in \c vars */
69 } SDLVisualTest_Variation;
72 * "Increments" the value of the option by one and returns the carry. We wrap
73 * around to the initial value on overflow which makes the carry one.
74 * For example: "incrementing" an SDL_FALSE option makes it SDL_TRUE with no
75 * carry, and "incrementing" an SDL_TRUE option makes it SDL_FALSE with carry
76 * one. For integers, a random value in the valid range for the option is used.
78 * \param var Value of the option
79 * \param opt Object with metadata about the option
81 * \return 1 if there is a carry for enum and bool type options, 0 otherwise.
82 * 1 is always returned for integer and string type options. -1 is
85 int SDLVisualTest_NextValue(SDLVisualTest_SUTOptionValue* var,
86 SDLVisualTest_SUTOption* opt);
89 * Converts a variation object into a string of command line arguments.
91 * \param variation Variation object to be converted.
92 * \param config Config object for the SUT.
93 * \param buffer Pointer to the buffer the arguments string will be copied into.
94 * \param size Size of the buffer.
96 * \return 1 on success, 0 on failure
98 int SDLVisualTest_MakeStrFromVariation(SDLVisualTest_Variation* variation,
99 SDLVisualTest_SUTConfig* config,
100 char* buffer, int size);
103 * Initializes the variation using the following rules:
104 * - Boolean options are initialized to SDL_FALSE.
105 * - Integer options are initialized to the minimum valid value they can hold.
106 * - Enum options are initialized to the first element in the list of values they
108 * - String options are initialized to the name of the option.
110 * \return 1 on success, 0 on failure.
112 int SDLVisualTest_InitVariation(SDLVisualTest_Variation* variation,
113 SDLVisualTest_SUTConfig* config);
115 /* Ends C function definitions when using C++ */
120 #endif /* _SDL_visualtest_variator_common_h */