Skip to content

Commit 7c936a6

Browse files
authored
[testing] Speed up test_sdl_audio_beep_sleep. (#25253)
This test takes over 60 seconds to run. There's really no point for it using such long beeps and delays when running in an automated test. After the changes it finishes in ~4 seconds.
1 parent 09f5255 commit 7c936a6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/browser/test_sdl_audio_beep_sleep.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@
2222
#undef main
2323
#endif
2424

25+
// Set this to true to if manually testing in browser to give longer delays
26+
// and beeps.
27+
// #define INTERACTIVE true
28+
29+
#ifdef INTERACTIVE
2530
const int tone_duration = 1000;
31+
#define DELAY 1500
32+
#else
33+
#define DELAY 1
34+
const int tone_duration = 10;
35+
#endif
2636

2737
struct BeepObject {
2838
double toneFrequency;
@@ -196,7 +206,11 @@ void nextTest(void *unused = 0) {
196206
return;
197207
}
198208

209+
#ifdef INTERACTIVE
199210
emscripten_sleep(100);
211+
#else
212+
emscripten_sleep(1);
213+
#endif
200214

201215
printf("Playing back a beep for %d msecs at %d Hz tone with audio format %s, %d channels, and %d samples/sec.\n",
202216
tone_duration, (int)Hz, SdlAudioFormatToString(sdlAudioFormats[s]), channels[c], freqs[f]);
@@ -211,9 +225,9 @@ void update() {
211225
delete beep;
212226
beep = 0;
213227
#ifdef __EMSCRIPTEN__
214-
emscripten_async_call(nextTest, 0, 1500);
228+
emscripten_async_call(nextTest, 0, DELAY);
215229
#else
216-
SDL_Delay(1500);
230+
SDL_Delay(DELAY);
217231
nextTest();
218232
#endif
219233
}

0 commit comments

Comments
 (0)