aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-07-18 16:24:37 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-07-18 16:24:37 -0700
commita97aab0522858f3e24ab96fe93e7be9e2b976878 (patch)
treef8585d79dc26206ca04786ee7a3538934eb86eac /tests
parent168e8fd12dca0316f4edd08da5fb0c2608d67368 (diff)
refactor file preloading to happen in FS.createPreloadedFile, so that not only file_packager preloading gets preloaded Images and Audios
Diffstat (limited to 'tests')
-rw-r--r--tests/emscripten_fs_api_browser.cpp17
-rwxr-xr-xtests/runner.py1
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/emscripten_fs_api_browser.cpp b/tests/emscripten_fs_api_browser.cpp
index 07469f34..bfe33213 100644
--- a/tests/emscripten_fs_api_browser.cpp
+++ b/tests/emscripten_fs_api_browser.cpp
@@ -1,22 +1,25 @@
#include<stdio.h>
#include<emscripten.h>
#include<assert.h>
-#include <string.h>
-
+#include<string.h>
+#include<SDL/SDL.h>
+#include"SDL/SDL_image.h"
+
extern "C" {
int result = 1;
int get_count = 0;
void wait_wgets() {
- if (get_count == 2) {
+ if (get_count == 3) {
+ assert(IMG_Load("screen_shot.png"));
emscripten_cancel_main_loop();
REPORT_RESULT();
}
}
void onLoaded(const char* file) {
- if (strcmp(file, "/tmp/test.html")) {
+ if (strcmp(file, "/tmp/test.html") && strcmp(file, "/tmp/screen_shot.png")) {
result = 0;
}
@@ -60,6 +63,12 @@ int main() {
onLoaded,
onError);
+ emscripten_async_wget(
+ "http://localhost:8888/screenshot.png",
+ "/tmp/screen_shot.png",
+ onLoaded,
+ onError);
+
emscripten_set_main_loop(wait_wgets, 0);
return 0;
diff --git a/tests/runner.py b/tests/runner.py
index 9c714da5..156299db 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -7910,6 +7910,7 @@ elif 'browser' in str(sys.argv):
self.btest('emscripten_api_browser.cpp', '1')
def test_emscripten_fs_api(self):
+ shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) # preloaded *after* run
self.btest('emscripten_fs_api_browser.cpp', '1')
def test_gc(self):