diff options
author | Anthony Pesch <inolen@gmail.com> | 2013-08-06 23:46:54 -0700 |
---|---|---|
committer | Anthony Pesch <inolen@gmail.com> | 2013-08-06 23:50:06 -0700 |
commit | 10839f06ce2b14437ae60c61ff65f7de3b2d1ca2 (patch) | |
tree | 79b0828f49ab81deb4d8b0ff9ee04f4bcd10b68b | |
parent | d6cde3066305358ad1b0f074eedc0b307774ce72 (diff) |
Updated test_sdl_image to more extensively test relative paths
-rwxr-xr-x | tests/runner.py | 2 | ||||
-rw-r--r-- | tests/sdl_image.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/runner.py b/tests/runner.py index 46096213..47bf7a7c 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -13045,7 +13045,7 @@ Press any key to continue.''' open(os.path.join(self.get_dir(), 'sdl_image.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_image.c')).read())) for mem in [0, 1]: - Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'sdl_image.c'), '-O2', '--preload-file', 'screenshot.jpg', '-o', 'page.html', '--memory-init-file', str(mem)]).communicate() + Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'sdl_image.c'), '-O2', '--preload-file', 'screenshot.jpg@/assets/screenshot.jpg', '-o', 'page.html', '--memory-init-file', str(mem)]).communicate() self.run_browser('page.html', '', '/report_result?600') def test_sdl_image_jpeg(self): diff --git a/tests/sdl_image.c b/tests/sdl_image.c index 9d8c36f2..12588ff6 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, "/assets/screenshot.jpg"); // absolute path assert(result != 0); - result |= testImage(screen, "/screenshot.jpg"); // absolute path + + chdir("/assets"); + result = testImage(screen, "./screenshot.jpg"); // relative path assert(result != 0); SDL_Flip(screen); |