diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-03-14 19:57:23 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-15 11:53:16 -0700 |
commit | ff46d95e04588f0d328ef8c49b12ebaa99a782a0 (patch) | |
tree | b789ffa49feff14d52518fa88682e9d3990a75ce /tests | |
parent | be5bc3b617c7cca563f3b1cfe4ab3a5083318e67 (diff) |
Add tests for playback states
Diffstat (limited to 'tests')
-rw-r--r-- | tests/openal_playback.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/openal_playback.cpp b/tests/openal_playback.cpp index 4afa55fb..13d619e6 100644 --- a/tests/openal_playback.cpp +++ b/tests/openal_playback.cpp @@ -2,6 +2,28 @@ #include <stdlib.h> #include <AL/al.h> #include <AL/alc.h> +#include <assert.h> +#include <emscripten.h> + +void playSource(void* arg) +{ + ALuint source = reinterpret_cast<ALuint>(arg); + ALint state; + alGetSourcei(source, AL_SOURCE_STATE, &state); + assert(state == AL_PLAYING); + alSourcePause(source); + alGetSourcei(source, AL_SOURCE_STATE, &state); + assert(state == AL_PAUSED); + alSourcePlay(source); + alGetSourcei(source, AL_SOURCE_STATE, &state); + assert(state == AL_PLAYING); + alSourceStop(source); + alGetSourcei(source, AL_SOURCE_STATE, &state); + assert(state == AL_STOPPED); + + int result = 1; + REPORT_RESULT(); +} int main() { ALCdevice* device = alcOpenDevice(NULL); @@ -78,10 +100,16 @@ int main() { alSourcei(sources[0], AL_BUFFER, buffers[0]); + ALint state; + alGetSourcei(sources[0], AL_SOURCE_STATE, &state); + assert(state == AL_INITIAL); + alSourcePlay(sources[0]); - int result = 1; - REPORT_RESULT(); + alGetSourcei(sources[0], AL_SOURCE_STATE, &state); + assert(state == AL_PLAYING); + + emscripten_async_call(playSource, reinterpret_cast<void*>(sources[0]), 700); return 0; } |