Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
f51d1376
Commit
f51d1376
authored
Jul 05, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added audio suite.
parent
58b0cd86
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
164 additions
and
3 deletions
+164
-3
Makefile.am
test/test-automation/Makefile.am
+1
-1
install-tests.sh
test/test-automation/build-scripts/install-tests.sh
+1
-1
configure.ac
test/test-automation/configure.ac
+2
-1
Makefile.am
test/test-automation/testaudio/Makefile.am
+4
-0
testaudio.c
test/test-automation/testaudio/testaudio.c
+156
-0
No files found.
test/test-automation/Makefile.am
View file @
f51d1376
ACLOCAL_AMFLAGS
=
-I
acinclude
-I
build-scripts
SUBDIRS
=
testdummy testrect testplatform
SUBDIRS
=
testdummy testrect testplatform
testaudio
bin_PROGRAMS
=
runner
runner_SOURCES
=
runner.c SDL_test.c logger.c xml_logger.c plain_logger.c xml.c logger_helpers.c
...
...
test/test-automation/build-scripts/install-tests.sh
View file @
f51d1376
...
...
@@ -16,7 +16,7 @@ elif [[ $PLATFORM == "Darwin" ]]; then
fi
# TODO: put the test in an array
for
suite
in
"testdummy"
"testplatform"
"testrect"
for
suite
in
"testdummy"
"testplatform"
"testrect"
"testaudio"
do
cp
-f
"
$suite
/.libs/lib
$suite
.
$EXT
"
$DIRECTORY
done
...
...
test/test-automation/configure.ac
View file @
f51d1376
...
...
@@ -35,7 +35,8 @@ AC_FUNC_FORK
AC_CONFIG_FILES([Makefile
testdummy/Makefile
testrect/Makefile
testplatform/Makefile])
testplatform/Makefile
testaudio/Makefile])
AC_OUTPUT
echo ""
...
...
test/test-automation/testaudio/Makefile.am
0 → 100644
View file @
f51d1376
lib_LTLIBRARIES
=
libtestaudio.la
libtestaudio_la_SOURCES
=
testaudio.c ../SDL_test.c ../logger.c ../logger_helpers.c ../plain_logger.c ../xml_logger.c ../xml.c
libtestaudio_la_CLAGS
=
-fPIC
-g
libtestaudio_la_LDFLAGS
=
`
sdl-config
--libs
`
\ No newline at end of file
test/test-automation/testaudio/testaudio.c
0 → 100644
View file @
f51d1376
/*
Copyright (C) 2011 Markus Kauppila <markus.kauppila@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <stdio.h>
#include <SDL/SDL.h>
#include "../SDL_test.h"
/* Test casess */
static
const
TestCaseReference
test1
=
(
TestCaseReference
){
"audio_printOutputDevices"
,
"Checks available output (non-capture) device names."
,
TEST_ENABLED
,
0
,
0
};
static
const
TestCaseReference
test2
=
(
TestCaseReference
){
"audio_printInputDevices"
,
"Checks available input (capture) device names."
,
TEST_ENABLED
,
0
,
0
};
static
const
TestCaseReference
test3
=
(
TestCaseReference
){
"audio_printAudioDrivers"
,
"Checks available audio driver names."
,
TEST_ENABLED
,
0
,
0
};
static
const
TestCaseReference
test4
=
(
TestCaseReference
){
"audio_printCurrentAudioDriver"
,
"Checks current audio driver name with initialized audio."
,
TEST_ENABLED
,
0
,
0
};
/* Test suite */
extern
const
TestCaseReference
*
testSuite
[]
=
{
&
test1
,
&
test2
,
&
test3
,
&
test4
,
NULL
};
TestCaseReference
**
QueryTestSuite
()
{
return
(
TestCaseReference
**
)
testSuite
;
}
/* Test case functions */
/**
* @brief Checks available output (non-capture) device names.
*/
int
audio_printOutputDevices
()
{
int
ret
;
int
i
,
n
;
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Get number of devices. */
n
=
SDL_GetNumAudioDevices
(
0
);
AssertTrue
(
n
>=
0
,
"Number of output devices < 0, reported as %i"
,
n
);
/* List devices. */
if
(
n
>
0
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
name
=
SDL_GetAudioDeviceName
(
i
,
0
);
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name blank"
);
}
}
/* Quit SDL. */
SDL_Quit
();
}
/**
* @brief Checks available input (capture) device names.
*/
int
audio_printInputDevices
()
{
int
ret
;
int
i
,
n
;
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Get number of devices. */
n
=
SDL_GetNumAudioDevices
(
1
);
AssertTrue
(
n
>=
0
,
"Number of input devices < 0, reported as %i"
,
n
);
/* List devices. */
if
(
n
>
0
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
name
=
SDL_GetAudioDeviceName
(
i
,
1
);
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
}
}
/* Quit SDL. */
SDL_Quit
();
}
/**
* @brief Checks available audio driver names.
*/
int
audio_printAudioDrivers
()
{
int
i
,
n
;
char
*
name
;
/* Get number of drivers */
n
=
SDL_GetNumAudioDrivers
();
AssertTrue
(
n
>=
0
,
"Number of audio drivers >= 0"
);
/* List drivers. */
if
(
n
>
0
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
name
=
SDL_GetAudioDriver
(
i
);
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
}
}
}
/**
* @brief Checks current audio driver name with initialized audio.
*/
int
audio_printCurrentAudioDriver
()
{
int
ret
;
char
*
name
;
/* Start SDL. */
ret
=
SDL_Init
(
SDL_INIT_AUDIO
);
AssertTrue
(
ret
==
0
,
"SDL_Init(SDL_INIT_AUDIO): %s"
,
SDL_GetError
());
/* Check current audio driver */
name
=
SDL_GetCurrentAudioDriver
();
AssertTrue
(
name
!=
NULL
,
"name != NULL"
);
AssertTrue
(
strlen
(
name
)
>
0
,
"name empty"
);
/* Quit SDL. */
SDL_Quit
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment