aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sdl_audio.c')
-rw-r--r--tests/sdl_audio.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/sdl_audio.c b/tests/sdl_audio.c
index 4927d868..938df3c4 100644
--- a/tests/sdl_audio.c
+++ b/tests/sdl_audio.c
@@ -10,14 +10,23 @@ void play2();
void play() {
int channel = Mix_PlayChannel(-1, sound, 1);
- assert(channel >= 0);
+ assert(channel == 0);
emscripten_run_script("setTimeout(Module['_play2'], 500)");
}
+void done(int channel) {
+ assert(channel == 1);
+
+ int result = 1;
+ REPORT_RESULT();
+}
+
void play2() {
+ Mix_ChannelFinished(done);
+
int channel2 = Mix_PlayChannel(-1, sound2, 1);
- assert(channel2 >= 0);
+ assert(channel2 == 1);
}
int main(int argc, char **argv) {
@@ -42,9 +51,6 @@ int main(int argc, char **argv) {
printf("you should hear two sounds. press the button to replay!\n");
- int result = 1;
- REPORT_RESULT();
-
return 0;
}