Added missing loop cancel for Emscripten in test programs.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Mon, 18 May 2015 21:21:14 +0200
changeset 96077746ab058d12
parent 9606 ec24a5add229
child 9608 17d2af576814
Added missing loop cancel for Emscripten in test programs.
test/checkkeys.c
test/testdraw2.c
test/testdrawchessboard.c
test/testgamecontroller.c
test/testgesture.c
test/testgles2.c
test/testintersections.c
test/testjoystick.c
test/testoverlay2.c
test/testrelative.c
test/testrendercopyex.c
test/testrendertarget.c
test/testscale.c
test/testsprite2.c
test/testspriteminimal.c
test/teststreaming.c
test/testviewport.c
test/testwm2.c
     1.1 --- a/test/checkkeys.c	Mon May 18 21:17:13 2015 +0200
     1.2 +++ b/test/checkkeys.c	Mon May 18 21:21:14 2015 +0200
     1.3 @@ -162,6 +162,11 @@
     1.4              break;
     1.5          }
     1.6      }
     1.7 +#ifdef __EMSCRIPTEN__
     1.8 +    if (done) {
     1.9 +        emscripten_cancel_main_loop();
    1.10 +    }
    1.11 +#endif
    1.12  }
    1.13  
    1.14  int
     2.1 --- a/test/testdraw2.c	Mon May 18 21:17:13 2015 +0200
     2.2 +++ b/test/testdraw2.c	Mon May 18 21:21:14 2015 +0200
     2.3 @@ -198,6 +198,11 @@
     2.4  
     2.5          SDL_RenderPresent(renderer);
     2.6      }
     2.7 +#ifdef __EMSCRIPTEN__
     2.8 +    if (done) {
     2.9 +        emscripten_cancel_main_loop();
    2.10 +    }
    2.11 +#endif
    2.12  }
    2.13  
    2.14  int
     3.1 --- a/test/testdrawchessboard.c	Mon May 18 21:17:13 2015 +0200
     3.2 +++ b/test/testdrawchessboard.c	Mon May 18 21:21:14 2015 +0200
     3.3 @@ -62,11 +62,17 @@
     3.4      while (SDL_PollEvent(&e)) {
     3.5  		if (e.type == SDL_QUIT) {
     3.6  			done = 1;
     3.7 +#ifdef __EMSCRIPTEN__
     3.8 +			emscripten_cancel_main_loop();
     3.9 +#endif
    3.10  			return;
    3.11  		}
    3.12  
    3.13  		if(e.key.keysym.sym == SDLK_ESCAPE) {
    3.14  			done = 1;
    3.15 +#ifdef __EMSCRIPTEN__
    3.16 +			emscripten_cancel_main_loop();
    3.17 +#endif
    3.18  			return;
    3.19  		}
    3.20  	}
     4.1 --- a/test/testgamecontroller.c	Mon May 18 21:17:13 2015 +0200
     4.2 +++ b/test/testgamecontroller.c	Mon May 18 21:21:14 2015 +0200
     4.3 @@ -153,6 +153,12 @@
     4.4          done = SDL_TRUE;
     4.5          retval = SDL_TRUE;  /* keep going, wait for reattach. */
     4.6      }
     4.7 +
     4.8 +#ifdef __EMSCRIPTEN__
     4.9 +    if (done) {
    4.10 +        emscripten_cancel_main_loop();
    4.11 +    }
    4.12 +#endif
    4.13  }
    4.14  
    4.15  SDL_bool
     5.1 --- a/test/testgesture.c	Mon May 18 21:17:13 2015 +0200
     5.2 +++ b/test/testgesture.c	Mon May 18 21:21:14 2015 +0200
     5.3 @@ -266,6 +266,12 @@
     5.4        }
     5.5      }
     5.6      DrawScreen(screen, window);
     5.7 +
     5.8 +#ifdef __EMSCRIPTEN__
     5.9 +    if (quitting) {
    5.10 +        emscripten_cancel_main_loop();
    5.11 +    }
    5.12 +#endif
    5.13  }
    5.14  
    5.15  int main(int argc, char* argv[])
     6.1 --- a/test/testgles2.c	Mon May 18 21:17:13 2015 +0200
     6.2 +++ b/test/testgles2.c	Mon May 18 21:21:14 2015 +0200
     6.3 @@ -466,6 +466,11 @@
     6.4            SDL_GL_SwapWindow(state->windows[i]);
     6.5        }
     6.6      }
     6.7 +#ifdef __EMSCRIPTEN__
     6.8 +    else {
     6.9 +        emscripten_cancel_main_loop();
    6.10 +    }
    6.11 +#endif
    6.12  }
    6.13  
    6.14  int
     7.1 --- a/test/testintersections.c	Mon May 18 21:17:13 2015 +0200
     7.2 +++ b/test/testintersections.c	Mon May 18 21:21:14 2015 +0200
     7.3 @@ -257,6 +257,11 @@
     7.4  
     7.5          SDL_RenderPresent(renderer);
     7.6      }
     7.7 +#ifdef __EMSCRIPTEN__
     7.8 +    if (done) {
     7.9 +        emscripten_cancel_main_loop();
    7.10 +    }
    7.11 +#endif
    7.12  }
    7.13  
    7.14  int
     8.1 --- a/test/testjoystick.c	Mon May 18 21:17:13 2015 +0200
     8.2 +++ b/test/testjoystick.c	Mon May 18 21:21:14 2015 +0200
     8.3 @@ -175,6 +175,12 @@
     8.4              done = SDL_TRUE;
     8.5              retval = SDL_TRUE;  /* keep going, wait for reattach. */
     8.6          }
     8.7 +
     8.8 +#ifdef __EMSCRIPTEN__
     8.9 +    if (done) {
    8.10 +        emscripten_cancel_main_loop();
    8.11 +    }
    8.12 +#endif
    8.13  }
    8.14  
    8.15  static SDL_bool
     9.1 --- a/test/testoverlay2.c	Mon May 18 21:17:13 2015 +0200
     9.2 +++ b/test/testoverlay2.c	Mon May 18 21:21:14 2015 +0200
     9.3 @@ -312,6 +312,12 @@
     9.4      SDL_RenderClear(renderer);
     9.5      SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);
     9.6      SDL_RenderPresent(renderer);
     9.7 +
     9.8 +#ifdef __EMSCRIPTEN__
     9.9 +    if (done) {
    9.10 +        emscripten_cancel_main_loop();
    9.11 +    }
    9.12 +#endif
    9.13  }
    9.14  
    9.15  int
    10.1 --- a/test/testrelative.c	Mon May 18 21:17:13 2015 +0200
    10.2 +++ b/test/testrelative.c	Mon May 18 21:21:14 2015 +0200
    10.3 @@ -67,6 +67,11 @@
    10.4  
    10.5          SDL_RenderPresent(renderer);
    10.6      }
    10.7 +#ifdef __EMSCRIPTEN__
    10.8 +    if (done) {
    10.9 +        emscripten_cancel_main_loop();
   10.10 +    }
   10.11 +#endif
   10.12  }
   10.13  
   10.14  int
    11.1 --- a/test/testrendercopyex.c	Mon May 18 21:17:13 2015 +0200
    11.2 +++ b/test/testrendercopyex.c	Mon May 18 21:21:14 2015 +0200
    11.3 @@ -152,6 +152,11 @@
    11.4              continue;
    11.5          Draw(&drawstates[i]);
    11.6      }
    11.7 +#ifdef __EMSCRIPTEN__
    11.8 +    if (done) {
    11.9 +        emscripten_cancel_main_loop();
   11.10 +    }
   11.11 +#endif
   11.12  }
   11.13  
   11.14  int
    12.1 --- a/test/testrendertarget.c	Mon May 18 21:17:13 2015 +0200
    12.2 +++ b/test/testrendertarget.c	Mon May 18 21:21:14 2015 +0200
    12.3 @@ -241,6 +241,11 @@
    12.4              if (!Draw(&drawstates[i])) done = 1;
    12.5          }
    12.6      }
    12.7 +#ifdef __EMSCRIPTEN__
    12.8 +    if (done) {
    12.9 +        emscripten_cancel_main_loop();
   12.10 +    }
   12.11 +#endif
   12.12  }
   12.13  
   12.14  int
    13.1 --- a/test/testscale.c	Mon May 18 21:17:13 2015 +0200
    13.2 +++ b/test/testscale.c	Mon May 18 21:21:14 2015 +0200
    13.3 @@ -142,6 +142,11 @@
    13.4              continue;
    13.5          Draw(&drawstates[i]);
    13.6      }
    13.7 +#ifdef __EMSCRIPTEN__
    13.8 +    if (done) {
    13.9 +        emscripten_cancel_main_loop();
   13.10 +    }
   13.11 +#endif
   13.12  }
   13.13  
   13.14  int
    14.1 --- a/test/testsprite2.c	Mon May 18 21:17:13 2015 +0200
    14.2 +++ b/test/testsprite2.c	Mon May 18 21:21:14 2015 +0200
    14.3 @@ -251,6 +251,11 @@
    14.4              continue;
    14.5          MoveSprites(state->renderers[i], sprites[i]);
    14.6      }
    14.7 +#ifdef __EMSCRIPTEN__
    14.8 +    if (done) {
    14.9 +        emscripten_cancel_main_loop();
   14.10 +    }
   14.11 +#endif
   14.12  }
   14.13  
   14.14  int
    15.1 --- a/test/testspriteminimal.c	Mon May 18 21:17:13 2015 +0200
    15.2 +++ b/test/testspriteminimal.c	Mon May 18 21:21:14 2015 +0200
    15.3 @@ -136,6 +136,11 @@
    15.4          }
    15.5      }
    15.6      MoveSprites(renderer, sprite);
    15.7 +#ifdef __EMSCRIPTEN__
    15.8 +    if (done) {
    15.9 +        emscripten_cancel_main_loop();
   15.10 +    }
   15.11 +#endif
   15.12  }
   15.13  
   15.14  int
    16.1 --- a/test/teststreaming.c	Mon May 18 21:17:13 2015 +0200
    16.2 +++ b/test/teststreaming.c	Mon May 18 21:21:14 2015 +0200
    16.3 @@ -115,6 +115,12 @@
    16.4      SDL_RenderClear(renderer);
    16.5      SDL_RenderCopy(renderer, MooseTexture, NULL, NULL);
    16.6      SDL_RenderPresent(renderer);
    16.7 +
    16.8 +#ifdef __EMSCRIPTEN__
    16.9 +    if (done) {
   16.10 +        emscripten_cancel_main_loop();
   16.11 +    }
   16.12 +#endif
   16.13  }
   16.14  
   16.15  int
    17.1 --- a/test/testviewport.c	Mon May 18 21:17:13 2015 +0200
    17.2 +++ b/test/testviewport.c	Mon May 18 21:21:14 2015 +0200
    17.3 @@ -129,6 +129,12 @@
    17.4              SDL_RenderPresent(state->renderers[i]);
    17.5          }
    17.6      }
    17.7 +
    17.8 +#ifdef __EMSCRIPTEN__
    17.9 +    if (done) {
   17.10 +        emscripten_cancel_main_loop();
   17.11 +    }
   17.12 +#endif
   17.13  }
   17.14  
   17.15  int
    18.1 --- a/test/testwm2.c	Mon May 18 21:17:13 2015 +0200
    18.2 +++ b/test/testwm2.c	Mon May 18 21:21:14 2015 +0200
    18.3 @@ -100,6 +100,11 @@
    18.4                  }
    18.5              }
    18.6          }
    18.7 +#ifdef __EMSCRIPTEN__
    18.8 +    if (done) {
    18.9 +        emscripten_cancel_main_loop();
   18.10 +    }
   18.11 +#endif
   18.12  }
   18.13  
   18.14  int