mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-18 10:48:28 +00:00
SDL_test: don't parse audio/video arguments when its subsystem is not enabled
This commit is contained in:
parent
c8d4ca35ad
commit
c52ad54b05
1 changed files with 403 additions and 398 deletions
|
@ -142,6 +142,50 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
{
|
{
|
||||||
char **argv = state->argv;
|
char **argv = state->argv;
|
||||||
|
|
||||||
|
if ((SDL_strcasecmp(argv[index], "-h") == 0) || (SDL_strcasecmp(argv[index], "--help") == 0)) {
|
||||||
|
/* Print the usage message */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "--trackmem") == 0) {
|
||||||
|
/* Already handled in SDLTest_CommonCreateState() */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "--log") == 0) {
|
||||||
|
++index;
|
||||||
|
if (!argv[index]) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "all") == 0) {
|
||||||
|
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "error") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "system") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "audio") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "video") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "render") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (SDL_strcasecmp(argv[index], "input") == 0) {
|
||||||
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (state->flags & SDL_INIT_VIDEO) {
|
||||||
if (SDL_strcasecmp(argv[index], "--video") == 0) {
|
if (SDL_strcasecmp(argv[index], "--video") == 0) {
|
||||||
++index;
|
++index;
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
|
@ -195,41 +239,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--log") == 0) {
|
|
||||||
++index;
|
|
||||||
if (!argv[index]) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "all") == 0) {
|
|
||||||
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "error") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "system") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "audio") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "video") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "render") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "input") == 0) {
|
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (SDL_strcasecmp(argv[index], "--display") == 0) {
|
if (SDL_strcasecmp(argv[index], "--display") == 0) {
|
||||||
++index;
|
++index;
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
|
@ -264,7 +273,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--windows") == 0) {
|
if (SDL_strcasecmp(argv[index], "--windows") == 0) {
|
||||||
++index;
|
++index;
|
||||||
if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) {
|
if (!argv[index] || !SDL_isdigit((unsigned char) *argv[index])) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
|
if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
|
||||||
|
@ -471,7 +480,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
state->scale = (float)SDL_atof(argv[index]);
|
state->scale = (float) SDL_atof(argv[index]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--depth") == 0) {
|
if (SDL_strcasecmp(argv[index], "--depth") == 0) {
|
||||||
|
@ -487,7 +496,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
state->refresh_rate = (float)SDL_atof(argv[index]);
|
state->refresh_rate = (float) SDL_atof(argv[index]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
|
if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
|
||||||
|
@ -546,6 +555,9 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
state->window_flags |= SDL_WINDOW_KEYBOARD_GRABBED;
|
state->window_flags |= SDL_WINDOW_KEYBOARD_GRABBED;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state->flags & SDL_INIT_AUDIO) {
|
||||||
if (SDL_strcasecmp(argv[index], "--rate") == 0) {
|
if (SDL_strcasecmp(argv[index], "--rate") == 0) {
|
||||||
++index;
|
++index;
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
|
@ -589,7 +601,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
state->audiospec.channels = (Uint8)SDL_atoi(argv[index]);
|
state->audiospec.channels = (Uint8) SDL_atoi(argv[index]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--samples") == 0) {
|
if (SDL_strcasecmp(argv[index], "--samples") == 0) {
|
||||||
|
@ -597,16 +609,9 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
if (!argv[index]) {
|
if (!argv[index]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
state->audiospec.samples = (Uint16)SDL_atoi(argv[index]);
|
state->audiospec.samples = (Uint16) SDL_atoi(argv[index]);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--trackmem") == 0) {
|
|
||||||
/* Already handled in SDLTest_CommonCreateState() */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if ((SDL_strcasecmp(argv[index], "-h") == 0) || (SDL_strcasecmp(argv[index], "--help") == 0)) {
|
|
||||||
/* Print the usage message */
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
|
if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
|
||||||
/* Debug flag sent by Xcode */
|
/* Debug flag sent by Xcode */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue