diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-30 19:58:50 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-30 19:58:50 -0700 |
commit | f842201acec3c1edafb2916a76a8eb8d75474c2b (patch) | |
tree | 80d7dbe324973a26e3c9367c516ebe04d203b136 | |
parent | 68d23c61c9d8967b5d8798b48a686ac5a670c1d1 (diff) |
make test_sdl_mouse more robust
-rw-r--r-- | tests/sdl_mouse.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/sdl_mouse.c b/tests/sdl_mouse.c index 8af87c8c..0c10198a 100644 --- a/tests/sdl_mouse.c +++ b/tests/sdl_mouse.c @@ -43,6 +43,8 @@ void one() { } } +void main_2(); + int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_HWSURFACE); @@ -50,6 +52,12 @@ int main() { SDL_Rect rect = { 0, 0, 600, 450 }; SDL_FillRect(screen, &rect, 0x2244ffff); + emscripten_async_call(main_2, 3000); // avoid startup delays and intermittent errors + + return 0; +} + +void main_2() { emscripten_run_script("window.simulateMouseEvent(10, 20, -1)"); // move from 0,0 to 10,20 emscripten_run_script("window.simulateMouseEvent(10, 20, 0)"); // click emscripten_run_script("window.simulateMouseEvent(10, 20, 0)"); // click some more, but this one should be ignored through PeepEvent @@ -57,7 +65,5 @@ int main() { emscripten_run_script("window.simulateMouseEvent(30, 77, 1)"); // trigger the end emscripten_set_main_loop(one, 0); - - return 0; } |