diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-06 10:06:15 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-06 10:06:15 -0700 |
commit | a0b5fa6be83e76bc1ba418495df0307378985572 (patch) | |
tree | fe4448cd713ec85f9ae855babd575534d84ce577 /tests | |
parent | 85c15a40f96d3e14416bcbef1fd76537080798b5 (diff) | |
parent | ab37a004d25744d4c48353ed4fd215173650e099 (diff) |
Merge pull request #2409 from Daft-Freak/preloaded_image_data
Add emscripten_get_preloaded_image_data
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sdl_image.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/sdl_image.c b/tests/sdl_image.c index 523f8903..9639ea37 100644 --- a/tests/sdl_image.c +++ b/tests/sdl_image.c @@ -4,6 +4,7 @@ #include <assert.h> #include <emscripten.h> #include <unistd.h> +#include <stdlib.h> int testImage(SDL_Surface* screen, const char* fileName) { SDL_Surface *image = IMG_Load(fileName); @@ -18,7 +19,16 @@ int testImage(SDL_Surface* screen, const char* fileName) { int result = image->w; SDL_BlitSurface (image, NULL, screen, NULL); + + int w, h; + char *data = emscripten_get_preloaded_image_data(fileName, &w, &h); + + assert(data); + assert(w == image->w); + assert(h == image->h); + SDL_FreeSurface (image); + free(data); return result; } |