From 51b56eaa6cb2a63efde1fce7f3ad2af80272b51c Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Mon, 17 Aug 2009 17:52:42 +0000 Subject: [PATCH] Added simple audio test. --- test/automated/Makefile | 13 +++++- test/automated/audio/audio.c | 89 ++++++++++++++++++++++++++++++++++++ test/automated/audio/audio.h | 18 ++++++++ test/automated/testsdl.c | 8 ++++ 4 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 test/automated/audio/audio.c create mode 100644 test/automated/audio/audio.h diff --git a/test/automated/Makefile b/test/automated/Makefile index 80a135913..2d37606b8 100644 --- a/test/automated/Makefile +++ b/test/automated/Makefile @@ -11,11 +11,17 @@ SRC := testsdl.c \ rwops/rwops.c \ platform/platform.c \ surface/surface.c \ - render/render.c + render/render.c \ + audio/audio.c COMMON_SRC := SDL_at.c common/common.c COMMON_INCLUDE := SDL_at.h -TESTS_ALL := testsdl rwops/rwops platform/platform surface/surface render/render +TESTS_ALL := testsdl \ + rwops/rwops \ + platform/platform \ + surface/surface \ + render/render \ + audio/audio .PHONY: all clean test @@ -41,5 +47,8 @@ surface/surface: surface/surface.c $(COMMON_INCLUDE) $(COMMON_SRC) render/render: render/render.c $(COMMON_INCLUDE) $(COMMON_SRC) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ render/render.c $(COMMON_SRC) -DTEST_STANDALONE +audio/audio: audio/audio.c $(COMMON_INCLUDE) $(COMMON_SRC) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ audio/audio.c $(COMMON_SRC) -DTEST_STANDALONE + clean: $(RM) $(TESTS_ALL) diff --git a/test/automated/audio/audio.c b/test/automated/audio/audio.c new file mode 100644 index 000000000..d4096af60 --- /dev/null +++ b/test/automated/audio/audio.c @@ -0,0 +1,89 @@ +/** + * Automated SDL_RWops test. + * + * Written by Edgar Simo "bobbens" + * + * Released under Public Domain. + */ + + +#include "SDL.h" +#include "SDL_at.h" + + +/** + * @brief Prints available devices. + */ +static int audio_printDevices( int iscapture ) +{ + int i, n; + + /* Get number of devices. */ + n = SDL_GetNumAudioDevices(iscapture); + SDL_ATprintVerbose( 1, "%d %s Audio Devices\n", + n, iscapture ? "Capture" : "Output" ); + + /* List devices. */ + for (i=0; i /* printf */ #include /* exit */ @@ -32,6 +33,7 @@ static int run_platform = 1; /**< Run platform tests. */ static int run_rwops = 1; /**< Run RWops tests. */ static int run_surface = 1; /**< Run surface tests. */ static int run_render = 1; /**< Run render tests. */ +static int run_audio = 1; /**< Run audio tests. */ /* * Prototypes. @@ -52,6 +54,7 @@ static void print_usage( const char *name ) printf(" --norwops do not run the rwops tests\n"); printf(" --nosurface do not run the surface tests\n"); printf(" --norender do not run the render tests\n"); + printf(" --noaudio do not run the audio tests\n"); printf(" -v, --verbose increases verbosity level by 1 for each -v\n"); printf(" -q, --quiet only displays errors\n"); printf(" -h, --help display this message and exit\n"); @@ -69,6 +72,7 @@ static void parse_options( int argc, char *argv[] ) { "norwops", no_argument, 0, 0 }, { "nosurface", no_argument, 0, 0 }, { "norender", no_argument, 0, 0 }, + { "noaudio", no_argument, 0, 0 }, { "verbose", no_argument, 0, 'v' }, { "quiet", no_argument, 0, 'q' }, { "help", no_argument, 0, 'h' }, @@ -96,6 +100,8 @@ static void parse_options( int argc, char *argv[] ) run_surface = 0; else if (strcmp(str,"norender")==0) run_render = 0; + else if (strcmp(str,"noaudio")==0) + run_audio = 0; break; /* Manual. */ @@ -154,6 +160,8 @@ int main( int argc, char *argv[] ) failed += test_surface(); if (run_render) failed += test_render(); + if (run_audio) + failed += test_audio(); /* Manual tests. */ if (run_manual) {