aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Birks <admin@daftgames.net>2014-06-06 13:14:09 +0100
committerCharlie Birks <admin@daftgames.net>2014-06-06 13:14:09 +0100
commitab37a004d25744d4c48353ed4fd215173650e099 (patch)
tree37c6f1d2176bdf9ee800b8e59bb8352ecc7c5f7c
parenta6860c18cf3a3525692a0dd2bee0b94e604189e3 (diff)
add test
-rw-r--r--tests/sdl_image.c10
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;
}