mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-18 02:38:27 +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]) {
|
||||||
|
@ -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]) {
|
||||||
|
@ -600,13 +612,6 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
||||||
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