diff options
author | ToadKing <toadking@toadking.com> | 2013-08-25 15:31:45 -0400 |
---|---|---|
committer | ToadKing <toadking@toadking.com> | 2013-08-25 15:31:45 -0400 |
commit | 70161252a9d748e98cd7df3b35b0630660cbbea7 (patch) | |
tree | ceaa5ace7deea4fd108a00c006bf507d72fdd863 | |
parent | 42c0bcffe65ebde4264e4915875055a2350a878f (diff) |
emscripten_get_canvas_size testcase
-rw-r--r-- | tests/sdl_canvas.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/sdl_canvas.c b/tests/sdl_canvas.c index 10044ff4..6bd659b8 100644 --- a/tests/sdl_canvas.c +++ b/tests/sdl_canvas.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <SDL/SDL.h> #include <SDL/SDL_ttf.h> #include <emscripten.h> @@ -43,6 +44,16 @@ int main(int argc, char **argv) { SDL_Flip(screen); SDL_LockSurface(screen); + + int width, height, isFullscreen; + emscripten_get_canvas_size(&width, &height, &isFullscreen); + + if (width != 600 && height != 450) + { + printf("error: wrong width/height\n"); + abort(); + } + int sum = 0; for (int i = 0; i < screen->h; i++) { sum += *((char*)screen->pixels + i*screen->w*4 + i*4 + 0); |