aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_image.c
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-08 15:03:41 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-08 15:03:41 -0700
commit634bac9e1ed719c5779d3116a3797b3aef4b2012 (patch)
treeea6e3e39584431f09992e5637a750cd05f75b782 /tests/sdl_image.c
parentfef6f254c305db507904d1068af4f9e25ce5769a (diff)
parent47c1d35c944c8ef954aa3d8de9686e35c2858a24 (diff)
Merge pull request #1470 from inolen/preload_path_fixes
file preload path fixes
Diffstat (limited to 'tests/sdl_image.c')
-rw-r--r--tests/sdl_image.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/sdl_image.c b/tests/sdl_image.c
index 9d8c36f2..523f8903 100644
--- a/tests/sdl_image.c
+++ b/tests/sdl_image.c
@@ -3,6 +3,7 @@
#include <SDL/SDL_image.h>
#include <assert.h>
#include <emscripten.h>
+#include <unistd.h>
int testImage(SDL_Surface* screen, const char* fileName) {
SDL_Surface *image = IMG_Load(fileName);
@@ -27,9 +28,12 @@ int main() {
SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE);
int result = 0;
- result = testImage(screen, "screenshot.jpg"); // relative path
+
+ result |= testImage(screen, SCREENSHOT_DIRNAME "/" SCREENSHOT_BASENAME); // absolute path
assert(result != 0);
- result |= testImage(screen, "/screenshot.jpg"); // absolute path
+
+ chdir(SCREENSHOT_DIRNAME);
+ result = testImage(screen, "./" SCREENSHOT_BASENAME); // relative path
assert(result != 0);
SDL_Flip(screen);