diff options
Diffstat (limited to 'tests/emscripten_api_browser.cpp')
-rw-r--r-- | tests/emscripten_api_browser.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/emscripten_api_browser.cpp b/tests/emscripten_api_browser.cpp index 305265e5..c209550b 100644 --- a/tests/emscripten_api_browser.cpp +++ b/tests/emscripten_api_browser.cpp @@ -11,19 +11,22 @@ extern "C" { bool pre1ed = false; bool pre2ed = false; -void pre1() { +void pre1(void *arg) { assert(!pre1ed); assert(!pre2ed); + assert((int)arg == 123); pre1ed = true; } -void pre2() { +void pre2(void *arg) { assert(pre1ed); assert(!pre2ed); + assert((int)arg == 98); pre2ed = true; } bool fived = false; -void five() { +void five(void *arg) { + assert((int)arg == 55); fived = true; emscripten_resume_main_loop(); } @@ -33,11 +36,11 @@ void mainey() { printf("mainey: %d\n", counter++); if (counter == 20) { emscripten_pause_main_loop(); - emscripten_async_call(five, 1000); + emscripten_async_call(five, (void*)55, 1000); } else if (counter == 22) { // very soon after 20, so without pausing we fail assert(fived); - emscripten_push_main_loop_blocker(pre1); - emscripten_push_main_loop_blocker(pre2); + emscripten_push_main_loop_blocker(pre1, (void*)123); + emscripten_push_main_loop_blocker(pre2, (void*)98); } else if (counter == 23) { assert(pre1ed); assert(pre2ed); @@ -47,7 +50,8 @@ void mainey() { } } -void four() { +void four(void *arg) { + assert((int)arg == 43); printf("four!\n"); emscripten_set_main_loop(mainey, 0); } @@ -56,10 +60,10 @@ void __attribute__((used)) third() { int now = SDL_GetTicks(); printf("thard! %d\n", now); assert(fabs(now - last - 1000) < 500); - emscripten_async_call(four, -1); // triggers requestAnimationFrame + emscripten_async_call(four, (void*)43, -1); // triggers requestAnimationFrame } -void second() { +void second(void *arg) { int now = SDL_GetTicks(); printf("sacond! %d\n", now); assert(fabs(now - last - 500) < 250); @@ -81,7 +85,7 @@ int main() { atexit(never); // should never be called - it is wrong to exit the runtime orderly if we have async calls! - emscripten_async_call(second, 500); + emscripten_async_call(second, (void*)0, 500); return 1; } |